mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Fix for vfatfs on volumes with smaller cluster sizes
svn path=/trunk/; revision=1506
This commit is contained in:
parent
df75bd846f
commit
15491f14dd
10 changed files with 183 additions and 265 deletions
|
@ -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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
#include <ntos/minmax.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
@ -268,28 +269,42 @@ VfatRequestDiskPage(PDEVICE_EXTENSION DeviceExt,
|
||||||
return(STATUS_SUCCESS);
|
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
|
ULONG
|
||||||
FAT16FindAvailableCluster (PDEVICE_EXTENSION DeviceExt)
|
FAT16FindAvailableCluster (PDEVICE_EXTENSION DeviceExt)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Finds the first available cluster in a FAT16 table
|
* FUNCTION: Finds the first available cluster in a FAT16 table
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
PUSHORT Block;
|
|
||||||
ULONG i;
|
ULONG i;
|
||||||
PCACHE_SEG CacheSeg;
|
PCACHE_SEGMENT CacheSeg;
|
||||||
PVOID BaseAddress;
|
PVOID BaseAddress;
|
||||||
BOOLEAN Valid;
|
|
||||||
ULONG StartOffset;
|
ULONG StartOffset;
|
||||||
ULONG FatLength;
|
ULONG FatLength;
|
||||||
ULONG j;
|
|
||||||
ULONG RCluster;
|
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
|
ULONG r;
|
||||||
|
ULONG FatStart;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
StartOffset = DeviceExt->Boot->FatStart * BLOCKSIZE;
|
FatStart = DeviceExt->FATStart * BLOCKSIZE;
|
||||||
FatLength = DevceExt->Boot->FatSectors * BLOCKSIZE;
|
StartOffset = DeviceExt->FATStart * BLOCKSIZE;
|
||||||
|
FatLength = DeviceExt->Boot->FATSectors * BLOCKSIZE;
|
||||||
|
|
||||||
if (StartOffset % PAGESIZE) != 0)
|
if ((StartOffset % PAGESIZE) != 0)
|
||||||
{
|
{
|
||||||
Status = VfatRequestDiskPage(DeviceExt,
|
Status = VfatRequestDiskPage(DeviceExt,
|
||||||
PAGE_ROUND_DOWN(StartOffset),
|
PAGE_ROUND_DOWN(StartOffset),
|
||||||
|
@ -300,13 +315,12 @@ FAT16FindAvailableCluster (PDEVICE_EXTENSION DeviceExt)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
Length = max(PAGESIZE, FatLength);
|
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)
|
return((r - (StartOffset % PAGESIZE)) / 2);
|
||||||
{
|
|
||||||
CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, FALSE);
|
|
||||||
return(j);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, FALSE);
|
CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, FALSE);
|
||||||
StartOffset = StartOffset + (Length - (StartOffset % PAGESIZE));
|
StartOffset = StartOffset + (Length - (StartOffset % PAGESIZE));
|
||||||
|
@ -322,23 +336,19 @@ FAT16FindAvailableCluster (PDEVICE_EXTENSION DeviceExt)
|
||||||
{
|
{
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
for (j = 0; j < PAGESIZE; j+=2)
|
r = Vfat16FindAvailableClusterInPage(BaseAddress, 0, PAGESIZE);
|
||||||
|
if (r != 0)
|
||||||
{
|
{
|
||||||
if (*((PUSHORT)(BaseAddress + j)) == 0)
|
return((r + StartOffset - FatStart) / 2);
|
||||||
{
|
|
||||||
CcReleaseCacheSegment(DeviceExt->StorageBcb,
|
|
||||||
CacheSeg,
|
|
||||||
TRUE);
|
|
||||||
RCluster =
|
|
||||||
(StartOffset + j) - (DeviceExt->Boot->FatStart * BLOCKSIZE);
|
|
||||||
RCluster = RCluster / 2;
|
|
||||||
return(RCluster);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, TRUE);
|
||||||
|
StartOffset = StartOffset + PAGESIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
ULONG
|
ULONG
|
||||||
FAT12FindAvailableCluster (PDEVICE_EXTENSION DeviceExt)
|
FAT12FindAvailableCluster (PDEVICE_EXTENSION DeviceExt)
|
||||||
/*
|
/*
|
||||||
|
@ -719,21 +729,24 @@ VFATLoadCluster (PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster)
|
||||||
DPRINT ("Finished VFATReadSectors\n");
|
DPRINT ("Finished VFATReadSectors\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
NTSTATUS
|
||||||
VOID
|
VfatWriteCluster (PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster)
|
||||||
VFATWriteCluster (PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster)
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Write a cluster to the physical device
|
* FUNCTION: Write a cluster to the physical device
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
ULONG Sector;
|
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);
|
DeviceExt, Buffer, Cluster);
|
||||||
|
|
||||||
Sector = ClusterToSector (DeviceExt, Cluster);
|
Sector = ClusterToSector (DeviceExt, Cluster);
|
||||||
|
|
||||||
/* FIXME: Check status */
|
/* FIXME: Check status */
|
||||||
VfatWriteSectors (DeviceExt->StorageDevice,
|
Status = VfatWriteSectors (DeviceExt->StorageDevice,
|
||||||
Sector, DeviceExt->Boot->SectorsPerCluster, Buffer);
|
Sector, DeviceExt->Boot->SectorsPerCluster,
|
||||||
|
Buffer);
|
||||||
|
return(Status);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
@ -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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* 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
|
NTSTATUS
|
||||||
VfatRawReadCluster (PDEVICE_EXTENSION DeviceExt,
|
VfatRawReadCluster (PDEVICE_EXTENSION DeviceExt,
|
||||||
ULONG FirstCluster,
|
ULONG FirstCluster,
|
||||||
|
@ -270,7 +110,7 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
|
||||||
ULONG FirstCluster,
|
ULONG FirstCluster,
|
||||||
PULONG CurrentCluster,
|
PULONG CurrentCluster,
|
||||||
PVOID Destination,
|
PVOID Destination,
|
||||||
ULONG Cached,
|
ULONG NoCache,
|
||||||
ULONG InternalOffset,
|
ULONG InternalOffset,
|
||||||
ULONG InternalLength)
|
ULONG InternalLength)
|
||||||
{
|
{
|
||||||
|
@ -287,6 +127,9 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
|
||||||
/*
|
/*
|
||||||
* In this case the size of a cache segment is the same as a cluster
|
* In this case the size of a cache segment is the same as a cluster
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (!NoCache)
|
||||||
|
{
|
||||||
Status = CcRequestCacheSegment(Fcb->RFCB.Bcb,
|
Status = CcRequestCacheSegment(Fcb->RFCB.Bcb,
|
||||||
StartOffset,
|
StartOffset,
|
||||||
&BaseAddress,
|
&BaseAddress,
|
||||||
|
@ -296,6 +139,11 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
|
||||||
{
|
{
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Valid = FALSE;
|
||||||
|
}
|
||||||
if (!Valid)
|
if (!Valid)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -304,8 +152,11 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
|
||||||
Status = VfatRawReadCluster(DeviceExt, FirstCluster, CurrentCluster,
|
Status = VfatRawReadCluster(DeviceExt, FirstCluster, CurrentCluster,
|
||||||
BaseAddress);
|
BaseAddress);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
if (!NoCache)
|
||||||
{
|
{
|
||||||
CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, FALSE);
|
CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, FALSE);
|
||||||
|
}
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -313,7 +164,10 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
|
||||||
* Copy the data from the cache to the caller
|
* Copy the data from the cache to the caller
|
||||||
*/
|
*/
|
||||||
memcpy(Destination, BaseAddress + InternalOffset, InternalLength);
|
memcpy(Destination, BaseAddress + InternalOffset, InternalLength);
|
||||||
|
if (!NoCache)
|
||||||
|
{
|
||||||
CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, TRUE);
|
CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
Status = NextCluster(DeviceExt, FirstCluster, CurrentCluster);
|
Status = NextCluster(DeviceExt, FirstCluster, CurrentCluster);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -324,14 +178,15 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ULONG i;
|
ULONG i;
|
||||||
ULONG ReadOffset;
|
|
||||||
ULONG InternalOffset;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Otherwise we read a page of clusters together
|
* Otherwise we read a page of clusters together
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (!NoCache)
|
||||||
|
{
|
||||||
Status = CcRequestCacheSegment(Fcb->RFCB.Bcb,
|
Status = CcRequestCacheSegment(Fcb->RFCB.Bcb,
|
||||||
ReadOffset,
|
StartOffset,
|
||||||
&BaseAddress,
|
&BaseAddress,
|
||||||
&Valid,
|
&Valid,
|
||||||
&CacheSeg);
|
&CacheSeg);
|
||||||
|
@ -339,6 +194,11 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
|
||||||
{
|
{
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Valid = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If necessary read all the data for the page, unfortunately the
|
* If necessary read all the data for the page, unfortunately the
|
||||||
|
@ -355,8 +215,11 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
|
||||||
CurrentCluster,
|
CurrentCluster,
|
||||||
BaseAddress + (i * BytesPerCluster));
|
BaseAddress + (i * BytesPerCluster));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
if (!NoCache)
|
||||||
{
|
{
|
||||||
CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, FALSE);
|
CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, FALSE);
|
||||||
|
}
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
Status = NextCluster(DeviceExt, FirstCluster, CurrentCluster);
|
Status = NextCluster(DeviceExt, FirstCluster, CurrentCluster);
|
||||||
|
@ -384,15 +247,18 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
|
||||||
* Copy the data from the cache to the caller
|
* Copy the data from the cache to the caller
|
||||||
*/
|
*/
|
||||||
memcpy(Destination, BaseAddress + InternalOffset, InternalLength);
|
memcpy(Destination, BaseAddress + InternalOffset, InternalLength);
|
||||||
|
if (!NoCache)
|
||||||
|
{
|
||||||
CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, TRUE);
|
CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, TRUE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
PVOID Buffer, ULONG Length, ULONG ReadOffset,
|
PVOID Buffer, ULONG Length, ULONG ReadOffset,
|
||||||
PULONG LengthRead)
|
PULONG LengthRead, ULONG NoCache)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Reads data from a file
|
* FUNCTION: Reads data from a file
|
||||||
*/
|
*/
|
||||||
|
@ -410,7 +276,7 @@ VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
assert (FileObject != NULL);
|
assert (FileObject != NULL);
|
||||||
assert (FileObject->FsContext != 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 %d, ReadOffset 0x%x)\n", DeviceExt, FileObject, Buffer,
|
||||||
Length, ReadOffset);
|
Length, ReadOffset);
|
||||||
|
|
||||||
|
@ -441,8 +307,14 @@ VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DeviceExt->BytesPerCluster >= PAGESIZE)
|
||||||
ChunkSize = max(DeviceExt->BytesPerCluster, PAGESIZE);
|
{
|
||||||
|
ChunkSize = DeviceExt->BytesPerCluster;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ChunkSize = PAGESIZE;
|
||||||
|
}
|
||||||
|
|
||||||
*LengthRead = 0;
|
*LengthRead = 0;
|
||||||
|
|
||||||
|
@ -467,7 +339,7 @@ VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
TempLength = min (Length, ChunkSize - (ReadOffset % ChunkSize));
|
TempLength = min (Length, ChunkSize - (ReadOffset % ChunkSize));
|
||||||
VfatReadCluster(DeviceExt, Fcb,
|
VfatReadCluster(DeviceExt, Fcb,
|
||||||
ROUND_DOWN(ReadOffset, ChunkSize),
|
ROUND_DOWN(ReadOffset, ChunkSize),
|
||||||
FirstCluster, &CurrentCluster, Buffer, 1,
|
FirstCluster, &CurrentCluster, Buffer, NoCache,
|
||||||
ReadOffset % ChunkSize, TempLength);
|
ReadOffset % ChunkSize, TempLength);
|
||||||
|
|
||||||
(*LengthRead) = (*LengthRead) + TempLength;
|
(*LengthRead) = (*LengthRead) + TempLength;
|
||||||
|
@ -479,7 +351,8 @@ VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
while (Length >= ChunkSize)
|
while (Length >= ChunkSize)
|
||||||
{
|
{
|
||||||
VfatReadCluster(DeviceExt, Fcb, ReadOffset,
|
VfatReadCluster(DeviceExt, Fcb, ReadOffset,
|
||||||
FirstCluster, &CurrentCluster, Buffer, 1, 0, ChunkSize);
|
FirstCluster, &CurrentCluster, Buffer, NoCache, 0,
|
||||||
|
ChunkSize);
|
||||||
if (CurrentCluster == 0xffffffff)
|
if (CurrentCluster == 0xffffffff)
|
||||||
{
|
{
|
||||||
return (STATUS_SUCCESS);
|
return (STATUS_SUCCESS);
|
||||||
|
@ -493,13 +366,13 @@ VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
if (Length > 0)
|
if (Length > 0)
|
||||||
{
|
{
|
||||||
VfatReadCluster(DeviceExt, Fcb, ReadOffset,
|
VfatReadCluster(DeviceExt, Fcb, ReadOffset,
|
||||||
FirstCluster, &CurrentCluster, Buffer, 1, 0, Length);
|
FirstCluster, &CurrentCluster, Buffer, NoCache, 0,
|
||||||
|
Length);
|
||||||
(*LengthRead) = (*LengthRead) + Length;
|
(*LengthRead) = (*LengthRead) + Length;
|
||||||
}
|
}
|
||||||
return (STATUS_SUCCESS);
|
return (STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
VfatWriteFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
VfatWriteFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
PVOID Buffer, ULONG Length, ULONG WriteOffset)
|
PVOID Buffer, ULONG Length, ULONG WriteOffset)
|
||||||
|
@ -516,7 +389,7 @@ VfatWriteFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
ULONG TempLength, Length2 = Length;
|
ULONG TempLength, Length2 = Length;
|
||||||
LARGE_INTEGER SystemTime, LocalTime;
|
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);
|
"WriteOffset %x\n", FileObject, Buffer, Length, WriteOffset);
|
||||||
|
|
||||||
/* Locate the first cluster of the file */
|
/* Locate the first cluster of the file */
|
||||||
|
@ -553,7 +426,7 @@ VfatWriteFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
/*
|
/*
|
||||||
* File of size zero
|
* File of size zero
|
||||||
*/
|
*/
|
||||||
CurrentCluster = GetNextWriteCluster (DeviceExt, 0);
|
// CurrentCluster = GetNextWriteCluster (DeviceExt, 0);
|
||||||
if (DeviceExt->FatType == FAT32)
|
if (DeviceExt->FatType == FAT32)
|
||||||
{
|
{
|
||||||
Fcb->entry.FirstClusterHigh = CurrentCluster >> 16;
|
Fcb->entry.FirstClusterHigh = CurrentCluster >> 16;
|
||||||
|
@ -568,8 +441,10 @@ VfatWriteFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
FileOffset < WriteOffset / DeviceExt->BytesPerCluster;
|
FileOffset < WriteOffset / DeviceExt->BytesPerCluster;
|
||||||
FileOffset++)
|
FileOffset++)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
CurrentCluster =
|
CurrentCluster =
|
||||||
GetNextWriteCluster (DeviceExt, CurrentCluster);
|
GetNextWriteCluster (DeviceExt, CurrentCluster);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
|
@ -606,16 +481,18 @@ VfatWriteFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
Length2 -= TempLength;
|
Length2 -= TempLength;
|
||||||
if (FirstCluster == 1)
|
if (FirstCluster == 1)
|
||||||
{
|
{
|
||||||
VFATWriteSectors (DeviceExt->StorageDevice,
|
VfatWriteSectors (DeviceExt->StorageDevice,
|
||||||
CurrentCluster,
|
CurrentCluster,
|
||||||
DeviceExt->Boot->SectorsPerCluster, Temp);
|
DeviceExt->Boot->SectorsPerCluster, Temp);
|
||||||
CurrentCluster += DeviceExt->Boot->SectorsPerCluster;
|
CurrentCluster += DeviceExt->Boot->SectorsPerCluster;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VFATWriteCluster (DeviceExt, Temp, CurrentCluster);
|
VfatWriteCluster (DeviceExt, Temp, CurrentCluster);
|
||||||
|
#if 0
|
||||||
if (Length2 > 0)
|
if (Length2 > 0)
|
||||||
CurrentCluster = GetNextWriteCluster (DeviceExt, CurrentCluster);
|
CurrentCluster = GetNextWriteCluster (DeviceExt, CurrentCluster);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
Buffer = Buffer + TempLength;
|
Buffer = Buffer + TempLength;
|
||||||
}
|
}
|
||||||
|
@ -634,16 +511,18 @@ VfatWriteFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
Length2 -= DeviceExt->BytesPerCluster;
|
Length2 -= DeviceExt->BytesPerCluster;
|
||||||
if (FirstCluster == 1)
|
if (FirstCluster == 1)
|
||||||
{
|
{
|
||||||
VFATWriteSectors (DeviceExt->StorageDevice,
|
VfatWriteSectors (DeviceExt->StorageDevice,
|
||||||
CurrentCluster,
|
CurrentCluster,
|
||||||
DeviceExt->Boot->SectorsPerCluster, Buffer);
|
DeviceExt->Boot->SectorsPerCluster, Buffer);
|
||||||
CurrentCluster += DeviceExt->Boot->SectorsPerCluster;
|
CurrentCluster += DeviceExt->Boot->SectorsPerCluster;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VFATWriteCluster (DeviceExt, Buffer, CurrentCluster);
|
VfatWriteCluster (DeviceExt, Buffer, CurrentCluster);
|
||||||
|
#if 0
|
||||||
if (Length2 > 0)
|
if (Length2 > 0)
|
||||||
CurrentCluster = GetNextWriteCluster (DeviceExt, CurrentCluster);
|
CurrentCluster = GetNextWriteCluster (DeviceExt, CurrentCluster);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
Buffer = Buffer + DeviceExt->BytesPerCluster;
|
Buffer = Buffer + DeviceExt->BytesPerCluster;
|
||||||
}
|
}
|
||||||
|
@ -676,13 +555,13 @@ VfatWriteFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
if (FirstCluster == 1)
|
if (FirstCluster == 1)
|
||||||
{
|
{
|
||||||
VFATWriteSectors (DeviceExt->StorageDevice,
|
VfatWriteSectors (DeviceExt->StorageDevice,
|
||||||
CurrentCluster,
|
CurrentCluster,
|
||||||
DeviceExt->Boot->SectorsPerCluster, Temp);
|
DeviceExt->Boot->SectorsPerCluster, Temp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VFATWriteCluster (DeviceExt, Temp, CurrentCluster);
|
VfatWriteCluster (DeviceExt, Temp, CurrentCluster);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
|
@ -703,13 +582,12 @@ VfatWriteFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
/*
|
/*
|
||||||
* update entry in directory
|
* update entry in directory
|
||||||
*/
|
*/
|
||||||
updEntry (DeviceExt, FileObject);
|
// updEntry (DeviceExt, FileObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
ExFreePool (Temp);
|
ExFreePool (Temp);
|
||||||
return (STATUS_SUCCESS);
|
return (STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
VfatWrite (PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
VfatWrite (PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
|
@ -721,8 +599,8 @@ VfatWrite (PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
PVOID Buffer;
|
PVOID Buffer;
|
||||||
ULONG Offset;
|
ULONG Offset;
|
||||||
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation (Irp);
|
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation (Irp);
|
||||||
/* PFILE_OBJECT FileObject = Stack->FileObject; */
|
PFILE_OBJECT FileObject = Stack->FileObject;
|
||||||
/* PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension; */
|
PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT ("VfatWrite(DeviceObject %x Irp %x)\n", DeviceObject, Irp);
|
DPRINT ("VfatWrite(DeviceObject %x Irp %x)\n", DeviceObject, Irp);
|
||||||
|
@ -731,8 +609,7 @@ VfatWrite (PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
|
Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
|
||||||
Offset = Stack->Parameters.Write.ByteOffset.u.LowPart;
|
Offset = Stack->Parameters.Write.ByteOffset.u.LowPart;
|
||||||
|
|
||||||
/* Status = VfatWriteFile (DeviceExt, FileObject, Buffer, Length, Offset); */
|
Status = VfatWriteFile (DeviceExt, FileObject, Buffer, Length, Offset);
|
||||||
Status = STATUS_MEDIA_WRITE_PROTECTED;
|
|
||||||
|
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
Irp->IoStatus.Information = Length;
|
Irp->IoStatus.Information = Length;
|
||||||
|
@ -756,6 +633,7 @@ VfatRead (PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG LengthRead;
|
ULONG LengthRead;
|
||||||
PVFATFCB Fcb;
|
PVFATFCB Fcb;
|
||||||
|
ULONG NoCache;
|
||||||
|
|
||||||
DPRINT ("VfatRead(DeviceObject %x, Irp %x)\n", DeviceObject, Irp);
|
DPRINT ("VfatRead(DeviceObject %x, Irp %x)\n", DeviceObject, Irp);
|
||||||
|
|
||||||
|
@ -772,6 +650,16 @@ VfatRead (PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
|
Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
|
||||||
Offset = Stack->Parameters.Read.ByteOffset.u.LowPart;
|
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 */
|
/* fail if file is a directory */
|
||||||
Fcb = ((PVFATCCB) (FileObject->FsContext2))->pFcb;
|
Fcb = ((PVFATCCB) (FileObject->FsContext2))->pFcb;
|
||||||
if (Fcb->entry.Attrib & FILE_ATTRIBUTE_DIRECTORY)
|
if (Fcb->entry.Attrib & FILE_ATTRIBUTE_DIRECTORY)
|
||||||
|
@ -781,7 +669,8 @@ VfatRead (PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Status = VfatReadFile (DeviceExt,
|
Status = VfatReadFile (DeviceExt,
|
||||||
FileObject, Buffer, Length, Offset, &LengthRead);
|
FileObject, Buffer, Length, Offset, &LengthRead,
|
||||||
|
NoCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
|
|
|
@ -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>
|
#include <ddk/ntifs.h>
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ VfatOpenFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
VfatReadFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
VfatReadFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
PVOID Buffer, ULONG Length, ULONG ReadOffset,
|
PVOID Buffer, ULONG Length, ULONG ReadOffset,
|
||||||
PULONG LengthRead);
|
PULONG LengthRead, ULONG NoCache);
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
VfatWriteFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
VfatWriteFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
PVOID Buffer, ULONG Length, ULONG WriteOffset);
|
PVOID Buffer, ULONG Length, ULONG WriteOffset);
|
||||||
|
@ -197,8 +197,8 @@ BOOLEAN
|
||||||
IsLastEntry(PVOID Block, ULONG Offset);
|
IsLastEntry(PVOID Block, ULONG Offset);
|
||||||
wchar_t*
|
wchar_t*
|
||||||
vfat_wcsncpy(wchar_t * dest, const wchar_t *src,size_t wcount);
|
vfat_wcsncpy(wchar_t * dest, const wchar_t *src,size_t wcount);
|
||||||
VOID
|
NTSTATUS
|
||||||
VFATWriteCluster(PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster);
|
VfatWriteCluster(PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster);
|
||||||
|
|
||||||
/* internal functions in dirwr.c */
|
/* internal functions in dirwr.c */
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
|
|
@ -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: 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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -79,7 +79,8 @@ PIRP IoBuildSynchronousFsdRequestWithMdl(ULONG MajorFunction,
|
||||||
PMDL Mdl,
|
PMDL Mdl,
|
||||||
PLARGE_INTEGER StartingOffset,
|
PLARGE_INTEGER StartingOffset,
|
||||||
PKEVENT Event,
|
PKEVENT Event,
|
||||||
PIO_STATUS_BLOCK IoStatusBlock);
|
PIO_STATUS_BLOCK IoStatusBlock,
|
||||||
|
ULONG PagingIo);
|
||||||
|
|
||||||
VOID IoInitShutdownNotification(VOID);
|
VOID IoInitShutdownNotification(VOID);
|
||||||
VOID IoShutdownRegisteredDevices(VOID);
|
VOID IoShutdownRegisteredDevices(VOID);
|
||||||
|
@ -88,7 +89,8 @@ VOID IoShutdownRegisteredFileSystems(VOID);
|
||||||
NTSTATUS STDCALL IoPageRead (PFILE_OBJECT FileObject,
|
NTSTATUS STDCALL IoPageRead (PFILE_OBJECT FileObject,
|
||||||
PMDL Mdl,
|
PMDL Mdl,
|
||||||
PLARGE_INTEGER Offset,
|
PLARGE_INTEGER Offset,
|
||||||
PIO_STATUS_BLOCK StatusBlock);
|
PIO_STATUS_BLOCK StatusBlock,
|
||||||
|
ULONG PagingIo);
|
||||||
NTSTATUS STDCALL IoPageWrite (PFILE_OBJECT FileObject,
|
NTSTATUS STDCALL IoPageWrite (PFILE_OBJECT FileObject,
|
||||||
PMDL Mdl,
|
PMDL Mdl,
|
||||||
PLARGE_INTEGER Offset,
|
PLARGE_INTEGER Offset,
|
||||||
|
|
|
@ -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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -479,7 +479,8 @@ PIRP IoBuildSynchronousFsdRequestWithMdl(ULONG MajorFunction,
|
||||||
PMDL Mdl,
|
PMDL Mdl,
|
||||||
PLARGE_INTEGER StartingOffset,
|
PLARGE_INTEGER StartingOffset,
|
||||||
PKEVENT Event,
|
PKEVENT Event,
|
||||||
PIO_STATUS_BLOCK IoStatusBlock)
|
PIO_STATUS_BLOCK IoStatusBlock,
|
||||||
|
ULONG PagingIo)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Allocates and builds an IRP to be sent synchronously to lower
|
* FUNCTION: Allocates and builds an IRP to be sent synchronously to lower
|
||||||
* level driver(s)
|
* level driver(s)
|
||||||
|
@ -515,7 +516,14 @@ PIRP IoBuildSynchronousFsdRequestWithMdl(ULONG MajorFunction,
|
||||||
Irp->UserIosb = IoStatusBlock;
|
Irp->UserIosb = IoStatusBlock;
|
||||||
DPRINT("Irp->UserIosb %x\n", Irp->UserIosb);
|
DPRINT("Irp->UserIosb %x\n", Irp->UserIosb);
|
||||||
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
|
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
|
||||||
|
if (PagingIo)
|
||||||
|
{
|
||||||
Irp->Flags = IRP_PAGING_IO;
|
Irp->Flags = IRP_PAGING_IO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Irp->Flags = 0;
|
||||||
|
}
|
||||||
|
|
||||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||||
StackPtr->MajorFunction = MajorFunction;
|
StackPtr->MajorFunction = MajorFunction;
|
||||||
|
|
|
@ -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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -43,7 +43,8 @@ NTSTATUS STDCALL IoPageWrite(PFILE_OBJECT FileObject,
|
||||||
Mdl,
|
Mdl,
|
||||||
Offset,
|
Offset,
|
||||||
&Event,
|
&Event,
|
||||||
StatusBlock);
|
StatusBlock,
|
||||||
|
FALSE);
|
||||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||||
StackPtr->FileObject = FileObject;
|
StackPtr->FileObject = FileObject;
|
||||||
DPRINT("Before IoCallDriver\n");
|
DPRINT("Before IoCallDriver\n");
|
||||||
|
@ -70,7 +71,8 @@ NTSTATUS STDCALL IoPageWrite(PFILE_OBJECT FileObject,
|
||||||
NTSTATUS STDCALL IoPageRead(PFILE_OBJECT FileObject,
|
NTSTATUS STDCALL IoPageRead(PFILE_OBJECT FileObject,
|
||||||
PMDL Mdl,
|
PMDL Mdl,
|
||||||
PLARGE_INTEGER Offset,
|
PLARGE_INTEGER Offset,
|
||||||
PIO_STATUS_BLOCK StatusBlock)
|
PIO_STATUS_BLOCK StatusBlock,
|
||||||
|
ULONG PagingIo)
|
||||||
{
|
{
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
|
@ -91,7 +93,8 @@ NTSTATUS STDCALL IoPageRead(PFILE_OBJECT FileObject,
|
||||||
Mdl,
|
Mdl,
|
||||||
Offset,
|
Offset,
|
||||||
&Event,
|
&Event,
|
||||||
StatusBlock);
|
StatusBlock,
|
||||||
|
PagingIo);
|
||||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||||
StackPtr->FileObject = FileObject;
|
StackPtr->FileObject = FileObject;
|
||||||
DPRINT("Before IoCallDriver\n");
|
DPRINT("Before IoCallDriver\n");
|
||||||
|
|
|
@ -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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -106,7 +106,8 @@ NTSTATUS MmReadFromSwapPage(SWAPENTRY SwapEntry, PMDL Mdl)
|
||||||
Status = IoPageRead(PagingFileList[i]->FileObject,
|
Status = IoPageRead(PagingFileList[i]->FileObject,
|
||||||
Mdl,
|
Mdl,
|
||||||
&file_offset,
|
&file_offset,
|
||||||
&Iosb);
|
&Iosb,
|
||||||
|
TRUE);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -151,7 +151,8 @@ MmUnalignedLoadPageForSection(PMADDRESS_SPACE AddressSpace,
|
||||||
Status = IoPageRead(MemoryArea->Data.SectionData.Section->FileObject,
|
Status = IoPageRead(MemoryArea->Data.SectionData.Section->FileObject,
|
||||||
Mdl,
|
Mdl,
|
||||||
&Offset,
|
&Offset,
|
||||||
&IoStatus);
|
&IoStatus,
|
||||||
|
FALSE);
|
||||||
if (!NT_SUCCESS(Status) && Status != STATUS_END_OF_FILE)
|
if (!NT_SUCCESS(Status) && Status != STATUS_END_OF_FILE)
|
||||||
{
|
{
|
||||||
DPRINT("IoPageRead failed (%x)\n", Status);
|
DPRINT("IoPageRead failed (%x)\n", Status);
|
||||||
|
@ -430,7 +431,8 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
||||||
Status = IoPageRead(MemoryArea->Data.SectionData.Section->FileObject,
|
Status = IoPageRead(MemoryArea->Data.SectionData.Section->FileObject,
|
||||||
Mdl,
|
Mdl,
|
||||||
&Offset,
|
&Offset,
|
||||||
&IoStatus);
|
&IoStatus,
|
||||||
|
FALSE);
|
||||||
if (!NT_SUCCESS(Status) && Status != STATUS_END_OF_FILE)
|
if (!NT_SUCCESS(Status) && Status != STATUS_END_OF_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
|
; reactos/ntoskrnl/ntoskrnl.def
|
||||||
;
|
;
|
||||||
|
@ -260,7 +260,7 @@ IoInitializeTimer@12
|
||||||
IoIsOperationSynchronous@4
|
IoIsOperationSynchronous@4
|
||||||
IoMakeAssociatedIrp@8
|
IoMakeAssociatedIrp@8
|
||||||
IoOpenDeviceInstanceKey@20
|
IoOpenDeviceInstanceKey@20
|
||||||
IoPageRead@16
|
;IoPageRead@16
|
||||||
IoQueryDeviceDescription@32
|
IoQueryDeviceDescription@32
|
||||||
IoQueryDeviceEnumInfo@8
|
IoQueryDeviceEnumInfo@8
|
||||||
IoQueryFileInformation@20
|
IoQueryFileInformation@20
|
||||||
|
|
|
@ -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
|
; reactos/ntoskrnl/ntoskrnl.def
|
||||||
;
|
;
|
||||||
|
@ -260,7 +260,7 @@ IoInitializeTimer=IoInitializeTimer@12
|
||||||
IoIsOperationSynchronous=IoIsOperationSynchronous@4
|
IoIsOperationSynchronous=IoIsOperationSynchronous@4
|
||||||
IoMakeAssociatedIrp=IoMakeAssociatedIrp@8
|
IoMakeAssociatedIrp=IoMakeAssociatedIrp@8
|
||||||
IoOpenDeviceInstanceKey=IoOpenDeviceInstanceKey@20
|
IoOpenDeviceInstanceKey=IoOpenDeviceInstanceKey@20
|
||||||
IoPageRead=IoPageRead@16
|
;IoPageRead=IoPageRead@16
|
||||||
IoQueryDeviceDescription=IoQueryDeviceDescription@32
|
IoQueryDeviceDescription=IoQueryDeviceDescription@32
|
||||||
IoQueryDeviceEnumInfo=IoQueryDeviceEnumInfo@8
|
IoQueryDeviceEnumInfo=IoQueryDeviceEnumInfo@8
|
||||||
IoQueryFileInformation=IoQueryFileInformation@20
|
IoQueryFileInformation=IoQueryFileInformation@20
|
||||||
|
|
Loading…
Reference in a new issue