ReactOS  0.4.13-dev-101-g0ca4b50
cmcb.c
Go to the documentation of this file.
1 /*
2  * FFS File System Driver for Windows
3  *
4  * cmcb.c
5  *
6  * 2004.5.6 ~
7  *
8  * Lee Jae-Hong, http://www.pyrasis.com
9  *
10  * See License.txt
11  *
12  */
13 
14 #include "ntifs.h"
15 #include "ffsdrv.h"
16 
17 /* Globals */
18 
19 extern PFFS_GLOBAL FFSGlobal;
20 
21 /* Definitions */
22 
23 #ifdef ALLOC_PRAGMA
24 #pragma alloc_text(PAGE, FFSAcquireForLazyWrite)
25 #pragma alloc_text(PAGE, FFSReleaseFromLazyWrite)
26 #pragma alloc_text(PAGE, FFSAcquireForReadAhead)
27 #pragma alloc_text(PAGE, FFSReleaseFromReadAhead)
28 #pragma alloc_text(PAGE, FFSNoOpAcquire)
29 #pragma alloc_text(PAGE, FFSNoOpRelease)
30 #endif
31 
32 
37  IN BOOLEAN Wait)
38 {
39  //
40  // On a readonly filesystem this function still has to exist but it
41  // doesn't need to do anything.
42 
43  PFFS_FCB Fcb;
44 
45  PAGED_CODE();
46 
47  Fcb = (PFFS_FCB)Context;
48 
49  ASSERT(Fcb != NULL);
50 
52  (Fcb->Identifier.Size == sizeof(FFS_FCB)));
53 
54  FFSPrint((DBG_INFO, "FFSAcquireForLazyWrite: %s %s %s\n",
56  "ACQUIRE_FOR_LAZY_WRITE",
57  Fcb->AnsiFileName.Buffer));
58 
59 
60  if (!IsFlagOn(Fcb->Vcb->Flags, VCB_READ_ONLY))
61  {
62  FFSPrint((DBG_INFO, "FFSAcquireForLazyWrite: Inode=%xh %S\n",
63  Fcb->FFSMcb->Inode, Fcb->FFSMcb->ShortName.Buffer));
64 
67  {
68  return FALSE;
69  }
70  }
71 
73 
75 
76  return TRUE;
77 }
78 
79 
81 VOID NTAPI
84 {
85  //
86  // On a readonly filesystem this function still has to exist but it
87  // doesn't need to do anything.
88  PFFS_FCB Fcb;
89 
90  PAGED_CODE();
91 
92  Fcb = (PFFS_FCB)Context;
93 
94  ASSERT(Fcb != NULL);
95 
97  (Fcb->Identifier.Size == sizeof(FFS_FCB)));
98 
99  FFSPrint((DBG_INFO, "FFSReleaseFromLazyWrite: %s %s %s\n",
101  "RELEASE_FROM_LAZY_WRITE",
102  Fcb->AnsiFileName.Buffer));
103 
104  if (!IsFlagOn(Fcb->Vcb->Flags, VCB_READ_ONLY))
105  {
106  FFSPrint((DBG_INFO, "FFSReleaseFromLazyWrite: Inode=%xh %S\n",
107  Fcb->FFSMcb->Inode, Fcb->FFSMcb->ShortName.Buffer));
108 
110  }
111 
113 
115 
116 }
117 
118 
122  IN PVOID Context,
123  IN BOOLEAN Wait)
124 {
125  PFFS_FCB Fcb;
126 
127  PAGED_CODE();
128 
129  Fcb = (PFFS_FCB)Context;
130 
131  ASSERT(Fcb != NULL);
132 
133  ASSERT((Fcb->Identifier.Type == FFSFCB) &&
134  (Fcb->Identifier.Size == sizeof(FFS_FCB)));
135 
136  FFSPrint((DBG_INFO, "FFSAcquireForReadAhead: Inode=%xh %S\n",
137  Fcb->FFSMcb->Inode, Fcb->FFSMcb->ShortName.Buffer));
138 
140  &Fcb->MainResource, Wait))
141  return FALSE;
142 
144 
146 
147  return TRUE;
148 }
149 
150 
152 VOID NTAPI
154  IN PVOID Context)
155 {
156  PFFS_FCB Fcb;
157 
158  PAGED_CODE();
159 
160  Fcb = (PFFS_FCB)Context;
161 
162  ASSERT(Fcb != NULL);
163 
164  ASSERT((Fcb->Identifier.Type == FFSFCB) &&
165  (Fcb->Identifier.Size == sizeof(FFS_FCB)));
166 
167  FFSPrint((DBG_INFO, "FFSReleaseFromReadAhead: Inode=%xh %S\n",
168  Fcb->FFSMcb->Inode, Fcb->FFSMcb->ShortName.Buffer));
169 
171 
173 }
174 
175 
178  IN PVOID Fcb,
179  IN BOOLEAN Wait)
180 {
183 
184  //
185  // This is a kludge because Cc is really the top level. We it
186  // enters the file system, we will think it is a resursive call
187  // and complete the request with hard errors or verify. It will
188  // have to deal with them, somehow....
189  //
190 
191  PAGED_CODE();
192 
194 
196 
197  return TRUE;
198 }
199 
200 
201 VOID NTAPI
203  IN PVOID Fcb)
204 {
205  //
206  // Clear the kludge at this point.
207  //
208 
209  PAGED_CODE();
210 
212 
214 
216 
217  return;
218 }
Definition: ffsdrv.h:281
#define IN
Definition: typedefs.h:38
#define TRUE
Definition: types.h:120
#define __drv_mustHoldCriticalRegion
Definition: ffsdrv.h:34
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
BOOLEAN NTAPI FFSNoOpAcquire(IN PVOID Fcb, IN BOOLEAN Wait)
Definition: cmcb.c:177
__drv_mustHoldCriticalRegion VOID NTAPI FFSReleaseFromReadAhead(IN PVOID Context)
Definition: cmcb.c:153
PFFS_GLOBAL FFSGlobal
Definition: init.c:22
struct _FFS_FCB * PFFS_FCB
#define PAGED_CODE()
Definition: video.h:57
__drv_mustHoldCriticalRegion VOID NTAPI FFSReleaseFromLazyWrite(IN PVOID Context)
Definition: cmcb.c:82
NTFSIDENTIFIER Identifier
Definition: ntfs.h:499
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
__drv_mustHoldCriticalRegion BOOLEAN NTAPI FFSAcquireForReadAhead(IN PVOID Context, IN BOOLEAN Wait)
Definition: cmcb.c:121
VOID NTAPI FFSNoOpRelease(IN PVOID Fcb)
Definition: cmcb.c:202
#define IsFlagOn(a, b)
Definition: ext2fs.h:177
__drv_mustHoldCriticalRegion BOOLEAN NTAPI FFSAcquireForLazyWrite(IN PVOID Context, IN BOOLEAN Wait)
Definition: cmcb.c:35
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define FFSGetCurrentProcessName()
Definition: ffsdrv.h:1070
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
ULONG Type
Definition: ntfs.h:95
ERESOURCE MainResource
Definition: ntfs.h:512
#define VCB_READ_ONLY
Definition: ext2fs.h:795
#define FFSPrint(arg)
Definition: ffsdrv.h:1047
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
ERESOURCE PagingIoResource
Definition: ntfs.h:511
PVCB Vcb
Definition: cdstruc.h:939
#define DBG_INFO
Definition: ffsdrv.h:1034
_In_ PFCB Fcb
Definition: cdprocs.h:151
#define FSRTL_CACHE_TOP_LEVEL_IRP
Definition: fsrtltypes.h:60
FILE_NAME_NODE ShortName
Definition: fatstruc.h:1111
ULONG Size
Definition: ntfs.h:96
IN BOOLEAN Wait
Definition: fatprocs.h:1529