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.

747 lines
19 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. ramdisk.h
  5. Abstract:
  6. This file includes extension declaration for
  7. the RAM Disk driver for Whistler.
  8. Author:
  9. Chuck Lenzmeier (chuckl) 2001
  10. Environment:
  11. Kernel mode only.
  12. Notes:
  13. Revision History:
  14. --*/
  15. //
  16. // Pool allocation tag.
  17. //
  18. // ISSUE: Add this to pooltags.txt.
  19. //
  20. #define RAMDISK_TAG_GENERAL 'dmaR'
  21. //
  22. // I/O completion macro. Set the IoStatus field of the IRP and complete it.
  23. //
  24. // Note: IO_NO_INCREMENT is used to complete the IRP. If you want an
  25. // increment (such as IO_DISK_INCREMENT), do it manually.
  26. //
  27. #define COMPLETE_REQUEST( _status, _information, _irp ) { \
  28. ASSERT( (_irp) != NULL ); \
  29. ASSERT( KeGetCurrentIrql() <= DISPATCH_LEVEL ); \
  30. _irp->IoStatus.Status = (_status); \
  31. _irp->IoStatus.Information = (_information); \
  32. IoCompleteRequest( (_irp), IO_NO_INCREMENT ); \
  33. }
  34. //
  35. // Types of devices serviced by this driver. BusFdo is the bus enumeration
  36. // FDO. DiskPdo is a RAM disk device PDO.
  37. //
  38. typedef enum {
  39. RamdiskDeviceTypeBusFdo,
  40. RamdiskDeviceTypeDiskPdo
  41. } RAMDISK_DEVICE_TYPE;
  42. //
  43. // States that a device can be in.
  44. //
  45. typedef enum {
  46. RamdiskDeviceStateStopped,
  47. RamdiskDeviceStateWorking,
  48. RamdiskDeviceStatePendingStop,
  49. RamdiskDeviceStatePendingRemove,
  50. RamdiskDeviceStateSurpriseRemoved,
  51. RamdiskDeviceStateRemoved,
  52. RamdiskDeviceStateRemovedAndNotReported,
  53. RamdiskDeviceStateDeleted,
  54. RamdiskDeviceStateMaximum
  55. } RAMDISK_DEVICE_STATE;
  56. //
  57. // Bits for the DISK_EXTENSION.Status field.
  58. //
  59. #define RAMDISK_STATUS_PREVENT_REMOVE 0x00000001
  60. #define RAMDISK_STATUS_CLAIMED 0x00000002
  61. //
  62. // Saved path to the driver's registry key.
  63. //
  64. extern UNICODE_STRING DriverRegistryPath;
  65. //
  66. // Should RAM disks be marked as removable? TRUE makes the hotplug applet play
  67. // a sound when RAM disks appear and disappear. FALSE (the default) keeps it
  68. // quiet.
  69. //
  70. extern BOOLEAN MarkRamdisksAsRemovable;
  71. #if SUPPORT_DISK_NUMBERS
  72. //
  73. // Disk numbering. The disk number is only maintained so that it can be
  74. // returned from IOCTL_STORAGE_GET_DEVICE_NUMBER.
  75. //
  76. #define MINIMUM_DISK_NUMBERS_BITMAP_SIZE 64
  77. #define DEFAULT_DISK_NUMBERS_BITMAP_SIZE 256
  78. #define MAXIMUM_DISK_NUMBERS_BITMAP_SIZE (64 * 1024)
  79. extern ULONG DiskNumbersBitmapSize;
  80. #endif // SUPPORT_DISK_NUMBERS
  81. //
  82. // Disk image windowing.
  83. //
  84. #define MINIMUM_MINIMUM_VIEW_COUNT 2
  85. #define MAXIMUM_MINIMUM_VIEW_COUNT MAXIMUM_MAXIMUM_VIEW_COUNT
  86. #define DEFAULT_DEFAULT_VIEW_COUNT 16
  87. #define MAXIMUM_DEFAULT_VIEW_COUNT MAXIMUM_MAXIMUM_VIEW_COUNT
  88. #define DEFAULT_MAXIMUM_VIEW_COUNT 64
  89. #define MAXIMUM_MAXIMUM_VIEW_COUNT 256
  90. #define MINIMUM_MINIMUM_VIEW_LENGTH (64 * 1024)
  91. #define MAXIMUM_MINIMUM_VIEW_LENGTH MAXIMUM_MAXIMUM_VIEW_LENGTH
  92. #define DEFAULT_DEFAULT_VIEW_LENGTH ( 1 * 1024 * 1024)
  93. #define MAXIMUM_DEFAULT_VIEW_LENGTH MAXIMUM_MAXIMUM_VIEW_LENGTH
  94. #define DEFAULT_MAXIMUM_VIEW_LENGTH (256 * 1024 * 1024)
  95. #define MAXIMUM_MAXIMUM_VIEW_LENGTH ( 1 * 1024 * 1024 * 1024)
  96. #define MINIMUM_MAXIMUM_PER_DISK_VIEW_LENGTH ( 16 * 1024 * 1024)
  97. #define DEFAULT_MAXIMUM_PER_DISK_VIEW_LENGTH (256 * 1024 * 1024)
  98. #define MAXIMUM_MAXIMUM_PER_DISK_VIEW_LENGTH MAXULONG
  99. extern ULONG MinimumViewCount;
  100. extern ULONG DefaultViewCount;
  101. extern ULONG MaximumViewCount;
  102. extern ULONG MinimumViewLength;
  103. extern ULONG DefaultViewLength;
  104. extern ULONG MaximumViewLength;
  105. extern ULONG MaximumPerDiskViewLength;
  106. typedef struct _VIEW {
  107. //
  108. // Views are kept in two lists.
  109. //
  110. // The by-offset list is sorted in ascending order by the base offset of
  111. // the view. (Unmapped views have offset and length both 0 and are always
  112. // at the front of the by-offset list.)
  113. //
  114. // The MRU list is sorted with the most recently used views at the front.
  115. // When we need to unmap a view and remap a new view, we take a free view
  116. // from the back of the MRU list.
  117. //
  118. LIST_ENTRY ByOffsetListEntry;
  119. LIST_ENTRY ByMruListEntry;
  120. //
  121. // Address is the virtual address at which the view is mapped.
  122. //
  123. // Offset is the offset from the start of the file that backs the RAM disk.
  124. //
  125. // Length if the length of the view. Normally this is the same as the
  126. // ViewLength field in the disk extension, but it can be less for the
  127. // view at the end of the disk image. (If we permanently map the first
  128. // few pages of the disk image [to keep the boot sector mapped], then the
  129. // first view will also be "short".
  130. //
  131. PUCHAR Address;
  132. ULONGLONG Offset;
  133. ULONG Length;
  134. //
  135. // ReferenceCount indicates how many active operations are using the view.
  136. // When ReferenceCount is 0, the view is a candidate for replacement.
  137. //
  138. // Permanent indicates whether the view is to remain mapped permanently.
  139. // If Permanent is TRUE, the ReferenceCount field is not used. (Permanent
  140. // is intended to be used to keep a view permanently mapped to the boot
  141. // sector. Currently we don't implement any permanent views.)
  142. //
  143. ULONG ReferenceCount;
  144. BOOLEAN Permanent;
  145. } VIEW, *PVIEW;
  146. //
  147. // The device extensions for BusFdo and DiskPdo devices have a common header.
  148. //
  149. typedef struct _COMMON_EXTENSION {
  150. //
  151. // Device type and state.
  152. //
  153. RAMDISK_DEVICE_TYPE DeviceType;
  154. RAMDISK_DEVICE_STATE DeviceState;
  155. //
  156. // Fdo points to the FDO for the device. For the BusFdo, Fdo is the device
  157. // that we created for the BusFdo (see RamdiskAddDevice()). For a DiskPdo,
  158. // Fdo is the BusFdo.
  159. //
  160. // Pdo points to the PDO for the device. For the BusFdo, Pdo is the PDO
  161. // that was passed in to RamdiskAddDevice(). For a DiskPdo, Pdo is the
  162. // device that we created for the DiskPdo (see RamdiskCreateDiskDevice()).
  163. //
  164. // LowerDeviceObject points to the device object below this device in the
  165. // device stack. For the BusFdo, LowerDeviceObject is returned by the call
  166. // to IoAttachDeviceToDeviceStack() in RamdiskAddDevice(). For a DiskPdo,
  167. // LowerDeviceObject is the BusFdo.
  168. //
  169. PDEVICE_OBJECT Fdo;
  170. PDEVICE_OBJECT Pdo;
  171. PDEVICE_OBJECT LowerDeviceObject;
  172. //
  173. // RemoveLock prevents removal of a device while it is busy.
  174. //
  175. IO_REMOVE_LOCK RemoveLock;
  176. //
  177. // InterfaceString is returned by IoRegisterDeviceInterface().
  178. //
  179. UNICODE_STRING InterfaceString;
  180. //
  181. // DeviceName is the name of the device.
  182. //
  183. UNICODE_STRING DeviceName;
  184. //
  185. // Mutex controls access to various fields in the device extension.
  186. //
  187. FAST_MUTEX Mutex;
  188. } COMMON_EXTENSION, *PCOMMON_EXTENSION;
  189. //
  190. // The BusFdo has the following device extension. (Must start with a
  191. // COMMON_EXTENSION!)
  192. //
  193. typedef struct _BUS_EXTENSION {
  194. COMMON_EXTENSION ;
  195. #if SUPPORT_DISK_NUMBERS
  196. //
  197. // DiskNumbersBitmap is a bitmap indicating which disk numbers are in
  198. // use by active RAM disks. Bit number 0 of the bitmap corresponds to
  199. // disk number 1.
  200. //
  201. RTL_BITMAP DiskNumbersBitmap;
  202. PULONG DiskNumbersBitmapBuffer;
  203. #endif // SUPPORT_DISK_NUMBERS
  204. //
  205. // DiskPdoList is a list of all existing RAM disk devices.
  206. //
  207. LIST_ENTRY DiskPdoList;
  208. } BUS_EXTENSION, *PBUS_EXTENSION;
  209. //
  210. // Each DiskPdo has the following device extension. (Must start with a
  211. // COMMON_EXTENSION!)
  212. //
  213. typedef struct _DISK_EXTENSION {
  214. COMMON_EXTENSION ;
  215. //
  216. // DiskPdoListEntry links the DiskPdo into the BusFdo's DiskPdoList.
  217. //
  218. LIST_ENTRY DiskPdoListEntry;
  219. //
  220. // DiskGuid is the GUID assigned to the disk by the creator.
  221. // DiskGuidFormatted is the GUID in printable format.
  222. //
  223. GUID DiskGuid;
  224. UNICODE_STRING DiskGuidFormatted;
  225. //
  226. // DosSymLink is the DosDevices name associated with the device. This is
  227. // only valid if Options.NoDosDevice is FALSE.
  228. //
  229. UNICODE_STRING DosSymLink;
  230. #if SUPPORT_DISK_NUMBERS
  231. //
  232. // DiskNumber is the number of the disk.
  233. //
  234. ULONG DiskNumber;
  235. #endif // SUPPORT_DISK_NUMBERS
  236. //
  237. // DiskType indicates what type of disk is being emulated. (See
  238. // RAMDISK_TYPE_xxx in ramdisku.h.)
  239. //
  240. ULONG DiskType;
  241. //
  242. // Status indicates whether the disk has been claimed and whether removal
  243. // is prevented. (See RAMDISK_STATUS_xxx above.)
  244. //
  245. ULONG Status;
  246. //
  247. // Options specifies various create options for the disk: is it readonly;
  248. // is it fixed or removable; does it have a drive letter; etc.
  249. //
  250. RAMDISK_CREATE_OPTIONS Options;
  251. //
  252. // DiskLength is the length of the disk image. DiskOffset is the offset
  253. // from the start of the backing file or memory block to the actual start
  254. // of the disk image. (DiskLength does NOT include DiskOffset.)
  255. //
  256. // FileRelativeEndOfDisk is the sum of DiskOffset + DiskLength. It is
  257. // calculated once to avoid recalculating it every time a view is mapped.
  258. //
  259. ULONGLONG DiskLength;
  260. ULONG DiskOffset;
  261. ULONGLONG FileRelativeEndOfDisk;
  262. //
  263. // BasePage indicates the base physical page when DiskType is
  264. // RAMDISK_TYPE_BOOT_DISK. For file-backed RAM disks, SectionObject
  265. // is a referenced pointer to the section. For virtual floppies,
  266. // BaseAddress indicates the base virtual address.
  267. //
  268. ULONG_PTR BasePage;
  269. PVOID SectionObject;
  270. PVOID BaseAddress;
  271. //
  272. // DriveLetter is the drive letter assigned to the boot disk.
  273. //
  274. WCHAR DriveLetter;
  275. //
  276. // MarkedForDeletion indicates whether user mode has informed us
  277. // that it is about to delete the device.
  278. //
  279. BOOLEAN MarkedForDeletion;
  280. //
  281. // Mapped image windowing.
  282. //
  283. // ViewCount is the number of views that are available. ViewLength is
  284. // length of each view.
  285. //
  286. ULONG ViewCount;
  287. ULONG ViewLength;
  288. //
  289. // ViewDescriptors points to an array of view descriptors allocated when
  290. // the disk was created.
  291. //
  292. PVIEW ViewDescriptors;
  293. //
  294. // ViewsByOffset and ViewsByMru are lists of view descriptors (see the
  295. // description of the VIEW struct).
  296. //
  297. LIST_ENTRY ViewsByOffset;
  298. LIST_ENTRY ViewsByMru;
  299. //
  300. // ViewSemaphore is used to wake up threads that are waiting for a free
  301. // view (so they can remap a new view). ViewWaiterCount is the number of
  302. // threads that are currently waiting for a free view. The semaphore is
  303. // "kicked" by this amount when a view is freed.
  304. //
  305. KSEMAPHORE ViewSemaphore;
  306. ULONG ViewWaiterCount;
  307. //
  308. // ISSUE: Do we really need XIP_BOOT_PARAMETERS?
  309. //
  310. //XIP_BOOT_PARAMETERS BootParameters;
  311. //
  312. // ViewSemaphore is used to wake up threads that are waiting for a free
  313. // view (so they can remap a new view). ViewWaiterCount is the number of
  314. //BIOS_PARAMETER_BLOCK BiosParameters;
  315. //
  316. // Disk geometry.
  317. //
  318. ULONG BytesPerSector;
  319. ULONG SectorsPerTrack;
  320. ULONG NumberOfCylinders;
  321. ULONG TracksPerCylinder;
  322. ULONG BytesPerCylinder;
  323. ULONG HiddenSectors;
  324. //
  325. // For file-backed RAM disks, FileName is the NT name of the backing file.
  326. //
  327. WCHAR FileName[1];
  328. } DISK_EXTENSION, *PDISK_EXTENSION;
  329. #if !defined( _UCHAR_DEFINED_ )
  330. #define _UCHAR_DEFINED_
  331. //
  332. // The following types and macros are used to help unpack the packed and
  333. // misaligned fields found in the Bios parameter block
  334. //
  335. typedef union _UCHAR1 {
  336. UCHAR Uchar[1];
  337. UCHAR ForceAlignment;
  338. } UCHAR1, *PUCHAR1;
  339. typedef union _UCHAR2 {
  340. UCHAR Uchar[2];
  341. USHORT ForceAlignment;
  342. } UCHAR2, *PUCHAR2;
  343. typedef union _UCHAR4 {
  344. UCHAR Uchar[4];
  345. ULONG ForceAlignment;
  346. } UCHAR4, *PUCHAR4;
  347. #define CopyUchar1(Dst,Src) { \
  348. *((UCHAR1 *)(Dst)) = *((UNALIGNED UCHAR1 *)(Src)); \
  349. }
  350. #define CopyUchar2(Dst,Src) { \
  351. *((UCHAR2 *)(Dst)) = *((UNALIGNED UCHAR2 *)(Src)); \
  352. }
  353. #define CopyU2char(Dst,Src) { \
  354. *((UNALIGNED UCHAR2 *)(Dst)) = *((UCHAR2 *)(Src)); \
  355. }
  356. #define CopyUchar4(Dst,Src) { \
  357. *((UCHAR4 *)(Dst)) = *((UNALIGNED UCHAR4 *)((ULONG_PTR)(Src))); \
  358. }
  359. #define CopyU4char(Dst, Src) { \
  360. *((UNALIGNED UCHAR4 *)(Dst)) = *((UCHAR4 *)(Src)); \
  361. }
  362. #endif // _UCHAR_DEFINED_
  363. #define cOEM 8
  364. #define cLABEL 11
  365. #define cSYSID 8
  366. //
  367. // Defines the packet and unpacked BPB structs used for extraction of geometry
  368. // from the boot sector of the ramdisk image
  369. //
  370. typedef struct _PACKED_BIOS_PARAMETER_BLOCK {
  371. UCHAR BytesPerSector[2]; // offset = 0x000
  372. UCHAR SectorsPerCluster[1]; // offset = 0x002
  373. UCHAR ReservedSectors[2]; // offset = 0x003
  374. UCHAR Fats[1]; // offset = 0x005
  375. UCHAR RootEntries[2]; // offset = 0x006
  376. UCHAR Sectors[2]; // offset = 0x008
  377. UCHAR Media[1]; // offset = 0x00A
  378. UCHAR SectorsPerFat[2]; // offset = 0x00B
  379. UCHAR SectorsPerTrack[2]; // offset = 0x00D
  380. UCHAR Heads[2]; // offset = 0x00F
  381. UCHAR HiddenSectors[4]; // offset = 0x011
  382. UCHAR LargeSectors[4]; // offset = 0x015
  383. UCHAR BigSectorsPerFat[4]; // offset = 0x019 25
  384. UCHAR ExtFlags[2]; // offset = 0x01D 29
  385. UCHAR FS_Version[2]; // offset = 0x01F 31
  386. UCHAR RootDirStrtClus[4]; // offset = 0x021 33
  387. UCHAR FSInfoSec[2]; // offset = 0x025 37
  388. UCHAR BkUpBootSec[2]; // offset = 0x027 39
  389. UCHAR Reserved[12]; // offset = 0x029 41
  390. } PACKED_BIOS_PARAMETER_BLOCK; // sizeof = 0x035 53
  391. typedef PACKED_BIOS_PARAMETER_BLOCK *PPACKED_BIOS_PARAMETER_BLOCK;
  392. typedef struct BIOS_PARAMETER_BLOCK {
  393. USHORT BytesPerSector;
  394. UCHAR SectorsPerCluster;
  395. USHORT ReservedSectors;
  396. UCHAR Fats;
  397. USHORT RootEntries;
  398. USHORT Sectors;
  399. UCHAR Media;
  400. USHORT SectorsPerFat;
  401. USHORT SectorsPerTrack;
  402. USHORT Heads;
  403. ULONG HiddenSectors;
  404. ULONG LargeSectors;
  405. ULONG BigSectorsPerFat;
  406. USHORT ExtFlags;
  407. USHORT FS_Version;
  408. ULONG RootDirStrtClus;
  409. USHORT FSInfoSec;
  410. USHORT BkUpBootSec;
  411. } BIOS_PARAMETER_BLOCK;
  412. typedef BIOS_PARAMETER_BLOCK *PBIOS_PARAMETER_BLOCK;
  413. //
  414. // Macro to unpack packed bpb
  415. //
  416. #define UnpackBios(Bios,Pbios) { \
  417. CopyUchar2(&((Bios)->BytesPerSector), (Pbios)->BytesPerSector ); \
  418. CopyUchar1(&((Bios)->SectorsPerCluster), (Pbios)->SectorsPerCluster); \
  419. CopyUchar2(&((Bios)->ReservedSectors), (Pbios)->ReservedSectors ); \
  420. CopyUchar1(&((Bios)->Fats), (Pbios)->Fats ); \
  421. CopyUchar2(&((Bios)->RootEntries), (Pbios)->RootEntries ); \
  422. CopyUchar2(&((Bios)->Sectors), (Pbios)->Sectors ); \
  423. CopyUchar1(&((Bios)->Media), (Pbios)->Media ); \
  424. CopyUchar2(&((Bios)->SectorsPerFat), (Pbios)->SectorsPerFat ); \
  425. CopyUchar2(&((Bios)->SectorsPerTrack), (Pbios)->SectorsPerTrack ); \
  426. CopyUchar2(&((Bios)->Heads), (Pbios)->Heads ); \
  427. CopyUchar4(&((Bios)->HiddenSectors), (Pbios)->HiddenSectors ); \
  428. CopyUchar4(&((Bios)->LargeSectors), (Pbios)->LargeSectors ); \
  429. }
  430. typedef struct _PACKED_EXTENDED_BIOS_PARAMETER_BLOCK {
  431. UCHAR IntelNearJumpCommand[1];
  432. UCHAR BootStrapJumpOffset[2];
  433. UCHAR OemData[cOEM];
  434. PACKED_BIOS_PARAMETER_BLOCK Bpb;
  435. UCHAR PhysicalDrive[1]; // 0 = removable, 80h = fixed
  436. UCHAR CurrentHead[1]; // used for dirty partition info
  437. UCHAR Signature[1]; // boot signature
  438. UCHAR SerialNumber[4]; // volume serial number
  439. UCHAR Label[cLABEL]; // volume label, padded with spaces
  440. UCHAR SystemIdText[cSYSID]; // system ID, (e.g. FAT or HPFS)
  441. UCHAR StartBootCode; // first byte of boot code
  442. } PACKED_EXTENDED_BIOS_PARAMETER_BLOCK, *PPACKED_EXTENDED_BIOS_PARAMETER_BLOCK;
  443. //
  444. // Global variables.
  445. //
  446. extern PDEVICE_OBJECT RamdiskBusFdo;
  447. //
  448. // External functions implemented in ioctl.c.
  449. //
  450. NTSTATUS
  451. RamdiskDeviceControl (
  452. IN PDEVICE_OBJECT DeviceObject,
  453. IN PIRP Irp
  454. );
  455. NTSTATUS
  456. RamdiskCreateRamDisk (
  457. IN PDEVICE_OBJECT DeviceObject,
  458. IN PIRP Irp,
  459. IN BOOLEAN AccessCheckOnly
  460. );
  461. NTSTATUS
  462. RamdiskCreateDiskDevice (
  463. IN PBUS_EXTENSION BusExtension,
  464. IN PRAMDISK_CREATE_INPUT CreateInput,
  465. IN BOOLEAN AccessCheckOnly,
  466. OUT PDISK_EXTENSION *DiskExtension
  467. );
  468. NTSTATUS
  469. RamdiskGetDriveLayout (
  470. PIRP Irp,
  471. PDISK_EXTENSION DiskExtension
  472. );
  473. NTSTATUS
  474. RamdiskGetPartitionInfo (
  475. PIRP Irp,
  476. PDISK_EXTENSION DiskExtension
  477. );
  478. NTSTATUS
  479. RamdiskSetPartitionInfo (
  480. PIRP Irp,
  481. PDISK_EXTENSION DiskExtension
  482. );
  483. //
  484. // External functions implemented in pnp.c.
  485. //
  486. NTSTATUS
  487. RamdiskPnp (
  488. IN PDEVICE_OBJECT DeviceObject,
  489. IN PIRP Irp
  490. );
  491. NTSTATUS
  492. RamdiskPower (
  493. IN PDEVICE_OBJECT DeviceObject,
  494. IN PIRP Irp
  495. );
  496. NTSTATUS
  497. RamdiskAddDevice (
  498. IN PDRIVER_OBJECT DriverObject,
  499. IN PDEVICE_OBJECT Pdo
  500. );
  501. BOOLEAN
  502. CreateRegistryDisks (
  503. IN BOOLEAN CheckPresenceOnly
  504. );
  505. //
  506. // External functions implemented in ramdisk.c.
  507. //
  508. VOID
  509. RamdiskWorkerThread (
  510. IN PDEVICE_OBJECT DeviceObject,
  511. IN PVOID Context
  512. );
  513. NTSTATUS
  514. RamdiskFlushBuffersReal (
  515. IN PDISK_EXTENSION DiskExtension
  516. );
  517. //
  518. // External functions implemented in readwrite.c.
  519. //
  520. NTSTATUS
  521. RamdiskReadWrite (
  522. IN PDEVICE_OBJECT DeviceObject,
  523. IN PIRP Irp
  524. );
  525. NTSTATUS
  526. RamdiskReadWriteReal (
  527. IN PIRP Irp,
  528. IN PDISK_EXTENSION DiskExtension
  529. );
  530. //
  531. // External functions implemented in scsi.c.
  532. //
  533. NTSTATUS
  534. RamdiskScsi (
  535. IN PDEVICE_OBJECT DeviceObject,
  536. IN PIRP Irp
  537. );
  538. NTSTATUS
  539. RamdiskScsiExecuteNone (
  540. PDEVICE_OBJECT DeviceObject,
  541. PIRP Irp,
  542. PSCSI_REQUEST_BLOCK Srb,
  543. ULONG ControlCode
  544. );
  545. NTSTATUS
  546. RamdiskScsiExecuteIo (
  547. PDEVICE_OBJECT DeviceObject,
  548. PIRP Irp,
  549. PSCSI_REQUEST_BLOCK Srb,
  550. ULONG ControlCode
  551. );
  552. //
  553. // External functions implemented in utils.c.
  554. //
  555. NTSTATUS
  556. SendIrpToThread (
  557. IN PDEVICE_OBJECT DeviceObject,
  558. IN PIRP Irp
  559. );
  560. PUCHAR
  561. RamdiskMapPages (
  562. IN PDISK_EXTENSION DiskExtension,
  563. IN ULONGLONG Offset,
  564. IN ULONG RequestedLength,
  565. OUT PULONG ActualLength
  566. );
  567. VOID
  568. RamdiskUnmapPages (
  569. IN PDISK_EXTENSION DiskExtension,
  570. IN PUCHAR Va,
  571. IN ULONGLONG Offset,
  572. IN ULONG Length
  573. );
  574. NTSTATUS
  575. RamdiskFlushViews (
  576. IN PDISK_EXTENSION DiskExtension
  577. );