zftape.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #ifndef _ZFTAPE_H
  2. #define _ZFTAPE_H
  3. /*
  4. * Copyright (C) 1996, 1997 Claus-Justus Heine.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2, or (at your option)
  8. any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; see the file COPYING. If not, write to
  15. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  16. *
  17. * $Source: /homes/cvs/ftape-stacked/include/linux/zftape.h,v $
  18. * $Revision: 1.12 $
  19. * $Date: 1997/10/21 11:02:37 $
  20. *
  21. * Special ioctl and other global info for the zftape VFS
  22. * interface for the QIC-40/80/3010/3020 floppy-tape driver for
  23. * Linux.
  24. */
  25. #define ZFTAPE_VERSION "zftape for " FTAPE_VERSION
  26. #include <linux/ftape.h>
  27. #define ZFTAPE_LABEL "Ftape - The Linux Floppy Tape Project!"
  28. /* Bits of the minor device number that control the operation mode */
  29. #define ZFT_Q80_MODE (1 << 3)
  30. #define ZFT_ZIP_MODE (1 << 4)
  31. #define ZFT_RAW_MODE (1 << 5)
  32. #define ZFT_MINOR_OP_MASK (ZFT_Q80_MODE | \
  33. ZFT_ZIP_MODE | \
  34. ZFT_RAW_MODE)
  35. #define ZFT_MINOR_MASK (FTAPE_SEL_MASK | \
  36. ZFT_MINOR_OP_MASK | \
  37. FTAPE_NO_REWIND)
  38. #ifdef ZFT_OBSOLETE
  39. struct mtblksz {
  40. unsigned int mt_blksz;
  41. };
  42. #define MTIOC_ZFTAPE_GETBLKSZ _IOR('m', 104, struct mtblksz)
  43. #endif
  44. #ifdef __KERNEL__
  45. extern int zft_init(void);
  46. static inline __s64 zft_div_blksz(__s64 value, __u32 blk_sz)
  47. {
  48. if (blk_sz == 1) {
  49. return value;
  50. } else {
  51. return (__s64)(((__u32)(value >> 10) + (blk_sz >> 10) - 1)
  52. / (blk_sz >> 10));
  53. }
  54. }
  55. static inline __s64 zft_mul_blksz(__s64 value, __u32 blk_sz)
  56. {
  57. if (blk_sz == 1) {
  58. return value;
  59. } else {
  60. /* if blk_sz != 1, then it is a multiple of 1024. In
  61. * this case, `value' will also fit into 32 bits.
  62. *
  63. * Actually, this limits the capacity to 42
  64. * bits. This is (2^32)*1024, roughly a thousand
  65. * times 2GB, or 3 Terabytes. Hopefully this is enough
  66. */
  67. return(__s64)(((__u32)(value)*(blk_sz>>10))<<10);
  68. }
  69. }
  70. #endif
  71. #endif