Fix for vfatfs on volumes with smaller cluster sizes

svn path=/trunk/; revision=1506
This commit is contained in:
David Welch 2001-01-13 18:38:09 +00:00
parent df75bd846f
commit 15491f14dd
10 changed files with 183 additions and 265 deletions

View file

@ -1,5 +1,5 @@
/*
* $Id: fat.c,v 1.11 2001/01/12 21:00:08 dwelch Exp $
* $Id: fat.c,v 1.12 2001/01/13 18:38:09 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -13,6 +13,7 @@
#include <ddk/ntddk.h>
#include <wchar.h>
#include <ntos/minmax.h>
#define NDEBUG
#include <debug.h>
@ -268,28 +269,42 @@ VfatRequestDiskPage(PDEVICE_EXTENSION DeviceExt,
return(STATUS_SUCCESS);
}
#if 0
ULONG
Vfat16FindAvailableClusterInPage (PVOID Page, ULONG Offset, ULONG Length)
{
ULONG j;
for (j = Offset ; j < Length; j+=2)
{
if ((*((PUSHORT)(Page + j))) == 0)
{
return(j);
}
}
return(0);
}
ULONG
FAT16FindAvailableCluster (PDEVICE_EXTENSION DeviceExt)
/*
* FUNCTION: Finds the first available cluster in a FAT16 table
*/
{
PUSHORT Block;
ULONG i;
PCACHE_SEG CacheSeg;
PCACHE_SEGMENT CacheSeg;
PVOID BaseAddress;
BOOLEAN Valid;
ULONG StartOffset;
ULONG FatLength;
ULONG j;
ULONG RCluster;
ULONG Length;
ULONG r;
ULONG FatStart;
NTSTATUS Status;
StartOffset = DeviceExt->Boot->FatStart * BLOCKSIZE;
FatLength = DevceExt->Boot->FatSectors * BLOCKSIZE;
FatStart = DeviceExt->FATStart * BLOCKSIZE;
StartOffset = DeviceExt->FATStart * BLOCKSIZE;
FatLength = DeviceExt->Boot->FATSectors * BLOCKSIZE;
if (StartOffset % PAGESIZE) != 0)
if ((StartOffset % PAGESIZE) != 0)
{
Status = VfatRequestDiskPage(DeviceExt,
PAGE_ROUND_DOWN(StartOffset),
@ -300,14 +315,13 @@ FAT16FindAvailableCluster (PDEVICE_EXTENSION DeviceExt)
return(0);
}
Length = max(PAGESIZE, FatLength);
for (j = (StartOffset % PAGESIZE); j < Length; j+=2)
r = Vfat16FindAvailableClusterInPage(BaseAddress,
StartOffset % PAGESIZE,
Length);
if (r != 0)
{
if ((*((PUSHORT)(BaseAddress + j))) == 0)
{
CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, FALSE);
return(j);
}
}
return((r - (StartOffset % PAGESIZE)) / 2);
}
CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, FALSE);
StartOffset = StartOffset + (Length - (StartOffset % PAGESIZE));
FatLength = FatLength - (Length - (StartOffset % PAGESIZE));
@ -322,23 +336,19 @@ FAT16FindAvailableCluster (PDEVICE_EXTENSION DeviceExt)
{
return(0);
}
for (j = 0; j < PAGESIZE; j+=2)
r = Vfat16FindAvailableClusterInPage(BaseAddress, 0, PAGESIZE);
if (r != 0)
{
if (*((PUSHORT)(BaseAddress + j)) == 0)
{
CcReleaseCacheSegment(DeviceExt->StorageBcb,
CacheSeg,
TRUE);
RCluster =
(StartOffset + j) - (DeviceExt->Boot->FatStart * BLOCKSIZE);
RCluster = RCluster / 2;
return(RCluster);
}
return((r + StartOffset - FatStart) / 2);
}
CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, TRUE);
StartOffset = StartOffset + PAGESIZE;
}
return(0);
}
#if 0
ULONG
FAT12FindAvailableCluster (PDEVICE_EXTENSION DeviceExt)
/*
@ -719,21 +729,24 @@ VFATLoadCluster (PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster)
DPRINT ("Finished VFATReadSectors\n");
}
#if 0
VOID
VFATWriteCluster (PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster)
NTSTATUS
VfatWriteCluster (PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster)
/*
* FUNCTION: Write a cluster to the physical device
*/
{
ULONG Sector;
DPRINT ("VFATWriteCluster(DeviceExt %x, Buffer %x, Cluster %d)\n",
NTSTATUS Status;
DPRINT ("VfatWriteCluster(DeviceExt %x, Buffer %x, Cluster %d)\n",
DeviceExt, Buffer, Cluster);
Sector = ClusterToSector (DeviceExt, Cluster);
/* FIXME: Check status */
VfatWriteSectors (DeviceExt->StorageDevice,
Sector, DeviceExt->Boot->SectorsPerCluster, Buffer);
Status = VfatWriteSectors (DeviceExt->StorageDevice,
Sector, DeviceExt->Boot->SectorsPerCluster,
Buffer);
return(Status);
}
#endif

View file

@ -1,5 +1,5 @@
/* $Id: rw.c,v 1.16 2001/01/13 12:40:21 dwelch Exp $
/* $Id: rw.c,v 1.17 2001/01/13 18:38:09 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -79,166 +79,6 @@ OffsetToCluster(PDEVICE_EXTENSION DeviceExt,
}
}
NTSTATUS
VfatReadFileNoCache (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
PVOID Buffer, ULONG Length, ULONG ReadOffset,
PULONG LengthRead)
/*
* FUNCTION: Reads data from a file
*/
{
ULONG CurrentCluster;
ULONG FileOffset;
ULONG FirstCluster;
PVFATFCB Fcb;
PVOID Temp;
ULONG TempLength;
NTSTATUS Status;
/* PRECONDITION */
assert (DeviceExt != NULL);
assert (DeviceExt->BytesPerCluster != 0);
assert (FileObject != NULL);
assert (FileObject->FsContext != NULL);
DPRINT ("FsdReadFile(DeviceExt %x, FileObject %x, Buffer %x, "
"Length %d, ReadOffset %d)\n", DeviceExt, FileObject, Buffer,
Length, ReadOffset);
Fcb = ((PVFATCCB)FileObject->FsContext2)->pFcb;
/*
* Find the first cluster
*/
if (DeviceExt->FatType == FAT32)
CurrentCluster = Fcb->entry.FirstCluster
+ Fcb->entry.FirstClusterHigh * 65536;
else
CurrentCluster = Fcb->entry.FirstCluster;
FirstCluster = CurrentCluster;
/*
* Truncate the read if necessary
*/
if (!(Fcb->entry.Attrib & FILE_ATTRIBUTE_DIRECTORY))
{
if (ReadOffset >= Fcb->entry.FileSize)
{
return (STATUS_END_OF_FILE);
}
if ((ReadOffset + Length) > Fcb->entry.FileSize)
{
Length = Fcb->entry.FileSize - ReadOffset;
}
}
*LengthRead = 0;
/*
* Allocate a buffer to hold partial clusters
*/
Temp = ExAllocatePool (NonPagedPool, DeviceExt->BytesPerCluster);
if (!Temp)
return STATUS_UNSUCCESSFUL;
/*
* Find the cluster to start the read from
* FIXME: Optimize by remembering the last cluster read and using if
* possible.
*/
if (FirstCluster == 1)
{
/* root of FAT16 or FAT12 */
CurrentCluster = DeviceExt->rootStart + ReadOffset
/ (DeviceExt->BytesPerCluster) * DeviceExt->Boot->SectorsPerCluster;
}
else
for (FileOffset = 0; FileOffset < ReadOffset / DeviceExt->BytesPerCluster;
FileOffset++)
{
Status = GetNextCluster (DeviceExt, CurrentCluster, &CurrentCluster);
return(Status);
}
/*
* If the read doesn't begin on a cluster boundary then read a full
* cluster and copy it.
*/
if ((ReadOffset % DeviceExt->BytesPerCluster) != 0)
{
if (FirstCluster == 1)
{
/* FIXME: Check status */
VfatReadSectors (DeviceExt->StorageDevice,
CurrentCluster,
DeviceExt->Boot->SectorsPerCluster, Temp);
CurrentCluster += DeviceExt->Boot->SectorsPerCluster;
}
else
{
VFATLoadCluster (DeviceExt, Temp, CurrentCluster);
Status = GetNextCluster (DeviceExt, CurrentCluster, &CurrentCluster);
}
TempLength = min (Length, DeviceExt->BytesPerCluster -
(ReadOffset % DeviceExt->BytesPerCluster));
memcpy (Buffer, Temp + ReadOffset % DeviceExt->BytesPerCluster,
TempLength);
(*LengthRead) = (*LengthRead) + TempLength;
Length = Length - TempLength;
Buffer = Buffer + TempLength;
}
CHECKPOINT;
while (Length >= DeviceExt->BytesPerCluster)
{
if (FirstCluster == 1)
{
/* FIXME: Check status */
VfatReadSectors (DeviceExt->StorageDevice,
CurrentCluster,
DeviceExt->Boot->SectorsPerCluster, Buffer);
CurrentCluster += DeviceExt->Boot->SectorsPerCluster;
}
else
{
VFATLoadCluster (DeviceExt, Buffer, CurrentCluster);
Status = GetNextCluster (DeviceExt, CurrentCluster, &CurrentCluster);
}
if (CurrentCluster == 0xffffffff)
{
ExFreePool (Temp);
return (STATUS_SUCCESS);
}
(*LengthRead) = (*LengthRead) + DeviceExt->BytesPerCluster;
Buffer = Buffer + DeviceExt->BytesPerCluster;
Length = Length - DeviceExt->BytesPerCluster;
}
CHECKPOINT;
if (Length > 0)
{
(*LengthRead) = (*LengthRead) + Length;
if (FirstCluster == 1)
{
/* FIXME: Check status */
VfatReadSectors (DeviceExt->StorageDevice,
CurrentCluster,
DeviceExt->Boot->SectorsPerCluster, Temp);
CurrentCluster += DeviceExt->Boot->SectorsPerCluster;
}
else
{
VFATLoadCluster (DeviceExt, Temp, CurrentCluster);
Status = GetNextCluster (DeviceExt, CurrentCluster, &CurrentCluster);
}
memcpy (Buffer, Temp, Length);
}
ExFreePool (Temp);
return (STATUS_SUCCESS);
}
NTSTATUS
VfatRawReadCluster (PDEVICE_EXTENSION DeviceExt,
ULONG FirstCluster,
@ -270,7 +110,7 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
ULONG FirstCluster,
PULONG CurrentCluster,
PVOID Destination,
ULONG Cached,
ULONG NoCache,
ULONG InternalOffset,
ULONG InternalLength)
{
@ -281,20 +121,28 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
NTSTATUS Status;
BytesPerCluster = DeviceExt->Boot->SectorsPerCluster * BLOCKSIZE;
if (BytesPerCluster >= PAGESIZE)
{
/*
* In this case the size of a cache segment is the same as a cluster
*/
Status = CcRequestCacheSegment(Fcb->RFCB.Bcb,
StartOffset,
&BaseAddress,
&Valid,
&CacheSeg);
if (!NT_SUCCESS(Status))
if (!NoCache)
{
return(Status);
Status = CcRequestCacheSegment(Fcb->RFCB.Bcb,
StartOffset,
&BaseAddress,
&Valid,
&CacheSeg);
if (!NT_SUCCESS(Status))
{
return(Status);
}
}
else
{
Valid = FALSE;
}
if (!Valid)
{
@ -305,7 +153,10 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
BaseAddress);
if (!NT_SUCCESS(Status))
{
CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, FALSE);
if (!NoCache)
{
CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, FALSE);
}
return(Status);
}
}
@ -313,7 +164,10 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
* Copy the data from the cache to the caller
*/
memcpy(Destination, BaseAddress + InternalOffset, InternalLength);
CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, TRUE);
if (!NoCache)
{
CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, TRUE);
}
Status = NextCluster(DeviceExt, FirstCluster, CurrentCluster);
if (!NT_SUCCESS(Status))
@ -324,20 +178,26 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
else
{
ULONG i;
ULONG ReadOffset;
ULONG InternalOffset;
/*
* Otherwise we read a page of clusters together
*/
Status = CcRequestCacheSegment(Fcb->RFCB.Bcb,
ReadOffset,
&BaseAddress,
&Valid,
&CacheSeg);
if (!NT_SUCCESS(Status))
if (!NoCache)
{
return(Status);
Status = CcRequestCacheSegment(Fcb->RFCB.Bcb,
StartOffset,
&BaseAddress,
&Valid,
&CacheSeg);
if (!NT_SUCCESS(Status))
{
return(Status);
}
}
else
{
Valid = FALSE;
}
/*
@ -356,7 +216,10 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
BaseAddress + (i * BytesPerCluster));
if (!NT_SUCCESS(Status))
{
CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, FALSE);
if (!NoCache)
{
CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, FALSE);
}
return(Status);
}
Status = NextCluster(DeviceExt, FirstCluster, CurrentCluster);
@ -384,7 +247,10 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
* Copy the data from the cache to the caller
*/
memcpy(Destination, BaseAddress + InternalOffset, InternalLength);
CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, TRUE);
if (!NoCache)
{
CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, TRUE);
}
}
return(STATUS_SUCCESS);
}
@ -392,7 +258,7 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
NTSTATUS
VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
PVOID Buffer, ULONG Length, ULONG ReadOffset,
PULONG LengthRead)
PULONG LengthRead, ULONG NoCache)
/*
* FUNCTION: Reads data from a file
*/
@ -410,7 +276,7 @@ VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
assert (FileObject != NULL);
assert (FileObject->FsContext != NULL);
DPRINT ("FsdReadFile(DeviceExt %x, FileObject %x, Buffer %x, "
DPRINT ("VfatReadFile(DeviceExt %x, FileObject %x, Buffer %x, "
"Length %d, ReadOffset 0x%x)\n", DeviceExt, FileObject, Buffer,
Length, ReadOffset);
@ -441,8 +307,14 @@ VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
}
}
ChunkSize = max(DeviceExt->BytesPerCluster, PAGESIZE);
if (DeviceExt->BytesPerCluster >= PAGESIZE)
{
ChunkSize = DeviceExt->BytesPerCluster;
}
else
{
ChunkSize = PAGESIZE;
}
*LengthRead = 0;
@ -467,7 +339,7 @@ VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
TempLength = min (Length, ChunkSize - (ReadOffset % ChunkSize));
VfatReadCluster(DeviceExt, Fcb,
ROUND_DOWN(ReadOffset, ChunkSize),
FirstCluster, &CurrentCluster, Buffer, 1,
FirstCluster, &CurrentCluster, Buffer, NoCache,
ReadOffset % ChunkSize, TempLength);
(*LengthRead) = (*LengthRead) + TempLength;
@ -479,7 +351,8 @@ VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
while (Length >= ChunkSize)
{
VfatReadCluster(DeviceExt, Fcb, ReadOffset,
FirstCluster, &CurrentCluster, Buffer, 1, 0, ChunkSize);
FirstCluster, &CurrentCluster, Buffer, NoCache, 0,
ChunkSize);
if (CurrentCluster == 0xffffffff)
{
return (STATUS_SUCCESS);
@ -493,13 +366,13 @@ VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
if (Length > 0)
{
VfatReadCluster(DeviceExt, Fcb, ReadOffset,
FirstCluster, &CurrentCluster, Buffer, 1, 0, Length);
FirstCluster, &CurrentCluster, Buffer, NoCache, 0,
Length);
(*LengthRead) = (*LengthRead) + Length;
}
return (STATUS_SUCCESS);
}
#if 0
NTSTATUS
VfatWriteFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
PVOID Buffer, ULONG Length, ULONG WriteOffset)
@ -516,7 +389,7 @@ VfatWriteFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
ULONG TempLength, Length2 = Length;
LARGE_INTEGER SystemTime, LocalTime;
DPRINT1 ("FsdWriteFile(FileObject %x, Buffer %x, Length %x, "
DPRINT1 ("VfatWriteFile(FileObject %x, Buffer %x, Length %x, "
"WriteOffset %x\n", FileObject, Buffer, Length, WriteOffset);
/* Locate the first cluster of the file */
@ -553,7 +426,7 @@ VfatWriteFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
/*
* File of size zero
*/
CurrentCluster = GetNextWriteCluster (DeviceExt, 0);
// CurrentCluster = GetNextWriteCluster (DeviceExt, 0);
if (DeviceExt->FatType == FAT32)
{
Fcb->entry.FirstClusterHigh = CurrentCluster >> 16;
@ -568,8 +441,10 @@ VfatWriteFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
FileOffset < WriteOffset / DeviceExt->BytesPerCluster;
FileOffset++)
{
#if 0
CurrentCluster =
GetNextWriteCluster (DeviceExt, CurrentCluster);
#endif
}
}
CHECKPOINT;
@ -606,16 +481,18 @@ VfatWriteFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
Length2 -= TempLength;
if (FirstCluster == 1)
{
VFATWriteSectors (DeviceExt->StorageDevice,
VfatWriteSectors (DeviceExt->StorageDevice,
CurrentCluster,
DeviceExt->Boot->SectorsPerCluster, Temp);
CurrentCluster += DeviceExt->Boot->SectorsPerCluster;
}
else
{
VFATWriteCluster (DeviceExt, Temp, CurrentCluster);
VfatWriteCluster (DeviceExt, Temp, CurrentCluster);
#if 0
if (Length2 > 0)
CurrentCluster = GetNextWriteCluster (DeviceExt, CurrentCluster);
#endif
}
Buffer = Buffer + TempLength;
}
@ -634,16 +511,18 @@ VfatWriteFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
Length2 -= DeviceExt->BytesPerCluster;
if (FirstCluster == 1)
{
VFATWriteSectors (DeviceExt->StorageDevice,
VfatWriteSectors (DeviceExt->StorageDevice,
CurrentCluster,
DeviceExt->Boot->SectorsPerCluster, Buffer);
CurrentCluster += DeviceExt->Boot->SectorsPerCluster;
}
else
{
VFATWriteCluster (DeviceExt, Buffer, CurrentCluster);
if (Length2 > 0)
VfatWriteCluster (DeviceExt, Buffer, CurrentCluster);
#if 0
if (Length2 > 0)
CurrentCluster = GetNextWriteCluster (DeviceExt, CurrentCluster);
#endif
}
Buffer = Buffer + DeviceExt->BytesPerCluster;
}
@ -676,13 +555,13 @@ VfatWriteFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
CHECKPOINT;
if (FirstCluster == 1)
{
VFATWriteSectors (DeviceExt->StorageDevice,
VfatWriteSectors (DeviceExt->StorageDevice,
CurrentCluster,
DeviceExt->Boot->SectorsPerCluster, Temp);
}
else
{
VFATWriteCluster (DeviceExt, Temp, CurrentCluster);
VfatWriteCluster (DeviceExt, Temp, CurrentCluster);
}
}
CHECKPOINT;
@ -703,13 +582,12 @@ VfatWriteFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
/*
* update entry in directory
*/
updEntry (DeviceExt, FileObject);
// updEntry (DeviceExt, FileObject);
}
ExFreePool (Temp);
return (STATUS_SUCCESS);
}
#endif
NTSTATUS STDCALL
VfatWrite (PDEVICE_OBJECT DeviceObject, PIRP Irp)
@ -721,8 +599,8 @@ VfatWrite (PDEVICE_OBJECT DeviceObject, PIRP Irp)
PVOID Buffer;
ULONG Offset;
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation (Irp);
/* PFILE_OBJECT FileObject = Stack->FileObject; */
/* PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension; */
PFILE_OBJECT FileObject = Stack->FileObject;
PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension;
NTSTATUS Status;
DPRINT ("VfatWrite(DeviceObject %x Irp %x)\n", DeviceObject, Irp);
@ -731,8 +609,7 @@ VfatWrite (PDEVICE_OBJECT DeviceObject, PIRP Irp)
Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
Offset = Stack->Parameters.Write.ByteOffset.u.LowPart;
/* Status = VfatWriteFile (DeviceExt, FileObject, Buffer, Length, Offset); */
Status = STATUS_MEDIA_WRITE_PROTECTED;
Status = VfatWriteFile (DeviceExt, FileObject, Buffer, Length, Offset);
Irp->IoStatus.Status = Status;
Irp->IoStatus.Information = Length;
@ -756,6 +633,7 @@ VfatRead (PDEVICE_OBJECT DeviceObject, PIRP Irp)
NTSTATUS Status;
ULONG LengthRead;
PVFATFCB Fcb;
ULONG NoCache;
DPRINT ("VfatRead(DeviceObject %x, Irp %x)\n", DeviceObject, Irp);
@ -771,6 +649,16 @@ VfatRead (PDEVICE_OBJECT DeviceObject, PIRP Irp)
Length = Stack->Parameters.Read.Length;
Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
Offset = Stack->Parameters.Read.ByteOffset.u.LowPart;
if (Irp->Flags & IRP_PAGING_IO ||
FileObject->Flags & FO_NO_INTERMEDIATE_BUFFERING)
{
NoCache = TRUE;
}
else
{
NoCache = FALSE;
}
/* fail if file is a directory */
Fcb = ((PVFATCCB) (FileObject->FsContext2))->pFcb;
@ -781,7 +669,8 @@ VfatRead (PDEVICE_OBJECT DeviceObject, PIRP Irp)
else
{
Status = VfatReadFile (DeviceExt,
FileObject, Buffer, Length, Offset, &LengthRead);
FileObject, Buffer, Length, Offset, &LengthRead,
NoCache);
}
Irp->IoStatus.Status = Status;

View file

@ -1,4 +1,4 @@
/* $Id: vfat.h,v 1.21 2001/01/12 21:00:08 dwelch Exp $ */
/* $Id: vfat.h,v 1.22 2001/01/13 18:38:09 dwelch Exp $ */
#include <ddk/ntifs.h>
@ -185,7 +185,7 @@ VfatOpenFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
NTSTATUS
VfatReadFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
PVOID Buffer, ULONG Length, ULONG ReadOffset,
PULONG LengthRead);
PULONG LengthRead, ULONG NoCache);
NTSTATUS
VfatWriteFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
PVOID Buffer, ULONG Length, ULONG WriteOffset);
@ -197,8 +197,8 @@ BOOLEAN
IsLastEntry(PVOID Block, ULONG Offset);
wchar_t*
vfat_wcsncpy(wchar_t * dest, const wchar_t *src,size_t wcount);
VOID
VFATWriteCluster(PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster);
NTSTATUS
VfatWriteCluster(PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster);
/* internal functions in dirwr.c */
NTSTATUS

View file

@ -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: io.h,v 1.7 2000/12/28 03:38:07 dwelch Exp $
/* $Id: io.h,v 1.8 2001/01/13 18:38:08 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -79,7 +79,8 @@ PIRP IoBuildSynchronousFsdRequestWithMdl(ULONG MajorFunction,
PMDL Mdl,
PLARGE_INTEGER StartingOffset,
PKEVENT Event,
PIO_STATUS_BLOCK IoStatusBlock);
PIO_STATUS_BLOCK IoStatusBlock,
ULONG PagingIo);
VOID IoInitShutdownNotification(VOID);
VOID IoShutdownRegisteredDevices(VOID);
@ -88,7 +89,8 @@ VOID IoShutdownRegisteredFileSystems(VOID);
NTSTATUS STDCALL IoPageRead (PFILE_OBJECT FileObject,
PMDL Mdl,
PLARGE_INTEGER Offset,
PIO_STATUS_BLOCK StatusBlock);
PIO_STATUS_BLOCK StatusBlock,
ULONG PagingIo);
NTSTATUS STDCALL IoPageWrite (PFILE_OBJECT FileObject,
PMDL Mdl,
PLARGE_INTEGER Offset,

View file

@ -1,4 +1,4 @@
/* $Id: buildirp.c,v 1.22 2000/07/07 00:40:49 phreak Exp $
/* $Id: buildirp.c,v 1.23 2001/01/13 18:38:09 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -479,7 +479,8 @@ PIRP IoBuildSynchronousFsdRequestWithMdl(ULONG MajorFunction,
PMDL Mdl,
PLARGE_INTEGER StartingOffset,
PKEVENT Event,
PIO_STATUS_BLOCK IoStatusBlock)
PIO_STATUS_BLOCK IoStatusBlock,
ULONG PagingIo)
/*
* FUNCTION: Allocates and builds an IRP to be sent synchronously to lower
* level driver(s)
@ -515,7 +516,14 @@ PIRP IoBuildSynchronousFsdRequestWithMdl(ULONG MajorFunction,
Irp->UserIosb = IoStatusBlock;
DPRINT("Irp->UserIosb %x\n", Irp->UserIosb);
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
Irp->Flags = IRP_PAGING_IO;
if (PagingIo)
{
Irp->Flags = IRP_PAGING_IO;
}
else
{
Irp->Flags = 0;
}
StackPtr = IoGetNextIrpStackLocation(Irp);
StackPtr->MajorFunction = MajorFunction;

View file

@ -1,4 +1,4 @@
/* $Id: page.c,v 1.10 2001/01/08 02:14:05 dwelch Exp $
/* $Id: page.c,v 1.11 2001/01/13 18:38:09 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -43,7 +43,8 @@ NTSTATUS STDCALL IoPageWrite(PFILE_OBJECT FileObject,
Mdl,
Offset,
&Event,
StatusBlock);
StatusBlock,
FALSE);
StackPtr = IoGetNextIrpStackLocation(Irp);
StackPtr->FileObject = FileObject;
DPRINT("Before IoCallDriver\n");
@ -70,7 +71,8 @@ NTSTATUS STDCALL IoPageWrite(PFILE_OBJECT FileObject,
NTSTATUS STDCALL IoPageRead(PFILE_OBJECT FileObject,
PMDL Mdl,
PLARGE_INTEGER Offset,
PIO_STATUS_BLOCK StatusBlock)
PIO_STATUS_BLOCK StatusBlock,
ULONG PagingIo)
{
PIRP Irp;
KEVENT Event;
@ -91,7 +93,8 @@ NTSTATUS STDCALL IoPageRead(PFILE_OBJECT FileObject,
Mdl,
Offset,
&Event,
StatusBlock);
StatusBlock,
PagingIo);
StackPtr = IoGetNextIrpStackLocation(Irp);
StackPtr->FileObject = FileObject;
DPRINT("Before IoCallDriver\n");

View file

@ -1,4 +1,4 @@
/* $Id: pagefile.c,v 1.8 2001/01/08 02:14:06 dwelch Exp $
/* $Id: pagefile.c,v 1.9 2001/01/13 18:38:09 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -106,7 +106,8 @@ NTSTATUS MmReadFromSwapPage(SWAPENTRY SwapEntry, PMDL Mdl)
Status = IoPageRead(PagingFileList[i]->FileObject,
Mdl,
&file_offset,
&Iosb);
&Iosb,
TRUE);
return(Status);
}

View file

@ -1,4 +1,4 @@
/* $Id: section.c,v 1.41 2001/01/08 02:14:06 dwelch Exp $
/* $Id: section.c,v 1.42 2001/01/13 18:38:09 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -151,7 +151,8 @@ MmUnalignedLoadPageForSection(PMADDRESS_SPACE AddressSpace,
Status = IoPageRead(MemoryArea->Data.SectionData.Section->FileObject,
Mdl,
&Offset,
&IoStatus);
&IoStatus,
FALSE);
if (!NT_SUCCESS(Status) && Status != STATUS_END_OF_FILE)
{
DPRINT("IoPageRead failed (%x)\n", Status);
@ -430,7 +431,8 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
Status = IoPageRead(MemoryArea->Data.SectionData.Section->FileObject,
Mdl,
&Offset,
&IoStatus);
&IoStatus,
FALSE);
if (!NT_SUCCESS(Status) && Status != STATUS_END_OF_FILE)
{
/*

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.def,v 1.92 2001/01/01 04:42:11 dwelch Exp $
; $Id: ntoskrnl.def,v 1.93 2001/01/13 18:38:08 dwelch Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -260,7 +260,7 @@ IoInitializeTimer@12
IoIsOperationSynchronous@4
IoMakeAssociatedIrp@8
IoOpenDeviceInstanceKey@20
IoPageRead@16
;IoPageRead@16
IoQueryDeviceDescription@32
IoQueryDeviceEnumInfo@8
IoQueryFileInformation@20

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.edf,v 1.79 2001/01/01 04:42:11 dwelch Exp $
; $Id: ntoskrnl.edf,v 1.80 2001/01/13 18:38:08 dwelch Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -260,7 +260,7 @@ IoInitializeTimer=IoInitializeTimer@12
IoIsOperationSynchronous=IoIsOperationSynchronous@4
IoMakeAssociatedIrp=IoMakeAssociatedIrp@8
IoOpenDeviceInstanceKey=IoOpenDeviceInstanceKey@20
IoPageRead=IoPageRead@16
;IoPageRead=IoPageRead@16
IoQueryDeviceDescription=IoQueryDeviceDescription@32
IoQueryDeviceEnumInfo=IoQueryDeviceEnumInfo@8
IoQueryFileInformation=IoQueryFileInformation@20