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.

162 lines
2.7 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. dcache.hxx
  5. Abstract:
  6. This class models a general cache for reading and writing.
  7. The actual implementation of this base class is to not have
  8. any cache at all.
  9. --*/
  10. #if !defined(_DRIVE_CACHE_DEFN_)
  11. #define _DRIVE_CACHE_DEFN_
  12. #include "bigint.hxx"
  13. #include "drive.hxx"
  14. DECLARE_CLASS(DRIVE_CACHE);
  15. class DRIVE_CACHE : public OBJECT {
  16. public:
  17. DECLARE_CONSTRUCTOR( DRIVE_CACHE );
  18. VIRTUAL
  19. ~DRIVE_CACHE(
  20. );
  21. NONVIRTUAL
  22. BOOLEAN
  23. Initialize(
  24. IN OUT PIO_DP_DRIVE Drive
  25. );
  26. VIRTUAL
  27. BOOLEAN
  28. Read(
  29. IN BIG_INT StartingSector,
  30. IN SECTORCOUNT NumberOfSectors,
  31. OUT PVOID Buffer
  32. );
  33. VIRTUAL
  34. BOOLEAN
  35. Write(
  36. IN BIG_INT StartingSector,
  37. IN SECTORCOUNT NumberOfSectors,
  38. IN PVOID Buffer
  39. );
  40. VIRTUAL
  41. BOOLEAN
  42. Flush(
  43. );
  44. protected:
  45. NONVIRTUAL
  46. BOOLEAN
  47. HardRead(
  48. IN BIG_INT StartingSector,
  49. IN SECTORCOUNT NumberOfSectors,
  50. OUT PVOID Buffer
  51. );
  52. NONVIRTUAL
  53. BOOLEAN
  54. HardWrite(
  55. IN BIG_INT StartingSector,
  56. IN SECTORCOUNT NumberOfSectors,
  57. IN PVOID Buffer
  58. );
  59. private:
  60. NONVIRTUAL
  61. VOID
  62. Construct(
  63. );
  64. NONVIRTUAL
  65. VOID
  66. Destroy(
  67. );
  68. PIO_DP_DRIVE _drive;
  69. };
  70. INLINE
  71. BOOLEAN
  72. DRIVE_CACHE::HardRead(
  73. IN BIG_INT StartingSector,
  74. IN SECTORCOUNT NumberOfSectors,
  75. OUT PVOID Buffer
  76. )
  77. /*++
  78. Routine Description:
  79. This routine reads the requested sectors directly from the disk.
  80. Arguments:
  81. StartingSector - Supplies the first sector to be read.
  82. NumberOfSectors - Supplies the number of sectors to be read.
  83. Buffer - Supplies the buffer to read the run of sectors to.
  84. Return Value:
  85. FALSE - Failure.
  86. TRUE - Success.
  87. --*/
  88. {
  89. return DRIVE_CACHE::Read(StartingSector, NumberOfSectors, Buffer);
  90. }
  91. INLINE
  92. BOOLEAN
  93. DRIVE_CACHE::HardWrite(
  94. IN BIG_INT StartingSector,
  95. IN SECTORCOUNT NumberOfSectors,
  96. IN PVOID Buffer
  97. )
  98. /*++
  99. Routine Description:
  100. This routine writes the requested sectors directly to the disk.
  101. Arguments:
  102. StartingSector - Supplies the first sector to be written.
  103. NumberOfSectors - Supplies the number of sectors to be written.
  104. Buffer - Supplies the buffer to write the run of sectors from.
  105. Return Value:
  106. FALSE - Failure.
  107. TRUE - Success.
  108. --*/
  109. {
  110. return DRIVE_CACHE::Write(StartingSector, NumberOfSectors, Buffer);
  111. }
  112. #endif // _DRIVE_CACHE_DEFN_