Leaked source code of windows server 2003
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.

160 lines
3.0 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. //
  18. // Normal Header for Refcounted Structure
  19. //
  20. NODE_TYPE_CODE NodeTypeCode;
  21. NODE_BYTE_SIZE NodeByteSize;
  22. //
  23. // the computed hash value
  24. //
  25. ULONG HashValue;
  26. //
  27. // the path associated with the FCB
  28. //
  29. UNICODE_STRING Path;
  30. //
  31. // the threaded list of all entries in a bucket.
  32. //
  33. LIST_ENTRY HashLinks;
  34. //
  35. // Statistics for amortising lookup costs
  36. //
  37. LONG Lookups;
  38. } RX_FCB_TABLE_ENTRY, *PRX_FCB_TABLE_ENTRY;
  39. #define RX_FCB_TABLE_NUMBER_OF_HASH_BUCKETS 32
  40. typedef struct _RX_FCB_TABLE {
  41. //
  42. // Normal Header for refcounted data structures
  43. //
  44. NODE_TYPE_CODE NodeTypeCode;
  45. NODE_BYTE_SIZE NodeByteSize;
  46. //
  47. // version stamp changes on each insertion/removal
  48. //
  49. ULONG Version;
  50. BOOLEAN CaseInsensitiveMatch;
  51. USHORT NumberOfBuckets;
  52. //
  53. // Statistics for table maintenance
  54. //
  55. LONG Lookups;
  56. LONG FailedLookups;
  57. LONG Compares;
  58. //
  59. // Resource used to control table access
  60. //
  61. ERESOURCE TableLock;
  62. //
  63. // TableEntry for the Null string
  64. //
  65. PRX_FCB_TABLE_ENTRY TableEntryForNull;
  66. //
  67. // the hash buckets
  68. //
  69. LIST_ENTRY HashBuckets[RX_FCB_TABLE_NUMBER_OF_HASH_BUCKETS];
  70. } RX_FCB_TABLE, *PRX_FCB_TABLE;
  71. extern
  72. VOID
  73. RxInitializeFcbTable (
  74. IN OUT PRX_FCB_TABLE FcbTable,
  75. IN BOOLEAN CaseInsensitiveMatch
  76. );
  77. extern
  78. VOID
  79. RxFinalizeFcbTable (
  80. IN OUT PRX_FCB_TABLE FcbTable
  81. );
  82. extern
  83. PFCB
  84. RxFcbTableLookupFcb (
  85. IN PRX_FCB_TABLE FcbTable,
  86. IN PUNICODE_STRING Path
  87. );
  88. extern
  89. NTSTATUS
  90. RxFcbTableInsertFcb (
  91. IN OUT PRX_FCB_TABLE FcbTable,
  92. IN OUT PFCB Fcb
  93. );
  94. extern
  95. NTSTATUS
  96. RxFcbTableRemoveFcb (
  97. IN OUT PRX_FCB_TABLE FcbTable,
  98. IN OUT PFCB Fcb
  99. );
  100. #define RxAcquireFcbTableLockShared(TABLE,WAIT) \
  101. ExAcquireResourceSharedLite( &(TABLE)->TableLock, WAIT )
  102. #define RxAcquireFcbTableLockExclusive(TABLE,WAIT) \
  103. ExAcquireResourceExclusiveLite( &(TABLE)->TableLock, WAIT )
  104. #define RxReleaseFcbTableLock(TABLE) \
  105. ExReleaseResourceLite( &(TABLE)->TableLock )
  106. #define RxIsFcbTableLockExclusive(TABLE) ExIsResourceAcquiredExclusiveLite( &(TABLE)->TableLock )
  107. #define RxIsFcbTableLockAcquired(TABLE) ( ExIsResourceAcquiredSharedLite( &(TABLE)->TableLock ) || \
  108. ExIsResourceAcquiredExclusiveLite( &(TABLE)->TableLock ) )
  109. #endif