mirror of
https://github.com/reactos/reactos.git
synced 2025-06-23 10:20:19 +00:00
[FASTFAT_NEW] Fix ReactOS compiler workaround
This commit is contained in:
parent
57cf5cdc5d
commit
9e6866402b
1 changed files with 112 additions and 112 deletions
|
@ -288,7 +288,7 @@ Routine Description:
|
||||||
1. First window with >50% free clusters
|
1. First window with >50% free clusters
|
||||||
2. First empty window
|
2. First empty window
|
||||||
3. Window with greatest number of free clusters.
|
3. Window with greatest number of free clusters.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Vcb - Supplies the Vcb for the volume
|
Vcb - Supplies the Vcb for the volume
|
||||||
|
@ -305,17 +305,17 @@ Return Value:
|
||||||
ULONG ClustersPerWindow = MAX_CLUSTER_BITMAP_SIZE;
|
ULONG ClustersPerWindow = MAX_CLUSTER_BITMAP_SIZE;
|
||||||
|
|
||||||
NT_ASSERT( 1 != Vcb->NumberOfWindows);
|
NT_ASSERT( 1 != Vcb->NumberOfWindows);
|
||||||
|
|
||||||
for (i = 0; i < Vcb->NumberOfWindows; i++) {
|
for (i = 0; i < Vcb->NumberOfWindows; i++) {
|
||||||
|
|
||||||
if (Vcb->Windows[i].ClustersFree == ClustersPerWindow) {
|
if (Vcb->Windows[i].ClustersFree == ClustersPerWindow) {
|
||||||
|
|
||||||
if (-1 == FirstEmpty) {
|
if (-1 == FirstEmpty) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Keep note of the first empty window on the disc
|
// Keep note of the first empty window on the disc
|
||||||
//
|
//
|
||||||
|
|
||||||
FirstEmpty = i;
|
FirstEmpty = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -324,7 +324,7 @@ Return Value:
|
||||||
//
|
//
|
||||||
// This window has the most free clusters, so far
|
// This window has the most free clusters, so far
|
||||||
//
|
//
|
||||||
|
|
||||||
MaxFree = Vcb->Windows[i].ClustersFree;
|
MaxFree = Vcb->Windows[i].ClustersFree;
|
||||||
Fave = i;
|
Fave = i;
|
||||||
|
|
||||||
|
@ -332,9 +332,9 @@ Return Value:
|
||||||
// If this window has >50% free clusters, then we will take it,
|
// If this window has >50% free clusters, then we will take it,
|
||||||
// so don't bother considering more windows.
|
// so don't bother considering more windows.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (MaxFree >= (ClustersPerWindow >> 1)) {
|
if (MaxFree >= (ClustersPerWindow >> 1)) {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -345,7 +345,7 @@ Return Value:
|
||||||
// first empty window on the disc, if any - otherwise we'll just go with
|
// first empty window on the disc, if any - otherwise we'll just go with
|
||||||
// the one with the most free clusters.
|
// the one with the most free clusters.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((MaxFree < (ClustersPerWindow >> 1)) && (-1 != FirstEmpty)) {
|
if ((MaxFree < (ClustersPerWindow >> 1)) && (-1 != FirstEmpty)) {
|
||||||
|
|
||||||
Fave = FirstEmpty;
|
Fave = FirstEmpty;
|
||||||
|
@ -354,7 +354,7 @@ Return Value:
|
||||||
return Fave;
|
return Fave;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatSetupAllocationSupport (
|
FatSetupAllocationSupport (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
|
@ -544,7 +544,7 @@ Arguments:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatTearDownAllocationSupport (
|
FatTearDownAllocationSupport (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
|
@ -613,8 +613,8 @@ Return Value:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatLookupFileAllocation (
|
FatLookupFileAllocation (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
|
@ -934,7 +934,7 @@ Arguments:
|
||||||
*Allocated = FALSE;
|
*Allocated = FALSE;
|
||||||
|
|
||||||
FcbOrDcb->Header.AllocationSize.QuadPart = CurrentVbo;
|
FcbOrDcb->Header.AllocationSize.QuadPart = CurrentVbo;
|
||||||
|
|
||||||
DebugTrace( 0, Dbg, "New file allocation size = %08lx.\n", CurrentVbo);
|
DebugTrace( 0, Dbg, "New file allocation size = %08lx.\n", CurrentVbo);
|
||||||
try_return ( NOTHING );
|
try_return ( NOTHING );
|
||||||
}
|
}
|
||||||
|
@ -1077,8 +1077,8 @@ Arguments:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatAddFileAllocation (
|
FatAddFileAllocation (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
|
@ -1170,7 +1170,7 @@ Arguments:
|
||||||
LBO FirstLboOfFile;
|
LBO FirstLboOfFile;
|
||||||
|
|
||||||
NT_ASSERT( FcbOrDcb->FcbCondition == FcbGood );
|
NT_ASSERT( FcbOrDcb->FcbCondition == FcbGood );
|
||||||
|
|
||||||
FatGetDirentFromFcbOrDcb( IrpContext,
|
FatGetDirentFromFcbOrDcb( IrpContext,
|
||||||
FcbOrDcb,
|
FcbOrDcb,
|
||||||
FALSE,
|
FALSE,
|
||||||
|
@ -1485,7 +1485,7 @@ Return Value:
|
||||||
//
|
//
|
||||||
// Inspired by a Prefix complaint.
|
// Inspired by a Prefix complaint.
|
||||||
//
|
//
|
||||||
|
|
||||||
NT_ASSERT( FcbOrDcb->FcbCondition == FcbGood );
|
NT_ASSERT( FcbOrDcb->FcbCondition == FcbGood );
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1538,7 +1538,7 @@ Return Value:
|
||||||
|
|
||||||
DebugTrace(0, Dbg, "Desired size equals current allocation.\n", 0);
|
DebugTrace(0, Dbg, "Desired size equals current allocation.\n", 0);
|
||||||
DebugTrace(-1, Dbg, "FatTruncateFileAllocation -> (VOID)\n", 0);
|
DebugTrace(-1, Dbg, "FatTruncateFileAllocation -> (VOID)\n", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnwindInitialAllocationSize = FcbOrDcb->Header.AllocationSize.LowPart;
|
UnwindInitialAllocationSize = FcbOrDcb->Header.AllocationSize.LowPart;
|
||||||
|
@ -1572,7 +1572,7 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
NT_ASSERT( FcbOrDcb->FcbCondition == FcbGood );
|
NT_ASSERT( FcbOrDcb->FcbCondition == FcbGood );
|
||||||
|
|
||||||
FatGetDirentFromFcbOrDcb( IrpContext, FcbOrDcb, FALSE, &Dirent, &Bcb );
|
FatGetDirentFromFcbOrDcb( IrpContext, FcbOrDcb, FALSE, &Dirent, &Bcb );
|
||||||
|
|
||||||
Dirent->FirstClusterOfFile = 0;
|
Dirent->FirstClusterOfFile = 0;
|
||||||
|
@ -1679,8 +1679,8 @@ Return Value:
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatLookupFileAllocationSize (
|
FatLookupFileAllocationSize (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
|
@ -1739,8 +1739,8 @@ Arguments:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatAllocateDiskSpace (
|
FatAllocateDiskSpace (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
|
@ -1875,7 +1875,7 @@ Arguments:
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make sure there are enough free clusters to start with, and
|
// Make sure there are enough free clusters to start with, and
|
||||||
// take them now so that nobody else takes them from us.
|
// take them now so that nobody else takes them from us.
|
||||||
//
|
//
|
||||||
|
|
||||||
ExAcquireResourceSharedLite(&Vcb->ChangeBitMapResource, TRUE);
|
ExAcquireResourceSharedLite(&Vcb->ChangeBitMapResource, TRUE);
|
||||||
|
@ -1922,8 +1922,8 @@ Arguments:
|
||||||
// Drop our shared lock on the ChangeBitMapResource, and pick it up again
|
// Drop our shared lock on the ChangeBitMapResource, and pick it up again
|
||||||
// exclusive in preparation for making the window swap.
|
// exclusive in preparation for making the window swap.
|
||||||
//
|
//
|
||||||
|
|
||||||
FatUnlockFreeClusterBitMap(Vcb);
|
FatUnlockFreeClusterBitMap(Vcb);
|
||||||
ExReleaseResourceLite(&Vcb->ChangeBitMapResource);
|
ExReleaseResourceLite(&Vcb->ChangeBitMapResource);
|
||||||
ExAcquireResourceExclusiveLite(&Vcb->ChangeBitMapResource, TRUE);
|
ExAcquireResourceExclusiveLite(&Vcb->ChangeBitMapResource, TRUE);
|
||||||
FatLockFreeClusterBitMap(Vcb);
|
FatLockFreeClusterBitMap(Vcb);
|
||||||
|
@ -1932,12 +1932,12 @@ Arguments:
|
||||||
|
|
||||||
//
|
//
|
||||||
// Again, test the current window against the one we want - some other
|
// Again, test the current window against the one we want - some other
|
||||||
// thread could have sneaked in behind our backs and kindly set it to the one
|
// thread could have sneaked in behind our backs and kindly set it to the one
|
||||||
// we need, when we dropped and reacquired the ChangeBitMapResource above.
|
// we need, when we dropped and reacquired the ChangeBitMapResource above.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (Window != Vcb->CurrentWindow) {
|
if (Window != Vcb->CurrentWindow) {
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
Wait = BooleanFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT);
|
Wait = BooleanFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT);
|
||||||
|
@ -1947,7 +1947,7 @@ Arguments:
|
||||||
// Change to the new window (update Vcb->CurrentWindow) and scan it
|
// Change to the new window (update Vcb->CurrentWindow) and scan it
|
||||||
// to build up a freespace bitmap etc.
|
// to build up a freespace bitmap etc.
|
||||||
//
|
//
|
||||||
|
|
||||||
FatExamineFatEntries( IrpContext, Vcb,
|
FatExamineFatEntries( IrpContext, Vcb,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -2004,7 +2004,7 @@ Arguments:
|
||||||
//
|
//
|
||||||
// NOTE: Clusterhint in the Vcb is not guaranteed to be set (may be -1)
|
// NOTE: Clusterhint in the Vcb is not guaranteed to be set (may be -1)
|
||||||
//
|
//
|
||||||
|
|
||||||
WindowRelativeHint = Vcb->ClusterHint;
|
WindowRelativeHint = Vcb->ClusterHint;
|
||||||
AbsoluteClusterHint = 0;
|
AbsoluteClusterHint = 0;
|
||||||
|
|
||||||
|
@ -2130,7 +2130,7 @@ Arguments:
|
||||||
// it'll get converted into a true cluster number and put in Cluster, which
|
// it'll get converted into a true cluster number and put in Cluster, which
|
||||||
// will be a volume relative true cluster number.
|
// will be a volume relative true cluster number.
|
||||||
//
|
//
|
||||||
|
|
||||||
ULONG Index = 0;
|
ULONG Index = 0;
|
||||||
ULONG Cluster = 0;
|
ULONG Cluster = 0;
|
||||||
ULONG CurrentVbo = 0;
|
ULONG CurrentVbo = 0;
|
||||||
|
@ -2147,7 +2147,7 @@ Arguments:
|
||||||
// Drop our shared lock on the ChangeBitMapResource, and pick it up again
|
// Drop our shared lock on the ChangeBitMapResource, and pick it up again
|
||||||
// exclusive in preparation for making a window swap.
|
// exclusive in preparation for making a window swap.
|
||||||
//
|
//
|
||||||
|
|
||||||
FatUnlockFreeClusterBitMap(Vcb);
|
FatUnlockFreeClusterBitMap(Vcb);
|
||||||
ExReleaseResourceLite(&Vcb->ChangeBitMapResource);
|
ExReleaseResourceLite(&Vcb->ChangeBitMapResource);
|
||||||
ExAcquireResourceExclusiveLite(&Vcb->ChangeBitMapResource, TRUE);
|
ExAcquireResourceExclusiveLite(&Vcb->ChangeBitMapResource, TRUE);
|
||||||
|
@ -2279,11 +2279,11 @@ Arguments:
|
||||||
if ((0 == WindowRelativeHint) && (0 == ClustersFound)) {
|
if ((0 == WindowRelativeHint) && (0 == ClustersFound)) {
|
||||||
|
|
||||||
if (ClustersRemaining <= Vcb->CurrentWindow->ClustersFree) {
|
if (ClustersRemaining <= Vcb->CurrentWindow->ClustersFree) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// The remaining allocation could be satisfied entirely from this
|
// The remaining allocation could be satisfied entirely from this
|
||||||
// window. We will ask only for what we need, to try and avoid
|
// window. We will ask only for what we need, to try and avoid
|
||||||
// unnecessarily fragmenting large runs of space by always using
|
// unnecessarily fragmenting large runs of space by always using
|
||||||
// (part of) the largest run we can find. This call will return the
|
// (part of) the largest run we can find. This call will return the
|
||||||
// first run large enough.
|
// first run large enough.
|
||||||
//
|
//
|
||||||
|
@ -2291,19 +2291,19 @@ Arguments:
|
||||||
Index = RtlFindClearBits( &Vcb->FreeClusterBitMap, ClustersRemaining, 0);
|
Index = RtlFindClearBits( &Vcb->FreeClusterBitMap, ClustersRemaining, 0);
|
||||||
|
|
||||||
if (-1 != Index) {
|
if (-1 != Index) {
|
||||||
|
|
||||||
ClustersFound = ClustersRemaining;
|
ClustersFound = ClustersRemaining;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == ClustersFound) {
|
if (0 == ClustersFound) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Still nothing, so just take the largest free run we can find.
|
// Still nothing, so just take the largest free run we can find.
|
||||||
//
|
//
|
||||||
|
|
||||||
ClustersFound = RtlFindLongestRunClear( &Vcb->FreeClusterBitMap, &Index );
|
ClustersFound = RtlFindLongestRunClear( &Vcb->FreeClusterBitMap, &Index );
|
||||||
|
|
||||||
}
|
}
|
||||||
#if DBG
|
#if DBG
|
||||||
PreviousClear = RtlNumberOfClearBits( &Vcb->FreeClusterBitMap );
|
PreviousClear = RtlNumberOfClearBits( &Vcb->FreeClusterBitMap );
|
||||||
|
@ -2366,7 +2366,7 @@ Arguments:
|
||||||
) {
|
) {
|
||||||
|
|
||||||
FaveWindow = NextWindow;
|
FaveWindow = NextWindow;
|
||||||
SelectedWindow = TRUE;
|
SelectedWindow = TRUE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
@ -2394,7 +2394,7 @@ Arguments:
|
||||||
//
|
//
|
||||||
// Select a new window to begin allocating from
|
// Select a new window to begin allocating from
|
||||||
//
|
//
|
||||||
|
|
||||||
FaveWindow = FatSelectBestWindow( Vcb);
|
FaveWindow = FatSelectBestWindow( Vcb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2403,8 +2403,8 @@ Arguments:
|
||||||
//
|
//
|
||||||
|
|
||||||
if (0 == Vcb->Windows[ FaveWindow].ClustersFree) {
|
if (0 == Vcb->Windows[ FaveWindow].ClustersFree) {
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma prefast( suppress: 28159, "we bugcheck here because our internal data structures are seriously corrupted if this happens" )
|
#pragma prefast( suppress: 28159, "we bugcheck here because our internal data structures are seriously corrupted if this happens" )
|
||||||
#endif
|
#endif
|
||||||
FatBugCheck( 0, 5, 1 );
|
FatBugCheck( 0, 5, 1 );
|
||||||
|
@ -2445,7 +2445,7 @@ Arguments:
|
||||||
FatReserveClusters( IrpContext, Vcb, (Index + 2), ClustersFound );
|
FatReserveClusters( IrpContext, Vcb, (Index + 2), ClustersFound );
|
||||||
|
|
||||||
Cluster = Index + Window->FirstCluster;
|
Cluster = Index + Window->FirstCluster;
|
||||||
|
|
||||||
Window->ClustersFree -= ClustersFound;
|
Window->ClustersFree -= ClustersFound;
|
||||||
NT_ASSERT( PreviousClear - ClustersFound == Window->ClustersFree );
|
NT_ASSERT( PreviousClear - ClustersFound == Window->ClustersFree );
|
||||||
|
|
||||||
|
@ -2593,7 +2593,7 @@ Arguments:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Limit our zeroing writes to 1 MB.
|
// Limit our zeroing writes to 1 MB.
|
||||||
|
@ -2607,7 +2607,7 @@ FatDeallocateDiskSpace (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
IN PVCB Vcb,
|
IN PVCB Vcb,
|
||||||
IN PLARGE_MCB Mcb,
|
IN PLARGE_MCB Mcb,
|
||||||
IN BOOLEAN ZeroOnDeallocate
|
IN BOOLEAN ZeroOnDeallocate
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -2697,7 +2697,7 @@ Return Value:
|
||||||
KeInitializeEvent( &IoEvent,
|
KeInitializeEvent( &IoEvent,
|
||||||
NotificationEvent,
|
NotificationEvent,
|
||||||
FALSE );
|
FALSE );
|
||||||
|
|
||||||
for ( McbIndex = 0; McbIndex < RunsInMcb; McbIndex++ ) {
|
for ( McbIndex = 0; McbIndex < RunsInMcb; McbIndex++ ) {
|
||||||
|
|
||||||
FatGetNextMcbEntry( Vcb, Mcb, McbIndex, &Vbo, &Lbo, &ByteCount );
|
FatGetNextMcbEntry( Vcb, Mcb, McbIndex, &Vbo, &Lbo, &ByteCount );
|
||||||
|
@ -2713,7 +2713,7 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
if (ByteCount > MAX_ZERO_MDL_SIZE) {
|
if (ByteCount > MAX_ZERO_MDL_SIZE) {
|
||||||
Mdl = FatBuildZeroMdl( IrpContext, MAX_ZERO_MDL_SIZE);
|
Mdl = FatBuildZeroMdl( IrpContext, MAX_ZERO_MDL_SIZE);
|
||||||
} else {
|
} else {
|
||||||
Mdl = FatBuildZeroMdl( IrpContext, ByteCount);
|
Mdl = FatBuildZeroMdl( IrpContext, ByteCount);
|
||||||
}
|
}
|
||||||
|
@ -2765,7 +2765,7 @@ Return Value:
|
||||||
&Iosb );
|
&Iosb );
|
||||||
|
|
||||||
if (IoIrp == NULL) {
|
if (IoIrp == NULL) {
|
||||||
NT_ASSERT( FALSE );
|
NT_ASSERT( FALSE );
|
||||||
ZeroingStatus = STATUS_INSUFFICIENT_RESOURCES;
|
ZeroingStatus = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
goto try_exit2;
|
goto try_exit2;
|
||||||
}
|
}
|
||||||
|
@ -2792,14 +2792,14 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NT_SUCCESS( ZeroingStatus )) {
|
if (!NT_SUCCESS( ZeroingStatus )) {
|
||||||
NT_ASSERT( FALSE );
|
NT_ASSERT( FALSE );
|
||||||
goto try_exit2;
|
goto try_exit2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Increment the starting offset where we will zero.
|
// Increment the starting offset where we will zero.
|
||||||
//
|
//
|
||||||
|
|
||||||
Lbo += MdlSizeMapped;
|
Lbo += MdlSizeMapped;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -2811,13 +2811,13 @@ Return Value:
|
||||||
if (ByteCountToZero < MdlSizeMapped) {
|
if (ByteCountToZero < MdlSizeMapped) {
|
||||||
MdlSizeMapped = ByteCountToZero;
|
MdlSizeMapped = ByteCountToZero;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try_exit2:
|
try_exit2:
|
||||||
|
|
||||||
NOTHING;
|
NOTHING;
|
||||||
|
|
||||||
} _SEH2_FINALLY {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
if (!FlagOn( Mdl->MdlFlags, MDL_SOURCE_IS_NONPAGED_POOL) &&
|
if (!FlagOn( Mdl->MdlFlags, MDL_SOURCE_IS_NONPAGED_POOL) &&
|
||||||
|
@ -2827,22 +2827,22 @@ Return Value:
|
||||||
}
|
}
|
||||||
IoFreeMdl( Mdl );
|
IoFreeMdl( Mdl );
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try_exit:
|
try_exit:
|
||||||
|
|
||||||
NOTHING;
|
NOTHING;
|
||||||
|
|
||||||
} _SEH2_EXCEPT(FatExceptionFilter( NULL, _SEH2_GetExceptionInformation() )) {
|
} _SEH2_EXCEPT(FatExceptionFilter( NULL, _SEH2_GetExceptionInformation() )) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we failed to zero for some reason, still go ahead and deallocate
|
// If we failed to zero for some reason, still go ahead and deallocate
|
||||||
// the clusters. Otherwise we'll leak space from the volume.
|
// the clusters. Otherwise we'll leak space from the volume.
|
||||||
//
|
//
|
||||||
|
|
||||||
ZeroingStatus = _SEH2_GetExceptionCode();
|
ZeroingStatus = _SEH2_GetExceptionCode();
|
||||||
|
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3155,7 +3155,7 @@ Return Value:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatSplitAllocation (
|
FatSplitAllocation (
|
||||||
|
@ -3225,7 +3225,7 @@ Return Value:
|
||||||
|
|
||||||
ULONG ByteCount;
|
ULONG ByteCount;
|
||||||
|
|
||||||
#if DBG
|
#if DBG
|
||||||
ULONG BytesPerCluster;
|
ULONG BytesPerCluster;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3237,7 +3237,7 @@ Return Value:
|
||||||
DebugTrace( 0, Dbg, " SplitAtVbo = %8lx\n", SplitAtVbo);
|
DebugTrace( 0, Dbg, " SplitAtVbo = %8lx\n", SplitAtVbo);
|
||||||
DebugTrace( 0, Dbg, " RemainingMcb = %p\n", RemainingMcb);
|
DebugTrace( 0, Dbg, " RemainingMcb = %p\n", RemainingMcb);
|
||||||
|
|
||||||
#if DBG
|
#if DBG
|
||||||
BytesPerCluster = 1 << Vcb->AllocationSupport.LogOfBytesPerCluster;
|
BytesPerCluster = 1 << Vcb->AllocationSupport.LogOfBytesPerCluster;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3341,8 +3341,8 @@ Return Value:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatMergeAllocation (
|
FatMergeAllocation (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
|
@ -3464,7 +3464,7 @@ Return Value:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal support routine
|
// Internal support routine
|
||||||
//
|
//
|
||||||
|
@ -3556,7 +3556,7 @@ Return Value:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal support routine
|
// Internal support routine
|
||||||
//
|
//
|
||||||
|
@ -3744,7 +3744,7 @@ Arguments:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatSetFatEntry (
|
FatSetFatEntry (
|
||||||
|
@ -4130,7 +4130,7 @@ Arguments:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal support routine
|
// Internal support routine
|
||||||
//
|
//
|
||||||
|
@ -4646,7 +4646,7 @@ Return Value:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal support routine
|
// Internal support routine
|
||||||
//
|
//
|
||||||
|
@ -4705,7 +4705,7 @@ Return Value:
|
||||||
DebugTrace( 0, Dbg, "Received non power of 2.\n", 0);
|
DebugTrace( 0, Dbg, "Received non power of 2.\n", 0);
|
||||||
|
|
||||||
DebugTrace(-1, Dbg, "LogOf -> %8lx\n", Log);
|
DebugTrace(-1, Dbg, "LogOf -> %8lx\n", Log);
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma prefast( suppress: 28159, "we bugcheck here because our internal data structures are seriously corrupted if this happens" )
|
#pragma prefast( suppress: 28159, "we bugcheck here because our internal data structures are seriously corrupted if this happens" )
|
||||||
#endif
|
#endif
|
||||||
|
@ -4715,7 +4715,7 @@ Return Value:
|
||||||
return Log;
|
return Log;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatExamineFatEntries(
|
FatExamineFatEntries(
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
|
@ -4818,14 +4818,14 @@ Return Value:
|
||||||
|
|
||||||
//
|
//
|
||||||
// FAT32: Calculate the number of FAT entries covered by a window. This is
|
// FAT32: Calculate the number of FAT entries covered by a window. This is
|
||||||
// equal to the number of bits in the freespace bitmap, the size of which
|
// equal to the number of bits in the freespace bitmap, the size of which
|
||||||
// is hardcoded.
|
// is hardcoded.
|
||||||
//
|
//
|
||||||
|
|
||||||
EntriesPerWindow = MAX_CLUSTER_BITMAP_SIZE;
|
EntriesPerWindow = MAX_CLUSTER_BITMAP_SIZE;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
EntriesPerWindow = Vcb->AllocationSupport.NumberOfClusters;
|
EntriesPerWindow = Vcb->AllocationSupport.NumberOfClusters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4924,44 +4924,44 @@ Return Value:
|
||||||
//
|
//
|
||||||
// Pick up the initial chunk of the FAT and first entry.
|
// Pick up the initial chunk of the FAT and first entry.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FatIndexBitSize == 12) {
|
if (FatIndexBitSize == 12) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// We read in the entire fat in the 12 bit case.
|
// We read in the entire fat in the 12 bit case.
|
||||||
//
|
//
|
||||||
|
|
||||||
FatReadVolumeFile( IrpContext,
|
FatReadVolumeFile( IrpContext,
|
||||||
Vcb,
|
Vcb,
|
||||||
FatReservedBytes( &Vcb->Bpb ),
|
FatReservedBytes( &Vcb->Bpb ),
|
||||||
FatBytesPerFat( &Vcb->Bpb ),
|
FatBytesPerFat( &Vcb->Bpb ),
|
||||||
&Bcb,
|
&Bcb,
|
||||||
(PVOID *)&FatBuffer );
|
(PVOID *)&FatBuffer );
|
||||||
|
|
||||||
FatLookup12BitEntry(FatBuffer, 0, &FirstFatEntry);
|
FatLookup12BitEntry(FatBuffer, 0, &FirstFatEntry);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read in one page of fat at a time. We cannot read in the
|
// Read in one page of fat at a time. We cannot read in the
|
||||||
// all of the fat we need because of cache manager limitations.
|
// all of the fat we need because of cache manager limitations.
|
||||||
//
|
//
|
||||||
|
|
||||||
ULONG BytesPerEntry = FatIndexBitSize >> 3;
|
ULONG BytesPerEntry = FatIndexBitSize >> 3;
|
||||||
|
|
||||||
FatPages = (FatReservedBytes(&Vcb->Bpb) + FatBytesPerFat(&Vcb->Bpb) + (PAGE_SIZE - 1)) / PAGE_SIZE;
|
FatPages = (FatReservedBytes(&Vcb->Bpb) + FatBytesPerFat(&Vcb->Bpb) + (PAGE_SIZE - 1)) / PAGE_SIZE;
|
||||||
Page = (FatReservedBytes(&Vcb->Bpb) + StartIndex * BytesPerEntry) / PAGE_SIZE;
|
Page = (FatReservedBytes(&Vcb->Bpb) + StartIndex * BytesPerEntry) / PAGE_SIZE;
|
||||||
|
|
||||||
Offset = Page * PAGE_SIZE;
|
Offset = Page * PAGE_SIZE;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Prefetch the FAT entries in memory for optimal performance.
|
// Prefetch the FAT entries in memory for optimal performance.
|
||||||
//
|
//
|
||||||
|
|
||||||
PrefetchPages = FatPages - Page;
|
PrefetchPages = FatPages - Page;
|
||||||
|
|
||||||
if (PrefetchPages > FAT_PREFETCH_PAGE_COUNT) {
|
if (PrefetchPages > FAT_PREFETCH_PAGE_COUNT) {
|
||||||
|
|
||||||
PrefetchPages = ALIGN_UP_BY(Page, FAT_PREFETCH_PAGE_COUNT) - Page;
|
PrefetchPages = ALIGN_UP_BY(Page, FAT_PREFETCH_PAGE_COUNT) - Page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4978,33 +4978,33 @@ Return Value:
|
||||||
PAGE_SIZE,
|
PAGE_SIZE,
|
||||||
&Bcb,
|
&Bcb,
|
||||||
&pv);
|
&pv);
|
||||||
|
|
||||||
if (FatIndexBitSize == 32) {
|
if (FatIndexBitSize == 32) {
|
||||||
|
|
||||||
FatBuffer = (PUSHORT)((PUCHAR)pv +
|
FatBuffer = (PUSHORT)((PUCHAR)pv +
|
||||||
(FatReservedBytes(&Vcb->Bpb) + StartIndex * BytesPerEntry) %
|
(FatReservedBytes(&Vcb->Bpb) + StartIndex * BytesPerEntry) %
|
||||||
PAGE_SIZE);
|
PAGE_SIZE);
|
||||||
|
|
||||||
FirstFatEntry = *((PULONG)FatBuffer);
|
FirstFatEntry = *((PULONG)FatBuffer);
|
||||||
FirstFatEntry = FirstFatEntry & FAT32_ENTRY_MASK;
|
FirstFatEntry = FirstFatEntry & FAT32_ENTRY_MASK;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
FatBuffer = (PUSHORT)((PUCHAR)pv +
|
FatBuffer = (PUSHORT)((PUCHAR)pv +
|
||||||
FatReservedBytes(&Vcb->Bpb) % PAGE_SIZE) + 2;
|
FatReservedBytes(&Vcb->Bpb) % PAGE_SIZE) + 2;
|
||||||
|
|
||||||
FirstFatEntry = *FatBuffer;
|
FirstFatEntry = *FatBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClusterSize = 1 << (Vcb->AllocationSupport.LogOfBytesPerCluster);
|
ClusterSize = 1 << (Vcb->AllocationSupport.LogOfBytesPerCluster);
|
||||||
|
|
||||||
CurrentRun = (FirstFatEntry == FAT_CLUSTER_AVAILABLE) ?
|
CurrentRun = (FirstFatEntry == FAT_CLUSTER_AVAILABLE) ?
|
||||||
FreeClusters : AllocatedClusters;
|
FreeClusters : AllocatedClusters;
|
||||||
|
|
||||||
StartIndexOfThisRun = StartIndex;
|
StartIndexOfThisRun = StartIndex;
|
||||||
|
|
||||||
for (FatIndex = StartIndex; FatIndex <= EndIndex; FatIndex++) {
|
for (FatIndex = StartIndex; FatIndex <= EndIndex; FatIndex++) {
|
||||||
|
|
||||||
if (FatIndexBitSize == 12) {
|
if (FatIndexBitSize == 12) {
|
||||||
|
@ -5105,8 +5105,8 @@ Return Value:
|
||||||
FatEntry = *((PULONG)FatBuffer)++;
|
FatEntry = *((PULONG)FatBuffer)++;
|
||||||
FatEntry = FatEntry & FAT32_ENTRY_MASK;
|
FatEntry = FatEntry & FAT32_ENTRY_MASK;
|
||||||
#else
|
#else
|
||||||
FatEntry = *FatBuffer;
|
FatEntry = *((PULONG)FatBuffer);
|
||||||
FatBuffer += 1;
|
FatBuffer += 2; /* PUSHORT FatBuffer */
|
||||||
FatEntry = FatEntry & FAT32_ENTRY_MASK;
|
FatEntry = FatEntry & FAT32_ENTRY_MASK;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -5173,14 +5173,14 @@ Return Value:
|
||||||
// If the entry is marked bad, add it to the bad block MCB
|
// If the entry is marked bad, add it to the bad block MCB
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((SetupWindows || (Vcb->NumberOfWindows == 1)) &&
|
if ((SetupWindows || (Vcb->NumberOfWindows == 1)) &&
|
||||||
(FatInterpretClusterType( Vcb, FatEntry ) == FatClusterBad)) {
|
(FatInterpretClusterType( Vcb, FatEntry ) == FatClusterBad)) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// This cluster is marked bad.
|
// This cluster is marked bad.
|
||||||
// Add it to the BadBlockMcb.
|
// Add it to the BadBlockMcb.
|
||||||
//
|
//
|
||||||
|
|
||||||
Lbo = FatGetLboFromIndex( Vcb, FatIndex );
|
Lbo = FatGetLboFromIndex( Vcb, FatIndex );
|
||||||
FatAddMcbEntry( Vcb, &Vcb->BadBlockMcb, BadClusterVbo, Lbo, ClusterSize );
|
FatAddMcbEntry( Vcb, &Vcb->BadBlockMcb, BadClusterVbo, Lbo, ClusterSize );
|
||||||
BadClusterVbo += ClusterSize;
|
BadClusterVbo += ClusterSize;
|
||||||
|
@ -5190,9 +5190,9 @@ Return Value:
|
||||||
//
|
//
|
||||||
// If we finished the scan, then we know about all the possible bad clusters.
|
// If we finished the scan, then we know about all the possible bad clusters.
|
||||||
//
|
//
|
||||||
|
|
||||||
SetFlag( Vcb->VcbState, VCB_STATE_FLAG_BAD_BLOCKS_POPULATED);
|
SetFlag( Vcb->VcbState, VCB_STATE_FLAG_BAD_BLOCKS_POPULATED);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now we have to record the final run we encountered
|
// Now we have to record the final run we encountered
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue