[FORMATTING]

Fix indentation and coding style. No code changes!

svn path=/trunk/; revision=61143
This commit is contained in:
Eric Kohl 2013-11-29 11:03:34 +00:00
parent 2f7e31bc07
commit 932bee1e8a

View file

@ -14,11 +14,15 @@
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
static NTSTATUS static
FsdGetFsVolumeInformation(PDEVICE_OBJECT DeviceObject, NTSTATUS
FsdGetFsVolumeInformation(
PDEVICE_OBJECT DeviceObject,
PFILE_FS_VOLUME_INFORMATION FsVolumeInfo, PFILE_FS_VOLUME_INFORMATION FsVolumeInfo,
PULONG BufferLength) PULONG BufferLength)
{ {
PDEVICE_EXTENSION DeviceExt;
DPRINT("FsdGetFsVolumeInformation()\n"); DPRINT("FsdGetFsVolumeInformation()\n");
DPRINT("FsVolumeInfo = %p\n", FsVolumeInfo); DPRINT("FsVolumeInfo = %p\n", FsVolumeInfo);
DPRINT("BufferLength %lu\n", *BufferLength); DPRINT("BufferLength %lu\n", *BufferLength);
@ -33,6 +37,8 @@ FsdGetFsVolumeInformation(PDEVICE_OBJECT DeviceObject,
if (*BufferLength < (sizeof(FILE_FS_VOLUME_INFORMATION) + DeviceObject->Vpb->VolumeLabelLength)) if (*BufferLength < (sizeof(FILE_FS_VOLUME_INFORMATION) + DeviceObject->Vpb->VolumeLabelLength))
return STATUS_BUFFER_OVERFLOW; return STATUS_BUFFER_OVERFLOW;
DeviceExt = DeviceObject->DeviceExtension;
/* valid entries */ /* valid entries */
FsVolumeInfo->VolumeSerialNumber = DeviceObject->Vpb->SerialNumber; FsVolumeInfo->VolumeSerialNumber = DeviceObject->Vpb->SerialNumber;
FsVolumeInfo->VolumeLabelLength = DeviceObject->Vpb->VolumeLabelLength; FsVolumeInfo->VolumeLabelLength = DeviceObject->Vpb->VolumeLabelLength;
@ -48,12 +54,14 @@ FsdGetFsVolumeInformation(PDEVICE_OBJECT DeviceObject,
DPRINT("BufferLength %lu\n", *BufferLength); DPRINT("BufferLength %lu\n", *BufferLength);
return(STATUS_SUCCESS); return STATUS_SUCCESS;
} }
static NTSTATUS static
FsdGetFsAttributeInformation(PDEVICE_EXTENSION DeviceExt, NTSTATUS
FsdGetFsAttributeInformation(
PDEVICE_EXTENSION DeviceExt,
PFILE_FS_ATTRIBUTE_INFORMATION FsAttributeInfo, PFILE_FS_ATTRIBUTE_INFORMATION FsAttributeInfo,
PULONG BufferLength) PULONG BufferLength)
{ {
@ -88,19 +96,21 @@ FsdGetFsAttributeInformation(PDEVICE_EXTENSION DeviceExt,
FsAttributeInfo->FileSystemNameLength = Length; FsAttributeInfo->FileSystemNameLength = Length;
RtlCopyMemory(FsAttributeInfo->FileSystemName, pName, Length ); RtlCopyMemory(FsAttributeInfo->FileSystemName, pName, Length);
DPRINT("Finished FsdGetFsAttributeInformation()\n"); DPRINT("Finished FsdGetFsAttributeInformation()\n");
*BufferLength -= (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + Length); *BufferLength -= (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + Length);
DPRINT("BufferLength %lu\n", *BufferLength); DPRINT("BufferLength %lu\n", *BufferLength);
return(STATUS_SUCCESS); return STATUS_SUCCESS;
} }
static NTSTATUS static
FsdGetFsSizeInformation(PDEVICE_OBJECT DeviceObject, NTSTATUS
FsdGetFsSizeInformation(
PDEVICE_OBJECT DeviceObject,
PFILE_FS_SIZE_INFORMATION FsSizeInfo, PFILE_FS_SIZE_INFORMATION FsSizeInfo,
PULONG BufferLength) PULONG BufferLength)
{ {
@ -111,7 +121,7 @@ FsdGetFsSizeInformation(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;
Status = CountAvailableClusters(DeviceExt, &FsSizeInfo->AvailableAllocationUnits); Status = CountAvailableClusters(DeviceExt, &FsSizeInfo->AvailableAllocationUnits);
@ -124,17 +134,16 @@ FsdGetFsSizeInformation(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
FsdGetFsDeviceInformation NTSTATUS
( FsdGetFsDeviceInformation(
PDEVICE_OBJECT DeviceObject, PDEVICE_OBJECT DeviceObject,
PFILE_FS_DEVICE_INFORMATION FsDeviceInfo, PFILE_FS_DEVICE_INFORMATION FsDeviceInfo,
PULONG BufferLength PULONG BufferLength)
)
{ {
DPRINT("FsdGetFsDeviceInformation()\n"); DPRINT("FsdGetFsDeviceInformation()\n");
DPRINT("FsDeviceInfo = %p\n", FsDeviceInfo); DPRINT("FsDeviceInfo = %p\n", FsDeviceInfo);
@ -142,7 +151,7 @@ FsdGetFsDeviceInformation
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_DISK; FsDeviceInfo->DeviceType = FILE_DEVICE_DISK;
FsDeviceInfo->Characteristics = DeviceObject->Characteristics; FsDeviceInfo->Characteristics = DeviceObject->Characteristics;
@ -152,12 +161,14 @@ FsdGetFsDeviceInformation
*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;
} }
static NTSTATUS static
FsdSetFsLabelInformation(PDEVICE_OBJECT DeviceObject, NTSTATUS
FsdSetFsLabelInformation(
PDEVICE_OBJECT DeviceObject,
PFILE_FS_LABEL_INFORMATION FsLabelInfo) PFILE_FS_LABEL_INFORMATION FsLabelInfo)
{ {
PDEVICE_EXTENSION DeviceExt; PDEVICE_EXTENSION DeviceExt;
@ -190,6 +201,7 @@ FsdSetFsLabelInformation(PDEVICE_OBJECT DeviceObject,
{ {
if (FsLabelInfo->VolumeLabelLength / sizeof(WCHAR) > 42) if (FsLabelInfo->VolumeLabelLength / sizeof(WCHAR) > 42)
return STATUS_NAME_TOO_LONG; return STATUS_NAME_TOO_LONG;
SizeDirEntry = sizeof(FATX_DIR_ENTRY); SizeDirEntry = sizeof(FATX_DIR_ENTRY);
EntriesPerPage = FATX_ENTRIES_PER_PAGE; EntriesPerPage = FATX_ENTRIES_PER_PAGE;
} }
@ -197,6 +209,7 @@ FsdSetFsLabelInformation(PDEVICE_OBJECT DeviceObject,
{ {
if (FsLabelInfo->VolumeLabelLength / sizeof(WCHAR) > 11) if (FsLabelInfo->VolumeLabelLength / sizeof(WCHAR) > 11)
return STATUS_NAME_TOO_LONG; return STATUS_NAME_TOO_LONG;
SizeDirEntry = sizeof(FAT_DIR_ENTRY); SizeDirEntry = sizeof(FAT_DIR_ENTRY);
EntriesPerPage = FAT_ENTRIES_PER_PAGE; EntriesPerPage = FAT_ENTRIES_PER_PAGE;
} }
@ -212,6 +225,7 @@ FsdSetFsLabelInformation(PDEVICE_OBJECT DeviceObject,
Status = RtlUnicodeStringToOemString(&StringO, &StringW, FALSE); Status = RtlUnicodeStringToOemString(&StringO, &StringW, FALSE);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return Status; return Status;
if (DeviceExt->Flags & VCB_IS_FATX) if (DeviceExt->Flags & VCB_IS_FATX)
{ {
RtlCopyMemory(VolumeLabelDirEntry.FatX.Filename, cString, LabelLen); RtlCopyMemory(VolumeLabelDirEntry.FatX.Filename, cString, LabelLen);
@ -250,10 +264,12 @@ FsdSetFsLabelInformation(PDEVICE_OBJECT DeviceObject,
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
break; break;
} }
if (ENTRY_END(DeviceExt, Entry)) if (ENTRY_END(DeviceExt, Entry))
{ {
break; break;
} }
DirIndex++; DirIndex++;
Entry = (PDIR_ENTRY)((ULONG_PTR)Entry + SizeDirEntry); Entry = (PDIR_ENTRY)((ULONG_PTR)Entry + SizeDirEntry);
if ((DirIndex % EntriesPerPage) == 0) if ((DirIndex % EntriesPerPage) == 0)
@ -267,11 +283,13 @@ FsdSetFsLabelInformation(PDEVICE_OBJECT DeviceObject,
} }
} }
} }
if (Context) if (Context)
{ {
CcUnpinData(Context); CcUnpinData(Context);
} }
} }
if (!LabelFound) if (!LabelFound)
{ {
/* Add new entry for label */ /* Add new entry for label */
@ -310,7 +328,9 @@ FsdSetFsLabelInformation(PDEVICE_OBJECT DeviceObject,
} }
NTSTATUS VfatQueryVolumeInformation(PVFAT_IRP_CONTEXT IrpContext) NTSTATUS
VfatQueryVolumeInformation(
PVFAT_IRP_CONTEXT IrpContext)
/* /*
* FUNCTION: Retrieve the specified volume information * FUNCTION: Retrieve the specified volume information
*/ */
@ -328,7 +348,7 @@ NTSTATUS VfatQueryVolumeInformation(PVFAT_IRP_CONTEXT IrpContext)
if (!ExAcquireResourceSharedLite(&((PDEVICE_EXTENSION)IrpContext->DeviceObject->DeviceExtension)->DirResource, if (!ExAcquireResourceSharedLite(&((PDEVICE_EXTENSION)IrpContext->DeviceObject->DeviceExtension)->DirResource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT))) (BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{ {
return VfatQueueRequest (IrpContext); return VfatQueueRequest(IrpContext);
} }
/* INITIALIZATION */ /* INITIALIZATION */
@ -336,9 +356,8 @@ NTSTATUS VfatQueryVolumeInformation(PVFAT_IRP_CONTEXT IrpContext)
BufferLength = IrpContext->Stack->Parameters.QueryVolume.Length; BufferLength = IrpContext->Stack->Parameters.QueryVolume.Length;
SystemBuffer = IrpContext->Irp->AssociatedIrp.SystemBuffer; SystemBuffer = IrpContext->Irp->AssociatedIrp.SystemBuffer;
DPRINT("FsInformationClass %d\n", FsInformationClass);
DPRINT ("FsInformationClass %d\n", FsInformationClass); DPRINT("SystemBuffer %p\n", SystemBuffer);
DPRINT ("SystemBuffer %p\n", SystemBuffer);
switch (FsInformationClass) switch (FsInformationClass)
{ {
@ -384,7 +403,9 @@ NTSTATUS VfatQueryVolumeInformation(PVFAT_IRP_CONTEXT IrpContext)
} }
NTSTATUS VfatSetVolumeInformation(PVFAT_IRP_CONTEXT IrpContext) NTSTATUS
VfatSetVolumeInformation(
PVFAT_IRP_CONTEXT IrpContext)
/* /*
* FUNCTION: Set the specified volume information * FUNCTION: Set the specified volume information
*/ */
@ -398,23 +419,23 @@ NTSTATUS VfatSetVolumeInformation(PVFAT_IRP_CONTEXT IrpContext)
/* PRECONDITION */ /* PRECONDITION */
ASSERT(IrpContext); ASSERT(IrpContext);
DPRINT ("VfatSetVolumeInformation(IrpContext %p)\n", IrpContext); DPRINT("VfatSetVolumeInformation(IrpContext %p)\n", IrpContext);
if (!ExAcquireResourceExclusiveLite(&((PDEVICE_EXTENSION)IrpContext->DeviceObject->DeviceExtension)->DirResource, if (!ExAcquireResourceExclusiveLite(&((PDEVICE_EXTENSION)IrpContext->DeviceObject->DeviceExtension)->DirResource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT))) (BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{ {
return VfatQueueRequest (IrpContext); return VfatQueueRequest(IrpContext);
} }
FsInformationClass = Stack->Parameters.SetVolume.FsInformationClass; FsInformationClass = Stack->Parameters.SetVolume.FsInformationClass;
BufferLength = Stack->Parameters.SetVolume.Length; BufferLength = Stack->Parameters.SetVolume.Length;
SystemBuffer = IrpContext->Irp->AssociatedIrp.SystemBuffer; SystemBuffer = IrpContext->Irp->AssociatedIrp.SystemBuffer;
DPRINT ("FsInformationClass %d\n", FsInformationClass); DPRINT("FsInformationClass %d\n", FsInformationClass);
DPRINT ("BufferLength %u\n", BufferLength); DPRINT("BufferLength %u\n", BufferLength);
DPRINT ("SystemBuffer %p\n", SystemBuffer); DPRINT("SystemBuffer %p\n", SystemBuffer);
switch(FsInformationClass) switch (FsInformationClass)
{ {
case FileFsLabelInformation: case FileFsLabelInformation:
Status = FsdSetFsLabelInformation(IrpContext->DeviceObject, Status = FsdSetFsLabelInformation(IrpContext->DeviceObject,
@ -431,7 +452,7 @@ NTSTATUS VfatSetVolumeInformation(PVFAT_IRP_CONTEXT IrpContext)
IoCompleteRequest(IrpContext->Irp, IO_NO_INCREMENT); IoCompleteRequest(IrpContext->Irp, IO_NO_INCREMENT);
VfatFreeIrpContext(IrpContext); VfatFreeIrpContext(IrpContext);
return(Status); return Status;
} }
/* EOF */ /* EOF */