- Removed the using of the media change count to recognize a median change.

svn path=/trunk/; revision=9999
This commit is contained in:
Hartmut Birr 2004-07-05 21:39:02 +00:00
parent 52f4f6acef
commit fac1d981b1
3 changed files with 24 additions and 51 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 * PROJECT: ReactOS kernel
* FILE: drivers/fs/vfat/create.c * FILE: drivers/fs/vfat/create.c
@ -178,7 +178,7 @@ FindFile (PDEVICE_EXTENSION DeviceExt,
PVOID Page; PVOID Page;
PVFATFCB rcFcb; PVFATFCB rcFcb;
BOOLEAN FoundLong; BOOLEAN FoundLong;
BOOLEAN FoundShort; BOOLEAN FoundShort = FALSE;
UNICODE_STRING PathNameU; UNICODE_STRING PathNameU;
BOOLEAN WildCard; BOOLEAN WildCard;
PWCHAR curr, last; PWCHAR curr, last;
@ -339,8 +339,7 @@ VfatOpenFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
PVFATFCB ParentFcb; PVFATFCB ParentFcb;
PVFATFCB Fcb; PVFATFCB Fcb;
NTSTATUS Status; NTSTATUS Status;
ULONG Size;
ULONG MediaChangeCount;
// PDEVICE_OBJECT DeviceObject = DeviceExt->StorageDevice->Vpb->DeviceObject; // PDEVICE_OBJECT DeviceObject = DeviceExt->StorageDevice->Vpb->DeviceObject;
@ -373,39 +372,34 @@ VfatOpenFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
if (!DeviceExt->FatInfo.FixedMedia) if (!DeviceExt->FatInfo.FixedMedia)
{ {
Size = sizeof(ULONG);
Status = VfatBlockDeviceIoControl (DeviceExt->StorageDevice, Status = VfatBlockDeviceIoControl (DeviceExt->StorageDevice,
IOCTL_DISK_CHECK_VERIFY, IOCTL_DISK_CHECK_VERIFY,
NULL, NULL,
0, 0,
&MediaChangeCount, NULL,
&Size, 0,
FALSE); FALSE);
if (Status == STATUS_VERIFY_REQUIRED || MediaChangeCount != DeviceExt->MediaChangeCount) if (Status == STATUS_VERIFY_REQUIRED)
{ {
PDEVICE_OBJECT DeviceToVerify; PDEVICE_OBJECT DeviceToVerify;
DPRINT ("Media change detected!\n"); DPRINT ("Media change detected!\n");
DPRINT ("Device %p\n", DeviceExt->StorageDevice); DPRINT ("Device %p\n", DeviceExt->StorageDevice);
DeviceToVerify = IoGetDeviceToVerify (PsGetCurrentThread ()); DeviceToVerify = IoGetDeviceToVerify (PsGetCurrentThread ());
IoSetDeviceToVerify (PsGetCurrentThread (),
IoSetDeviceToVerify (PsGetCurrentThread (),
NULL); NULL);
Status = IoVerifyVolume (DeviceExt->StorageDevice,
Status = IoVerifyVolume (DeviceToVerify, FALSE);
FALSE); }
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT ("Status %lx\n", Status); DPRINT ("Status %lx\n", Status);
return Status; return Status;
} }
}
else if (!NT_SUCCESS(Status))
{
DPRINT ("Status %lx\n", Status);
return Status;
}
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -275,7 +275,6 @@ VfatMountDevice(PDEVICE_EXTENSION DeviceExt,
{ {
NTSTATUS Status; NTSTATUS Status;
BOOLEAN RecognizedFS; BOOLEAN RecognizedFS;
ULONG Size;
DPRINT("Mounting VFAT device...\n"); 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); 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); return(STATUS_SUCCESS);
} }
@ -498,20 +482,19 @@ VfatVerify (PVFAT_IRP_CONTEXT IrpContext)
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status = STATUS_SUCCESS;
FATINFO FatInfo; FATINFO FatInfo;
BOOLEAN RecognizedFS; BOOLEAN RecognizedFS;
ULONG Size;
PDEVICE_EXTENSION DeviceExt = IrpContext->DeviceExt; PDEVICE_EXTENSION DeviceExt = IrpContext->DeviceExt;
DPRINT("VfatVerify(IrpContext %x)\n", IrpContext); DPRINT("VfatVerify(IrpContext %x)\n", IrpContext);
DeviceToVerify = IrpContext->Stack->Parameters.VerifyVolume.DeviceObject; DeviceToVerify = IrpContext->Stack->Parameters.VerifyVolume.DeviceObject;
Size = sizeof(ULONG);
Status = VfatBlockDeviceIoControl(DeviceToVerify, Status = VfatBlockDeviceIoControl(DeviceToVerify,
IOCTL_DISK_CHECK_VERIFY, IOCTL_DISK_CHECK_VERIFY,
NULL, NULL,
0, 0,
&DeviceExt->MediaChangeCount, NULL,
&Size, 0,
FALSE); TRUE);
DeviceToVerify->Flags &= ~DO_VERIFY_VOLUME;
if (!NT_SUCCESS(Status) && Status != STATUS_VERIFY_REQUIRED) if (!NT_SUCCESS(Status) && Status != STATUS_VERIFY_REQUIRED)
{ {
DPRINT("VfatBlockDeviceIoControl() failed (Status %lx)\n", Status); 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. * Each write to the root directory must update this crc sum.
*/ */
DeviceToVerify->Flags &= ~DO_VERIFY_VOLUME;
} }
else else
{ {

View file

@ -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 <ddk/ntifs.h> #include <ddk/ntifs.h>
@ -163,9 +163,6 @@ typedef struct
struct _VFATFCB * VolumeFcb; struct _VFATFCB * VolumeFcb;
LIST_ENTRY VolumeListEntry; LIST_ENTRY VolumeListEntry;
ULONG MediaChangeCount;
} DEVICE_EXTENSION, *PDEVICE_EXTENSION, VCB, *PVCB; } DEVICE_EXTENSION, *PDEVICE_EXTENSION, VCB, *PVCB;
typedef struct typedef struct