Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
2.7 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. fcbtable.h
  5. Abstract:
  6. This module defines the data structures that facilitate management of the
  7. collection of FCB's associated with a NET_ROOT
  8. Author:
  9. Balan Sethu Raman (SethuR) 10/17/96
  10. Revision History:
  11. This was derived from the original implementation of prefix tables done
  12. by Joe Linn.
  13. --*/
  14. #ifndef _RXFCBTABLE_
  15. #define _RXFCBTABLE_
  16. typedef struct _RX_FCB_TABLE_ENTRY {
  17. // Normal Header for Refcounted Structure
  18. NODE_TYPE_CODE NodeTypeCode;
  19. NODE_BYTE_SIZE NodeByteSize;
  20. // the computed hash value
  21. ULONG HashValue;
  22. // the path associated with the FCB
  23. UNICODE_STRING Path;
  24. // the threaded list of all entries in a bucket.
  25. LIST_ENTRY HashLinks;
  26. // Statistics for amortising lookup costs
  27. LONG Lookups;
  28. } RX_FCB_TABLE_ENTRY, *PRX_FCB_TABLE_ENTRY;
  29. #define RX_FCB_TABLE_NUMBER_OF_HASH_BUCKETS 32
  30. typedef struct _RX_FCB_TABLE {
  31. // Normal Header for refcounted data structures
  32. NODE_TYPE_CODE NodeTypeCode;
  33. NODE_BYTE_SIZE NodeByteSize;
  34. // version stamp changes on each insertion/removal
  35. ULONG Version;
  36. BOOLEAN CaseInsensitiveMatch;
  37. USHORT NumberOfBuckets;
  38. // Statistics for table maintenance
  39. LONG Lookups;
  40. LONG FailedLookups;
  41. LONG Compares;
  42. // Resource used to control table access
  43. ERESOURCE TableLock;
  44. // TableEntry for the Null string
  45. PRX_FCB_TABLE_ENTRY pTableEntryForNull;
  46. // the hash buckets
  47. LIST_ENTRY HashBuckets[RX_FCB_TABLE_NUMBER_OF_HASH_BUCKETS];
  48. } RX_FCB_TABLE, *PRX_FCB_TABLE;
  49. extern VOID
  50. RxInitializeFcbTable(
  51. IN OUT PRX_FCB_TABLE pFcbTable,
  52. IN BOOLEAN CaseInsensitiveMatch);
  53. extern VOID
  54. RxFinalizeFcbTable(
  55. IN OUT PRX_FCB_TABLE pFcbTable);
  56. extern PFCB
  57. RxFcbTableLookupFcb(
  58. IN PRX_FCB_TABLE pFcbTable,
  59. IN PUNICODE_STRING pPath);
  60. extern NTSTATUS
  61. RxFcbTableInsertFcb (
  62. IN OUT PRX_FCB_TABLE pFcbTable,
  63. IN OUT PFCB pFcb);
  64. extern NTSTATUS
  65. RxFcbTableRemoveFcb (
  66. IN OUT PRX_FCB_TABLE pFcbTable,
  67. IN OUT PFCB pFcb);
  68. #define RxAcquireFcbTableLockShared(pFcbTable,Wait) \
  69. ExAcquireResourceSharedLite(&(pFcbTable)->TableLock,Wait)
  70. #define RxAcquireFcbTableLockExclusive(pFcbTable,Wait) \
  71. ExAcquireResourceExclusiveLite(&(pFcbTable)->TableLock,Wait)
  72. #define RxReleaseFcbTableLock(pFcbTable) \
  73. ExReleaseResourceLite(&(pFcbTable)->TableLock)
  74. #define RxIsFcbTableLockExclusive(PTABLE) ExIsResourceAcquiredExclusiveLite(&(PTABLE)->TableLock)
  75. #define RxIsFcbTableLockAcquired(PTABLE) ( ExIsResourceAcquiredSharedLite(&(PTABLE)->TableLock) || \
  76. ExIsResourceAcquiredExclusiveLite(&(PTABLE)->TableLock) )
  77. #endif