From fac1d981b14b93f474d1f2cead8799b31c91e8dd Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Mon, 5 Jul 2004 21:39:02 +0000 Subject: [PATCH] - Removed the using of the media change count to recognize a median change. svn path=/trunk/; revision=9999 --- reactos/drivers/fs/vfat/create.c | 42 ++++++++++++++------------------ reactos/drivers/fs/vfat/fsctl.c | 28 ++++----------------- reactos/drivers/fs/vfat/vfat.h | 5 +--- 3 files changed, 24 insertions(+), 51 deletions(-) diff --git a/reactos/drivers/fs/vfat/create.c b/reactos/drivers/fs/vfat/create.c index 00843c284da..433a516891c 100644 --- a/reactos/drivers/fs/vfat/create.c +++ b/reactos/drivers/fs/vfat/create.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: create.c,v 1.69 2004/07/03 17:31:30 hbirr Exp $ +/* $Id: create.c,v 1.70 2004/07/05 21:39:02 hbirr Exp $ * * PROJECT: ReactOS kernel * FILE: drivers/fs/vfat/create.c @@ -178,7 +178,7 @@ FindFile (PDEVICE_EXTENSION DeviceExt, PVOID Page; PVFATFCB rcFcb; BOOLEAN FoundLong; - BOOLEAN FoundShort; + BOOLEAN FoundShort = FALSE; UNICODE_STRING PathNameU; BOOLEAN WildCard; PWCHAR curr, last; @@ -339,8 +339,7 @@ VfatOpenFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject, PVFATFCB ParentFcb; PVFATFCB Fcb; NTSTATUS Status; - ULONG Size; - ULONG MediaChangeCount; + // PDEVICE_OBJECT DeviceObject = DeviceExt->StorageDevice->Vpb->DeviceObject; @@ -373,39 +372,34 @@ VfatOpenFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject, if (!DeviceExt->FatInfo.FixedMedia) { - Size = sizeof(ULONG); Status = VfatBlockDeviceIoControl (DeviceExt->StorageDevice, IOCTL_DISK_CHECK_VERIFY, NULL, 0, - &MediaChangeCount, - &Size, + NULL, + 0, FALSE); - if (Status == STATUS_VERIFY_REQUIRED || MediaChangeCount != DeviceExt->MediaChangeCount) + if (Status == STATUS_VERIFY_REQUIRED) + { PDEVICE_OBJECT DeviceToVerify; DPRINT ("Media change detected!\n"); DPRINT ("Device %p\n", DeviceExt->StorageDevice); - DeviceToVerify = IoGetDeviceToVerify (PsGetCurrentThread ()); - IoSetDeviceToVerify (PsGetCurrentThread (), + DeviceToVerify = IoGetDeviceToVerify (PsGetCurrentThread ()); + + IoSetDeviceToVerify (PsGetCurrentThread (), NULL); - - Status = IoVerifyVolume (DeviceToVerify, - FALSE); - if (!NT_SUCCESS(Status)) - { - DPRINT ("Status %lx\n", Status); - return Status; - } - } - else if (!NT_SUCCESS(Status)) - { - DPRINT ("Status %lx\n", Status); - return Status; - } + Status = IoVerifyVolume (DeviceExt->StorageDevice, + FALSE); + } + if (!NT_SUCCESS(Status)) + { + DPRINT ("Status %lx\n", Status); + return Status; + } } diff --git a/reactos/drivers/fs/vfat/fsctl.c b/reactos/drivers/fs/vfat/fsctl.c index 890595b35f9..f179d268afc 100644 --- a/reactos/drivers/fs/vfat/fsctl.c +++ b/reactos/drivers/fs/vfat/fsctl.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: fsctl.c,v 1.32 2004/06/23 20:23:59 hbirr Exp $ +/* $Id: fsctl.c,v 1.33 2004/07/05 21:39:02 hbirr Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -275,7 +275,6 @@ VfatMountDevice(PDEVICE_EXTENSION DeviceExt, { NTSTATUS Status; BOOLEAN RecognizedFS; - ULONG Size; DPRINT("Mounting VFAT device...\n"); @@ -286,21 +285,6 @@ VfatMountDevice(PDEVICE_EXTENSION DeviceExt, } DPRINT("MountVfatdev %d, PAGE_SIZE = %d\n", DeviceExt->FatInfo.BytesPerCluster, PAGE_SIZE); - if (!DeviceExt->FatInfo.FixedMedia) - { - Size = sizeof(ULONG); - Status = VfatBlockDeviceIoControl (DeviceToMount, - IOCTL_DISK_CHECK_VERIFY, - NULL, - 0, - &DeviceExt->MediaChangeCount, - &Size, - FALSE); - if (!NT_SUCCESS(Status)) - { - return Status; - } - } return(STATUS_SUCCESS); } @@ -498,20 +482,19 @@ VfatVerify (PVFAT_IRP_CONTEXT IrpContext) NTSTATUS Status = STATUS_SUCCESS; FATINFO FatInfo; BOOLEAN RecognizedFS; - ULONG Size; PDEVICE_EXTENSION DeviceExt = IrpContext->DeviceExt; DPRINT("VfatVerify(IrpContext %x)\n", IrpContext); DeviceToVerify = IrpContext->Stack->Parameters.VerifyVolume.DeviceObject; - Size = sizeof(ULONG); Status = VfatBlockDeviceIoControl(DeviceToVerify, IOCTL_DISK_CHECK_VERIFY, NULL, 0, - &DeviceExt->MediaChangeCount, - &Size, - FALSE); + NULL, + 0, + TRUE); + DeviceToVerify->Flags &= ~DO_VERIFY_VOLUME; if (!NT_SUCCESS(Status) && Status != STATUS_VERIFY_REQUIRED) { DPRINT("VfatBlockDeviceIoControl() failed (Status %lx)\n", Status); @@ -533,7 +516,6 @@ VfatVerify (PVFAT_IRP_CONTEXT IrpContext) * Each write to the root directory must update this crc sum. */ - DeviceToVerify->Flags &= ~DO_VERIFY_VOLUME; } else { diff --git a/reactos/drivers/fs/vfat/vfat.h b/reactos/drivers/fs/vfat/vfat.h index 0eb9b0d53a4..56c2f151104 100644 --- a/reactos/drivers/fs/vfat/vfat.h +++ b/reactos/drivers/fs/vfat/vfat.h @@ -1,4 +1,4 @@ -/* $Id: vfat.h,v 1.64 2004/06/23 20:23:59 hbirr Exp $ */ +/* $Id: vfat.h,v 1.65 2004/07/05 21:39:02 hbirr Exp $ */ #include @@ -163,9 +163,6 @@ typedef struct struct _VFATFCB * VolumeFcb; LIST_ENTRY VolumeListEntry; - - ULONG MediaChangeCount; - } DEVICE_EXTENSION, *PDEVICE_EXTENSION, VCB, *PVCB; typedef struct