ReactOS  0.4.14-dev-606-g14ebc0b
cmcb.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: GNU GENERAL PUBLIC LICENSE VERSION 2
3  * PROJECT: ReiserFs file system driver for Windows NT/2000/XP/Vista.
4  * FILE: cmcb.c
5  * PURPOSE:
6  * PROGRAMMER: Mark Piper, Matt Wu, Bo BrantÚn.
7  * HOMEPAGE:
8  * UPDATE HISTORY:
9  */
10 
11 /* INCLUDES *****************************************************************/
12 
13 #include "rfsd.h"
14 
15 /* GLOBALS ***************************************************************/
16 
18 
19 /* DEFINITIONS *************************************************************/
20 
21 #ifdef ALLOC_PRAGMA
22 #pragma alloc_text(PAGE, RfsdAcquireForLazyWrite)
23 #pragma alloc_text(PAGE, RfsdReleaseFromLazyWrite)
24 #pragma alloc_text(PAGE, RfsdAcquireForReadAhead)
25 #pragma alloc_text(PAGE, RfsdReleaseFromReadAhead)
26 #pragma alloc_text(PAGE, RfsdNoOpAcquire)
27 #pragma alloc_text(PAGE, RfsdNoOpRelease)
28 #endif
29 
34  IN BOOLEAN Wait)
35 {
36  PRFSD_FCB Fcb;
37 
38  PAGED_CODE();
39 
40  Fcb = (PRFSD_FCB) Context;
41 
42  ASSERT(Fcb != NULL);
43 
45  (Fcb->Identifier.Size == sizeof(RFSD_FCB)));
46 
47  RfsdPrint((DBG_INFO, "RfsdAcquireForLazyWrite: %s %s %s\n",
49  "ACQUIRE_FOR_LAZY_WRITE",
50  Fcb->AnsiFileName.Buffer ));
51 
52  if (!IsFlagOn(Fcb->Vcb->Flags, VCB_READ_ONLY)) {
53  RfsdPrint(( DBG_INFO, "RfsdAcquireForLazyWrite: Key=%x,%xh %S\n",
54  Fcb->RfsdMcb->Key.k_dir_id, Fcb->RfsdMcb->Key.k_objectid, Fcb->RfsdMcb->ShortName.Buffer ));
55 
58  return FALSE;
59  }
60  }
61 
63 
65 
66  return TRUE;
67 }
68 
70 VOID NTAPI
72 {
73  PRFSD_FCB Fcb;
74 
75  PAGED_CODE();
76 
77  Fcb = (PRFSD_FCB) Context;
78 
79  ASSERT(Fcb != NULL);
80 
82  (Fcb->Identifier.Size == sizeof(RFSD_FCB)));
83 
84  RfsdPrint((DBG_INFO, "RfsdReleaseFromLazyWrite: %s %s %s\n",
86  "RELEASE_FROM_LAZY_WRITE",
87  Fcb->AnsiFileName.Buffer
88  ));
89 
90  if (!IsFlagOn(Fcb->Vcb->Flags, VCB_READ_ONLY)) {
91  RfsdPrint(( DBG_INFO, "RfsdReleaseFromLazyWrite: Inode=%x%xh %S\n",
92  Fcb->RfsdMcb->Key.k_dir_id, Fcb->RfsdMcb->Key.k_objectid, Fcb->RfsdMcb->ShortName.Buffer ));
93 
95  }
96 
98 
100 }
101 
105  IN BOOLEAN Wait)
106 {
107  PRFSD_FCB Fcb;
108 
109  PAGED_CODE();
110 
111  Fcb = (PRFSD_FCB) Context;
112 
113  ASSERT(Fcb != NULL);
114 
115  ASSERT((Fcb->Identifier.Type == RFSDFCB) &&
116  (Fcb->Identifier.Size == sizeof(RFSD_FCB)));
117 
118  RfsdPrint(( DBG_INFO, "RfsdAcquireForReadAhead: Inode=%x,%xh %S\n",
119  Fcb->RfsdMcb->Key.k_dir_id, Fcb->RfsdMcb->Key.k_objectid, Fcb->RfsdMcb->ShortName.Buffer ));
120 
122  &Fcb->MainResource, Wait ))
123  return FALSE;
124 
126 
128 
129  return TRUE;
130 }
131 
133 VOID NTAPI
135 {
136  PRFSD_FCB Fcb;
137 
138  PAGED_CODE();
139 
140  Fcb = (PRFSD_FCB) Context;
141 
142  ASSERT(Fcb != NULL);
143 
144  ASSERT((Fcb->Identifier.Type == RFSDFCB) &&
145  (Fcb->Identifier.Size == sizeof(RFSD_FCB)));
146 
147  RfsdPrint(( DBG_INFO, "RfsdReleaseFromReadAhead: Inode=%x,%xh %S\n",
148  Fcb->RfsdMcb->Key.k_dir_id, Fcb->RfsdMcb->Key.k_objectid, Fcb->RfsdMcb->ShortName.Buffer ));
149 
151 
153 }
154 
157  IN PVOID Fcb,
158  IN BOOLEAN Wait
159  )
160 {
163 
164  PAGED_CODE();
165 
166  //
167  // This is a kludge because Cc is really the top level. We it
168  // enters the file system, we will think it is a resursive call
169  // and complete the request with hard errors or verify. It will
170  // have to deal with them, somehow....
171  //
172 
174 
176 
177  return TRUE;
178 }
179 
180 VOID NTAPI
182  IN PVOID Fcb
183  )
184 {
185  PAGED_CODE();
186 
187  //
188  // Clear the kludge at this point.
189  //
190 
192 
194 
196 
197  return;
198 }
__drv_mustHoldCriticalRegion VOID NTAPI RfsdReleaseFromLazyWrite(IN PVOID Context)
Definition: cmcb.c:71
#define IN
Definition: typedefs.h:38
#define TRUE
Definition: types.h:120
__drv_mustHoldCriticalRegion BOOLEAN NTAPI RfsdAcquireForLazyWrite(IN PVOID Context, IN BOOLEAN Wait)
Definition: cmcb.c:32
#define __drv_mustHoldCriticalRegion
Definition: ffsdrv.h:34
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
__drv_mustHoldCriticalRegion VOID NTAPI RfsdReleaseFromReadAhead(IN PVOID Context)
Definition: cmcb.c:134
#define PAGED_CODE()
Definition: video.h:57
Definition: rfsd.h:324
struct _RFSD_FCB * PRFSD_FCB
NTFSIDENTIFIER Identifier
Definition: ntfs.h:511
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define IsFlagOn(a, b)
Definition: ext2fs.h:177
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define RfsdGetCurrentProcessName()
Definition: rfsd.h:1095
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
__drv_mustHoldCriticalRegion BOOLEAN NTAPI RfsdAcquireForReadAhead(IN PVOID Context, IN BOOLEAN Wait)
Definition: cmcb.c:104
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
#define RfsdPrint(arg)
Definition: rfsd.h:1069
ULONG Type
Definition: ntfs.h:95
PRFSD_GLOBAL RfsdGlobal
Definition: init.c:17
ERESOURCE MainResource
Definition: ntfs.h:524
#define VCB_READ_ONLY
Definition: ext2fs.h:795
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
ERESOURCE PagingIoResource
Definition: ntfs.h:523
PVCB Vcb
Definition: cdstruc.h:939
VOID NTAPI RfsdNoOpRelease(IN PVOID Fcb)
Definition: cmcb.c:181
#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:1114
ULONG Size
Definition: ntfs.h:96
BOOLEAN NTAPI RfsdNoOpAcquire(IN PVOID Fcb, IN BOOLEAN Wait)
Definition: cmcb.c:156
IN BOOLEAN Wait
Definition: fatprocs.h:1529