ReactOS  0.4.13-dev-39-g8b6696f
cmcb.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYRIGHT.TXT
3  * PROJECT: Ext2 File System Driver for WinNT/2K/XP
4  * FILE: cmcb.c
5  * PROGRAMMER: Matt Wu <mattwu@163.com>
6  * HOMEPAGE: http://www.ext2fsd.com
7  * UPDATE HISTORY:
8  */
9 
10 /* INCLUDES *****************************************************************/
11 
12 #include "ext2fs.h"
13 
14 /* GLOBALS ***************************************************************/
15 
17 
18 /* DEFINITIONS *************************************************************/
19 
20 #define CMCB_DEBUG_LEVEL DL_NVR
21 
25  IN BOOLEAN Wait)
26 {
27  //
28  // On a readonly filesystem this function still has to exist but it
29  // doesn't need to do anything.
30 
31  PEXT2_FCB Fcb;
32 
33  Fcb = (PEXT2_FCB) Context;
34  ASSERT(Fcb != NULL);
36  (Fcb->Identifier.Size == sizeof(EXT2_FCB)));
37 #if EXT2_DEBUG
38  DEBUG(CMCB_DEBUG_LEVEL, ("Ext2AcquireForLazyWrite: %s %s Fcb=%p\n",
39  Ext2GetCurrentProcessName(), "ACQUIRE_FOR_LAZY_WRITE", Fcb));
40 #endif
41  if (!ExAcquireResourceExclusiveLite(Fcb->Header.Resource, Wait)) {
42  return FALSE;
43  }
44 
45  ASSERT(Fcb->LazyWriterThread == NULL);
46  Fcb->LazyWriterThread = PsGetCurrentThread();
47 
50 
51  return TRUE;
52 }
53 
54 VOID NTAPI
56 {
57  //
58  // On a readonly filesystem this function still has to exist but it
59  // doesn't need to do anything.
61 
62  ASSERT(Fcb != NULL);
63 
65  (Fcb->Identifier.Size == sizeof(EXT2_FCB)));
66 #if EXT2_DEBUG
67  DEBUG(CMCB_DEBUG_LEVEL, ( "Ext2ReleaseFromLazyWrite: %s %s Fcb=%p\n",
68  Ext2GetCurrentProcessName(), "RELEASE_FROM_LAZY_WRITE", Fcb));
69 #endif
70  ASSERT(Fcb->LazyWriterThread == PsGetCurrentThread());
71  Fcb->LazyWriterThread = NULL;
72 
73  ExReleaseResourceLite(Fcb->Header.Resource);
74 
77 }
78 
81  IN BOOLEAN Wait)
82 {
84 
85  ASSERT(Fcb != NULL);
87  (Fcb->Identifier.Size == sizeof(EXT2_FCB)));
88 
89  DEBUG(CMCB_DEBUG_LEVEL, ("Ext2AcquireForReadAhead: i=%xh Fcb=%p\n",
90  Fcb->Mcb->Inode.i_ino, Fcb));
91 
92  if (!ExAcquireResourceSharedLite(Fcb->Header.Resource, Wait))
93  return FALSE;
96 
97  return TRUE;
98 }
99 
100 VOID NTAPI
102 {
104 
105  ASSERT(Fcb != NULL);
106 
107  ASSERT((Fcb->Identifier.Type == EXT2FCB) &&
108  (Fcb->Identifier.Size == sizeof(EXT2_FCB)));
109 
110  DEBUG(CMCB_DEBUG_LEVEL, ("Ext2ReleaseFromReadAhead: i=%xh Fcb=%p\n",
111  Fcb->Mcb->Inode.i_ino, Fcb));
112 
114  ExReleaseResourceLite(Fcb->Header.Resource);
115 }
116 
119  IN PVOID Fcb,
120  IN BOOLEAN Wait
121 )
122 {
125  return TRUE;
126 }
127 
128 VOID NTAPI
130  IN PVOID Fcb
131 )
132 {
135 
136  return;
137 }
138 
BOOLEAN NTAPI Ext2AcquireForReadAhead(IN PVOID Context, IN BOOLEAN Wait)
Definition: cmcb.c:80
struct _EXT2_FCB * PEXT2_FCB
#define IN
Definition: typedefs.h:38
#define TRUE
Definition: types.h:120
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
FSRTL_ADVANCED_FCB_HEADER Header
Definition: cdstruc.h:931
#define Ext2GetCurrentProcessName()
Definition: ext2fs.h:1452
BOOLEAN NTAPI Ext2AcquireForLazyWrite(IN PVOID Context, IN BOOLEAN Wait)
Definition: cmcb.c:23
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
NTFSIDENTIFIER Identifier
Definition: ntfs.h:499
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
PEXT2_GLOBAL Ext2Global
Definition: init.c:16
unsigned char BOOLEAN
#define CMCB_DEBUG_LEVEL
Definition: cmcb.c:20
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI Ext2NoOpRelease(IN PVOID Fcb)
Definition: cmcb.c:129
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)
CD_MCB Mcb
Definition: cdstruc.h:1022
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
ULONG Type
Definition: ntfs.h:95
VOID NTAPI Ext2ReleaseFromReadAhead(IN PVOID Context)
Definition: cmcb.c:101
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
BOOLEAN NTAPI Ext2NoOpAcquire(IN PVOID Fcb, IN BOOLEAN Wait)
Definition: cmcb.c:118
#define DEBUG(args)
Definition: rdesktop.h:129
_In_ PFCB Fcb
Definition: cdprocs.h:151
#define FSRTL_CACHE_TOP_LEVEL_IRP
Definition: fsrtltypes.h:60
ULONG Size
Definition: ntfs.h:96
VOID NTAPI Ext2ReleaseFromLazyWrite(IN PVOID Context)
Definition: cmcb.c:55
IN BOOLEAN Wait
Definition: fatprocs.h:1529