mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 18:45:46 +00:00
[CDFS]
Fix indentation and coding style. No code changes! svn path=/trunk/; revision=67990
This commit is contained in:
parent
d284e715f4
commit
ef692c9c85
2 changed files with 173 additions and 154 deletions
|
@ -19,7 +19,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: drivers/fs/cdfs/fsctl.c
|
* FILE: drivers/filesystems/cdfs/fsctl.c
|
||||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||||
* PROGRAMMER: Art Yerkes
|
* PROGRAMMER: Art Yerkes
|
||||||
* Eric Kohl
|
* Eric Kohl
|
||||||
|
@ -41,9 +41,11 @@ int msf_to_lba (UCHAR m, UCHAR s, UCHAR f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
static
|
||||||
CdfsGetPVDData(PUCHAR Buffer,
|
VOID
|
||||||
PCDINFO CdInfo)
|
CdfsGetPVDData(
|
||||||
|
PUCHAR Buffer,
|
||||||
|
PCDINFO CdInfo)
|
||||||
{
|
{
|
||||||
PPVD Pvd;
|
PPVD Pvd;
|
||||||
USHORT i;
|
USHORT i;
|
||||||
|
@ -150,9 +152,11 @@ CdfsGetPVDData(PUCHAR Buffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
static
|
||||||
CdfsGetSVDData(PUCHAR Buffer,
|
VOID
|
||||||
PCDINFO CdInfo)
|
CdfsGetSVDData(
|
||||||
|
PUCHAR Buffer,
|
||||||
|
PCDINFO CdInfo)
|
||||||
{
|
{
|
||||||
PSVD Svd;
|
PSVD Svd;
|
||||||
ULONG JolietLevel = 0;
|
ULONG JolietLevel = 0;
|
||||||
|
@ -190,9 +194,11 @@ CdfsGetSVDData(PUCHAR Buffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static NTSTATUS
|
static
|
||||||
CdfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
NTSTATUS
|
||||||
PCDINFO CdInfo)
|
CdfsGetVolumeData(
|
||||||
|
PDEVICE_OBJECT DeviceObject,
|
||||||
|
PCDINFO CdInfo)
|
||||||
{
|
{
|
||||||
PUCHAR Buffer;
|
PUCHAR Buffer;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -210,12 +216,12 @@ CdfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
Size = sizeof(Toc);
|
Size = sizeof(Toc);
|
||||||
Status = CdfsDeviceIoControl(DeviceObject,
|
Status = CdfsDeviceIoControl(DeviceObject,
|
||||||
IOCTL_CDROM_READ_TOC,
|
IOCTL_CDROM_READ_TOC,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
&Toc,
|
&Toc,
|
||||||
&Size,
|
&Size,
|
||||||
TRUE);
|
TRUE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ExFreePoolWithTag(Buffer, CDFS_TAG);
|
ExFreePoolWithTag(Buffer, CDFS_TAG);
|
||||||
|
@ -223,7 +229,7 @@ CdfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("FirstTrack %u, LastTrack %u, TrackNumber %u\n",
|
DPRINT("FirstTrack %u, LastTrack %u, TrackNumber %u\n",
|
||||||
Toc.FirstTrack, Toc.LastTrack, Toc.TrackData[0].TrackNumber);
|
Toc.FirstTrack, Toc.LastTrack, Toc.TrackData[0].TrackNumber);
|
||||||
|
|
||||||
Offset = Toc.TrackData[0].Address[1] * 60 * 75;
|
Offset = Toc.TrackData[0].Address[1] * 60 * 75;
|
||||||
Offset += Toc.TrackData[0].Address[2] * 75;
|
Offset += Toc.TrackData[0].Address[2] * 75;
|
||||||
|
@ -245,11 +251,11 @@ CdfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
for (Sector = CDFS_PRIMARY_DESCRIPTOR_LOCATION; Sector < 100 && Buffer[0] != 255; Sector++)
|
for (Sector = CDFS_PRIMARY_DESCRIPTOR_LOCATION; Sector < 100 && Buffer[0] != 255; Sector++)
|
||||||
{
|
{
|
||||||
/* Read the Primary Volume Descriptor (PVD) */
|
/* Read the Primary Volume Descriptor (PVD) */
|
||||||
Status = CdfsReadSectors (DeviceObject,
|
Status = CdfsReadSectors(DeviceObject,
|
||||||
Sector + Offset,
|
Sector + Offset,
|
||||||
1,
|
1,
|
||||||
Buffer,
|
Buffer,
|
||||||
TRUE);
|
TRUE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ExFreePoolWithTag(Buffer, CDFS_TAG);
|
ExFreePoolWithTag(Buffer, CDFS_TAG);
|
||||||
|
@ -270,43 +276,45 @@ CdfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
switch (VdHeader->VdType)
|
switch (VdHeader->VdType)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
DPRINT("BootVolumeDescriptor found!\n");
|
DPRINT("BootVolumeDescriptor found!\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
DPRINT("PrimaryVolumeDescriptor found!\n");
|
DPRINT("PrimaryVolumeDescriptor found!\n");
|
||||||
CdfsGetPVDData(Buffer, CdInfo);
|
CdfsGetPVDData(Buffer, CdInfo);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
DPRINT("SupplementaryVolumeDescriptor found!\n");
|
DPRINT("SupplementaryVolumeDescriptor found!\n");
|
||||||
CdfsGetSVDData(Buffer, CdInfo);
|
CdfsGetSVDData(Buffer, CdInfo);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
DPRINT("VolumePartitionDescriptor found!\n");
|
DPRINT("VolumePartitionDescriptor found!\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 255:
|
case 255:
|
||||||
DPRINT("VolumeDescriptorSetTerminator found!\n");
|
DPRINT("VolumeDescriptorSetTerminator found!\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DPRINT1("Unknown volume descriptor type %u found!\n", VdHeader->VdType);
|
DPRINT1("Unknown volume descriptor type %u found!\n", VdHeader->VdType);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ExFreePoolWithTag(Buffer, CDFS_TAG);
|
ExFreePoolWithTag(Buffer, CDFS_TAG);
|
||||||
|
|
||||||
return(STATUS_SUCCESS);
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static NTSTATUS
|
static
|
||||||
CdfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
NTSTATUS
|
||||||
PIRP Irp)
|
CdfsMountVolume(
|
||||||
|
PDEVICE_OBJECT DeviceObject,
|
||||||
|
PIRP Irp)
|
||||||
{
|
{
|
||||||
PDEVICE_EXTENSION DeviceExt = NULL;
|
PDEVICE_EXTENSION DeviceExt = NULL;
|
||||||
PDEVICE_OBJECT NewDeviceObject = NULL;
|
PDEVICE_OBJECT NewDeviceObject = NULL;
|
||||||
|
@ -337,12 +345,12 @@ CdfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = IoCreateDevice(CdfsGlobalData->DriverObject,
|
Status = IoCreateDevice(CdfsGlobalData->DriverObject,
|
||||||
sizeof(DEVICE_EXTENSION),
|
sizeof(DEVICE_EXTENSION),
|
||||||
NULL,
|
NULL,
|
||||||
FILE_DEVICE_CD_ROM_FILE_SYSTEM,
|
FILE_DEVICE_CD_ROM_FILE_SYSTEM,
|
||||||
DeviceToMount->Characteristics,
|
DeviceToMount->Characteristics,
|
||||||
FALSE,
|
FALSE,
|
||||||
&NewDeviceObject);
|
&NewDeviceObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
goto ByeBye;
|
goto ByeBye;
|
||||||
|
|
||||||
|
@ -350,7 +358,7 @@ CdfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
||||||
NewDeviceObject->Flags &= ~DO_VERIFY_VOLUME;
|
NewDeviceObject->Flags &= ~DO_VERIFY_VOLUME;
|
||||||
DeviceExt = (PVOID)NewDeviceObject->DeviceExtension;
|
DeviceExt = (PVOID)NewDeviceObject->DeviceExtension;
|
||||||
RtlZeroMemory(DeviceExt,
|
RtlZeroMemory(DeviceExt,
|
||||||
sizeof(DEVICE_EXTENSION));
|
sizeof(DEVICE_EXTENSION));
|
||||||
|
|
||||||
Vpb->SerialNumber = CdInfo.SerialNumber;
|
Vpb->SerialNumber = CdInfo.SerialNumber;
|
||||||
Vpb->VolumeLabelLength = CdInfo.VolumeLabelLength;
|
Vpb->VolumeLabelLength = CdInfo.VolumeLabelLength;
|
||||||
|
@ -373,7 +381,7 @@ CdfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
||||||
ExInitializeResourceLite(&DeviceExt->DirResource);
|
ExInitializeResourceLite(&DeviceExt->DirResource);
|
||||||
|
|
||||||
DeviceExt->StreamFileObject = IoCreateStreamFileObject(NULL,
|
DeviceExt->StreamFileObject = IoCreateStreamFileObject(NULL,
|
||||||
DeviceExt->StorageDevice);
|
DeviceExt->StorageDevice);
|
||||||
|
|
||||||
Fcb = CdfsCreateFCB(NULL);
|
Fcb = CdfsCreateFCB(NULL);
|
||||||
if (Fcb == NULL)
|
if (Fcb == NULL)
|
||||||
|
@ -388,8 +396,9 @@ CdfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
||||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
goto ByeBye;
|
goto ByeBye;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(Ccb,
|
RtlZeroMemory(Ccb,
|
||||||
sizeof(CCB));
|
sizeof(CCB));
|
||||||
|
|
||||||
DeviceExt->StreamFileObject->ReadAccess = TRUE;
|
DeviceExt->StreamFileObject->ReadAccess = TRUE;
|
||||||
DeviceExt->StreamFileObject->WriteAccess = FALSE;
|
DeviceExt->StreamFileObject->WriteAccess = FALSE;
|
||||||
|
@ -414,10 +423,10 @@ CdfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
CcInitializeCacheMap(DeviceExt->StreamFileObject,
|
CcInitializeCacheMap(DeviceExt->StreamFileObject,
|
||||||
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
|
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
|
||||||
TRUE,
|
TRUE,
|
||||||
&(CdfsGlobalData->CacheMgrCallbacks),
|
&(CdfsGlobalData->CacheMgrCallbacks),
|
||||||
Fcb);
|
Fcb);
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
|
@ -450,13 +459,15 @@ ByeBye:
|
||||||
|
|
||||||
DPRINT("CdfsMountVolume() done (Status: %lx)\n", Status);
|
DPRINT("CdfsMountVolume() done (Status: %lx)\n", Status);
|
||||||
|
|
||||||
return(Status);
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static NTSTATUS
|
static
|
||||||
CdfsVerifyVolume(PDEVICE_OBJECT DeviceObject,
|
NTSTATUS
|
||||||
PIRP Irp)
|
CdfsVerifyVolume(
|
||||||
|
PDEVICE_OBJECT DeviceObject,
|
||||||
|
PIRP Irp)
|
||||||
{
|
{
|
||||||
PDEVICE_EXTENSION DeviceExt;
|
PDEVICE_EXTENSION DeviceExt;
|
||||||
PIO_STACK_LOCATION Stack;
|
PIO_STACK_LOCATION Stack;
|
||||||
|
@ -466,7 +477,7 @@ CdfsVerifyVolume(PDEVICE_OBJECT DeviceObject,
|
||||||
PFCB Fcb;
|
PFCB Fcb;
|
||||||
PVPB VpbToVerify;
|
PVPB VpbToVerify;
|
||||||
|
|
||||||
DPRINT1 ("CdfsVerifyVolume() called\n");
|
DPRINT("CdfsVerifyVolume() called\n");
|
||||||
|
|
||||||
DeviceExt = DeviceObject->DeviceExtension;
|
DeviceExt = DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
|
@ -474,12 +485,12 @@ CdfsVerifyVolume(PDEVICE_OBJECT DeviceObject,
|
||||||
VpbToVerify = Stack->Parameters.VerifyVolume.Vpb;
|
VpbToVerify = Stack->Parameters.VerifyVolume.Vpb;
|
||||||
|
|
||||||
FsRtlEnterFileSystem();
|
FsRtlEnterFileSystem();
|
||||||
ExAcquireResourceExclusiveLite (&DeviceExt->VcbResource,
|
ExAcquireResourceExclusiveLite(&DeviceExt->VcbResource,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
if (!(VpbToVerify->RealDevice->Flags & DO_VERIFY_VOLUME))
|
if (!(VpbToVerify->RealDevice->Flags & DO_VERIFY_VOLUME))
|
||||||
{
|
{
|
||||||
DPRINT1 ("Volume has been verified!\n");
|
DPRINT1("Volume has been verified!\n");
|
||||||
ExReleaseResourceLite (&DeviceExt->VcbResource);
|
ExReleaseResourceLite (&DeviceExt->VcbResource);
|
||||||
FsRtlExitFileSystem();
|
FsRtlExitFileSystem();
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -488,13 +499,13 @@ CdfsVerifyVolume(PDEVICE_OBJECT DeviceObject,
|
||||||
DPRINT1("Device object %p Device to verify %p\n", DeviceObject, VpbToVerify->RealDevice);
|
DPRINT1("Device object %p Device to verify %p\n", DeviceObject, VpbToVerify->RealDevice);
|
||||||
|
|
||||||
Status = CdfsGetVolumeData(VpbToVerify->RealDevice,
|
Status = CdfsGetVolumeData(VpbToVerify->RealDevice,
|
||||||
&CdInfo);
|
&CdInfo);
|
||||||
if (NT_SUCCESS(Status) &&
|
if (NT_SUCCESS(Status) &&
|
||||||
CdInfo.SerialNumber == VpbToVerify->SerialNumber &&
|
CdInfo.SerialNumber == VpbToVerify->SerialNumber &&
|
||||||
CdInfo.VolumeLabelLength == VpbToVerify->VolumeLabelLength &&
|
CdInfo.VolumeLabelLength == VpbToVerify->VolumeLabelLength &&
|
||||||
!wcsncmp(CdInfo.VolumeLabel, VpbToVerify->VolumeLabel, CdInfo.VolumeLabelLength))
|
!wcsncmp(CdInfo.VolumeLabel, VpbToVerify->VolumeLabel, CdInfo.VolumeLabelLength))
|
||||||
{
|
{
|
||||||
DPRINT1 ("Same volume!\n");
|
DPRINT1("Same volume!\n");
|
||||||
|
|
||||||
/* FIXME: Flush and purge metadata */
|
/* FIXME: Flush and purge metadata */
|
||||||
|
|
||||||
|
@ -502,7 +513,7 @@ CdfsVerifyVolume(PDEVICE_OBJECT DeviceObject,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINT1 ("Different volume!\n");
|
DPRINT1("Different volume!\n");
|
||||||
|
|
||||||
/* FIXME: force volume dismount */
|
/* FIXME: force volume dismount */
|
||||||
Entry = DeviceExt->FcbListHead.Flink;
|
Entry = DeviceExt->FcbListHead.Flink;
|
||||||
|
@ -519,17 +530,18 @@ CdfsVerifyVolume(PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
VpbToVerify->RealDevice->Flags &= ~DO_VERIFY_VOLUME;
|
VpbToVerify->RealDevice->Flags &= ~DO_VERIFY_VOLUME;
|
||||||
|
|
||||||
ExReleaseResourceLite (&DeviceExt->VcbResource);
|
ExReleaseResourceLite(&DeviceExt->VcbResource);
|
||||||
FsRtlExitFileSystem();
|
FsRtlExitFileSystem();
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
CdfsSetCompression(
|
CdfsSetCompression(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
PIO_STACK_LOCATION Stack;
|
PIO_STACK_LOCATION Stack;
|
||||||
USHORT CompressionState;
|
USHORT CompressionState;
|
||||||
|
@ -549,7 +561,8 @@ CdfsSetCompression(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
CdfsFileSystemControl(
|
CdfsFileSystemControl(
|
||||||
PCDFS_IRP_CONTEXT IrpContext)
|
PCDFS_IRP_CONTEXT IrpContext)
|
||||||
{
|
{
|
||||||
|
@ -570,39 +583,39 @@ CdfsFileSystemControl(
|
||||||
|
|
||||||
switch (IrpContext->MinorFunction)
|
switch (IrpContext->MinorFunction)
|
||||||
{
|
{
|
||||||
case IRP_MN_KERNEL_CALL:
|
case IRP_MN_KERNEL_CALL:
|
||||||
case IRP_MN_USER_FS_REQUEST:
|
case IRP_MN_USER_FS_REQUEST:
|
||||||
switch (Stack->Parameters.DeviceIoControl.IoControlCode)
|
switch (Stack->Parameters.DeviceIoControl.IoControlCode)
|
||||||
{
|
{
|
||||||
case FSCTL_SET_COMPRESSION:
|
case FSCTL_SET_COMPRESSION:
|
||||||
DPRINT("CDFS: IRP_MN_USER_FS_REQUEST / FSCTL_SET_COMPRESSION\n");
|
DPRINT("CDFS: IRP_MN_USER_FS_REQUEST / FSCTL_SET_COMPRESSION\n");
|
||||||
Status = CdfsSetCompression(DeviceObject, Irp);
|
Status = CdfsSetCompression(DeviceObject, Irp);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
DPRINT1("CDFS: IRP_MN_USER_FS_REQUEST / Unknown IoControlCode 0x%x\n",
|
||||||
|
Stack->Parameters.DeviceIoControl.IoControlCode);
|
||||||
|
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IRP_MN_MOUNT_VOLUME:
|
||||||
|
DPRINT("CDFS: IRP_MN_MOUNT_VOLUME\n");
|
||||||
|
Status = CdfsMountVolume(DeviceObject, Irp);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IRP_MN_VERIFY_VOLUME:
|
||||||
|
DPRINT1("CDFS: IRP_MN_VERIFY_VOLUME\n");
|
||||||
|
Status = CdfsVerifyVolume(DeviceObject, Irp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DPRINT1("CDFS: IRP_MN_USER_FS_REQUEST / Unknown IoControlCode 0x%x\n",
|
DPRINT1("CDFS FSC: MinorFunction %u\n", Stack->MinorFunction);
|
||||||
Stack->Parameters.DeviceIoControl.IoControlCode);
|
|
||||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case IRP_MN_MOUNT_VOLUME:
|
|
||||||
DPRINT("CDFS: IRP_MN_MOUNT_VOLUME\n");
|
|
||||||
Status = CdfsMountVolume(DeviceObject, Irp);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IRP_MN_VERIFY_VOLUME:
|
|
||||||
DPRINT1("CDFS: IRP_MN_VERIFY_VOLUME\n");
|
|
||||||
Status = CdfsVerifyVolume(DeviceObject, Irp);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
DPRINT1("CDFS FSC: MinorFunction %u\n", Stack->MinorFunction);
|
|
||||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(Status);
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: services/fs/vfat/volume.c
|
* FILE: drivers/filesystems/cdfs/volume.c
|
||||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||||
* PROGRAMMER: Art Yerkes
|
* PROGRAMMER: Art Yerkes
|
||||||
* Eric Kohl
|
* Eric Kohl
|
||||||
|
@ -34,10 +34,12 @@
|
||||||
|
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
static NTSTATUS
|
static
|
||||||
CdfsGetFsVolumeInformation(PDEVICE_OBJECT DeviceObject,
|
NTSTATUS
|
||||||
PFILE_FS_VOLUME_INFORMATION FsVolumeInfo,
|
CdfsGetFsVolumeInformation(
|
||||||
PULONG BufferLength)
|
PDEVICE_OBJECT DeviceObject,
|
||||||
|
PFILE_FS_VOLUME_INFORMATION FsVolumeInfo,
|
||||||
|
PULONG BufferLength)
|
||||||
{
|
{
|
||||||
DPRINT("CdfsGetFsVolumeInformation() called\n");
|
DPRINT("CdfsGetFsVolumeInformation() called\n");
|
||||||
DPRINT("FsVolumeInfo = %p\n", FsVolumeInfo);
|
DPRINT("FsVolumeInfo = %p\n", FsVolumeInfo);
|
||||||
|
@ -59,8 +61,8 @@ CdfsGetFsVolumeInformation(PDEVICE_OBJECT DeviceObject,
|
||||||
FsVolumeInfo->VolumeSerialNumber = DeviceObject->Vpb->SerialNumber;
|
FsVolumeInfo->VolumeSerialNumber = DeviceObject->Vpb->SerialNumber;
|
||||||
FsVolumeInfo->VolumeLabelLength = DeviceObject->Vpb->VolumeLabelLength;
|
FsVolumeInfo->VolumeLabelLength = DeviceObject->Vpb->VolumeLabelLength;
|
||||||
memcpy(FsVolumeInfo->VolumeLabel,
|
memcpy(FsVolumeInfo->VolumeLabel,
|
||||||
DeviceObject->Vpb->VolumeLabel,
|
DeviceObject->Vpb->VolumeLabel,
|
||||||
DeviceObject->Vpb->VolumeLabelLength);
|
DeviceObject->Vpb->VolumeLabelLength);
|
||||||
|
|
||||||
/* dummy entries */
|
/* dummy entries */
|
||||||
FsVolumeInfo->VolumeCreationTime.QuadPart = 0;
|
FsVolumeInfo->VolumeCreationTime.QuadPart = 0;
|
||||||
|
@ -72,14 +74,16 @@ CdfsGetFsVolumeInformation(PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
DPRINT("BufferLength %lu\n", *BufferLength);
|
DPRINT("BufferLength %lu\n", *BufferLength);
|
||||||
|
|
||||||
return(STATUS_SUCCESS);
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static NTSTATUS
|
static
|
||||||
CdfsGetFsAttributeInformation(PDEVICE_EXTENSION DeviceExt,
|
NTSTATUS
|
||||||
PFILE_FS_ATTRIBUTE_INFORMATION FsAttributeInfo,
|
CdfsGetFsAttributeInformation(
|
||||||
PULONG BufferLength)
|
PDEVICE_EXTENSION DeviceExt,
|
||||||
|
PFILE_FS_ATTRIBUTE_INFORMATION FsAttributeInfo,
|
||||||
|
PULONG BufferLength)
|
||||||
{
|
{
|
||||||
DPRINT("CdfsGetFsAttributeInformation()\n");
|
DPRINT("CdfsGetFsAttributeInformation()\n");
|
||||||
DPRINT("FsAttributeInfo = %p\n", FsAttributeInfo);
|
DPRINT("FsAttributeInfo = %p\n", FsAttributeInfo);
|
||||||
|
@ -106,14 +110,15 @@ CdfsGetFsAttributeInformation(PDEVICE_EXTENSION DeviceExt,
|
||||||
*BufferLength -= (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8);
|
*BufferLength -= (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8);
|
||||||
DPRINT("BufferLength %lu\n", *BufferLength);
|
DPRINT("BufferLength %lu\n", *BufferLength);
|
||||||
|
|
||||||
return(STATUS_SUCCESS);
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
CdfsGetFsSizeInformation(PDEVICE_OBJECT DeviceObject,
|
CdfsGetFsSizeInformation(
|
||||||
PFILE_FS_SIZE_INFORMATION FsSizeInfo,
|
PDEVICE_OBJECT DeviceObject,
|
||||||
PULONG BufferLength)
|
PFILE_FS_SIZE_INFORMATION FsSizeInfo,
|
||||||
|
PULONG BufferLength)
|
||||||
{
|
{
|
||||||
PDEVICE_EXTENSION DeviceExt;
|
PDEVICE_EXTENSION DeviceExt;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
@ -122,7 +127,7 @@ CdfsGetFsSizeInformation(PDEVICE_OBJECT DeviceObject,
|
||||||
DPRINT("FsSizeInfo = %p\n", FsSizeInfo);
|
DPRINT("FsSizeInfo = %p\n", FsSizeInfo);
|
||||||
|
|
||||||
if (*BufferLength < sizeof(FILE_FS_SIZE_INFORMATION))
|
if (*BufferLength < sizeof(FILE_FS_SIZE_INFORMATION))
|
||||||
return(STATUS_BUFFER_OVERFLOW);
|
return STATUS_BUFFER_OVERFLOW;
|
||||||
|
|
||||||
DeviceExt = DeviceObject->DeviceExtension;
|
DeviceExt = DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
|
@ -135,17 +140,16 @@ CdfsGetFsSizeInformation(PDEVICE_OBJECT DeviceObject,
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
*BufferLength -= sizeof(FILE_FS_SIZE_INFORMATION);
|
*BufferLength -= sizeof(FILE_FS_SIZE_INFORMATION);
|
||||||
|
|
||||||
return(Status);
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static NTSTATUS
|
static
|
||||||
CdfsGetFsDeviceInformation
|
NTSTATUS
|
||||||
(
|
CdfsGetFsDeviceInformation(
|
||||||
PDEVICE_OBJECT DeviceObject,
|
PDEVICE_OBJECT DeviceObject,
|
||||||
PFILE_FS_DEVICE_INFORMATION FsDeviceInfo,
|
PFILE_FS_DEVICE_INFORMATION FsDeviceInfo,
|
||||||
PULONG BufferLength
|
PULONG BufferLength)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
DPRINT("CdfsGetFsDeviceInformation()\n");
|
DPRINT("CdfsGetFsDeviceInformation()\n");
|
||||||
DPRINT("FsDeviceInfo = %p\n", FsDeviceInfo);
|
DPRINT("FsDeviceInfo = %p\n", FsDeviceInfo);
|
||||||
|
@ -153,7 +157,7 @@ CdfsGetFsDeviceInformation
|
||||||
DPRINT("Required length %lu\n", sizeof(FILE_FS_DEVICE_INFORMATION));
|
DPRINT("Required length %lu\n", sizeof(FILE_FS_DEVICE_INFORMATION));
|
||||||
|
|
||||||
if (*BufferLength < sizeof(FILE_FS_DEVICE_INFORMATION))
|
if (*BufferLength < sizeof(FILE_FS_DEVICE_INFORMATION))
|
||||||
return(STATUS_BUFFER_OVERFLOW);
|
return STATUS_BUFFER_OVERFLOW;
|
||||||
|
|
||||||
FsDeviceInfo->DeviceType = FILE_DEVICE_CD_ROM;
|
FsDeviceInfo->DeviceType = FILE_DEVICE_CD_ROM;
|
||||||
FsDeviceInfo->Characteristics = DeviceObject->Characteristics;
|
FsDeviceInfo->Characteristics = DeviceObject->Characteristics;
|
||||||
|
@ -163,11 +167,12 @@ CdfsGetFsDeviceInformation
|
||||||
*BufferLength -= sizeof(FILE_FS_DEVICE_INFORMATION);
|
*BufferLength -= sizeof(FILE_FS_DEVICE_INFORMATION);
|
||||||
DPRINT("BufferLength %lu\n", *BufferLength);
|
DPRINT("BufferLength %lu\n", *BufferLength);
|
||||||
|
|
||||||
return(STATUS_SUCCESS);
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
CdfsQueryVolumeInformation(
|
CdfsQueryVolumeInformation(
|
||||||
PCDFS_IRP_CONTEXT IrpContext)
|
PCDFS_IRP_CONTEXT IrpContext)
|
||||||
{
|
{
|
||||||
|
@ -195,32 +200,32 @@ CdfsQueryVolumeInformation(
|
||||||
|
|
||||||
switch (FsInformationClass)
|
switch (FsInformationClass)
|
||||||
{
|
{
|
||||||
case FileFsVolumeInformation:
|
case FileFsVolumeInformation:
|
||||||
Status = CdfsGetFsVolumeInformation(DeviceObject,
|
Status = CdfsGetFsVolumeInformation(DeviceObject,
|
||||||
SystemBuffer,
|
SystemBuffer,
|
||||||
&BufferLength);
|
&BufferLength);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FileFsAttributeInformation:
|
||||||
|
Status = CdfsGetFsAttributeInformation(DeviceObject->DeviceExtension,
|
||||||
|
SystemBuffer,
|
||||||
|
&BufferLength);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FileFsSizeInformation:
|
||||||
|
Status = CdfsGetFsSizeInformation(DeviceObject,
|
||||||
|
SystemBuffer,
|
||||||
|
&BufferLength);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FileFsAttributeInformation:
|
case FileFsDeviceInformation:
|
||||||
Status = CdfsGetFsAttributeInformation(DeviceObject->DeviceExtension,
|
Status = CdfsGetFsDeviceInformation(DeviceObject,
|
||||||
SystemBuffer,
|
SystemBuffer,
|
||||||
&BufferLength);
|
&BufferLength);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FileFsSizeInformation:
|
default:
|
||||||
Status = CdfsGetFsSizeInformation(DeviceObject,
|
Status = STATUS_NOT_SUPPORTED;
|
||||||
SystemBuffer,
|
|
||||||
&BufferLength);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FileFsDeviceInformation:
|
|
||||||
Status = CdfsGetFsDeviceInformation(DeviceObject,
|
|
||||||
SystemBuffer,
|
|
||||||
&BufferLength);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
Status = STATUS_NOT_SUPPORTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
|
@ -230,11 +235,12 @@ CdfsQueryVolumeInformation(
|
||||||
else
|
else
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
|
|
||||||
return(Status);
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
CdfsSetVolumeInformation(
|
CdfsSetVolumeInformation(
|
||||||
PCDFS_IRP_CONTEXT IrpContext)
|
PCDFS_IRP_CONTEXT IrpContext)
|
||||||
{
|
{
|
||||||
|
@ -248,7 +254,7 @@ CdfsSetVolumeInformation(
|
||||||
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
|
|
||||||
return(STATUS_NOT_SUPPORTED);
|
return STATUS_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue