Leaked source code of windows server 2003
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.

349 lines
11 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_MEDIA_REMOVAL CTL_CODE(IOCTL_TAPE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
  54. #define IOCTL_TAPE_EJECT_MEDIA CTL_CODE(IOCTL_TAPE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
  55. #define IOCTL_TAPE_LOAD_MEDIA CTL_CODE(IOCTL_TAPE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
  56. #define IOCTL_TAPE_RESERVE CTL_CODE(IOCTL_TAPE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
  57. #define IOCTL_TAPE_RELEASE CTL_CODE(IOCTL_TAPE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
  58. //
  59. // The following file contains the IOCTL_STORAGE class ioctls
  60. //
  61. #include <ntddstor.h>
  62. // begin_winnt begin_ntminitape
  63. //
  64. // IOCTL_TAPE_ERASE definitions
  65. //
  66. #define TAPE_ERASE_SHORT 0L
  67. #define TAPE_ERASE_LONG 1L
  68. typedef struct _TAPE_ERASE {
  69. ULONG Type;
  70. BOOLEAN Immediate;
  71. } TAPE_ERASE, *PTAPE_ERASE;
  72. //
  73. // IOCTL_TAPE_PREPARE definitions
  74. //
  75. #define TAPE_LOAD 0L
  76. #define TAPE_UNLOAD 1L
  77. #define TAPE_TENSION 2L
  78. #define TAPE_LOCK 3L
  79. #define TAPE_UNLOCK 4L
  80. #define TAPE_FORMAT 5L
  81. typedef struct _TAPE_PREPARE {
  82. ULONG Operation;
  83. BOOLEAN Immediate;
  84. } TAPE_PREPARE, *PTAPE_PREPARE;
  85. //
  86. // IOCTL_TAPE_WRITE_MARKS definitions
  87. //
  88. #define TAPE_SETMARKS 0L
  89. #define TAPE_FILEMARKS 1L
  90. #define TAPE_SHORT_FILEMARKS 2L
  91. #define TAPE_LONG_FILEMARKS 3L
  92. typedef struct _TAPE_WRITE_MARKS {
  93. ULONG Type;
  94. ULONG Count;
  95. BOOLEAN Immediate;
  96. } TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS;
  97. //
  98. // IOCTL_TAPE_GET_POSITION definitions
  99. //
  100. #define TAPE_ABSOLUTE_POSITION 0L
  101. #define TAPE_LOGICAL_POSITION 1L
  102. #define TAPE_PSEUDO_LOGICAL_POSITION 2L
  103. typedef struct _TAPE_GET_POSITION {
  104. ULONG Type;
  105. ULONG Partition;
  106. LARGE_INTEGER Offset;
  107. } TAPE_GET_POSITION, *PTAPE_GET_POSITION;
  108. //
  109. // IOCTL_TAPE_SET_POSITION definitions
  110. //
  111. #define TAPE_REWIND 0L
  112. #define TAPE_ABSOLUTE_BLOCK 1L
  113. #define TAPE_LOGICAL_BLOCK 2L
  114. #define TAPE_PSEUDO_LOGICAL_BLOCK 3L
  115. #define TAPE_SPACE_END_OF_DATA 4L
  116. #define TAPE_SPACE_RELATIVE_BLOCKS 5L
  117. #define TAPE_SPACE_FILEMARKS 6L
  118. #define TAPE_SPACE_SEQUENTIAL_FMKS 7L
  119. #define TAPE_SPACE_SETMARKS 8L
  120. #define TAPE_SPACE_SEQUENTIAL_SMKS 9L
  121. typedef struct _TAPE_SET_POSITION {
  122. ULONG Method;
  123. ULONG Partition;
  124. LARGE_INTEGER Offset;
  125. BOOLEAN Immediate;
  126. } TAPE_SET_POSITION, *PTAPE_SET_POSITION;
  127. //
  128. // IOCTL_TAPE_GET_DRIVE_PARAMS definitions
  129. //
  130. //
  131. // Definitions for FeaturesLow parameter
  132. //
  133. #define TAPE_DRIVE_FIXED 0x00000001
  134. #define TAPE_DRIVE_SELECT 0x00000002
  135. #define TAPE_DRIVE_INITIATOR 0x00000004
  136. #define TAPE_DRIVE_ERASE_SHORT 0x00000010
  137. #define TAPE_DRIVE_ERASE_LONG 0x00000020
  138. #define TAPE_DRIVE_ERASE_BOP_ONLY 0x00000040
  139. #define TAPE_DRIVE_ERASE_IMMEDIATE 0x00000080
  140. #define TAPE_DRIVE_TAPE_CAPACITY 0x00000100
  141. #define TAPE_DRIVE_TAPE_REMAINING 0x00000200
  142. #define TAPE_DRIVE_FIXED_BLOCK 0x00000400
  143. #define TAPE_DRIVE_VARIABLE_BLOCK 0x00000800
  144. #define TAPE_DRIVE_WRITE_PROTECT 0x00001000
  145. #define TAPE_DRIVE_EOT_WZ_SIZE 0x00002000
  146. #define TAPE_DRIVE_ECC 0x00010000
  147. #define TAPE_DRIVE_COMPRESSION 0x00020000
  148. #define TAPE_DRIVE_PADDING 0x00040000
  149. #define TAPE_DRIVE_REPORT_SMKS 0x00080000
  150. #define TAPE_DRIVE_GET_ABSOLUTE_BLK 0x00100000
  151. #define TAPE_DRIVE_GET_LOGICAL_BLK 0x00200000
  152. #define TAPE_DRIVE_SET_EOT_WZ_SIZE 0x00400000
  153. #define TAPE_DRIVE_EJECT_MEDIA 0x01000000
  154. #define TAPE_DRIVE_CLEAN_REQUESTS 0x02000000
  155. #define TAPE_DRIVE_SET_CMP_BOP_ONLY 0x04000000
  156. #define TAPE_DRIVE_RESERVED_BIT 0x80000000 //don't use this bit!
  157. // //can't be a low features bit!
  158. // //reserved; high features only
  159. //
  160. // Definitions for FeaturesHigh parameter
  161. //
  162. #define TAPE_DRIVE_LOAD_UNLOAD 0x80000001
  163. #define TAPE_DRIVE_TENSION 0x80000002
  164. #define TAPE_DRIVE_LOCK_UNLOCK 0x80000004
  165. #define TAPE_DRIVE_REWIND_IMMEDIATE 0x80000008
  166. #define TAPE_DRIVE_SET_BLOCK_SIZE 0x80000010
  167. #define TAPE_DRIVE_LOAD_UNLD_IMMED 0x80000020
  168. #define TAPE_DRIVE_TENSION_IMMED 0x80000040
  169. #define TAPE_DRIVE_LOCK_UNLK_IMMED 0x80000080
  170. #define TAPE_DRIVE_SET_ECC 0x80000100
  171. #define TAPE_DRIVE_SET_COMPRESSION 0x80000200
  172. #define TAPE_DRIVE_SET_PADDING 0x80000400
  173. #define TAPE_DRIVE_SET_REPORT_SMKS 0x80000800
  174. #define TAPE_DRIVE_ABSOLUTE_BLK 0x80001000
  175. #define TAPE_DRIVE_ABS_BLK_IMMED 0x80002000
  176. #define TAPE_DRIVE_LOGICAL_BLK 0x80004000
  177. #define TAPE_DRIVE_LOG_BLK_IMMED 0x80008000
  178. #define TAPE_DRIVE_END_OF_DATA 0x80010000
  179. #define TAPE_DRIVE_RELATIVE_BLKS 0x80020000
  180. #define TAPE_DRIVE_FILEMARKS 0x80040000
  181. #define TAPE_DRIVE_SEQUENTIAL_FMKS 0x80080000
  182. #define TAPE_DRIVE_SETMARKS 0x80100000
  183. #define TAPE_DRIVE_SEQUENTIAL_SMKS 0x80200000
  184. #define TAPE_DRIVE_REVERSE_POSITION 0x80400000
  185. #define TAPE_DRIVE_SPACE_IMMEDIATE 0x80800000
  186. #define TAPE_DRIVE_WRITE_SETMARKS 0x81000000
  187. #define TAPE_DRIVE_WRITE_FILEMARKS 0x82000000
  188. #define TAPE_DRIVE_WRITE_SHORT_FMKS 0x84000000
  189. #define TAPE_DRIVE_WRITE_LONG_FMKS 0x88000000
  190. #define TAPE_DRIVE_WRITE_MARK_IMMED 0x90000000
  191. #define TAPE_DRIVE_FORMAT 0xA0000000
  192. #define TAPE_DRIVE_FORMAT_IMMEDIATE 0xC0000000
  193. #define TAPE_DRIVE_HIGH_FEATURES 0x80000000 //mask for high features flag
  194. typedef struct _TAPE_GET_DRIVE_PARAMETERS {
  195. BOOLEAN ECC;
  196. BOOLEAN Compression;
  197. BOOLEAN DataPadding;
  198. BOOLEAN ReportSetmarks;
  199. ULONG DefaultBlockSize;
  200. ULONG MaximumBlockSize;
  201. ULONG MinimumBlockSize;
  202. ULONG MaximumPartitionCount;
  203. ULONG FeaturesLow;
  204. ULONG FeaturesHigh;
  205. ULONG EOTWarningZoneSize;
  206. } TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS;
  207. //
  208. // IOCTL_TAPE_SET_DRIVE_PARAMETERS definitions
  209. //
  210. typedef struct _TAPE_SET_DRIVE_PARAMETERS {
  211. BOOLEAN ECC;
  212. BOOLEAN Compression;
  213. BOOLEAN DataPadding;
  214. BOOLEAN ReportSetmarks;
  215. ULONG EOTWarningZoneSize;
  216. } TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS;
  217. //
  218. // IOCTL_TAPE_GET_MEDIA_PARAMETERS definitions
  219. //
  220. typedef struct _TAPE_GET_MEDIA_PARAMETERS {
  221. LARGE_INTEGER Capacity;
  222. LARGE_INTEGER Remaining;
  223. ULONG BlockSize;
  224. ULONG PartitionCount;
  225. BOOLEAN WriteProtected;
  226. } TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS;
  227. //
  228. // IOCTL_TAPE_SET_MEDIA_PARAMETERS definitions
  229. //
  230. typedef struct _TAPE_SET_MEDIA_PARAMETERS {
  231. ULONG BlockSize;
  232. } TAPE_SET_MEDIA_PARAMETERS, *PTAPE_SET_MEDIA_PARAMETERS;
  233. //
  234. // IOCTL_TAPE_CREATE_PARTITION definitions
  235. //
  236. #define TAPE_FIXED_PARTITIONS 0L
  237. #define TAPE_SELECT_PARTITIONS 1L
  238. #define TAPE_INITIATOR_PARTITIONS 2L
  239. typedef struct _TAPE_CREATE_PARTITION {
  240. ULONG Method;
  241. ULONG Count;
  242. ULONG Size;
  243. } TAPE_CREATE_PARTITION, *PTAPE_CREATE_PARTITION;
  244. //
  245. // WMI Methods
  246. //
  247. #define TAPE_QUERY_DRIVE_PARAMETERS 0L
  248. #define TAPE_QUERY_MEDIA_CAPACITY 1L
  249. #define TAPE_CHECK_FOR_DRIVE_PROBLEM 2L
  250. #define TAPE_QUERY_IO_ERROR_DATA 3L
  251. #define TAPE_QUERY_DEVICE_ERROR_DATA 4L
  252. typedef struct _TAPE_WMI_OPERATIONS {
  253. ULONG Method;
  254. ULONG DataBufferSize;
  255. PVOID DataBuffer;
  256. } TAPE_WMI_OPERATIONS, *PTAPE_WMI_OPERATIONS;
  257. //
  258. // Type of drive errors
  259. //
  260. typedef enum _TAPE_DRIVE_PROBLEM_TYPE {
  261. TapeDriveProblemNone, TapeDriveReadWriteWarning,
  262. TapeDriveReadWriteError, TapeDriveReadWarning,
  263. TapeDriveWriteWarning, TapeDriveReadError,
  264. TapeDriveWriteError, TapeDriveHardwareError,
  265. TapeDriveUnsupportedMedia, TapeDriveScsiConnectionError,
  266. TapeDriveTimetoClean, TapeDriveCleanDriveNow,
  267. TapeDriveMediaLifeExpired, TapeDriveSnappedTape
  268. } TAPE_DRIVE_PROBLEM_TYPE;
  269. // end_winnt end_ntminitape
  270. #ifdef __cplusplus
  271. }
  272. #endif
  273. #endif // _NTDDTAPE_