test: fsrtlp.h File Reference

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# fsrtlp.h File Reference

`#include <ntos.h>`
`#include <FsRtl.h>`
`#include <NtDdFt.h>`
`#include <zwapi.h>`

Go to the source code of this file.

## Classes

union | _UCHAR1
union | _UCHAR2
union | _UCHAR4

## Defines

#define | FsRtlAllocatePool(PoolType, NumberOfBytes)
#define | FsRtlAllocatePoolWithQuota(PoolType, NumberOfBytes)
#define | FsRtlpAllocatePool(a, b) FsRtlAllocatePoolWithTag((a),(b),MODULE_POOL_TAG)
#define | DebugTrace(INDENT, LEVEL, X, Y) {NOTHING;}
#define | DebugDump(STR, LEVEL, PTR) {NOTHING;}
#define | FlagOn(Flags, SingleFlag) ((Flags) & (SingleFlag))
#define | BooleanFlagOn(Flags, SingleFlag) ((BOOLEAN)(((Flags) & (SingleFlag)) != 0))
#define | SetFlag(F, SF)
#define | ClearFlag(F, SF)
#define | WordAlign(Ptr)
#define | LongAlign(Ptr)
#define | QuadAlign(Ptr)
#define | SectorAlign(Ptr)
#define | SectorsFromBytes(bytes)
#define | BytesFromSectors(sectors)
#define | CopyUchar1(Dst, Src)
#define | CopyUchar2(Dst, Src)
#define | CopyUchar4(Dst, Src)
#define | try_return(S) { S; goto try_exit; }

## Typedefs

typedef _UCHAR1 | UCHAR1
typedef _UCHAR1 * | PUCHAR1
typedef _UCHAR2 | UCHAR2
typedef _UCHAR2 * | PUCHAR2
typedef _UCHAR4 | UCHAR4
typedef _UCHAR4 * | PUCHAR4

## Functions

VOID | FsRtlInitializeFileLocks (VOID)
VOID | FsRtlInitializeLargeMcbs (VOID)
VOID | FsRtlInitializeTunnels (VOID)
NTSTATUS | FsRtlInitializeWorkerThread (VOID)

## Define Documentation

#define BooleanFlagOn | ( | Flags,
|  | SingleFlag |  | ) | ((BOOLEAN)(((Flags) & (SingleFlag)) != 0))

| Definition at line 170 of file fsrtlp.h.

#define BytesFromSectors | ( | sectors |  | ) |

Value:

    ( \
        (sectors) * 512                 \
        )

Definition at line 231 of file fsrtlp.h.

Referenced by UdfCommonRead(), UdfLoadSparingTables(), UdfLookupAllocation(), and UdfReadSectors().

#define ClearFlag | ( | F,
|  | SF |  | ) |

Value:

    { \
        (F) &= ~(SF);         \
    }

Definition at line 176 of file fsrtlp.h.

#define CopyUchar1 | ( | Dst,
|  | Src |  | ) |

Value:

    {                                \
        *((UCHAR1 *)(Dst)) = *((UNALIGNED UCHAR1 *)(Src)); \
        }

Definition at line 259 of file fsrtlp.h.

#define CopyUchar2 | ( | Dst,
|  | Src |  | ) |

Value:

    {                                \
        *((UCHAR2 *)(Dst)) = *((UNALIGNED UCHAR2 *)(Src)); \
        }

Definition at line 267 of file fsrtlp.h.

#define CopyUchar4 | ( | Dst,
|  | Src |  | ) |

Value:

    {                                \
        *((UCHAR4 *)(Dst)) = *((UNALIGNED UCHAR4 *)(Src)); \
        }

Definition at line 275 of file fsrtlp.h.

#define DebugDump | ( | STR,
|  | LEVEL,
|  | PTR |  | ) | {NOTHING;}

| Definition at line 134 of file fsrtlp.h.

#define DebugTrace | ( | INDENT,
|  | LEVEL,
|  | X,
|  | Y |  | ) | {NOTHING;}

| Definition at line 132 of file fsrtlp.h.

#define FlagOn | ( | Flags,
|  | SingleFlag |  | ) | ((Flags) & (SingleFlag))

| Definition at line 168 of file fsrtlp.h.

#define FsRtlAllocatePool | ( | PoolType,
|  | NumberOfBytes |  | ) |

Value:

    ExAllocatePoolWithTag((POOL_TYPE)((PoolType) | POOL_RAISE_IF_ALLOCATION_FAILURE), \
                              NumberOfBytes,                                      \
                              'trSF')

Definition at line 29 of file fsrtlp.h.

#define FsRtlAllocatePoolWithQuota | ( | PoolType,
|  | NumberOfBytes |  | ) |

Value:

    ExAllocatePoolWithQuotaTag((POOL_TYPE)((PoolType) | POOL_RAISE_IF_ALLOCATION_FAILURE), \
                                   NumberOfBytes,                                 \
                                   'trSF')

Definition at line 35 of file fsrtlp.h.

#define FsRtlpAllocatePool | ( | a,
|  | b |  | ) | FsRtlAllocatePoolWithTag((a),(b),MODULE_POOL_TAG)

| Definition at line 40 of file fsrtlp.h. Referenced by FsRtlAddLargeEntry(), FsRtlAllocateOplock(), FsRtlCancelNotify(), FsRtlInitializeLargeMcb(), FsRtlIsDbcsInExpression(), FsRtlIsNameInExpressionPrivate(), FsRtlNotifyFullChangeDirectory(), FsRtlNotifyFullReportChange(), FsRtlNotifyInitializeSync(), FsRtlpPostStackOverflow(), FsRtlTruncateLargeMcb(), and FsRtlWaitOnIrp().

#define LongAlign | ( | Ptr |  | ) |

Value:

    (                \
        ((((ULONG_PTR)(Ptr)) + 3) & -4) \
        )

Definition at line 194 of file fsrtlp.h.

Referenced by FsRtlNotifyFullReportChange(), and RtlCopySidAndAttributesArray().

#define QuadAlign | ( | Ptr |  | ) |

Value:

    (                \
        ((((ULONG_PTR)(Ptr)) + 7) & -8) \
        )

Definition at line 203 of file fsrtlp.h.

#define SectorAlign | ( | Ptr |  | ) |

Value:

    (                \
        ((((ULONG_PTR)(Ptr)) + 511) & -512) \
        )

Definition at line 212 of file fsrtlp.h.

Referenced by UdfCommonRead(), UdfInitializeAllocations(), UdfPrepareBuffers(), UdfRawBufferSize(), and UdfRawReadSize().

#define SectorsFromBytes | ( | bytes |  | ) |

Value:

    ( \
        ((bytes) + 511) / 512         \
        )

Definition at line 222 of file fsrtlp.h.

Referenced by UdfFindVolumeDescriptors(), UdfInitializeAllocations(), UdfLookupAllocation(), UdfLookupMetaVsnOfExtent(), UdfLookupPsnOfExtent(), and UdfQueryFsSizeInfo().

#define SetFlag | ( | F,
|  | SF |  | ) |

Value:

    { \
        (F) |= (SF);        \
    }

Definition at line 172 of file fsrtlp.h.

#define try_return | ( | S |  | ) | { S; goto try_exit; }

| Definition at line 308 of file fsrtlp.h.

#define WordAlign | ( | Ptr |  | ) |

Value:

    (                \
        ((((ULONG_PTR)(Ptr)) + 1) & -2) \
        )

Definition at line 185 of file fsrtlp.h.

## Typedef Documentation

typedef union _UCHAR1 * PUCHAR1

typedef union _UCHAR2 * PUCHAR2

typedef union _UCHAR4 * PUCHAR4

typedef union _UCHAR1 UCHAR1

typedef union _UCHAR2 UCHAR2

typedef union _UCHAR4 UCHAR4

## Function Documentation

VOID FsRtlInitializeFileLocks | ( | VOID |  | ) |

Definition at line 744 of file filelock.c.

References ExInitializeFastMutex, ExInitializeNPagedLookasideList(), ExInitializePagedLookasideList(), FILE_LOCK, FsRtlCreateLockInfo, FsRtlExclusiveLockLookasideList, FsRtlFileLockLookasideList, FsRtlLockInfoLookasideList, FsRtlLockTreeNodeLookasideList, FsRtlSharedLockLookasideList, FsRtlWaitingLockLookasideList, NULL, TAG_EXCLUSIVE_LOCK, TAG_FILE_LOCK, TAG_LOCK_INFO, TAG_LOCKTREE_NODE, TAG_SHARED_LOCK, and TAG_WAITING_LOCK.

Referenced by FsRtlInitSystem().

    00749                    :
    00750
    00751     Initializes the global portion of the filelock package.
    00752
    00753 Arguments:
    00754
    00755     None
    00756
    00757 Return Value:
    00758
    00759     None.
    00760
    00761 --*/
    00762 {
    00763 #ifndef USERTEST
    00764
    00765     //
    00766     //  Build the lookaside lists for our internal structures.
    00767     //
    00768
    00769     ExInitializeNPagedLookasideList( &FsRtlSharedLockLookasideList,
    00770                                      NULL,
    00771                                      NULL,
    00772                                      0,
    00773                                      sizeof(SH_LOCK),
    00774                                      TAG_SHARED_LOCK,
    00775                                      16 );
    00776
    00777     ExInitializeNPagedLookasideList( &FsRtlExclusiveLockLookasideList,
    00778                                      NULL,
    00779                                      NULL,
    00780                                      0,
    00781                                      sizeof(EX_LOCK),
    00782                                      TAG_EXCLUSIVE_LOCK,
    00783                                      16 );
    00784
    00785     ExInitializeNPagedLookasideList( &FsRtlWaitingLockLookasideList,
    00786                                      NULL,
    00787                                      NULL,
    00788                                      0,
    00789                                      sizeof(WAITING_LOCK),
    00790                                      TAG_WAITING_LOCK,
    00791                                      16 );
    00792
    00793     ExInitializeNPagedLookasideList( &FsRtlLockTreeNodeLookasideList,
    00794                                      NULL,
    00795                                      NULL,
    00796                                      0,
    00797                                      sizeof(LOCKTREE_NODE),
    00798                                      TAG_LOCKTREE_NODE,
    00799                                      16 );
    00800
    00801     ExInitializeNPagedLookasideList( &FsRtlLockInfoLookasideList,
    00802                                      NULL,
    00803                                      NULL,
    00804                                      0,
    00805                                      sizeof(LOCK_INFO),
    00806                                      TAG_LOCK_INFO,
    00807                                      8 );
    00808
    00809     ExInitializePagedLookasideList( &FsRtlFileLockLookasideList,
    00810                                     NULL,
    00811                                     NULL,
    00812                                     0,
    00813                                     sizeof(FILE_LOCK),
    00814                                     TAG_FILE_LOCK,
    00815                                     8 );
    00816
    00817     //
    00818     //  Initialize the LockInfo creation mutex
    00819     //
    00820
    00821     ExInitializeFastMutex(&FsRtlCreateLockInfo);
    00822
    00823
    00824 #endif
    00825 }

VOID FsRtlInitializeLargeMcbs | ( | VOID |  | ) |

Definition at line 521 of file largemcb.c.

References ExInitializeNPagedLookasideList(), ExInitializePagedLookasideList(), FsRtlFastMutexLookasideList, FsRtlFirstMappingLookasideList, INITIAL_MAXIMUM_PAIR_COUNT, NULL, and POOL_RAISE_IF_ALLOCATION_FAILURE.

Referenced by FsRtlInitSystem().

    00527                    :
    00528
    00529     This routine initializes the global portion of the large mcb package
    00530     at system initialization time.
    00531
    00532 Arguments:
    00533
    00534     None.
    00535
    00536 Return Value:
    00537
    00538     None.
    00539
    00540 --*/
    00541
    00542 {
    00543     //
    00544     //  Initialize the lookaside of paged initial mapping arrays.
    00545     //
    00546
    00547     ExInitializePagedLookasideList( &FsRtlFirstMappingLookasideList,
    00548                                     NULL,
    00549                                     NULL,
    00550                                     POOL_RAISE_IF_ALLOCATION_FAILURE,
    00551                                     sizeof( MAPPING ) * INITIAL_MAXIMUM_PAIR_COUNT,
    00552                                     'miSF',
    00553                                     4 );
    00554
    00555     //
    00556     //  Initialize the Fast Mutex lookaside list.
    00557     //
    00558
    00559     ExInitializeNPagedLookasideList( &FsRtlFastMutexLookasideList,
    00560                                      NULL,
    00561                                      NULL,
    00562                                      POOL_RAISE_IF_ALLOCATION_FAILURE,
    00563                                      sizeof( FAST_MUTEX),
    00564                                      'mfSF',
    00565                                      32 );
    00566
    00567
    00568 }

VOID FsRtlInitializeTunnels | ( | VOID |  | ) |

Definition at line 382 of file tunnel.c.

References ExInitializePagedLookasideList(), FsRtlGetTunnelParameterValue(), LOOKASIDE_NODE_SIZE, MAX_LOOKASIDE_DEPTH, MmIsThisAnNtAsSystem(), NULL, PAGED_CODE, TUNNEL_AGE_VALUE_NAME, TUNNEL_SIZE_VALUE_NAME, TunnelLookasideList, TunnelMaxAge, TunnelMaxEntries, USHORT, ValueName, and VOID().

Referenced by FsRtlInitSystem().

    00387                    :
    00388
    00389     Initializes the global part of the tunneling package.
    00390
    00391 Arguments:
    00392
    00393     None
    00394
    00395 Return Value:
    00396
    00397     None
    00398
    00399 --*/
    00400 {
    00401     UNICODE_STRING  ValueName;
    00402     USHORT          LookasideDepth;
    00403
    00404     PAGED_CODE();
    00405
    00406     if (MmIsThisAnNtAsSystem()) {
    00407
    00408         TunnelMaxEntries = 1024;
    00409
    00410     } else {
    00411
    00412         TunnelMaxEntries = 256;
    00413     }
    00414
    00415     TunnelMaxAge = 15;
    00416
    00417     //
    00418     //  Query our configurable parameters
    00419     //
    00420     //  Don't worry about failure in retrieving from the registry. We've gotten
    00421     //  this far so fall back on defaults even if there was a problem with resources.
    00422     //
    00423
    00424     ValueName.Buffer = TUNNEL_SIZE_VALUE_NAME;
    00425     ValueName.Length = sizeof(TUNNEL_SIZE_VALUE_NAME) - sizeof(WCHAR);
    00426     ValueName.MaximumLength = sizeof(TUNNEL_SIZE_VALUE_NAME);
    00427     (VOID) FsRtlGetTunnelParameterValue(&ValueName, &TunnelMaxEntries);
    00428
    00429     ValueName.Buffer = TUNNEL_AGE_VALUE_NAME;
    00430     ValueName.Length = sizeof(TUNNEL_AGE_VALUE_NAME) - sizeof(WCHAR);
    00431     ValueName.MaximumLength = sizeof(TUNNEL_AGE_VALUE_NAME);
    00432     (VOID) FsRtlGetTunnelParameterValue(&ValueName, &TunnelMaxAge);
    00433
    00434     if (TunnelMaxAge == 0) {
    00435
    00436         //
    00437         //  If the registry has been set so the timeout is zero, we should force
    00438         //  the number of entries to zero also. This preserves expectations and lets
    00439         //  us key off of max entries alone in performing the hard disabling of the
    00440         //  caching code.
    00441         //
    00442
    00443         TunnelMaxEntries = 0;
    00444     }
    00445
    00446     //
    00447     //  Convert from seconds to 10ths of msecs, the internal resolution
    00448     //
    00449
    00450     TunnelMaxAge *= 10000000;
    00451
    00452     //
    00453     //  Build the lookaside list for common node allocation
    00454     //
    00455
    00456     if (TunnelMaxEntries > MAXUSHORT) {
    00457
    00458         //
    00459         //  User is hinting a big need to us
    00460         //
    00461
    00462         LookasideDepth = MAX_LOOKASIDE_DEPTH;
    00463
    00464     } else {
    00465
    00466         LookasideDepth = ((USHORT)TunnelMaxEntries)/16;
    00467     }
    00468
    00469     if (LookasideDepth == 0 && TunnelMaxEntries) {
    00470
    00471         //
    00472         //  Miniscule number of entries allowed. Lookaside 'em all.
    00473         //
    00474
    00475         LookasideDepth = (USHORT)TunnelMaxEntries + 1;
    00476     }
    00477
    00478     if (LookasideDepth > MAX_LOOKASIDE_DEPTH) {
    00479
    00480         //
    00481         //  Finally, restrict the depth to something reasonable.
    00482         //
    00483
    00484         LookasideDepth = MAX_LOOKASIDE_DEPTH;
    00485     }
    00486
    00487     ExInitializePagedLookasideList( &TunnelLookasideList,
    00488                                     NULL,
    00489                                     NULL,
    00490                                     0,
    00491                                     LOOKASIDE_NODE_SIZE,
    00492                                     'LnuT',
    00493                                     LookasideDepth );
    00494
    00495     return;
    00496 }

NTSTATUS FsRtlInitializeWorkerThread | ( | VOID |  | ) |

Definition at line 99 of file stackovf.c.

References FALSE, FsRtlWorkerQueues, FsRtlWorkerThread(), KeInitializeQueue(), L, NT_SUCCESS, NULL, ObjectAttributes, PsCreateSystemThread(), and TRUE.

Referenced by FsRtlInitSystem().

    00102 {
    00103     OBJECT_ATTRIBUTES ObjectAttributes;
    00104     HANDLE Thread;
    00105     ULONG i;
    00106
    00107     //
    00108     // Create worker threads to handle normal and paging overflow reads.
    00109     //
    00110
    00111     InitializeObjectAttributes(&ObjectAttributes, NULL, 0, NULL, NULL);
    00112
    00113     for (i=0; i < 2; i++) {
    00114
    00115         //
    00116         // Initialize the FsRtl stack overflow work Queue objects.
    00117         //
    00118
    00119         KeInitializeQueue(&FsRtlWorkerQueues[i], 0);
    00120
    00121         if (!NT_SUCCESS(PsCreateSystemThread(&Thread,
    00122                                              THREAD_ALL_ACCESS,
    00123                                              &ObjectAttributes,
    00124                                              0L,
    00125                                              NULL,
    00126                                              FsRtlWorkerThread,
    00127                                              ULongToPtr( i )))) {
    00128
    00129             return FALSE;
    00130         }
    00131     }
    00132
    00133     ZwClose( Thread );
    00134
    00135     return TRUE;
    00136 }