ReactOS  0.4.14-dev-1007-g90d795b
mcb.c
Go to the documentation of this file.
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
23  IN VBN Vbn,
24  IN LBN Lbn,
26 {
27  /* Call the newer function */
28  return FsRtlAddLargeMcbEntry(&Mcb->
29  DummyFieldThatSizesThisStructureCorrectly,
30  (LONGLONG)Vbn,
31  (LONGLONG)Lbn,
33 }
34 
35 /*
36  * @implemented
37  */
38 BOOLEAN
39 NTAPI
42  OUT PVBN Vbn,
43  OUT PLBN Lbn,
45 {
46  BOOLEAN Return = FALSE;
47  LONGLONG llVbn;
48  LONGLONG llLbn;
49  LONGLONG llSectorCount;
50 
51  /* Call the Large version */
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
75 {
76  /* Call the newer function */
77  FsRtlInitializeLargeMcb(&Mcb->DummyFieldThatSizesThisStructureCorrectly,
78  PoolType);
79 }
80 
81 /*
82  * @implemented
83  */
84 BOOLEAN
85 NTAPI
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 */
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
114  IN VBN Vbn,
115  OUT PLBN Lbn,
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
147 {
148  /* Call the newer function */
150  &Mcb->DummyFieldThatSizesThisStructureCorrectly);
151 }
152 
153 /*
154  * @implemented
155  */
156 VOID
157 NTAPI
159  IN VBN Vbn,
161 {
162  /* Call the large function */
163  FsRtlRemoveLargeMcbEntry(&Mcb->DummyFieldThatSizesThisStructureCorrectly,
164  (LONGLONG)Vbn,
166 }
167 
168 /*
169  * @implemented
170  */
171 VOID
172 NTAPI
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
187 {
188  /* Call the newer function */
189  FsRtlUninitializeLargeMcb(&Mcb->DummyFieldThatSizesThisStructureCorrectly);
190 }
#define IN
Definition: typedefs.h:39
VOID NTAPI FsRtlTruncateMcb(IN PMCB Mcb, IN VBN Vbn)
Definition: mcb.c:173
VBN * PVBN
Definition: fsrtltypes.h:8
VOID NTAPI FsRtlRemoveLargeMcbEntry(IN PLARGE_MCB Mcb, IN LONGLONG Vbn, IN LONGLONG SectorCount)
Definition: largemcb.c:862
_Must_inspect_result_ _In_ LONGLONG _In_ LONGLONG Lbn
Definition: fsrtlfuncs.h:479
ULONG NTAPI FsRtlNumberOfRunsInLargeMcb(IN PLARGE_MCB Mcb)
Definition: largemcb.c:769
LBN * PLBN
Definition: fsrtltypes.h:5
VOID NTAPI FsRtlTruncateLargeMcb(IN PLARGE_MCB Mcb, IN LONGLONG Vbn)
Definition: largemcb.c:1016
_Must_inspect_result_ _In_ ULONG RunIndex
Definition: fsrtlfuncs.h:538
BOOLEAN NTAPI FsRtlGetNextLargeMcbEntry(IN PLARGE_MCB Mcb, IN ULONG RunIndex, OUT PLONGLONG Vbn, OUT PLONGLONG Lbn, OUT PLONGLONG SectorCount)
Definition: largemcb.c:391
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
BOOLEAN NTAPI FsRtlGetNextMcbEntry(IN PMCB Mcb, IN ULONG RunIndex, OUT PVBN Vbn, OUT PLBN Lbn, OUT PULONG SectorCount)
Definition: mcb.c:40
VOID NTAPI FsRtlUninitializeMcb(IN PMCB Mcb)
Definition: mcb.c:186
VOID NTAPI FsRtlInitializeLargeMcb(IN PLARGE_MCB Mcb, IN POOL_TYPE PoolType)
Definition: largemcb.c:450
BOOLEAN NTAPI FsRtlLookupLastLargeMcbEntry(IN PLARGE_MCB Mcb, OUT PLONGLONG Vbn, OUT PLONGLONG Lbn)
Definition: largemcb.c:722
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
BOOLEAN NTAPI FsRtlLookupMcbEntry(IN PMCB Mcb, IN VBN Vbn, OUT PLBN Lbn, OUT PULONG SectorCount OPTIONAL, OUT PULONG Index)
Definition: mcb.c:113
int64_t LONGLONG
Definition: typedefs.h:67
INT POOL_TYPE
Definition: typedefs.h:77
static const UCHAR Index[8]
Definition: usbohci.c:18
BOOLEAN NTAPI FsRtlAddLargeMcbEntry(IN PLARGE_MCB Mcb, IN LONGLONG Vbn, IN LONGLONG Lbn, IN LONGLONG SectorCount)
Definition: largemcb.c:282
BOOLEAN NTAPI FsRtlLookupLastMcbEntry(IN PMCB Mcb, OUT PVBN Vbn, OUT PLBN Lbn)
Definition: mcb.c:86
ULONG SectorCount
Definition: part_xbox.c:31
ULONG VBN
Definition: fsrtltypes.h:7
BOOLEAN NTAPI FsRtlLookupLargeMcbEntry(IN PLARGE_MCB Mcb, IN LONGLONG Vbn, OUT PLONGLONG Lbn OPTIONAL, OUT PLONGLONG SectorCountFromLbn OPTIONAL, OUT PLONGLONG StartingLbn OPTIONAL, OUT PLONGLONG SectorCountFromStartingLbn OPTIONAL, OUT PULONG Index OPTIONAL)
Definition: largemcb.c:564
IN PVCB IN ULONG IN OUT PULONG IN BOOLEAN OUT PLARGE_MCB Mcb
Definition: fatprocs.h:334
BOOLEAN NTAPI FsRtlAddMcbEntry(IN PMCB Mcb, IN VBN Vbn, IN LBN Lbn, IN ULONG SectorCount)
Definition: mcb.c:22
VOID NTAPI FsRtlUninitializeLargeMcb(IN PLARGE_MCB Mcb)
Definition: largemcb.c:1053
unsigned int * PULONG
Definition: retypes.h:1
_In_ LONGLONG Vbn
Definition: fsrtlfuncs.h:470
VOID NTAPI FsRtlRemoveMcbEntry(IN PMCB Mcb, IN VBN Vbn, IN ULONG SectorCount)
Definition: mcb.c:158
#define OUT
Definition: typedefs.h:40
unsigned int ULONG
Definition: retypes.h:1
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T _In_ POOL_TYPE PoolType
Definition: fltkernel.h:1444
ULONG NTAPI FsRtlNumberOfRunsInMcb(IN PMCB Mcb)
Definition: mcb.c:146
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
VOID NTAPI FsRtlInitializeMcb(IN PMCB Mcb, IN POOL_TYPE PoolType)
Definition: mcb.c:73