xref: /reactos/sdk/include/ddk/fcbtable.h (revision c2c66aff)
1 #ifndef _RXFCBTABLE_
2 #define _RXFCBTABLE_
3 
4 typedef struct _RX_FCB_TABLE_ENTRY {
5     NODE_TYPE_CODE NodeTypeCode;
6     NODE_BYTE_SIZE NodeByteSize;
7     ULONG HashValue;
8     UNICODE_STRING Path;
9     LIST_ENTRY HashLinks;
10     LONG Lookups;
11 } RX_FCB_TABLE_ENTRY, *PRX_FCB_TABLE_ENTRY;
12 
13 #define RX_FCB_TABLE_NUMBER_OF_HASH_BUCKETS 32
14 
15 typedef struct _RX_FCB_TABLE
16 {
17     NODE_TYPE_CODE NodeTypeCode;
18     NODE_BYTE_SIZE NodeByteSize;
19     volatile ULONG Version;
20     BOOLEAN CaseInsensitiveMatch;
21     USHORT NumberOfBuckets;
22     volatile LONG Lookups;
23     volatile LONG FailedLookups;
24     volatile LONG Compares;
25     ERESOURCE TableLock;
26     PRX_FCB_TABLE_ENTRY TableEntryForNull;
27     LIST_ENTRY HashBuckets[RX_FCB_TABLE_NUMBER_OF_HASH_BUCKETS];
28 } RX_FCB_TABLE, *PRX_FCB_TABLE;
29 
30 VOID
31 RxInitializeFcbTable(
32     _Inout_ PRX_FCB_TABLE FcbTable,
33     _In_ BOOLEAN CaseInsensitiveMatch);
34 
35 VOID
36 RxFinalizeFcbTable(
37     _Inout_ PRX_FCB_TABLE FcbTable);
38 
39 PFCB
40 RxFcbTableLookupFcb(
41     _In_ PRX_FCB_TABLE FcbTable,
42     _In_ PUNICODE_STRING Path);
43 
44 NTSTATUS
45 RxFcbTableInsertFcb(
46     _Inout_ PRX_FCB_TABLE FcbTable,
47     _Inout_ PFCB Fcb);
48 
49 NTSTATUS
50 RxFcbTableRemoveFcb(
51     _Inout_ PRX_FCB_TABLE FcbTable,
52     _Inout_ PFCB Fcb);
53 
54 #define RxAcquireFcbTableLockShared(T, W) ExAcquireResourceSharedLite(&(T)->TableLock, W)
55 #define RxAcquireFcbTableLockExclusive(T, W) ExAcquireResourceExclusiveLite(&(T)->TableLock, W)
56 #define RxReleaseFcbTableLock(T) ExReleaseResourceLite(&(T)->TableLock)
57 
58 #define RxIsFcbTableLockExclusive(T) ExIsResourceAcquiredExclusiveLite(&(T)->TableLock)
59 
60 #define RxIsFcbTableLockAcquired(T) (ExIsResourceAcquiredSharedLite(&(T)->TableLock) ||  \
61                         	     ExIsResourceAcquiredExclusiveLite(&(T)->TableLock))
62 
63 #ifdef __REACTOS__
64 #define FCB_HASH_BUCKET(T, H) &(T)->HashBuckets[H % (T)->NumberOfBuckets]
65 #endif
66 
67 #endif
68