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.

383 lines
9.8 KiB

  1. //joejoe stuff in here is obsolete and will be removed in time.........
  2. #define REPINNED_BCBS_ARRAY_SIZE (4)
  3. typedef struct _REPINNED_BCBS {
  4. //
  5. // A pointer to the next structure contains additional repinned bcbs
  6. //
  7. struct _REPINNED_BCBS *Next;
  8. //
  9. // A fixed size array of pinned bcbs. Whenever a new bcb is added to
  10. // the repinned bcb structure it is added to this array. If the
  11. // array is already full then another repinned bcb structure is allocated
  12. // and pointed to with Next.
  13. //
  14. PBCB Bcb[ REPINNED_BCBS_ARRAY_SIZE ];
  15. } REPINNED_BCBS;
  16. typedef REPINNED_BCBS *PREPINNED_BCBS;
  17. //
  18. // The Vcb (Volume control Block) record corresponds to every volume mounted
  19. // by the file system. They are ordered in a queue off of RxData.VcbQueue.
  20. // This structure must be allocated from non-paged pool
  21. //
  22. typedef enum _VCB_CONDITION {
  23. VcbGood = 1,
  24. VcbNotMounted
  25. } VCB_CONDITION;
  26. typedef struct _VCB {
  27. //
  28. // The type and size of this record (must be RDBSS_NTC_VCB)
  29. //
  30. NODE_TYPE_CODE NodeTypeCode;
  31. NODE_BYTE_SIZE NodeByteSize;
  32. //
  33. // The links for the device queue off of RxData.VcbQueue
  34. //
  35. LIST_ENTRY VcbLinks;
  36. //
  37. // A pointer the device object passed in by the I/O system on a mount
  38. // This is the target device object that the file system talks to when it
  39. // needs to do any I/O (e.g., the disk stripper device object).
  40. //
  41. //
  42. PDEVICE_OBJECT TargetDeviceObject;
  43. //
  44. // A pointer to the VPB for the volume passed in by the I/O system on
  45. // a mount.
  46. //
  47. PVPB Vpb;
  48. //
  49. // The internal state of the device. This is a collection of fsd device
  50. // state flags.
  51. //
  52. ULONG VcbState;
  53. VCB_CONDITION VcbCondition;
  54. //
  55. // A pointer to the root DCB for this volume
  56. //
  57. struct _FCB *RootDcb;
  58. //
  59. // A count of the number of file objects that have opened the volume
  60. // for direct access, and their share access state.
  61. //
  62. CLONG DirectAccessOpenCount;
  63. SHARE_ACCESS ShareAccess;
  64. //
  65. // A count of the number of file objects that have any file/directory
  66. // opened on this volume, not including direct access. And also the
  67. // count of the number of file objects that have a file opened for
  68. // only read access (i.e., they cannot be modifying the disk).
  69. //
  70. CLONG OpenFileCount;
  71. CLONG ReadOnlyCount;
  72. //
  73. // The bios parameter block field contains
  74. // an unpacked copy of the bpb for the volume, it is initialized
  75. // during mount time and can be read by everyone else after that.
  76. //
  77. BIOS_PARAMETER_BLOCK Bpb;
  78. //
  79. // The following structure contains information useful to the
  80. // allocation support routines. Many of them are computed from
  81. // elements of the Bpb, but are too involved to recompute every time
  82. // they are needed.
  83. //
  84. struct {
  85. ULONG RootDirectoryLbo; // Lbo of beginning of root directory
  86. ULONG RootDirectorySize; // size of root directory in bytes
  87. ULONG FileAreaLbo; // Lbo of beginning of file area
  88. ULONG NumberOfClusters; // total number of clusters on the volume
  89. ULONG NumberOfFreeClusters; // number of free clusters on the volume
  90. UCHAR RxIndexBitSize; // indicates if 12 or 16 bit rx table
  91. UCHAR LogOfBytesPerSector; // Log(Bios->BytesPerSector)
  92. UCHAR LogOfBytesPerCluster; // Log(Bios->SectorsPerCluster)
  93. } AllocationSupport;
  94. //
  95. // The following Mcb is used to keep track of dirty sectors in the Rx.
  96. // Runs of holes denote clean sectors while runs of LBO == VBO denote
  97. // dirty sectors. The VBOs are that of the volume file, starting at
  98. // 0. The granuality of dirt is one sectors, and additions are only
  99. // made in sector chunks to prevent problems with several simultaneous
  100. // updaters.
  101. //
  102. MCB DirtyRxMcb;
  103. //
  104. // The FreeClusterBitMap keeps track of all the clusters in the rx.
  105. // A 1 means occupied while a 0 means free. It allows quick location
  106. // of contiguous runs of free clusters. It is initialized on mount
  107. // or verify.
  108. //
  109. RTL_BITMAP FreeClusterBitMap;
  110. //
  111. // The following event controls access to the free cluster bit map
  112. //
  113. KEVENT FreeClusterBitMapEvent;
  114. //
  115. // A resource variable to control access to the volume specific data
  116. // structures
  117. //
  118. ERESOURCE Resource;
  119. //
  120. // The following field points to the file object used to do I/O to
  121. // the virtual volume file. The virtual volume file maps sectors
  122. // 0 through the end of rx and is of a fixed size (determined during
  123. // mount)
  124. //
  125. PFILE_OBJECT VirtualVolumeFile;
  126. //
  127. // The following field contains a record of special pointers used by
  128. // MM and Cache to manipluate section objects. Note that the values
  129. // are set outside of the file system. However the file system on an
  130. // open/create will set the file object's SectionObject field to point
  131. // to this field
  132. //
  133. SECTION_OBJECT_POINTERS SectionObjectPointers;
  134. //
  135. // The following fields is a hint cluster index used by the file system
  136. // when allocating a new cluster.
  137. //
  138. ULONG ClusterHint;
  139. //
  140. // This field will point to a double space control block if this Vcb
  141. // is a DoubleSpace volume.
  142. //
  143. struct _DSCB *Dscb;
  144. //
  145. // The following link connects all DoubleSpace volumes mounted from
  146. // Cvfs on this volume.
  147. //
  148. LIST_ENTRY ParentDscbLinks;
  149. //
  150. // This field contains the "DeviceObject" that this volume is
  151. // currently mounted on. Note that this field can dynamically
  152. // change because of DoubleSpace automount, as opposed to
  153. // Vcb->Vpb->RealDevice which is constant.
  154. //
  155. PDEVICE_OBJECT CurrentDevice;
  156. //
  157. // This is a pointer to the file object and the Fcb which represent the ea data.
  158. //
  159. PFILE_OBJECT VirtualEaFile;
  160. struct _FCB *EaFcb;
  161. //
  162. // The following field is a pointer to the file object that has the
  163. // volume locked. if the VcbState has the locked flag set.
  164. //
  165. PFILE_OBJECT FileObjectWithVcbLocked;
  166. //
  167. // The following is the head of a list of notify Irps.
  168. //
  169. LIST_ENTRY DirNotifyList;
  170. //
  171. // The following is used to synchronize the dir notify list.
  172. //
  173. PNOTIFY_SYNC NotifySync;
  174. //
  175. // The following event is used to synchronize directory stream file
  176. // object creation.
  177. //
  178. KEVENT DirectoryFileCreationEvent;
  179. //
  180. // This field holds the thread address of the current (or most recent
  181. // depending on VcbState) thread doing a verify operation on this volume.
  182. //
  183. PKTHREAD VerifyThread;
  184. //
  185. // The following two structures are used for CleanVolume callbacks.
  186. //
  187. KDPC CleanVolumeDpc;
  188. KTIMER CleanVolumeTimer;
  189. //
  190. // This field records the last time RxMarkVolumeDirty was called, and
  191. // avoids excessive calls to push the CleanVolume forward in time.
  192. //
  193. LARGE_INTEGER LastRxMarkVolumeDirtyCall;
  194. } VCB;
  195. typedef VCB *PVCB;
  196. #define VCB_STATE_FLAG_LOCKED (0x00000001)
  197. #define VCB_STATE_FLAG_REMOVABLE_MEDIA (0x00000002)
  198. #define VCB_STATE_FLAG_VOLUME_DIRTY (0x00000004)
  199. #define VCB_STATE_FLAG_MOUNTED_DIRTY (0x00000010)
  200. #define VCB_STATE_FLAG_SHUTDOWN (0x00000040)
  201. #define VCB_STATE_FLAG_CLOSE_IN_PROGRESS (0x00000080)
  202. #define VCB_STATE_FLAG_DELETED_FCB (0x00000100)
  203. #define VCB_STATE_FLAG_CREATE_IN_PROGRESS (0x00000200)
  204. #define VCB_STATE_FLAG_FLOPPY (0x00000400)
  205. #define VCB_STATE_FLAG_BOOT_OR_PAGING_FILE (0x00000800)
  206. #define VCB_STATE_FLAG_COMPRESSED_VOLUME (0x00001000)
  207. #define VCB_STATE_FLAG_ASYNC_CLOSE_ACTIVE (0x00002000)
  208. #define VCB_STATE_FLAG_WRITE_PROTECTED (0x00004000)
  209. //
  210. // A double space control block for maintaining the double space environment
  211. //
  212. typedef struct _DSCB {
  213. //
  214. // The type and size of this record (must be RDBSS_NTC_DSCB)
  215. //
  216. NODE_TYPE_CODE NodeTypeCode;
  217. NODE_BYTE_SIZE NodeByteSize;
  218. //
  219. // The following field is used to read/write (via pin access) the
  220. // ancillary cvf structures (i.e., the bitmap and rx extensions).
  221. //
  222. //cvfoff PFILE_OBJECT CvfFileObject;
  223. //
  224. // A pointer to the compressed volume control block;
  225. //
  226. PVCB Vcb;
  227. //
  228. // A pointer to our parent volume control block;
  229. //
  230. PVCB ParentVcb;
  231. //
  232. // The following link connects all DoubleSpace volumes mounted from
  233. // Cvfs on our parent's volume.
  234. //
  235. LIST_ENTRY ChildDscbLinks;
  236. //
  237. // This field contains the device object that we created to represent
  238. // the "real" device holding the double space volume.
  239. //
  240. PDEVICE_OBJECT NewDevice;
  241. //
  242. // The following fields contain the unpacked header information for
  243. // the cvf, and the exact layout of each component in the cvf. With
  244. // this information we can always determine the size and location of
  245. // each cvf component.
  246. //
  247. //cvfoff CVF_HEADER CvfHeader;
  248. //cvfoff CVF_LAYOUT CvfLayout;
  249. //
  250. // The following fields describe the shape and size of the virtual rx
  251. // partition
  252. //
  253. struct {
  254. //cvfoff COMPONENT_LOCATION Rx;
  255. //cvfoff COMPONENT_LOCATION RootDirectory;
  256. //cvfoff COMPONENT_LOCATION FileArea;
  257. ULONG BytesPerCluster;
  258. } VfpLayout;
  259. //
  260. // The following fields keep track of allocation information.
  261. //
  262. ULONG SectorsAllocated;
  263. ULONG SectorsRepresented;
  264. #ifdef DOUBLE_SPACE_WRITE
  265. //
  266. // Have a resource that is used to synchronize access to this structure
  267. //
  268. PERESOURCE Resource;
  269. //
  270. // Use a bitmap here to keep track of free sectors
  271. //
  272. RTL_BITMAP Bitmap;
  273. #endif // DOUBLE_SPACE_WRITE
  274. } DSCB;
  275. typedef DSCB *PDSCB;
  276.