FAT12GetNextCluster still needs fixed to not assume entire FAT fits in one cache page

Fixed minor typos
Temporary fix for FAT12GetNextCluster to at least not overflow the cache page

svn path=/trunk/; revision=1825
This commit is contained in:
Phillip Susi 2001-04-26 01:28:15 +00:00
parent dc3c360885
commit 21cbb4fcc1

View file

@ -1,5 +1,5 @@
/*
* $Id: fat.c,v 1.21 2001/03/06 17:28:25 dwelch Exp $
* $Id: fat.c,v 1.22 2001/04/26 01:28:15 phreak Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -15,7 +15,7 @@
#include <wchar.h>
#include <ntos/minmax.h>
#define NDEBUGN
#define NDEBUG
#include <debug.h>
#include "vfat.h"
@ -133,9 +133,10 @@ Fat12GetNextCluster (PDEVICE_EXTENSION DeviceExt,
PVOID BaseAddress;
*NextCluster = 0;
FATOffset = (CurrentCluster * 12) / 8; /* first byte containing value */
Status = CcRequestCacheSegment(DeviceExt->Fat12StorageBcb,
0,
PAGE_ROUND_DOWN(FATOffset),
&BaseAddress,
&Valid,
&CacheSeg);
@ -147,7 +148,7 @@ Fat12GetNextCluster (PDEVICE_EXTENSION DeviceExt,
{
Status = VfatReadSectors(DeviceExt->StorageDevice,
DeviceExt->FATStart,
DeviceExt->Boot->FATSectors,
PAGESIZE / BLOCKSIZE,
BaseAddress);
if (!NT_SUCCESS(Status))
{
@ -157,11 +158,12 @@ Fat12GetNextCluster (PDEVICE_EXTENSION DeviceExt,
}
CBlock = (PUCHAR)BaseAddress;
FATOffset = (CurrentCluster * 12) / 8; /* first byte containing value */
if ((CurrentCluster % 2) == 0)
{
Entry = CBlock[FATOffset];
DPRINT( "Entry = %x, FATOffset = %x\n", Entry, FATOffset );
Entry |= ((CBlock[FATOffset+1] & 0xf)<<8);
DPRINT( "Entry = %x\n", Entry );
}
else
{
@ -173,8 +175,9 @@ Fat12GetNextCluster (PDEVICE_EXTENSION DeviceExt,
Entry = 0xffffffff;
// DPRINT("Returning %x\n",Entry);
*NextCluster = Entry;
DPRINT( "NextCluster = %x, CurrentCluster = %x\n", *NextCluster, CurrentCluster );
CcReleaseCacheSegment(DeviceExt->Fat12StorageBcb, CacheSeg, TRUE);
return(STATUS_SUCCESS);
return Entry == 0xffffffff ? STATUS_END_OF_FILE : STATUS_SUCCESS;
}
NTSTATUS