mirror of
https://github.com/reactos/reactos.git
synced 2025-04-27 00:50:23 +00:00
- Convert the function headers to a Doxygen-compatible style
- Fix some typos svn path=/trunk/; revision=39050
This commit is contained in:
parent
07814326c7
commit
16c99f33f3
3 changed files with 79 additions and 57 deletions
|
@ -22,7 +22,7 @@ typedef struct _FAT_ENUM_DIR_CONTEXT
|
||||||
{
|
{
|
||||||
PFILE_OBJECT FileObject;
|
PFILE_OBJECT FileObject;
|
||||||
LARGE_INTEGER PageOffset;
|
LARGE_INTEGER PageOffset;
|
||||||
LONGLONG BeyoundLastEntryOffset;
|
LONGLONG BeyondLastEntryOffset;
|
||||||
PVOID PageBuffer;
|
PVOID PageBuffer;
|
||||||
PBCB PageBcb;
|
PBCB PageBcb;
|
||||||
|
|
||||||
|
@ -512,9 +512,9 @@ FatEnumerateDirents(IN OUT PFAT_ENUM_DIR_CONTEXT Context,
|
||||||
Entry = Add2Ptr(Context->PageBuffer, OffsetWithinPage, PUCHAR);
|
Entry = Add2Ptr(Context->PageBuffer, OffsetWithinPage, PUCHAR);
|
||||||
/* Next Page Offset */
|
/* Next Page Offset */
|
||||||
PageOffset = Context->PageOffset.QuadPart + PAGE_SIZE;
|
PageOffset = Context->PageOffset.QuadPart + PAGE_SIZE;
|
||||||
if (PageOffset > Context->BeyoundLastEntryOffset)
|
if (PageOffset > Context->BeyondLastEntryOffset)
|
||||||
{
|
{
|
||||||
PageValidLength = (SIZE_T) (Context->BeyoundLastEntryOffset
|
PageValidLength = (SIZE_T) (Context->BeyondLastEntryOffset
|
||||||
- Context->PageOffset.QuadPart);
|
- Context->PageOffset.QuadPart);
|
||||||
}
|
}
|
||||||
BeyondLastEntry = Add2Ptr(Context->PageBuffer, PageValidLength, PUCHAR);
|
BeyondLastEntry = Add2Ptr(Context->PageBuffer, PageValidLength, PUCHAR);
|
||||||
|
@ -545,7 +545,7 @@ FatEnumerateDirents(IN OUT PFAT_ENUM_DIR_CONTEXT Context,
|
||||||
/* Check if this is the last available entry */
|
/* Check if this is the last available entry */
|
||||||
if (PageValidLength < PAGE_SIZE)
|
if (PageValidLength < PAGE_SIZE)
|
||||||
break;
|
break;
|
||||||
/* We are getting beyound current page and
|
/* We are getting beyond current page and
|
||||||
* are still in the continous run, map the next page.
|
* are still in the continous run, map the next page.
|
||||||
*/
|
*/
|
||||||
Context->PageOffset.QuadPart = PageOffset;
|
Context->PageOffset.QuadPart = PageOffset;
|
||||||
|
@ -564,9 +564,9 @@ FatEnumerateDirents(IN OUT PFAT_ENUM_DIR_CONTEXT Context,
|
||||||
Entry = (PUCHAR) Context->PageBuffer;
|
Entry = (PUCHAR) Context->PageBuffer;
|
||||||
/* Next Page Offset */
|
/* Next Page Offset */
|
||||||
PageOffset = Context->PageOffset.QuadPart + PAGE_SIZE;
|
PageOffset = Context->PageOffset.QuadPart + PAGE_SIZE;
|
||||||
if (PageOffset > Context->BeyoundLastEntryOffset)
|
if (PageOffset > Context->BeyondLastEntryOffset)
|
||||||
{
|
{
|
||||||
PageValidLength = (SIZE_T) (Context->BeyoundLastEntryOffset
|
PageValidLength = (SIZE_T) (Context->BeyondLastEntryOffset
|
||||||
- Context->PageOffset.QuadPart);
|
- Context->PageOffset.QuadPart);
|
||||||
}
|
}
|
||||||
BeyondLastEntry = Add2Ptr(Context->PageBuffer, PageValidLength, PUCHAR);
|
BeyondLastEntry = Add2Ptr(Context->PageBuffer, PageValidLength, PUCHAR);
|
||||||
|
|
|
@ -16,7 +16,7 @@ typedef struct _FAT_SCAN_CONTEXT
|
||||||
{
|
{
|
||||||
PFILE_OBJECT FileObject;
|
PFILE_OBJECT FileObject;
|
||||||
LARGE_INTEGER PageOffset;
|
LARGE_INTEGER PageOffset;
|
||||||
LONGLONG BeyoundLastEntryOffset;
|
LONGLONG BeyondLastEntryOffset;
|
||||||
PVOID PageBuffer;
|
PVOID PageBuffer;
|
||||||
PBCB PageBcb;
|
PBCB PageBcb;
|
||||||
} FAT_SCAN_CONTEXT;
|
} FAT_SCAN_CONTEXT;
|
||||||
|
@ -127,12 +127,14 @@ FAT_METHODS Fat32Methods = {
|
||||||
|
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* FUNCTION:
|
* Determines the index of the set bit.
|
||||||
* Determines the index of the set bit.
|
*
|
||||||
* ARGUMENTS:
|
* @param Number
|
||||||
* Number = Number having a single bit set.
|
* Number having a single bit set.
|
||||||
* RETURNS: Index of the set bit.
|
*
|
||||||
|
* @return
|
||||||
|
* Index of the set bit.
|
||||||
*/
|
*/
|
||||||
FORCEINLINE
|
FORCEINLINE
|
||||||
ULONG
|
ULONG
|
||||||
|
@ -218,17 +220,25 @@ FatSetFat16ValueRun(IN OUT PFAT_SCAN_CONTEXT Context,
|
||||||
ExRaiseStatus(STATUS_NOT_IMPLEMENTED);
|
ExRaiseStatus(STATUS_NOT_IMPLEMENTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* FUNCTION:
|
* Scans FAT32 for continous chain of clusters
|
||||||
* Scans FAT32 for continous chain of clusters
|
*
|
||||||
* ARGUMENTS:
|
* @param Context
|
||||||
* Context = Pointer to FAT_SCAN_CONTEXT.
|
* Pointer to FAT_SCAN_CONTEXT.
|
||||||
* Index = Supplies the Index of the first cluster
|
*
|
||||||
* and receves the last index after the last
|
* @param Index
|
||||||
* cluster in the chain.
|
* Supplies the Index of the first cluster
|
||||||
* CanWait = Indicates if the context allows blocking.
|
* and receves the last index after the last
|
||||||
* RETURNS: Value of the last claster terminated the scan.
|
* cluster in the chain.
|
||||||
* NOTES: Raises STATUS_CANT_WAIT race condition.
|
*
|
||||||
|
* @param CanWait
|
||||||
|
* Indicates if the context allows blocking.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* Value of the last claster terminated the scan.
|
||||||
|
*
|
||||||
|
* @note
|
||||||
|
* Raises STATUS_CANT_WAIT race condition.
|
||||||
*/
|
*/
|
||||||
ULONG
|
ULONG
|
||||||
FatScanFat32ForContinousRun(IN OUT PFAT_SCAN_CONTEXT Context,
|
FatScanFat32ForContinousRun(IN OUT PFAT_SCAN_CONTEXT Context,
|
||||||
|
@ -270,8 +280,8 @@ FatScanFat32ForContinousRun(IN OUT PFAT_SCAN_CONTEXT Context,
|
||||||
Entry = Add2Ptr(Context->PageBuffer, OffsetWithinPage, PULONG);
|
Entry = Add2Ptr(Context->PageBuffer, OffsetWithinPage, PULONG);
|
||||||
/* Next Page Offset */
|
/* Next Page Offset */
|
||||||
PageOffset = Context->PageOffset.QuadPart + PAGE_SIZE;
|
PageOffset = Context->PageOffset.QuadPart + PAGE_SIZE;
|
||||||
if (PageOffset > Context->BeyoundLastEntryOffset)
|
if (PageOffset > Context->BeyondLastEntryOffset)
|
||||||
PageValidLength = (SIZE_T) (Context->BeyoundLastEntryOffset
|
PageValidLength = (SIZE_T) (Context->BeyondLastEntryOffset
|
||||||
- Context->PageOffset.QuadPart);
|
- Context->PageOffset.QuadPart);
|
||||||
BeyoudLastEntry = Add2Ptr(Context->PageBuffer, PageValidLength, PULONG);
|
BeyoudLastEntry = Add2Ptr(Context->PageBuffer, PageValidLength, PULONG);
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
|
@ -284,7 +294,7 @@ FatScanFat32ForContinousRun(IN OUT PFAT_SCAN_CONTEXT Context,
|
||||||
/* Check if this is the last available entry */
|
/* Check if this is the last available entry */
|
||||||
if (PageValidLength < PAGE_SIZE)
|
if (PageValidLength < PAGE_SIZE)
|
||||||
break;
|
break;
|
||||||
/* We are getting beyound current page and
|
/* We are getting beyond current page and
|
||||||
* are still in the continous run, map the next page.
|
* are still in the continous run, map the next page.
|
||||||
*/
|
*/
|
||||||
Context->PageOffset.QuadPart = PageOffset;
|
Context->PageOffset.QuadPart = PageOffset;
|
||||||
|
@ -300,8 +310,8 @@ FatScanFat32ForContinousRun(IN OUT PFAT_SCAN_CONTEXT Context,
|
||||||
Entry = (PULONG) Context->PageBuffer;
|
Entry = (PULONG) Context->PageBuffer;
|
||||||
/* Next Page Offset */
|
/* Next Page Offset */
|
||||||
PageOffset = Context->PageOffset.QuadPart + PAGE_SIZE;
|
PageOffset = Context->PageOffset.QuadPart + PAGE_SIZE;
|
||||||
if (PageOffset > Context->BeyoundLastEntryOffset)
|
if (PageOffset > Context->BeyondLastEntryOffset)
|
||||||
PageValidLength = (SIZE_T) (Context->BeyoundLastEntryOffset
|
PageValidLength = (SIZE_T) (Context->BeyondLastEntryOffset
|
||||||
- Context->PageOffset.QuadPart);
|
- Context->PageOffset.QuadPart);
|
||||||
BeyoudLastEntry = Add2Ptr(Context->PageBuffer, PageValidLength, PULONG);
|
BeyoudLastEntry = Add2Ptr(Context->PageBuffer, PageValidLength, PULONG);
|
||||||
}
|
}
|
||||||
|
@ -336,25 +346,37 @@ FatSetFat32ValueRun(IN OUT PFAT_SCAN_CONTEXT Context,
|
||||||
ExRaiseStatus(STATUS_NOT_IMPLEMENTED);
|
ExRaiseStatus(STATUS_NOT_IMPLEMENTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* FUNCTION:
|
* Queries file MCB for the specified region [Vbo, Vbo + Length],
|
||||||
* Queries file MCB for the specified region [Vbo, Vbo + Length],
|
* returns the number of runs in the region as well as the first
|
||||||
* returns the number of runs in the region as well as the first
|
* run of the range itself.
|
||||||
* run of the range itself.
|
* If the specified region is not fully cached in MCB the routine
|
||||||
* If the specified region is not fully cached in MCB the routine
|
* scans FAT for the file and fills the MCB until the file offset
|
||||||
* scans FAT for the file and fills the MCB until the file offset
|
* (defined as Vbo + Length) is reached.
|
||||||
* (defined as Vbo + Length) is reached.
|
*
|
||||||
* ARGUMENTS:
|
* @param Fcb
|
||||||
* Fcb = Pointer to FCB structure for the file.
|
* Pointer to FCB structure for the file.
|
||||||
* Vbo = Virtual Byte Offset in the file.
|
*
|
||||||
* Lbo = Receives the Value of Logical Byte offset corresponding
|
* @param Vbo
|
||||||
* to supplied Vbo Value.
|
* Virtual Byte Offset in the file.
|
||||||
* Length = Supplies file range length to be examined and recieves
|
*
|
||||||
* the length of first run.
|
* @param Lbo
|
||||||
* OutIndex = Recieves the index (in MCB cache) of first run.
|
* Receives the Value of Logical Byte offset corresponding
|
||||||
* RETURNS: Incremented index of the last run (+1).
|
* to supplied Vbo Value.
|
||||||
* NOTES: Should be called by I/O routines to split the I/O operation
|
*
|
||||||
* into sequential or parallel I/O operations.
|
* @param Length
|
||||||
|
* Supplies file range length to be examined and receives
|
||||||
|
* the length of first run.
|
||||||
|
*
|
||||||
|
* @param OutIndex
|
||||||
|
* Receives the index (in MCB cache) of first run.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* Incremented index of the last run (+1).
|
||||||
|
*
|
||||||
|
* @note
|
||||||
|
* Should be called by I/O routines to split the I/O operation
|
||||||
|
* into sequential or parallel I/O operations.
|
||||||
*/
|
*/
|
||||||
ULONG
|
ULONG
|
||||||
FatScanFat(IN PFCB Fcb,
|
FatScanFat(IN PFCB Fcb,
|
||||||
|
@ -364,7 +386,7 @@ FatScanFat(IN PFCB Fcb,
|
||||||
OUT PULONG Index,
|
OUT PULONG Index,
|
||||||
IN BOOLEAN CanWait)
|
IN BOOLEAN CanWait)
|
||||||
{
|
{
|
||||||
LONGLONG CurrentLbo, CurrentVbo, BeyoundLastVbo, CurrentLength;
|
LONGLONG CurrentLbo, CurrentVbo, BeyondLastVbo, CurrentLength;
|
||||||
ULONG Entry, NextEntry, NumberOfEntries, CurrentIndex;
|
ULONG Entry, NextEntry, NumberOfEntries, CurrentIndex;
|
||||||
FAT_SCAN_CONTEXT Context;
|
FAT_SCAN_CONTEXT Context;
|
||||||
PVCB Vcb;
|
PVCB Vcb;
|
||||||
|
@ -372,15 +394,15 @@ FatScanFat(IN PFCB Fcb,
|
||||||
/* Some often used values */
|
/* Some often used values */
|
||||||
Vcb = Fcb->Vcb;
|
Vcb = Fcb->Vcb;
|
||||||
CurrentIndex = 0;
|
CurrentIndex = 0;
|
||||||
BeyoundLastVbo = Vbo + *Length;
|
BeyondLastVbo = Vbo + *Length;
|
||||||
CurrentLength = ((LONGLONG) Vcb->Clusters) << Vcb->BytesPerClusterLog;
|
CurrentLength = ((LONGLONG) Vcb->Clusters) << Vcb->BytesPerClusterLog;
|
||||||
if (BeyoundLastVbo > CurrentLength)
|
if (BeyondLastVbo > CurrentLength)
|
||||||
BeyoundLastVbo = CurrentLength;
|
BeyondLastVbo = CurrentLength;
|
||||||
/* Try to locate first run */
|
/* Try to locate first run */
|
||||||
if (FsRtlLookupLargeMcbEntry(&Fcb->Mcb, Vbo, Lbo, Length, NULL, NULL, Index))
|
if (FsRtlLookupLargeMcbEntry(&Fcb->Mcb, Vbo, Lbo, Length, NULL, NULL, Index))
|
||||||
{
|
{
|
||||||
/* Check if we have a single mapped run */
|
/* Check if we have a single mapped run */
|
||||||
if (Vbo >= BeyoundLastVbo)
|
if (Vbo >= BeyondLastVbo)
|
||||||
goto FatScanFcbFatExit;
|
goto FatScanFcbFatExit;
|
||||||
} else {
|
} else {
|
||||||
*Length = 0L;
|
*Length = 0L;
|
||||||
|
@ -401,14 +423,14 @@ FatScanFat(IN PFCB Fcb,
|
||||||
{
|
{
|
||||||
if (Entry < FAT_CLUSTER_LAST)
|
if (Entry < FAT_CLUSTER_LAST)
|
||||||
ExRaiseStatus(STATUS_FILE_CORRUPT_ERROR);
|
ExRaiseStatus(STATUS_FILE_CORRUPT_ERROR);
|
||||||
BeyoundLastVbo = 0LL;
|
BeyondLastVbo = 0LL;
|
||||||
}
|
}
|
||||||
CurrentIndex = 0L;
|
CurrentIndex = 0L;
|
||||||
CurrentVbo = 0LL;
|
CurrentVbo = 0LL;
|
||||||
}
|
}
|
||||||
RtlZeroMemory(&Context, sizeof(Context));
|
RtlZeroMemory(&Context, sizeof(Context));
|
||||||
Context.FileObject = Vcb->VolumeFileObject;
|
Context.FileObject = Vcb->VolumeFileObject;
|
||||||
while (CurrentVbo < BeyoundLastVbo)
|
while (CurrentVbo < BeyondLastVbo)
|
||||||
{
|
{
|
||||||
/* Locate Continous run starting with the current entry */
|
/* Locate Continous run starting with the current entry */
|
||||||
NumberOfEntries = Entry;
|
NumberOfEntries = Entry;
|
||||||
|
@ -509,7 +531,7 @@ FatiInitializeVcb(PVCB Vcb)
|
||||||
Vcb->Clusters = ClustersCapacity;
|
Vcb->Clusters = ClustersCapacity;
|
||||||
Vcb->BytesPerCluster = SectorsToBytes(Vcb, Vcb->Bpb.SectorsPerCluster);
|
Vcb->BytesPerCluster = SectorsToBytes(Vcb, Vcb->Bpb.SectorsPerCluster);
|
||||||
Vcb->BytesPerClusterLog = FatPowerOfTwo(Vcb->BytesPerCluster);
|
Vcb->BytesPerClusterLog = FatPowerOfTwo(Vcb->BytesPerCluster);
|
||||||
Vcb->BeyoundLastClusterInFat = ((LONGLONG) Vcb->Clusters) * Vcb->IndexDepth / 0x8;
|
Vcb->BeyondLastClusterInFat = ((LONGLONG) Vcb->Clusters) * Vcb->IndexDepth / 0x8;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
|
|
@ -107,7 +107,7 @@ typedef struct _VCB
|
||||||
ULONG IndexDepth;
|
ULONG IndexDepth;
|
||||||
ULONG RootDirent;
|
ULONG RootDirent;
|
||||||
ULONG RootDirentSectors;
|
ULONG RootDirentSectors;
|
||||||
LONGLONG BeyoundLastClusterInFat;
|
LONGLONG BeyondLastClusterInFat;
|
||||||
FAT_METHODS Methods;
|
FAT_METHODS Methods;
|
||||||
/* Root Directory Fcb: */
|
/* Root Directory Fcb: */
|
||||||
struct _FCB *RootFcb;
|
struct _FCB *RootFcb;
|
||||||
|
|
Loading…
Reference in a new issue