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.

166 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. Author:
  10. Norbert Kusters (norbertk) 23-Apr-92
  11. --*/
  12. #if !defined(_DRIVE_CACHE_DEFN_)
  13. #define _DRIVE_CACHE_DEFN_
  14. #include "bigint.hxx"
  15. #include "drive.hxx"
  16. DECLARE_CLASS(DRIVE_CACHE);
  17. class DRIVE_CACHE : public OBJECT {
  18. public:
  19. DECLARE_CONSTRUCTOR( DRIVE_CACHE );
  20. VIRTUAL
  21. ~DRIVE_CACHE(
  22. );
  23. NONVIRTUAL
  24. BOOLEAN
  25. Initialize(
  26. IN OUT PIO_DP_DRIVE Drive
  27. );
  28. VIRTUAL
  29. BOOLEAN
  30. Read(
  31. IN BIG_INT StartingSector,
  32. IN SECTORCOUNT NumberOfSectors,
  33. OUT PVOID Buffer
  34. );
  35. VIRTUAL
  36. BOOLEAN
  37. Write(
  38. IN BIG_INT StartingSector,
  39. IN SECTORCOUNT NumberOfSectors,
  40. IN PVOID Buffer
  41. );
  42. VIRTUAL
  43. BOOLEAN
  44. Flush(
  45. );
  46. protected:
  47. NONVIRTUAL
  48. BOOLEAN
  49. HardRead(
  50. IN BIG_INT StartingSector,
  51. IN SECTORCOUNT NumberOfSectors,
  52. OUT PVOID Buffer
  53. );
  54. NONVIRTUAL
  55. BOOLEAN
  56. HardWrite(
  57. IN BIG_INT StartingSector,
  58. IN SECTORCOUNT NumberOfSectors,
  59. IN PVOID Buffer
  60. );
  61. private:
  62. NONVIRTUAL
  63. VOID
  64. Construct(
  65. );
  66. NONVIRTUAL
  67. VOID
  68. Destroy(
  69. );
  70. PIO_DP_DRIVE _drive;
  71. };
  72. INLINE
  73. BOOLEAN
  74. DRIVE_CACHE::HardRead(
  75. IN BIG_INT StartingSector,
  76. IN SECTORCOUNT NumberOfSectors,
  77. OUT PVOID Buffer
  78. )
  79. /*++
  80. Routine Description:
  81. This routine reads the requested sectors directly from the disk.
  82. Arguments:
  83. StartingSector - Supplies the first sector to be read.
  84. NumberOfSectors - Supplies the number of sectors to be read.
  85. Buffer - Supplies the buffer to read the run of sectors to.
  86. Return Value:
  87. FALSE - Failure.
  88. TRUE - Success.
  89. --*/
  90. {
  91. return DRIVE_CACHE::Read(StartingSector, NumberOfSectors, Buffer);
  92. }
  93. INLINE
  94. BOOLEAN
  95. DRIVE_CACHE::HardWrite(
  96. IN BIG_INT StartingSector,
  97. IN SECTORCOUNT NumberOfSectors,
  98. IN PVOID Buffer
  99. )
  100. /*++
  101. Routine Description:
  102. This routine writes the requested sectors directly to the disk.
  103. Arguments:
  104. StartingSector - Supplies the first sector to be written.
  105. NumberOfSectors - Supplies the number of sectors to be written.
  106. Buffer - Supplies the buffer to write the run of sectors from.
  107. Return Value:
  108. FALSE - Failure.
  109. TRUE - Success.
  110. --*/
  111. {
  112. return DRIVE_CACHE::Write(StartingSector, NumberOfSectors, Buffer);
  113. }
  114. #endif // _DRIVE_CACHE_DEFN_