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.

83 lines
2.2 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Copyright (C) Microsoft Corporation, 1991 - 1998
  4. //
  5. // File: filidmap.hxx
  6. //
  7. // Contents: FileId to wid mapping using hashed access
  8. //
  9. // History: 07-May-97 SitaramR Created
  10. //
  11. //----------------------------------------------------------------------------
  12. #pragma once
  13. #include "pershash.hxx"
  14. #include "usnlist.hxx"
  15. class CiCat;
  16. //+-------------------------------------------------------------------------
  17. //
  18. // Class: CFileIdMap
  19. //
  20. // Purpose: FileId to wid mapping using hashed access
  21. //
  22. // History: 07-May-97 SitaramR Created
  23. //
  24. //--------------------------------------------------------------------------
  25. class CFileIdMap : public CPersHash
  26. {
  27. public:
  28. CFileIdMap( CPropStoreManager & propStoreMgr );
  29. #if CIDBG == 1
  30. ~CFileIdMap()
  31. {
  32. ciDebugOut(( DEB_ITRACE,
  33. "fileidmap cache hits %d, misses %d, negative hits %d, negative misses %d\n",
  34. _cCacheHits, _cCacheMisses, _cCacheNegativeHits, _cCacheNegativeMisses ));
  35. }
  36. #endif // CIDBG == 1
  37. BOOL FastInit ( CiStorage * pStorage, ULONG version );
  38. void LongInit ( ULONG version, BOOL fDirtyShutdown );
  39. void LokFlush();
  40. WORKID LokFind( FILEID fileId, VOLUMEID volumeId );
  41. void LokAdd ( FILEID fileId, WORKID wid, VOLUMEID volumeId );
  42. void LokDelete( FILEID fileId, WORKID wid );
  43. private:
  44. unsigned HashFun ( FILEID fileId );
  45. void HashAll();
  46. void AddToCache( FILEID & fileId, WORKID wid, VOLUMEID volumeId );
  47. BOOL FindInCache( FILEID & fileId, VOLUMEID volumeId, WORKID & wid );
  48. void RemoveFromCache( FILEID & fileId, WORKID wid );
  49. struct SFileIdMapEntry
  50. {
  51. FILEID fileId;
  52. WORKID wid;
  53. VOLUMEID volumeId;
  54. };
  55. enum { cFileIdMapCacheEntries = 6 };
  56. SFileIdMapEntry _aCache[ cFileIdMapCacheEntries ];
  57. unsigned _cCacheEntries;
  58. #if CIDBG == 1
  59. unsigned _cCacheHits;
  60. unsigned _cCacheNegativeHits;
  61. unsigned _cCacheMisses;
  62. unsigned _cCacheNegativeMisses;
  63. #endif // CIDBG == 1
  64. };