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.

269 lines
3.9 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. secrun.hxx
  5. Abstract:
  6. This class models a run of sectors. It is able to read in a run of
  7. sectors into memory and write a run of sectors in memory onto disk.
  8. Author:
  9. Norbert P. Kusters (norbertk) 26-Nov-90
  10. --*/
  11. #if !defined(SECRUN_DEFN)
  12. #define SECRUN_DEFN
  13. #include "drive.hxx"
  14. #include "mem.hxx"
  15. #if defined ( _AUTOCHECK_ )
  16. #define IFSUTIL_EXPORT
  17. #elif defined ( _IFSUTIL_MEMBER_ )
  18. #define IFSUTIL_EXPORT __declspec(dllexport)
  19. #else
  20. #define IFSUTIL_EXPORT __declspec(dllimport)
  21. #endif
  22. DECLARE_CLASS( SECRUN );
  23. class SECRUN : public OBJECT {
  24. public:
  25. IFSUTIL_EXPORT
  26. DECLARE_CONSTRUCTOR( SECRUN );
  27. VIRTUAL
  28. IFSUTIL_EXPORT
  29. ~SECRUN(
  30. );
  31. NONVIRTUAL
  32. IFSUTIL_EXPORT
  33. BOOLEAN
  34. Initialize(
  35. IN OUT PMEM Mem,
  36. IN OUT PIO_DP_DRIVE Drive,
  37. IN BIG_INT StartSector,
  38. IN SECTORCOUNT NumSectors
  39. );
  40. NONVIRTUAL
  41. VOID
  42. Relocate(
  43. IN BIG_INT NewStartSector
  44. );
  45. VIRTUAL
  46. IFSUTIL_EXPORT
  47. BOOLEAN
  48. Read(
  49. );
  50. VIRTUAL
  51. IFSUTIL_EXPORT
  52. BOOLEAN
  53. Write(
  54. );
  55. NONVIRTUAL
  56. PVOID
  57. GetBuf(
  58. );
  59. NONVIRTUAL
  60. BIG_INT
  61. QueryStartSector(
  62. ) CONST;
  63. NONVIRTUAL
  64. LBN
  65. QueryStartLbn(
  66. ) CONST;
  67. NONVIRTUAL
  68. SECTORCOUNT
  69. QueryLength(
  70. ) CONST;
  71. NONVIRTUAL
  72. IFSUTIL_EXPORT
  73. PIO_DP_DRIVE
  74. GetDrive(
  75. );
  76. private:
  77. NONVIRTUAL
  78. VOID
  79. Construct (
  80. );
  81. NONVIRTUAL
  82. VOID
  83. Destroy(
  84. );
  85. PVOID _buf;
  86. PIO_DP_DRIVE _drive;
  87. BIG_INT _start_sector;
  88. SECTORCOUNT _num_sectors;
  89. };
  90. INLINE
  91. VOID
  92. SECRUN::Relocate(
  93. IN BIG_INT NewStartSector
  94. )
  95. /*++
  96. Routine Description:
  97. This routine relocates the secrun.
  98. Arguments:
  99. NewStartSector - Supplies the new starting sector.
  100. Return Value:
  101. None.
  102. --*/
  103. {
  104. _start_sector = NewStartSector;
  105. }
  106. INLINE
  107. PVOID
  108. SECRUN::GetBuf(
  109. )
  110. /*++
  111. Routine Description:
  112. This routine returns a pointer to the beginning of the read/write
  113. buffer.
  114. Arguments:
  115. None.
  116. Return Value:
  117. A pointer to a read/write buffer.
  118. --*/
  119. {
  120. return _buf;
  121. }
  122. INLINE
  123. BIG_INT
  124. SECRUN::QueryStartSector(
  125. ) CONST
  126. /*++
  127. Routine Description:
  128. This routine returns the starting sector number for the run of sectors.
  129. Arguments:
  130. None.
  131. Return Value:
  132. The starting sector number for the run of sectors.
  133. --*/
  134. {
  135. return _start_sector;
  136. }
  137. INLINE
  138. LBN
  139. SECRUN::QueryStartLbn(
  140. ) CONST
  141. /*++
  142. Routine Description:
  143. This routine returns the starting LBN for the run of sectors.
  144. Arguments:
  145. None.
  146. Return Value:
  147. The starting LBN for the run of sectors.
  148. --*/
  149. {
  150. DebugAssert(_start_sector.GetHighPart() == 0);
  151. return _start_sector.GetLowPart();
  152. }
  153. INLINE
  154. SECTORCOUNT
  155. SECRUN::QueryLength(
  156. ) CONST
  157. /*++
  158. Routine Description:
  159. This routine computes the number of sectors in this sector run.
  160. Arguments:
  161. None.
  162. Return Value:
  163. The number of sectors in this sector run.
  164. --*/
  165. {
  166. return _num_sectors;
  167. }
  168. INLINE
  169. PIO_DP_DRIVE
  170. SECRUN::GetDrive(
  171. )
  172. /*++
  173. Routine Description:
  174. This routine returns a pointer to the drive object.
  175. Arguments:
  176. None.
  177. Return Value:
  178. A pointer to the drive object.
  179. --*/
  180. {
  181. return _drive;
  182. }
  183. #endif // SECRUN_DEFN