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.

311 lines
5.9 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1997 - 1999
  3. Module Name:
  4. partmgr.h
  5. Abstract:
  6. This file defines the internal data structure for the PARTMGR driver.
  7. Author:
  8. norbertk
  9. Revision History:
  10. --*/
  11. #include <partmgrp.h>
  12. #define DEVICENAME_MAXSTR 64 // used to storage device name for WMI
  13. #undef ExAllocatePool
  14. #define ExAllocatePool #
  15. #define PARTMGR_TAG_DEPENDANT_VOLUME_LIST 'vRcS' // ScRv
  16. #define PARTMGR_TAG_PARTITION_ENTRY 'pRcS' // ScRp
  17. #define PARTMGR_TAG_VOLUME_ENTRY 'VRcS' // ScRV
  18. #define PARTMGR_TAG_TABLE_ENTRY 'tRcS' // ScRt
  19. #define PARTMGR_TAG_POWER_WORK_ITEM 'wRcS' // ScRw
  20. #define PARTMGR_TAG_IOCTL_BUFFER 'iRcS' // ScRi
  21. #define PARTMGR_TAG_REMOVE_LOCK 'rRcS' // ScRr
  22. typedef struct _VOLMGR_LIST_ENTRY {
  23. LIST_ENTRY ListEntry;
  24. UNICODE_STRING VolumeManagerName;
  25. LONG RefCount;
  26. PDEVICE_OBJECT VolumeManager;
  27. PFILE_OBJECT VolumeManagerFileObject;
  28. } VOLMGR_LIST_ENTRY, *PVOLMGR_LIST_ENTRY;
  29. typedef struct _PARTITION_LIST_ENTRY {
  30. LIST_ENTRY ListEntry;
  31. PDEVICE_OBJECT TargetObject;
  32. PDEVICE_OBJECT WholeDiskPdo;
  33. PVOLMGR_LIST_ENTRY VolumeManagerEntry;
  34. } PARTITION_LIST_ENTRY, *PPARTITION_LIST_ENTRY;
  35. //
  36. // Allow usage of different clocks
  37. //
  38. #define USE_PERF_CTR // default to KeQueryPerformanceCounter
  39. #ifdef USE_PERF_CTR
  40. #define PmWmiGetClock(a, b) (a) = KeQueryPerformanceCounter((b))
  41. #else
  42. #define PmWmiGetClock(a, b) KeQuerySystemTime(&(a))
  43. #endif
  44. typedef
  45. VOID
  46. (*PPHYSICAL_DISK_IO_NOTIFY_ROUTINE)( // callout for disk I/O tracing
  47. IN ULONG DiskNumber,
  48. IN PIRP Irp,
  49. IN PDISK_PERFORMANCE PerfCounters
  50. );
  51. typedef struct _DO_EXTENSION {
  52. //
  53. // A pointer to the driver object.
  54. //
  55. PDRIVER_OBJECT DriverObject;
  56. //
  57. // A list of volume managers to pass partitions to. Protect with
  58. // 'Mutex'.
  59. //
  60. LIST_ENTRY VolumeManagerList;
  61. //
  62. // The list of device extensions. Protect with 'Mutex'.
  63. //
  64. LIST_ENTRY DeviceExtensionList;
  65. //
  66. // The notification entry.
  67. //
  68. PVOID NotificationEntry;
  69. //
  70. // For synchronization.
  71. //
  72. KMUTEX Mutex;
  73. //
  74. // Am I past Driver Reinit?
  75. //
  76. LONG PastReinit;
  77. //
  78. // A table to keep track disk signatures which includes signatures
  79. // on MBR disks and squashed disk GUIDs on GPT disks.
  80. //
  81. RTL_GENERIC_TABLE SignatureTable;
  82. //
  83. // A table to keep track of GPT disk and partition GUIDs.
  84. //
  85. RTL_GENERIC_TABLE GuidTable;
  86. //
  87. // Registry Path.
  88. //
  89. UNICODE_STRING DiskPerfRegistryPath; // for WMI QueryRegInfo
  90. //
  91. // BootDiskSig for OEM pre-install.
  92. //
  93. ULONG BootDiskSig;
  94. } DO_EXTENSION, *PDO_EXTENSION;
  95. typedef struct _DEVICE_EXTENSION {
  96. //
  97. // Indicates that a surprise remove has occurred.
  98. //
  99. BOOLEAN RemoveProcessed;
  100. //
  101. // Indicates that signatures have not yet been checked.
  102. //
  103. BOOLEAN SignaturesNotChecked;
  104. //
  105. // Indicates that this is a redundant path to a disk.
  106. //
  107. BOOLEAN IsRedundantPath;
  108. //
  109. // Indicates that the device is started. Protect with 'Mutex'.
  110. //
  111. BOOLEAN IsStarted;
  112. //
  113. // A pointer to our own device object.
  114. //
  115. PDEVICE_OBJECT DeviceObject;
  116. //
  117. // A pointer to the driver extension.
  118. //
  119. PDO_EXTENSION DriverExtension;
  120. //
  121. // A pointer to the device object that we are layered above -- a whole
  122. // disk.
  123. //
  124. PDEVICE_OBJECT TargetObject;
  125. //
  126. // A pointer to the PDO.
  127. //
  128. PDEVICE_OBJECT Pdo;
  129. //
  130. // A list of partitions allocated from paged pool. Protect with
  131. // 'Mutex'.
  132. //
  133. LIST_ENTRY PartitionList;
  134. //
  135. // A list entry for the device extension list in the driver extension.
  136. //
  137. LIST_ENTRY ListEntry;
  138. //
  139. // For paging notifications
  140. //
  141. ULONG PagingPathCount;
  142. KEVENT PagingPathCountEvent;
  143. //
  144. // Remember the disk signature so that you can write it out later.
  145. //
  146. ULONG DiskSignature;
  147. //
  148. // Keep a list of Signatures used on this disk.
  149. //
  150. LIST_ENTRY SignatureList;
  151. //
  152. // Keep a list of GUIDs used on this disk.
  153. //
  154. LIST_ENTRY GuidList;
  155. //
  156. // Whether or not the counters are running.
  157. //
  158. BOOLEAN CountersEnabled;
  159. //
  160. // Leave counters always enabled if we see IOCTL_DISK_PERFORMANCE
  161. //
  162. LONG EnableAlways;
  163. //
  164. // Disk Number.
  165. //
  166. ULONG DiskNumber;
  167. //
  168. // Counter structure.
  169. //
  170. PVOID PmWmiCounterContext;
  171. //
  172. // Device Name
  173. //
  174. UNICODE_STRING PhysicalDeviceName;
  175. WCHAR PhysicalDeviceNameBuffer[DEVICENAME_MAXSTR];
  176. //
  177. // Routine to notify on IO completion.
  178. //
  179. PPHYSICAL_DISK_IO_NOTIFY_ROUTINE PhysicalDiskIoNotifyRoutine;
  180. //
  181. // Table of WmiLib Functions.
  182. //
  183. PWMILIB_CONTEXT WmilibContext;
  184. //
  185. // Work queue for power mgmt processing
  186. // Protected by "SpinLock"
  187. //
  188. LIST_ENTRY PowerQueue;
  189. //
  190. // Spinlock used to protect the power mgmt work queue
  191. //
  192. KSPIN_LOCK SpinLock;
  193. //
  194. // Lock structure used to block the device deletion
  195. // as a result of IRP_MN_REMOVE_DEVICE
  196. //
  197. IO_REMOVE_LOCK RemoveLock;
  198. } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
  199. typedef struct _SIGNATURE_TABLE_ENTRY {
  200. LIST_ENTRY ListEntry;
  201. PDEVICE_EXTENSION Extension;
  202. ULONG Signature;
  203. } SIGNATURE_TABLE_ENTRY, *PSIGNATURE_TABLE_ENTRY;
  204. typedef struct _GUID_TABLE_ENTRY {
  205. LIST_ENTRY ListEntry;
  206. PDEVICE_EXTENSION Extension;
  207. GUID Guid;
  208. } GUID_TABLE_ENTRY, *PGUID_TABLE_ENTRY;
  209. //
  210. // Work item for PmPowerNotify
  211. //
  212. typedef struct _PM_POWER_WORK_ITEM {
  213. LIST_ENTRY ListEntry;
  214. DEVICE_POWER_STATE DevicePowerState;
  215. } PM_POWER_WORK_ITEM, *PPM_POWER_WORK_ITEM;