Author: ros-arm-bringup
Date: Tue Jul 22 00:49:52 2008
New Revision: 34657
URL:
http://svn.reactos.org/svn/reactos?rev=34657&view=rev
Log:
- Um, yeah, the "DiskType" is CLEARLY not an NT FILE_DEVICE_ constant... this
makes no sense at all.
- Defined some proper constants (somewhat based on guesses, but should be mostly correct)
for the DiskType.
- Now the code actually makes sense, instead of talking about CD-ROM File Systems and
CD-ROMs everywhere (and Controllers and...floppies?!)
Modified:
trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c
trunk/reactos/include/reactos/drivers/ntddrdsk.h
trunk/reactos/ntoskrnl/io/iomgr/ramdisk.c
Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/ramd…
==============================================================================
--- trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] Tue Jul 22 00:49:52
2008
@@ -311,15 +311,15 @@
LARGE_INTEGER CurrentOffset;
//
- // Check if we're a CDROM-type RAM disk
+ // Check if we're a boot RAM disk
//
DiskType = Input->DiskType;
- if (DiskType > FILE_DEVICE_CD_ROM)
+ if (DiskType >= RAMDISK_BOOT_DISK)
{
//
// Check if we're an ISO
//
- if (DiskType == FILE_DEVICE_CD_ROM_FILE_SYSTEM)
+ if (DiskType == RAMDISK_BOOT_DISK)
{
//
// NTLDR mounted us somewhere
@@ -340,10 +340,15 @@
else
{
//
- // The only other possibility is a controller
+ // The only other possibility is a WIM disk
//
- if (DiskType != FILE_DEVICE_CONTROLLER)
+ if (DiskType != RAMDISK_WIM_DISK)
+ {
+ //
+ // Fail
+ //
return STATUS_INVALID_PARAMETER;
+ }
//
// Read the view count instead
@@ -471,7 +476,7 @@
//
// It this an ISO boot ramdisk?
//
- if (Input->DiskType == FILE_DEVICE_CD_ROM_FILE_SYSTEM)
+ if (Input->DiskType == RAMDISK_BOOT_DISK)
{
//
// Does it need a drive letter?
@@ -536,10 +541,10 @@
GuidString.Buffer = NULL;
//
- // Check if this is an ISO boot, or a registry ram drive
+ // Check if this is an boot disk, or a registry ram drive
//
if (!(Input->Options.ExportAsCd) &&
- (Input->DiskType == FILE_DEVICE_CD_ROM_FILE_SYSTEM))
+ (Input->DiskType == RAMDISK_BOOT_DISK))
{
//
// Not an ISO boot, but it's a boot FS -- map it to figure out the
@@ -684,12 +689,12 @@
// Validate the disk type
//
DiskType = Input->DiskType;
- if (DiskType == FILE_DEVICE_CONTROLLER) return STATUS_INVALID_PARAMETER;
+ if (DiskType == RAMDISK_WIM_DISK) return STATUS_INVALID_PARAMETER;
//
// Look at the disk type
//
- if (DiskType == FILE_DEVICE_CD_ROM_FILE_SYSTEM)
+ if (DiskType == RAMDISK_BOOT_DISK)
{
//
// We only allow this as an early-init boot
@@ -706,19 +711,18 @@
//
// Validate the disk type
//
- if ((Input->Options.ExportAsCd) &&
- (DiskType != FILE_DEVICE_CD_ROM_FILE_SYSTEM))
+ if ((Input->Options.ExportAsCd) && (DiskType != RAMDISK_BOOT_DISK))
{
//
// If the type isn't CDFS, it has to at least be raw CD
//
- if (DiskType != FILE_DEVICE_CD_ROM) return STATUS_INVALID_PARAMETER;
+ if (DiskType != RAMDISK_MEMORY_MAPPED_DISK) return STATUS_INVALID_PARAMETER;
}
//
// Check if this is an actual file
//
- if (DiskType <= FILE_DEVICE_CD_ROM)
+ if (DiskType <= RAMDISK_MEMORY_MAPPED_DISK)
{
//
// Validate the file name
@@ -1134,7 +1138,7 @@
//
// See if we want to do this sync or async
//
- if (DeviceExtension->DiskType > FILE_DEVICE_CD_ROM)
+ if (DeviceExtension->DiskType > RAMDISK_MEMORY_MAPPED_DISK)
{
//
// Do it sync
Modified: trunk/reactos/include/reactos/drivers/ntddrdsk.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/drivers/nt…
==============================================================================
--- trunk/reactos/include/reactos/drivers/ntddrdsk.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/drivers/ntddrdsk.h [iso-8859-1] Tue Jul 22 00:49:52
2008
@@ -36,6 +36,14 @@
#define IOCTL_RAMDISK_BASE FILE_DEVICE_VIRTUAL_DISK
#define FSCTL_CREATE_RAM_DISK CTL_CODE(FILE_DEVICE_VIRTUAL_DISK, 0x0000,
METHOD_BUFFERED, FILE_ANY_ACCESS)
+//
+// Disk Types
+//
+#define RAMDISK_REGISTRY_DISK 1 // Loaded from the registry
+#define RAMDISK_MEMORY_MAPPED_DISK 2 // Loaded from the registry
+#define RAMDISK_BOOT_DISK 3 // Used as a boot device
+#define RAMDISK_WIM_DISK 4 // Used as an installation device
+
//
// Options when creating a ramdisk
//
Modified: trunk/reactos/ntoskrnl/io/iomgr/ramdisk.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/ramdisk.…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/ramdisk.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/ramdisk.c [iso-8859-1] Tue Jul 22 00:49:52 2008
@@ -83,7 +83,7 @@
//
RtlZeroMemory(&RamdiskCreate, sizeof(RamdiskCreate));
RamdiskCreate.Version = sizeof(RamdiskCreate);
- RamdiskCreate.DiskType = FILE_DEVICE_CD_ROM_FILE_SYSTEM;
+ RamdiskCreate.DiskType = RAMDISK_BOOT_DISK;
RamdiskCreate.BasePage = MemoryDescriptor->BasePage;
RamdiskCreate.DiskOffset = 0;
RamdiskCreate.DiskLength = MemoryDescriptor->PageCount << PAGE_SHIFT;