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.

137 lines
3.1 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1996.
  5. //
  6. // File: difat.hxx
  7. //
  8. // Contents: Double-indirect Fat class headers
  9. //
  10. // Classes: CDIFat
  11. // CDIFatVector
  12. //
  13. // Functions:
  14. //
  15. //--------------------------------------------------------------------------
  16. #ifndef __DIFAT_HXX__
  17. #define __DIFAT_HXX__
  18. //+-------------------------------------------------------------------------
  19. //
  20. // Class: CDIFat (dif)
  21. //
  22. // Purpose: Double Indirect Fat class for MSF
  23. //
  24. // Interface: See below.
  25. //
  26. //--------------------------------------------------------------------------
  27. class CDIFat
  28. {
  29. public:
  30. CDIFat(USHORT cbSector);
  31. inline ~CDIFat();
  32. VOID Empty(VOID);
  33. SCODE GetFatSect(const FSINDEX oSect, SECT *psect);
  34. SCODE SetFatSect(const FSINDEX oSect, const SECT sect);
  35. SCODE GetSect(const FSINDEX oSect, SECT *psect);
  36. SCODE Init(CMStream *pmsParent, const FSINDEX cFatSect);
  37. SCODE InitConvert(CMStream *pmsParent, SECT sectMax);
  38. inline SCODE InitNew(CMStream *pmsParent);
  39. SCODE Flush(void);
  40. inline void SetParent(CMStream *pms);
  41. private:
  42. CFatVector _fv;
  43. CMStream * _pmsParent;
  44. FSINDEX _cfsTable;
  45. SCODE Resize(FSINDEX fsiSize);
  46. inline VOID SectToPair(
  47. SECT sect,
  48. FSINDEX *pipfs,
  49. FSOFFSET *pisect) const;
  50. SECT PairToSect(FSINDEX ipfs, FSOFFSET isect) const;
  51. #ifdef _MSC_VER
  52. #pragma warning(disable:4512)
  53. // since there is a const member, there should be no assignment operator
  54. #endif // _MSC_VER
  55. };
  56. #ifdef _MSC_VER
  57. #pragma warning(default:4512)
  58. // since there is a const member, there should be no assignment operator
  59. #endif // _MSC_VER
  60. //+-------------------------------------------------------------------------
  61. //
  62. // Method: CDIFat::~CDIFat, public
  63. //
  64. // Synopsis: CDIFat destructor
  65. //
  66. //--------------------------------------------------------------------------
  67. inline CDIFat::~CDIFat()
  68. {
  69. msfDebugOut((DEB_TRACE,"In CDIFat destructor\n"));
  70. }
  71. inline VOID CDIFat::SectToPair(FSINDEX sect, FSINDEX *pipfs, FSOFFSET *pisect) const
  72. {
  73. msfAssert(sect >= CSECTFAT);
  74. sect = sect - CSECTFAT;
  75. *pipfs = (FSINDEX)(sect / _fv.GetSectTable());
  76. *pisect = (FSOFFSET)(sect % _fv.GetSectTable());
  77. }
  78. inline SECT CDIFat::PairToSect(FSINDEX ipfs, FSOFFSET isect) const
  79. {
  80. return ipfs * _fv.GetSectTable() + isect + CSECTFAT;
  81. }
  82. //+-------------------------------------------------------------------------
  83. //
  84. // Method: CDIFat::InitNew, public
  85. //
  86. // Synopsis: Init function for new DIFat
  87. //
  88. // Arguments: None.
  89. //
  90. // Returns: S_OK if call completed successfully.
  91. //
  92. // Algorithm: Doesn't do anything at present.
  93. //
  94. //--------------------------------------------------------------------------
  95. inline SCODE CDIFat::InitNew(CMStream *pmsParent)
  96. {
  97. _pmsParent = pmsParent;
  98. _fv.Init(_pmsParent, 0);
  99. _cfsTable = 0;
  100. return S_OK;
  101. }
  102. inline void CDIFat::SetParent(CMStream *pms)
  103. {
  104. _pmsParent = pms;
  105. _fv.SetParent(pms);
  106. }
  107. #endif //__DIFAT_HXX__