Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

351 lines
10 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. ntddtape.h
  5. Abstract:
  6. This is the include file that defines all constants and types for
  7. accessing the Tape device.
  8. Author:
  9. Mike Glass (mglass)
  10. Revision History:
  11. --*/
  12. #ifndef _NTDDTAPE_
  13. #define _NTDDTAPE_
  14. #if _MSC_VER > 1000
  15. #pragma once
  16. #endif
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. //
  21. // Device Name - this string is the name of the device. It is the name
  22. // that should be passed to NtOpenFile when accessing the device.
  23. //
  24. // Note: For devices that support multiple units, it should be suffixed
  25. // with the Ascii representation of the unit number.
  26. //
  27. #define DD_TAPE_DEVICE_NAME "\\Device\\Tape"
  28. //
  29. // NtDeviceIoControlFile IoControlCode values for this device.
  30. //
  31. // Warning: Remember that the low two bits of the code specify how the
  32. // buffers are passed to the driver!
  33. //
  34. #define IOCTL_TAPE_BASE FILE_DEVICE_TAPE
  35. #define IOCTL_TAPE_ERASE CTL_CODE(IOCTL_TAPE_BASE, 0x0000, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  36. #define IOCTL_TAPE_PREPARE CTL_CODE(IOCTL_TAPE_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
  37. #define IOCTL_TAPE_WRITE_MARKS CTL_CODE(IOCTL_TAPE_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  38. #define IOCTL_TAPE_GET_POSITION CTL_CODE(IOCTL_TAPE_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
  39. #define IOCTL_TAPE_SET_POSITION CTL_CODE(IOCTL_TAPE_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
  40. #define IOCTL_TAPE_GET_DRIVE_PARAMS CTL_CODE(IOCTL_TAPE_BASE, 0x0005, METHOD_BUFFERED, FILE_READ_ACCESS)
  41. #define IOCTL_TAPE_SET_DRIVE_PARAMS CTL_CODE(IOCTL_TAPE_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  42. #define IOCTL_TAPE_GET_MEDIA_PARAMS CTL_CODE(IOCTL_TAPE_BASE, 0x0007, METHOD_BUFFERED, FILE_READ_ACCESS)
  43. #define IOCTL_TAPE_SET_MEDIA_PARAMS CTL_CODE(IOCTL_TAPE_BASE, 0x0008, METHOD_BUFFERED, FILE_READ_ACCESS)
  44. #define IOCTL_TAPE_GET_STATUS CTL_CODE(IOCTL_TAPE_BASE, 0x0009, METHOD_BUFFERED, FILE_READ_ACCESS )
  45. #define IOCTL_TAPE_CREATE_PARTITION CTL_CODE(IOCTL_TAPE_BASE, 0x000a, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  46. //
  47. // The following device control codes are common for all class drivers. The
  48. // functions codes defined here must match all of the other class drivers.
  49. //
  50. // Warning: these codes will be replaced in the future with the IOCTL_STORAGE
  51. // codes included below
  52. //
  53. #define IOCTL_TAPE_CHECK_VERIFY CTL_CODE(IOCTL_TAPE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
  54. #define IOCTL_TAPE_MEDIA_REMOVAL CTL_CODE(IOCTL_TAPE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
  55. #define IOCTL_TAPE_EJECT_MEDIA CTL_CODE(IOCTL_TAPE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
  56. #define IOCTL_TAPE_LOAD_MEDIA CTL_CODE(IOCTL_TAPE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
  57. #define IOCTL_TAPE_RESERVE CTL_CODE(IOCTL_TAPE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
  58. #define IOCTL_TAPE_RELEASE CTL_CODE(IOCTL_TAPE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
  59. #define IOCTL_TAPE_FIND_NEW_DEVICES CTL_CODE(IOCTL_DISK_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
  60. //
  61. // The following file contains the IOCTL_STORAGE class ioctls
  62. //
  63. #include <ntddstor.h>
  64. // begin_winnt begin_ntminitape
  65. //
  66. // IOCTL_TAPE_ERASE definitions
  67. //
  68. #define TAPE_ERASE_SHORT 0L
  69. #define TAPE_ERASE_LONG 1L
  70. typedef struct _TAPE_ERASE {
  71. ULONG Type;
  72. BOOLEAN Immediate;
  73. } TAPE_ERASE, *PTAPE_ERASE;
  74. //
  75. // IOCTL_TAPE_PREPARE definitions
  76. //
  77. #define TAPE_LOAD 0L
  78. #define TAPE_UNLOAD 1L
  79. #define TAPE_TENSION 2L
  80. #define TAPE_LOCK 3L
  81. #define TAPE_UNLOCK 4L
  82. #define TAPE_FORMAT 5L
  83. typedef struct _TAPE_PREPARE {
  84. ULONG Operation;
  85. BOOLEAN Immediate;
  86. } TAPE_PREPARE, *PTAPE_PREPARE;
  87. //
  88. // IOCTL_TAPE_WRITE_MARKS definitions
  89. //
  90. #define TAPE_SETMARKS 0L
  91. #define TAPE_FILEMARKS 1L
  92. #define TAPE_SHORT_FILEMARKS 2L
  93. #define TAPE_LONG_FILEMARKS 3L
  94. typedef struct _TAPE_WRITE_MARKS {
  95. ULONG Type;
  96. ULONG Count;
  97. BOOLEAN Immediate;
  98. } TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS;
  99. //
  100. // IOCTL_TAPE_GET_POSITION definitions
  101. //
  102. #define TAPE_ABSOLUTE_POSITION 0L
  103. #define TAPE_LOGICAL_POSITION 1L
  104. #define TAPE_PSEUDO_LOGICAL_POSITION 2L
  105. typedef struct _TAPE_GET_POSITION {
  106. ULONG Type;
  107. ULONG Partition;
  108. LARGE_INTEGER Offset;
  109. } TAPE_GET_POSITION, *PTAPE_GET_POSITION;
  110. //
  111. // IOCTL_TAPE_SET_POSITION definitions
  112. //
  113. #define TAPE_REWIND 0L
  114. #define TAPE_ABSOLUTE_BLOCK 1L
  115. #define TAPE_LOGICAL_BLOCK 2L
  116. #define TAPE_PSEUDO_LOGICAL_BLOCK 3L
  117. #define TAPE_SPACE_END_OF_DATA 4L
  118. #define TAPE_SPACE_RELATIVE_BLOCKS 5L
  119. #define TAPE_SPACE_FILEMARKS 6L
  120. #define TAPE_SPACE_SEQUENTIAL_FMKS 7L
  121. #define TAPE_SPACE_SETMARKS 8L
  122. #define TAPE_SPACE_SEQUENTIAL_SMKS 9L
  123. typedef struct _TAPE_SET_POSITION {
  124. ULONG Method;
  125. ULONG Partition;
  126. LARGE_INTEGER Offset;
  127. BOOLEAN Immediate;
  128. } TAPE_SET_POSITION, *PTAPE_SET_POSITION;
  129. //
  130. // IOCTL_TAPE_GET_DRIVE_PARAMS definitions
  131. //
  132. //
  133. // Definitions for FeaturesLow parameter
  134. //
  135. #define TAPE_DRIVE_FIXED 0x00000001
  136. #define TAPE_DRIVE_SELECT 0x00000002
  137. #define TAPE_DRIVE_INITIATOR 0x00000004
  138. #define TAPE_DRIVE_ERASE_SHORT 0x00000010
  139. #define TAPE_DRIVE_ERASE_LONG 0x00000020
  140. #define TAPE_DRIVE_ERASE_BOP_ONLY 0x00000040
  141. #define TAPE_DRIVE_ERASE_IMMEDIATE 0x00000080
  142. #define TAPE_DRIVE_TAPE_CAPACITY 0x00000100
  143. #define TAPE_DRIVE_TAPE_REMAINING 0x00000200
  144. #define TAPE_DRIVE_FIXED_BLOCK 0x00000400
  145. #define TAPE_DRIVE_VARIABLE_BLOCK 0x00000800
  146. #define TAPE_DRIVE_WRITE_PROTECT 0x00001000
  147. #define TAPE_DRIVE_EOT_WZ_SIZE 0x00002000
  148. #define TAPE_DRIVE_ECC 0x00010000
  149. #define TAPE_DRIVE_COMPRESSION 0x00020000
  150. #define TAPE_DRIVE_PADDING 0x00040000
  151. #define TAPE_DRIVE_REPORT_SMKS 0x00080000
  152. #define TAPE_DRIVE_GET_ABSOLUTE_BLK 0x00100000
  153. #define TAPE_DRIVE_GET_LOGICAL_BLK 0x00200000
  154. #define TAPE_DRIVE_SET_EOT_WZ_SIZE 0x00400000
  155. #define TAPE_DRIVE_EJECT_MEDIA 0x01000000
  156. #define TAPE_DRIVE_CLEAN_REQUESTS 0x02000000
  157. #define TAPE_DRIVE_SET_CMP_BOP_ONLY 0x04000000
  158. #define TAPE_DRIVE_RESERVED_BIT 0x80000000 //don't use this bit!
  159. // //can't be a low features bit!
  160. // //reserved; high features only
  161. //
  162. // Definitions for FeaturesHigh parameter
  163. //
  164. #define TAPE_DRIVE_LOAD_UNLOAD 0x80000001
  165. #define TAPE_DRIVE_TENSION 0x80000002
  166. #define TAPE_DRIVE_LOCK_UNLOCK 0x80000004
  167. #define TAPE_DRIVE_REWIND_IMMEDIATE 0x80000008
  168. #define TAPE_DRIVE_SET_BLOCK_SIZE 0x80000010
  169. #define TAPE_DRIVE_LOAD_UNLD_IMMED 0x80000020
  170. #define TAPE_DRIVE_TENSION_IMMED 0x80000040
  171. #define TAPE_DRIVE_LOCK_UNLK_IMMED 0x80000080
  172. #define TAPE_DRIVE_SET_ECC 0x80000100
  173. #define TAPE_DRIVE_SET_COMPRESSION 0x80000200
  174. #define TAPE_DRIVE_SET_PADDING 0x80000400
  175. #define TAPE_DRIVE_SET_REPORT_SMKS 0x80000800
  176. #define TAPE_DRIVE_ABSOLUTE_BLK 0x80001000
  177. #define TAPE_DRIVE_ABS_BLK_IMMED 0x80002000
  178. #define TAPE_DRIVE_LOGICAL_BLK 0x80004000
  179. #define TAPE_DRIVE_LOG_BLK_IMMED 0x80008000
  180. #define TAPE_DRIVE_END_OF_DATA 0x80010000
  181. #define TAPE_DRIVE_RELATIVE_BLKS 0x80020000
  182. #define TAPE_DRIVE_FILEMARKS 0x80040000
  183. #define TAPE_DRIVE_SEQUENTIAL_FMKS 0x80080000
  184. #define TAPE_DRIVE_SETMARKS 0x80100000
  185. #define TAPE_DRIVE_SEQUENTIAL_SMKS 0x80200000
  186. #define TAPE_DRIVE_REVERSE_POSITION 0x80400000
  187. #define TAPE_DRIVE_SPACE_IMMEDIATE 0x80800000
  188. #define TAPE_DRIVE_WRITE_SETMARKS 0x81000000
  189. #define TAPE_DRIVE_WRITE_FILEMARKS 0x82000000
  190. #define TAPE_DRIVE_WRITE_SHORT_FMKS 0x84000000
  191. #define TAPE_DRIVE_WRITE_LONG_FMKS 0x88000000
  192. #define TAPE_DRIVE_WRITE_MARK_IMMED 0x90000000
  193. #define TAPE_DRIVE_FORMAT 0xA0000000
  194. #define TAPE_DRIVE_FORMAT_IMMEDIATE 0xC0000000
  195. #define TAPE_DRIVE_HIGH_FEATURES 0x80000000 //mask for high features flag
  196. typedef struct _TAPE_GET_DRIVE_PARAMETERS {
  197. BOOLEAN ECC;
  198. BOOLEAN Compression;
  199. BOOLEAN DataPadding;
  200. BOOLEAN ReportSetmarks;
  201. ULONG DefaultBlockSize;
  202. ULONG MaximumBlockSize;
  203. ULONG MinimumBlockSize;
  204. ULONG MaximumPartitionCount;
  205. ULONG FeaturesLow;
  206. ULONG FeaturesHigh;
  207. ULONG EOTWarningZoneSize;
  208. } TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS;
  209. //
  210. // IOCTL_TAPE_SET_DRIVE_PARAMETERS definitions
  211. //
  212. typedef struct _TAPE_SET_DRIVE_PARAMETERS {
  213. BOOLEAN ECC;
  214. BOOLEAN Compression;
  215. BOOLEAN DataPadding;
  216. BOOLEAN ReportSetmarks;
  217. ULONG EOTWarningZoneSize;
  218. } TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS;
  219. //
  220. // IOCTL_TAPE_GET_MEDIA_PARAMETERS definitions
  221. //
  222. typedef struct _TAPE_GET_MEDIA_PARAMETERS {
  223. LARGE_INTEGER Capacity;
  224. LARGE_INTEGER Remaining;
  225. ULONG BlockSize;
  226. ULONG PartitionCount;
  227. BOOLEAN WriteProtected;
  228. } TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS;
  229. //
  230. // IOCTL_TAPE_SET_MEDIA_PARAMETERS definitions
  231. //
  232. typedef struct _TAPE_SET_MEDIA_PARAMETERS {
  233. ULONG BlockSize;
  234. } TAPE_SET_MEDIA_PARAMETERS, *PTAPE_SET_MEDIA_PARAMETERS;
  235. //
  236. // IOCTL_TAPE_CREATE_PARTITION definitions
  237. //
  238. #define TAPE_FIXED_PARTITIONS 0L
  239. #define TAPE_SELECT_PARTITIONS 1L
  240. #define TAPE_INITIATOR_PARTITIONS 2L
  241. typedef struct _TAPE_CREATE_PARTITION {
  242. ULONG Method;
  243. ULONG Count;
  244. ULONG Size;
  245. } TAPE_CREATE_PARTITION, *PTAPE_CREATE_PARTITION;
  246. //
  247. // WMI Methods
  248. //
  249. #define TAPE_QUERY_DRIVE_PARAMETERS 0L
  250. #define TAPE_QUERY_MEDIA_CAPACITY 1L
  251. #define TAPE_CHECK_FOR_DRIVE_PROBLEM 2L
  252. #define TAPE_QUERY_IO_ERROR_DATA 3L
  253. #define TAPE_QUERY_DEVICE_ERROR_DATA 4L
  254. typedef struct _TAPE_WMI_OPERATIONS {
  255. ULONG Method;
  256. ULONG DataBufferSize;
  257. PVOID DataBuffer;
  258. } TAPE_WMI_OPERATIONS, *PTAPE_WMI_OPERATIONS;
  259. //
  260. // Type of drive errors
  261. //
  262. typedef enum _TAPE_DRIVE_PROBLEM_TYPE {
  263. TapeDriveProblemNone, TapeDriveReadWriteWarning,
  264. TapeDriveReadWriteError, TapeDriveReadWarning,
  265. TapeDriveWriteWarning, TapeDriveReadError,
  266. TapeDriveWriteError, TapeDriveHardwareError,
  267. TapeDriveUnsupportedMedia, TapeDriveScsiConnectionError,
  268. TapeDriveTimetoClean, TapeDriveCleanDriveNow,
  269. TapeDriveMediaLifeExpired, TapeDriveSnappedTape
  270. } TAPE_DRIVE_PROBLEM_TYPE;
  271. // end_winnt end_ntminitape
  272. #ifdef __cplusplus
  273. }
  274. #endif
  275. #endif // _NTDDTAPE_