1 /* 2 * PROJECT: ReactOS Kernel 3 * LICENSE: GPL - See COPYING in the top level directory 4 * FILE: ntoskrnl/fsrtl/mcb.c 5 * PURPOSE: Mapped Control Block (MCB) support for File System Drivers 6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) 7 */ 8 9 /* INCLUDES ******************************************************************/ 10 11 #include <ntoskrnl.h> 12 #define NDEBUG 13 #include <debug.h> 14 15 /* PUBLIC FUNCTIONS **********************************************************/ 16 17 /* 18 * @implemented 19 */ 20 BOOLEAN 21 NTAPI 22 FsRtlAddMcbEntry(IN PMCB Mcb, 23 IN VBN Vbn, 24 IN LBN Lbn, 25 IN ULONG SectorCount) 26 { 27 /* Call the newer function */ 28 return FsRtlAddLargeMcbEntry(&Mcb-> 29 DummyFieldThatSizesThisStructureCorrectly, 30 (LONGLONG)Vbn, 31 (LONGLONG)Lbn, 32 (LONGLONG)SectorCount); 33 } 34 35 /* 36 * @implemented 37 */ 38 BOOLEAN 39 NTAPI 40 FsRtlGetNextMcbEntry(IN PMCB Mcb, 41 IN ULONG RunIndex, 42 OUT PVBN Vbn, 43 OUT PLBN Lbn, 44 OUT PULONG SectorCount) 45 { 46 BOOLEAN Return = FALSE; 47 LONGLONG llVbn; 48 LONGLONG llLbn; 49 LONGLONG llSectorCount; 50 51 /* Call the Large version */ 52 Return = FsRtlGetNextLargeMcbEntry( 53 &Mcb->DummyFieldThatSizesThisStructureCorrectly, 54 RunIndex, 55 &llVbn, 56 &llLbn, 57 &llSectorCount); 58 59 /* Return the lower 32 bits */ 60 *Vbn = (ULONG)llVbn; 61 *Lbn = (ULONG)llLbn; 62 *SectorCount = (ULONG)llSectorCount; 63 64 /* And return the original value */ 65 return Return; 66 } 67 68 /* 69 * @implemented 70 */ 71 VOID 72 NTAPI 73 FsRtlInitializeMcb(IN PMCB Mcb, 74 IN POOL_TYPE PoolType) 75 { 76 /* Call the newer function */ 77 FsRtlInitializeLargeMcb(&Mcb->DummyFieldThatSizesThisStructureCorrectly, 78 PoolType); 79 } 80 81 /* 82 * @implemented 83 */ 84 BOOLEAN 85 NTAPI 86 FsRtlLookupLastMcbEntry(IN PMCB Mcb, 87 OUT PVBN Vbn, 88 OUT PLBN Lbn) 89 { 90 BOOLEAN Return = FALSE; 91 LONGLONG llVbn = 0; 92 LONGLONG llLbn = 0; 93 94 /* Call the Large version */ 95 Return = FsRtlLookupLastLargeMcbEntry( 96 &Mcb->DummyFieldThatSizesThisStructureCorrectly, 97 &llVbn, 98 &llLbn); 99 100 /* Return the lower 32-bits */ 101 *Vbn = (ULONG)llVbn; 102 *Lbn = (ULONG)llLbn; 103 104 /* And return the original value */ 105 return Return; 106 } 107 108 /* 109 * @implemented 110 */ 111 BOOLEAN 112 NTAPI 113 FsRtlLookupMcbEntry(IN PMCB Mcb, 114 IN VBN Vbn, 115 OUT PLBN Lbn, 116 OUT PULONG SectorCount OPTIONAL, 117 OUT PULONG Index) 118 { 119 BOOLEAN Return = FALSE; 120 LONGLONG llLbn; 121 LONGLONG llSectorCount; 122 123 /* Call the Large version */ 124 Return = FsRtlLookupLargeMcbEntry(&Mcb-> 125 DummyFieldThatSizesThisStructureCorrectly, 126 (LONGLONG)Vbn, 127 &llLbn, 128 &llSectorCount, 129 NULL, 130 NULL, 131 Index); 132 133 /* Return the lower 32-bits */ 134 *Lbn = (ULONG)llLbn; 135 if (SectorCount) *SectorCount = (ULONG)llSectorCount; 136 137 /* And return the original value */ 138 return Return; 139 } 140 141 /* 142 * @implemented 143 */ 144 ULONG 145 NTAPI 146 FsRtlNumberOfRunsInMcb(IN PMCB Mcb) 147 { 148 /* Call the newer function */ 149 return FsRtlNumberOfRunsInLargeMcb( 150 &Mcb->DummyFieldThatSizesThisStructureCorrectly); 151 } 152 153 /* 154 * @implemented 155 */ 156 VOID 157 NTAPI 158 FsRtlRemoveMcbEntry(IN PMCB Mcb, 159 IN VBN Vbn, 160 IN ULONG SectorCount) 161 { 162 /* Call the large function */ 163 FsRtlRemoveLargeMcbEntry(&Mcb->DummyFieldThatSizesThisStructureCorrectly, 164 (LONGLONG)Vbn, 165 (LONGLONG)SectorCount); 166 } 167 168 /* 169 * @implemented 170 */ 171 VOID 172 NTAPI 173 FsRtlTruncateMcb(IN PMCB Mcb, 174 IN VBN Vbn) 175 { 176 /* Call the newer function */ 177 FsRtlTruncateLargeMcb(&Mcb->DummyFieldThatSizesThisStructureCorrectly, 178 (LONGLONG)Vbn); 179 } 180 181 /* 182 * @implemented 183 */ 184 VOID 185 NTAPI 186 FsRtlUninitializeMcb(IN PMCB Mcb) 187 { 188 /* Call the newer function */ 189 FsRtlUninitializeLargeMcb(&Mcb->DummyFieldThatSizesThisStructureCorrectly); 190 } 191