-/* $Id: volume.c,v 1.9 2001/06/12 12:35:42 ekohl Exp $
+/* $Id: volume.c,v 1.11 2001/07/20 08:00:21 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
PULONG BufferLength)
{
PDEVICE_EXTENSION DeviceExt;
+ NTSTATUS Status;
DPRINT("FsdGetFsSizeInformation()\n");
DPRINT("FsSizeInfo = %p\n", FsSizeInfo);
FsSizeInfo->TotalAllocationUnits.QuadPart = ((BootSect->Sectors ? BootSect->Sectors : BootSect->SectorsHuge)-DeviceExt->dataStart)/BootSect->SectorsPerCluster;
-
-
- FsSizeInfo->AvailableAllocationUnits.QuadPart = FAT32CountAvailableClusters (DeviceExt);
+ Status = FAT32CountAvailableClusters(DeviceExt,
+ &FsSizeInfo->AvailableAllocationUnits);
FsSizeInfo->SectorsPerAllocationUnit = BootSect->SectorsPerCluster;
FsSizeInfo->BytesPerSector = BootSect->BytesPerSector;
FsSizeInfo->TotalAllocationUnits.QuadPart = ((BootSect->Sectors ? BootSect->Sectors : BootSect->SectorsHuge)-DeviceExt->dataStart)/BootSect->SectorsPerCluster;
if (DeviceExt->FatType == FAT16)
- FsSizeInfo->AvailableAllocationUnits.QuadPart =
-#if 0
- FAT16CountAvailableClusters (DeviceExt);
-#else
-0;
-#endif
+ Status = FAT16CountAvailableClusters(DeviceExt,
+ &FsSizeInfo->AvailableAllocationUnits);
else
- FsSizeInfo->AvailableAllocationUnits.QuadPart =
- FAT12CountAvailableClusters (DeviceExt);
+ Status = FAT12CountAvailableClusters(DeviceExt,
+ &FsSizeInfo->AvailableAllocationUnits);
FsSizeInfo->SectorsPerAllocationUnit = BootSect->SectorsPerCluster;
FsSizeInfo->BytesPerSector = BootSect->BytesPerSector;
}
DPRINT("Finished FsdGetFsSizeInformation()\n");
+ if (NT_SUCCESS(Status))
+ *BufferLength -= sizeof(FILE_FS_SIZE_INFORMATION);
- *BufferLength -= sizeof(FILE_FS_SIZE_INFORMATION);
-
- return(STATUS_SUCCESS);
+ return(Status);
}
FsdSetFsLabelInformation(PDEVICE_OBJECT DeviceObject,
PFILE_FS_LABEL_INFORMATION FsLabelInfo)
{
- DPRINT("FsdSetFsLabelInformation()\n");
-
- return STATUS_NOT_IMPLEMENTED;
+ DPRINT("FsdSetFsLabelInformation()\n");
+
+ return(STATUS_NOT_IMPLEMENTED);
}
* FUNCTION: Set the specified volume information
*/
{
- PIO_STACK_LOCATION Stack;
- FS_INFORMATION_CLASS FsInformationClass;
-// PFILE_OBJECT FileObject = NULL;
-// PVFATFCB FCB = NULL;
- NTSTATUS Status = STATUS_SUCCESS;
- PVOID SystemBuffer;
- ULONG BufferLength;
-
- /* PRECONDITION */
- assert(DeviceObject != NULL);
- assert(Irp != NULL);
-
- DPRINT("FsdSetVolumeInformation(DeviceObject %x, Irp %x)\n",
- DeviceObject,
- Irp);
-
- Stack = IoGetCurrentIrpStackLocation (Irp);
- FsInformationClass = Stack->Parameters.SetVolume.FsInformationClass;
- BufferLength = Stack->Parameters.SetVolume.Length;
- SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
-// FileObject = Stack->FileObject;
-// FCB = ((PVFATCCB) (FileObject->FsContext2))->pFcb;
-
- DPRINT("FsInformationClass %d\n", FsInformationClass);
- DPRINT("BufferLength %d\n", BufferLength);
- DPRINT("SystemBuffer %x\n", SystemBuffer);
-
- switch (FsInformationClass)
- {
- case FileFsLabelInformation:
- Status = FsdSetFsLabelInformation(DeviceObject,
- SystemBuffer);
- break;
-
- default:
- Status = STATUS_NOT_SUPPORTED;
- }
-
- Irp->IoStatus.Status = Status;
- Irp->IoStatus.Information = 0;
- IoCompleteRequest(Irp,
- IO_NO_INCREMENT);
-
- return(Status);
+ PIO_STACK_LOCATION Stack;
+ FS_INFORMATION_CLASS FsInformationClass;
+// PFILE_OBJECT FileObject = NULL;
+// PVFATFCB FCB = NULL;
+ NTSTATUS Status = STATUS_SUCCESS;
+ PVOID SystemBuffer;
+ ULONG BufferLength;
+
+ /* PRECONDITION */
+ assert(DeviceObject != NULL);
+ assert(Irp != NULL);
+
+ DPRINT("FsdSetVolumeInformation(DeviceObject %x, Irp %x)\n",
+ DeviceObject,
+ Irp);
+
+ Stack = IoGetCurrentIrpStackLocation(Irp);
+ FsInformationClass = Stack->Parameters.SetVolume.FsInformationClass;
+ BufferLength = Stack->Parameters.SetVolume.Length;
+ SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
+// FileObject = Stack->FileObject;
+// FCB = ((PVFATCCB) (FileObject->FsContext2))->pFcb;
+
+ DPRINT("FsInformationClass %d\n", FsInformationClass);
+ DPRINT("BufferLength %d\n", BufferLength);
+ DPRINT("SystemBuffer %x\n", SystemBuffer);
+
+ switch(FsInformationClass)
+ {
+ case FileFsLabelInformation:
+ Status = FsdSetFsLabelInformation(DeviceObject,
+ SystemBuffer);
+ break;
+
+ default:
+ Status = STATUS_NOT_SUPPORTED;
+ }
+
+ Irp->IoStatus.Status = Status;
+ Irp->IoStatus.Information = 0;
+ IoCompleteRequest(Irp,
+ IO_NO_INCREMENT);
+
+ return(Status);
}
/* EOF */