mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 06:22:58 +00:00
[FASTFAT]
Start implementing statistics support. So far, everything is just nulled. These 0 can be properly queried with fsutil fsinfo statistics. svn path=/trunk/; revision=75937
This commit is contained in:
parent
1ffd7e141b
commit
1fac1ca781
3 changed files with 74 additions and 0 deletions
|
@ -532,6 +532,7 @@ VfatMount(
|
||||||
UNICODE_STRING VolumeLabelU;
|
UNICODE_STRING VolumeLabelU;
|
||||||
ULONG HashTableSize;
|
ULONG HashTableSize;
|
||||||
ULONG eocMark;
|
ULONG eocMark;
|
||||||
|
ULONG i;
|
||||||
FATINFO FatInfo;
|
FATINFO FatInfo;
|
||||||
|
|
||||||
DPRINT("VfatMount(IrpContext %p)\n", IrpContext);
|
DPRINT("VfatMount(IrpContext %p)\n", IrpContext);
|
||||||
|
@ -669,6 +670,23 @@ VfatMount(
|
||||||
goto ByeBye;
|
goto ByeBye;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceExt->Statistics = ExAllocatePoolWithTag(NonPagedPool,
|
||||||
|
sizeof(STATISTICS) * VfatGlobalData->NumberProcessors,
|
||||||
|
TAG_VFAT);
|
||||||
|
if (DeviceExt->Statistics == NULL)
|
||||||
|
{
|
||||||
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
goto ByeBye;
|
||||||
|
}
|
||||||
|
|
||||||
|
RtlZeroMemory(DeviceExt->Statistics, sizeof(STATISTICS) * VfatGlobalData->NumberProcessors);
|
||||||
|
for (i = 0; i < VfatGlobalData->NumberProcessors; ++i)
|
||||||
|
{
|
||||||
|
DeviceExt->Statistics[i].Base.FileSystemType = FILESYSTEM_STATISTICS_TYPE_FAT;
|
||||||
|
DeviceExt->Statistics[i].Base.Version = 1;
|
||||||
|
DeviceExt->Statistics[i].Base.SizeOfCompleteStructure = sizeof(STATISTICS);
|
||||||
|
}
|
||||||
|
|
||||||
DeviceExt->FATFileObject = IoCreateStreamFileObject(NULL, DeviceExt->StorageDevice);
|
DeviceExt->FATFileObject = IoCreateStreamFileObject(NULL, DeviceExt->StorageDevice);
|
||||||
Fcb = vfatNewFCB(DeviceExt, &NameU);
|
Fcb = vfatNewFCB(DeviceExt, &NameU);
|
||||||
if (Fcb == NULL)
|
if (Fcb == NULL)
|
||||||
|
@ -776,6 +794,8 @@ ByeBye:
|
||||||
ObDereferenceObject (DeviceExt->FATFileObject);
|
ObDereferenceObject (DeviceExt->FATFileObject);
|
||||||
if (DeviceExt && DeviceExt->SpareVPB)
|
if (DeviceExt && DeviceExt->SpareVPB)
|
||||||
ExFreePoolWithTag(DeviceExt->SpareVPB, TAG_VFAT);
|
ExFreePoolWithTag(DeviceExt->SpareVPB, TAG_VFAT);
|
||||||
|
if (DeviceExt && DeviceExt->Statistics)
|
||||||
|
ExFreePoolWithTag(DeviceExt->Statistics, TAG_VFAT);
|
||||||
if (Fcb)
|
if (Fcb)
|
||||||
vfatDestroyFCB(Fcb);
|
vfatDestroyFCB(Fcb);
|
||||||
if (Ccb)
|
if (Ccb)
|
||||||
|
@ -1188,6 +1208,46 @@ VfatDismountVolume(
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
NTSTATUS
|
||||||
|
VfatGetStatistics(
|
||||||
|
PVFAT_IRP_CONTEXT IrpContext)
|
||||||
|
{
|
||||||
|
PVOID Buffer;
|
||||||
|
ULONG Length;
|
||||||
|
NTSTATUS Status;
|
||||||
|
PDEVICE_EXTENSION DeviceExt;
|
||||||
|
|
||||||
|
DeviceExt = IrpContext->DeviceExt;
|
||||||
|
Length = IrpContext->Stack->Parameters.FileSystemControl.OutputBufferLength;
|
||||||
|
Buffer = IrpContext->Irp->AssociatedIrp.SystemBuffer;
|
||||||
|
|
||||||
|
if (Length < sizeof(FILESYSTEM_STATISTICS))
|
||||||
|
{
|
||||||
|
return STATUS_BUFFER_TOO_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Buffer == NULL)
|
||||||
|
{
|
||||||
|
return STATUS_INVALID_USER_BUFFER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Length >= sizeof(STATISTICS) * VfatGlobalData->NumberProcessors)
|
||||||
|
{
|
||||||
|
Length = sizeof(STATISTICS) * VfatGlobalData->NumberProcessors;
|
||||||
|
Status = STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Status = STATUS_BUFFER_OVERFLOW;
|
||||||
|
}
|
||||||
|
|
||||||
|
RtlCopyMemory(Buffer, DeviceExt->Statistics, Length);
|
||||||
|
IrpContext->Irp->IoStatus.Information = Length;
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: File system control
|
* FUNCTION: File system control
|
||||||
*/
|
*/
|
||||||
|
@ -1243,6 +1303,10 @@ VfatFileSystemControl(
|
||||||
Status = VfatDismountVolume(IrpContext);
|
Status = VfatDismountVolume(IrpContext);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case FSCTL_FILESYSTEM_GET_STATISTICS:
|
||||||
|
Status = VfatGetStatistics(IrpContext);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,7 @@ DriverEntry(
|
||||||
RtlZeroMemory (VfatGlobalData, sizeof(VFAT_GLOBAL_DATA));
|
RtlZeroMemory (VfatGlobalData, sizeof(VFAT_GLOBAL_DATA));
|
||||||
VfatGlobalData->DriverObject = DriverObject;
|
VfatGlobalData->DriverObject = DriverObject;
|
||||||
VfatGlobalData->DeviceObject = DeviceObject;
|
VfatGlobalData->DeviceObject = DeviceObject;
|
||||||
|
VfatGlobalData->NumberProcessors = KeNumberProcessors;
|
||||||
/* Enable this to enter the debugger when file system corruption
|
/* Enable this to enter the debugger when file system corruption
|
||||||
* has been detected:
|
* has been detected:
|
||||||
VfatGlobalData->Flags = VFAT_BREAK_ON_CORRUPTION; */
|
VfatGlobalData->Flags = VFAT_BREAK_ON_CORRUPTION; */
|
||||||
|
|
|
@ -289,6 +289,13 @@ typedef struct _VFAT_DISPATCH
|
||||||
PGET_NEXT_DIR_ENTRY GetNextDirEntry;
|
PGET_NEXT_DIR_ENTRY GetNextDirEntry;
|
||||||
} VFAT_DISPATCH, *PVFAT_DISPATCH;
|
} VFAT_DISPATCH, *PVFAT_DISPATCH;
|
||||||
|
|
||||||
|
#define STATISTICS_SIZE_NO_PAD (sizeof(FILESYSTEM_STATISTICS) + sizeof(FAT_STATISTICS))
|
||||||
|
typedef struct _STATISTICS {
|
||||||
|
FILESYSTEM_STATISTICS Base;
|
||||||
|
FAT_STATISTICS Fat;
|
||||||
|
UCHAR Pad[((STATISTICS_SIZE_NO_PAD + 0x3f) & ~0x3f) - STATISTICS_SIZE_NO_PAD];
|
||||||
|
} STATISTICS, *PSTATISTICS;
|
||||||
|
|
||||||
typedef struct DEVICE_EXTENSION
|
typedef struct DEVICE_EXTENSION
|
||||||
{
|
{
|
||||||
ERESOURCE DirResource;
|
ERESOURCE DirResource;
|
||||||
|
@ -308,6 +315,7 @@ typedef struct DEVICE_EXTENSION
|
||||||
BOOLEAN AvailableClustersValid;
|
BOOLEAN AvailableClustersValid;
|
||||||
ULONG Flags;
|
ULONG Flags;
|
||||||
struct _VFATFCB *VolumeFcb;
|
struct _VFATFCB *VolumeFcb;
|
||||||
|
PSTATISTICS Statistics;
|
||||||
|
|
||||||
/* Pointers to functions for manipulating FAT. */
|
/* Pointers to functions for manipulating FAT. */
|
||||||
PGET_NEXT_CLUSTER GetNextCluster;
|
PGET_NEXT_CLUSTER GetNextCluster;
|
||||||
|
@ -383,6 +391,7 @@ typedef struct
|
||||||
PDRIVER_OBJECT DriverObject;
|
PDRIVER_OBJECT DriverObject;
|
||||||
PDEVICE_OBJECT DeviceObject;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
ULONG Flags;
|
ULONG Flags;
|
||||||
|
ULONG NumberProcessors;
|
||||||
ERESOURCE VolumeListLock;
|
ERESOURCE VolumeListLock;
|
||||||
LIST_ENTRY VolumeListHead;
|
LIST_ENTRY VolumeListHead;
|
||||||
NPAGED_LOOKASIDE_LIST FcbLookasideList;
|
NPAGED_LOOKASIDE_LIST FcbLookasideList;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue