diff --git a/reactos/drivers/fs/vfat/fat.c b/reactos/drivers/fs/vfat/fat.c index 0008a5d8acb..9dbbbe7215b 100644 --- a/reactos/drivers/fs/vfat/fat.c +++ b/reactos/drivers/fs/vfat/fat.c @@ -1,5 +1,5 @@ /* - * $Id: fat.c,v 1.40 2002/10/01 19:27:18 chorns Exp $ + * $Id: fat.c,v 1.41 2003/01/04 02:07:18 hbirr Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -632,7 +632,7 @@ WriteCluster(PDEVICE_EXTENSION DeviceExt, return(Status); } -ULONG +ULONGLONG ClusterToSector(PDEVICE_EXTENSION DeviceExt, ULONG Cluster) /* @@ -641,7 +641,8 @@ ClusterToSector(PDEVICE_EXTENSION DeviceExt, */ { return DeviceExt->FatInfo.dataStart + - ((Cluster - 2) * DeviceExt->FatInfo.SectorsPerCluster); + ((ULONGLONG)(Cluster - 2) * DeviceExt->FatInfo.SectorsPerCluster); + } NTSTATUS @@ -774,44 +775,4 @@ GetNextCluster(PDEVICE_EXTENSION DeviceExt, return(Status); } - -NTSTATUS -GetNextSector(PDEVICE_EXTENSION DeviceExt, - ULONG CurrentSector, - PULONG NextSector, - BOOLEAN Extend) -/* Some functions don't have access to the cluster they're really reading from. - Maybe this is a dirty solution, but it will allow them to handle fragmentation. */ -{ - NTSTATUS Status; - - DPRINT("GetNextSector(DeviceExt %x, CurrentSector %x)\n", - DeviceExt, - CurrentSector); - if (CurrentSectorFatInfo.dataStart || ((CurrentSector - DeviceExt->FatInfo.dataStart + 1) % DeviceExt->FatInfo.SectorsPerCluster)) - /* Basically, if the next sequential sector would be on a cluster border, then we'll need to check in the FAT */ - { - (*NextSector)=CurrentSector+1; - return (STATUS_SUCCESS); - } - else - { - CurrentSector = (CurrentSector - DeviceExt->FatInfo.dataStart) / DeviceExt->FatInfo.SectorsPerCluster + 2; - - Status = GetNextCluster(DeviceExt, CurrentSector, NextSector, Extend); - if (!NT_SUCCESS(Status)) - { - return(Status); - } - if ((*NextSector) == 0 || (*NextSector) == 0xffffffff) - { - /* The caller wants to know a sector. These FAT codes don't correspond to any sector. */ - return(STATUS_UNSUCCESSFUL); - } - - (*NextSector) = ClusterToSector(DeviceExt,(*NextSector)); - return(STATUS_SUCCESS); - } -} - /* EOF */ diff --git a/reactos/drivers/fs/vfat/rw.c b/reactos/drivers/fs/vfat/rw.c index 566e978c778..7fb3b7f7ea1 100644 --- a/reactos/drivers/fs/vfat/rw.c +++ b/reactos/drivers/fs/vfat/rw.c @@ -1,5 +1,5 @@ -/* $Id: rw.c,v 1.51 2003/01/03 23:58:31 gvg Exp $ +/* $Id: rw.c,v 1.52 2003/01/04 02:07:18 hbirr Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -273,7 +273,6 @@ VfatReadFileData (PVFAT_IRP_CONTEXT IrpContext, PVOID Buffer, NTSTATUS Status; ULONG BytesDone; ULONG BytesPerSector; - LARGE_INTEGER BytesPerSectorLarge; ULONG BytesPerCluster; /* PRECONDITION */ @@ -293,7 +292,6 @@ VfatReadFileData (PVFAT_IRP_CONTEXT IrpContext, PVOID Buffer, Ccb = (PVFATCCB)IrpContext->FileObject->FsContext2; Fcb = Ccb->pFcb; BytesPerSector = DeviceExt->FatInfo.BytesPerSector; - BytesPerSectorLarge.QuadPart = BytesPerSector; BytesPerCluster = DeviceExt->FatInfo.BytesPerCluster; assert(ReadOffset.QuadPart + Length <= ROUND_UP(Fcb->RFCB.FileSize.QuadPart, BytesPerSector)); @@ -377,7 +375,7 @@ VfatReadFileData (PVFAT_IRP_CONTEXT IrpContext, PVOID Buffer, while (Length > 0 && CurrentCluster != 0xffffffff && NT_SUCCESS(Status)) { StartCluster = CurrentCluster; - StartOffset.QuadPart = ClusterToSector(DeviceExt, StartCluster) * BytesPerSectorLarge.QuadPart; + StartOffset.QuadPart = ClusterToSector(DeviceExt, StartCluster) * BytesPerSector; BytesDone = 0; ClusterCount = 0; diff --git a/reactos/drivers/fs/vfat/vfat.h b/reactos/drivers/fs/vfat/vfat.h index 651f8768692..dddb7165e5a 100644 --- a/reactos/drivers/fs/vfat/vfat.h +++ b/reactos/drivers/fs/vfat/vfat.h @@ -1,4 +1,4 @@ -/* $Id: vfat.h,v 1.49 2002/12/03 01:14:49 hbirr Exp $ */ +/* $Id: vfat.h,v 1.50 2003/01/04 02:07:18 hbirr Exp $ */ #include @@ -397,19 +397,14 @@ NTSTATUS OffsetToCluster (PDEVICE_EXTENSION DeviceExt, PULONG Cluster, BOOLEAN Extend); -ULONG ClusterToSector (PDEVICE_EXTENSION DeviceExt, - ULONG Cluster); +ULONGLONG ClusterToSector (PDEVICE_EXTENSION DeviceExt, + ULONG Cluster); NTSTATUS GetNextCluster (PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster, PULONG NextCluster, BOOLEAN Extend); -NTSTATUS GetNextSector (PDEVICE_EXTENSION DeviceExt, - ULONG CurrentSector, - PULONG NextSector, - BOOLEAN Extend); - NTSTATUS CountAvailableClusters (PDEVICE_EXTENSION DeviceExt, PLARGE_INTEGER Clusters);