MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / Ext2VerifyVolume

Function Ext2VerifyVolume

Ext4Fsd/fsctl.c:2379–2492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2377
2378
2379NTSTATUS
2380Ext2VerifyVolume (IN PEXT2_IRP_CONTEXT IrpContext)
2381{
2382 PDEVICE_OBJECT DeviceObject;
2383 NTSTATUS Status = STATUS_UNSUCCESSFUL;
2384 PEXT2_SUPER_BLOCK ext2_sb = NULL;
2385 PEXT2_VCB Vcb = NULL;
2386 BOOLEAN VcbResourceAcquired = FALSE;
2387 PIRP Irp;
2388 ULONG ChangeCount = 0;
2389 ULONG dwBytes;
2390
2391 __try {
2392
2393 ASSERT(IrpContext != NULL);
2394 ASSERT((IrpContext->Identifier.Type == EXT2ICX) &&
2395 (IrpContext->Identifier.Size == sizeof(EXT2_IRP_CONTEXT)));
2396
2397 DeviceObject = IrpContext->DeviceObject;
2398 //
2399 // This request is not allowed on the main device object
2400 //
2401 if (IsExt2FsDevice(DeviceObject)) {
2402 Status = STATUS_INVALID_DEVICE_REQUEST;
2403 __leave;
2404 }
2405
2406 Vcb = (PEXT2_VCB) DeviceObject->DeviceExtension;
2407 ASSERT(Vcb != NULL);
2408 ASSERT((Vcb->Identifier.Type == EXT2VCB) &&
2409 (Vcb->Identifier.Size == sizeof(EXT2_VCB)));
2410
2411 VcbResourceAcquired =
2412 ExAcquireResourceExclusiveLite(
2413 &Vcb->MainResource,
2414 TRUE );
2415
2416 if (!FlagOn(Vcb->TargetDeviceObject->Flags, DO_VERIFY_VOLUME)) {
2417 Status = STATUS_SUCCESS;
2418 __leave;
2419 }
2420
2421 if (!IsMounted(Vcb)) {
2422 Status = STATUS_WRONG_VOLUME;
2423 __leave;
2424 }
2425
2426 dwBytes = sizeof(ULONG);
2427 Status = Ext2DiskIoControl(
2428 Vcb->TargetDeviceObject,
2429 IOCTL_DISK_CHECK_VERIFY,
2430 NULL,
2431 0,
2432 &ChangeCount,
2433 &dwBytes );
2434
2435
2436 if (!NT_SUCCESS(Status)) {

Callers 1

Ext2FileSystemControlFunction · 0.85

Calls 6

Ext2DiskIoControlFunction · 0.85
Ext2LoadSuperFunction · 0.85
Ext2PurgeVolumeFunction · 0.85
Ext2FreePoolFunction · 0.85
Ext2CompleteIrpContextFunction · 0.85

Tested by

no test coverage detected