mtio.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. #ifndef _SYS_MTIO_H
  2. #define _SYS_MTIO_H
  3. #include <sys/types.h>
  4. #include <sys/ioctl.h>
  5. struct mtop {
  6. short mt_op;
  7. int mt_count;
  8. };
  9. #define _IOT_mtop _IOT (_IOTS (short), 1, _IOTS (int), 1, 0, 0)
  10. #define _IOT_mtget _IOT (_IOTS (long), 7, 0, 0, 0, 0)
  11. #define _IOT_mtpos _IOT_SIMPLE (long)
  12. #define _IOT_mtconfiginfo _IOT (_IOTS (long), 2, _IOTS (short), 3, _IOTS (long), 1)
  13. #define MTRESET 0
  14. #define MTFSF 1
  15. #define MTBSF 2
  16. #define MTFSR 3
  17. #define MTBSR 4
  18. #define MTWEOF 5
  19. #define MTREW 6
  20. #define MTOFFL 7
  21. #define MTNOP 8
  22. #define MTRETEN 9
  23. #define MTBSFM 10
  24. #define MTFSFM 11
  25. #define MTEOM 12
  26. #define MTERASE 13
  27. #define MTRAS1 14
  28. #define MTRAS2 15
  29. #define MTRAS3 16
  30. #define MTSETBLK 20
  31. #define MTSETDENSITY 21
  32. #define MTSEEK 22
  33. #define MTTELL 23
  34. #define MTSETDRVBUFFER 24
  35. #define MTFSS 25
  36. #define MTBSS 26
  37. #define MTWSM 27
  38. #define MTLOCK 28
  39. #define MTUNLOCK 29
  40. #define MTLOAD 30
  41. #define MTUNLOAD 31
  42. #define MTCOMPRESSION 32
  43. #define MTSETPART 33
  44. #define MTMKPART 34
  45. struct mtget {
  46. long mt_type;
  47. long mt_resid;
  48. long mt_dsreg;
  49. long mt_gstat;
  50. long mt_erreg;
  51. int mt_fileno;
  52. int mt_blkno;
  53. };
  54. #define MT_ISUNKNOWN 0x01
  55. #define MT_ISQIC02 0x02
  56. #define MT_ISWT5150 0x03
  57. #define MT_ISARCHIVE_5945L2 0x04
  58. #define MT_ISCMSJ500 0x05
  59. #define MT_ISTDC3610 0x06
  60. #define MT_ISARCHIVE_VP60I 0x07
  61. #define MT_ISARCHIVE_2150L 0x08
  62. #define MT_ISARCHIVE_2060L 0x09
  63. #define MT_ISARCHIVESC499 0x0A
  64. #define MT_ISQIC02_ALL_FEATURES 0x0F
  65. #define MT_ISWT5099EEN24 0x11
  66. #define MT_ISTEAC_MT2ST 0x12
  67. #define MT_ISEVEREX_FT40A 0x32
  68. #define MT_ISDDS1 0x51
  69. #define MT_ISDDS2 0x52
  70. #define MT_ISSCSI1 0x71
  71. #define MT_ISSCSI2 0x72
  72. #define MT_ISFTAPE_UNKNOWN 0x800000
  73. #define MT_ISFTAPE_FLAG 0x800000
  74. struct mt_tape_info {
  75. long t_type;
  76. char *t_name;
  77. };
  78. #define MT_TAPE_INFO \
  79. { \
  80. {MT_ISUNKNOWN, "Unknown type of tape device"}, \
  81. {MT_ISQIC02, "Generic QIC-02 tape streamer"}, \
  82. {MT_ISWT5150, "Wangtek 5150, QIC-150"}, \
  83. {MT_ISARCHIVE_5945L2, "Archive 5945L-2"}, \
  84. {MT_ISCMSJ500, "CMS Jumbo 500"}, \
  85. {MT_ISTDC3610, "Tandberg TDC 3610, QIC-24"}, \
  86. {MT_ISARCHIVE_VP60I, "Archive VP60i, QIC-02"}, \
  87. {MT_ISARCHIVE_2150L, "Archive Viper 2150L"}, \
  88. {MT_ISARCHIVE_2060L, "Archive Viper 2060L"}, \
  89. {MT_ISARCHIVESC499, "Archive SC-499 QIC-36 controller"}, \
  90. {MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"}, \
  91. {MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, \
  92. {MT_ISTEAC_MT2ST, "Teac MT-2ST 155mb data cassette drive"}, \
  93. {MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, \
  94. {MT_ISSCSI1, "Generic SCSI-1 tape"}, \
  95. {MT_ISSCSI2, "Generic SCSI-2 tape"}, \
  96. {0, 0} \
  97. }
  98. struct mtpos {
  99. long mt_blkno;
  100. };
  101. struct mtconfiginfo {
  102. long mt_type;
  103. long ifc_type;
  104. unsigned short irqnr;
  105. unsigned short dmanr;
  106. unsigned short port;
  107. unsigned long debug;
  108. unsigned have_dens:1;
  109. unsigned have_bsf:1;
  110. unsigned have_fsr:1;
  111. unsigned have_bsr:1;
  112. unsigned have_eod:1;
  113. unsigned have_seek:1;
  114. unsigned have_tell:1;
  115. unsigned have_ras1:1;
  116. unsigned have_ras2:1;
  117. unsigned have_ras3:1;
  118. unsigned have_qfa:1;
  119. unsigned pad1:5;
  120. char reserved[10];
  121. };
  122. #define MTIOCTOP _IOW('m', 1, struct mtop)
  123. #define MTIOCGET _IOR('m', 2, struct mtget)
  124. #define MTIOCPOS _IOR('m', 3, struct mtpos)
  125. #define MTIOCGETCONFIG _IOR('m', 4, struct mtconfiginfo)
  126. #define MTIOCSETCONFIG _IOW('m', 5, struct mtconfiginfo)
  127. #define GMT_EOF(x) ((x) & 0x80000000)
  128. #define GMT_BOT(x) ((x) & 0x40000000)
  129. #define GMT_EOT(x) ((x) & 0x20000000)
  130. #define GMT_SM(x) ((x) & 0x10000000)
  131. #define GMT_EOD(x) ((x) & 0x08000000)
  132. #define GMT_WR_PROT(x) ((x) & 0x04000000)
  133. #define GMT_ONLINE(x) ((x) & 0x01000000)
  134. #define GMT_D_6250(x) ((x) & 0x00800000)
  135. #define GMT_D_1600(x) ((x) & 0x00400000)
  136. #define GMT_D_800(x) ((x) & 0x00200000)
  137. #define GMT_DR_OPEN(x) ((x) & 0x00040000)
  138. #define GMT_IM_REP_EN(x) ((x) & 0x00010000)
  139. #define MT_ST_BLKSIZE_SHIFT 0
  140. #define MT_ST_BLKSIZE_MASK 0xffffff
  141. #define MT_ST_DENSITY_SHIFT 24
  142. #define MT_ST_DENSITY_MASK 0xff000000
  143. #define MT_ST_SOFTERR_SHIFT 0
  144. #define MT_ST_SOFTERR_MASK 0xffff
  145. #define MT_ST_OPTIONS 0xf0000000
  146. #define MT_ST_BOOLEANS 0x10000000
  147. #define MT_ST_SETBOOLEANS 0x30000000
  148. #define MT_ST_CLEARBOOLEANS 0x40000000
  149. #define MT_ST_WRITE_THRESHOLD 0x20000000
  150. #define MT_ST_DEF_BLKSIZE 0x50000000
  151. #define MT_ST_DEF_OPTIONS 0x60000000
  152. #define MT_ST_BUFFER_WRITES 0x1
  153. #define MT_ST_ASYNC_WRITES 0x2
  154. #define MT_ST_READ_AHEAD 0x4
  155. #define MT_ST_DEBUGGING 0x8
  156. #define MT_ST_TWO_FM 0x10
  157. #define MT_ST_FAST_MTEOM 0x20
  158. #define MT_ST_AUTO_LOCK 0x40
  159. #define MT_ST_DEF_WRITES 0x80
  160. #define MT_ST_CAN_BSR 0x100
  161. #define MT_ST_NO_BLKLIMS 0x200
  162. #define MT_ST_CAN_PARTITIONS 0x400
  163. #define MT_ST_SCSI2LOGICAL 0x800
  164. #define MT_ST_CLEAR_DEFAULT 0xfffff
  165. #define MT_ST_DEF_DENSITY (MT_ST_DEF_OPTIONS | 0x100000)
  166. #define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000)
  167. #define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000)
  168. #define MT_ST_HPLOADER_OFFSET 10000
  169. #ifndef DEFTAPE
  170. # define DEFTAPE "/dev/tape"
  171. #endif
  172. #endif