Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

resrcsup.c File Reference

#include "UdfProcs.h"

Go to the source code of this file.

Defines

#define BugCheckFileId   (UDFS_BUG_CHECK_RESRCSUP)
#define Dbg   (UDFS_DEBUG_LEVEL_RESRCSUP)

Functions

BOOLEAN UdfAcquireResource (IN PIRP_CONTEXT IrpContext, IN PERESOURCE Resource, IN BOOLEAN IgnoreWait, IN TYPE_OF_ACQUIRE Type)
BOOLEAN UdfAcquireForCache (IN PFCB Fcb, IN BOOLEAN Wait)
VOID UdfReleaseFromCache (IN PFCB Fcb)
BOOLEAN UdfNoopAcquire (IN PVOID Fcb, IN BOOLEAN Wait)
VOID UdfNoopRelease (IN PVOID Fcb)
VOID UdfAcquireForCreateSection (IN PFILE_OBJECT FileObject)
VOID UdfReleaseForCreateSection (IN PFILE_OBJECT FileObject)


Define Documentation

#define BugCheckFileId   (UDFS_BUG_CHECK_RESRCSUP)
 

Definition at line 27 of file resrcsup.c.

#define Dbg   (UDFS_DEBUG_LEVEL_RESRCSUP)
 

Definition at line 33 of file resrcsup.c.


Function Documentation

BOOLEAN UdfAcquireForCache IN PFCB  Fcb,
IN BOOLEAN  Wait
 

Definition at line 136 of file resrcsup.c.

References ASSERT, ExAcquireResourceShared, FSRTL_CACHE_TOP_LEVEL_IRP, IoGetTopLevelIrp(), IoSetTopLevelIrp(), NULL, and PAGED_CODE.

Referenced by UdfInitializeGlobalData().

00143 : 00144 00145 The address of this routine is specified when creating a CacheMap for 00146 a file. It is subsequently called by the Lazy Writer for synchronization. 00147 00148 Arguments: 00149 00150 Fcb - The pointer supplied as context to the cache initialization 00151 routine. 00152 00153 Wait - TRUE if the caller is willing to block. 00154 00155 Return Value: 00156 00157 None 00158 00159 --*/ 00160 00161 { 00162 PAGED_CODE(); 00163 00164 ASSERT(IoGetTopLevelIrp() == NULL); 00165 IoSetTopLevelIrp((PIRP)FSRTL_CACHE_TOP_LEVEL_IRP); 00166 00167 return ExAcquireResourceShared( Fcb->Resource, Wait ); 00168 }

VOID UdfAcquireForCreateSection IN PFILE_OBJECT  FileObject  ) 
 

Definition at line 267 of file resrcsup.c.

References ExAcquireResourceExclusive, PAGED_CODE, and TRUE.

Referenced by UdfInitializeGlobalData().

00273 : 00274 00275 This is the callback routine for MM to use to acquire the file exclusively. 00276 00277 Arguments: 00278 00279 FileObject - File object for a Udffs stream. 00280 00281 Return Value: 00282 00283 None 00284 00285 --*/ 00286 00287 { 00288 PAGED_CODE(); 00289 00290 // 00291 // Get the file resource exclusively. 00292 // 00293 00294 ExAcquireResourceExclusive( &((PFCB) FileObject->FsContext)->FcbNonpaged->FcbResource, 00295 TRUE ); 00296 00297 return; 00298 }

BOOLEAN UdfAcquireResource IN PIRP_CONTEXT  IrpContext,
IN PERESOURCE  Resource,
IN BOOLEAN  IgnoreWait,
IN TYPE_OF_ACQUIRE  Type
 

Definition at line 47 of file resrcsup.c.

References AcquireExclusive, AcquireShared, AcquireSharedStarveExclusive, ASSERT, ExAcquireResourceExclusive, ExAcquireResourceShared, ExAcquireSharedStarveExclusive(), FALSE, FlagOn, IRP_CONTEXT_FLAG_WAIT, PAGED_CODE, Resource, TRUE, TYPE_OF_ACQUIRE, and UdfRaiseStatus().

00056 : 00057 00058 This is the single routine used to acquire file system resources. It 00059 looks at the IgnoreWait flag to determine whether to try to acquire the 00060 resource without waiting. Returning TRUE/FALSE to indicate success or 00061 failure. Otherwise it is driven by the WAIT flag in the IrpContext and 00062 will raise CANT_WAIT on a failure. 00063 00064 Arguments: 00065 00066 Resource - This is the resource to try and acquire. 00067 00068 IgnoreWait - If TRUE then this routine will not wait to acquire the 00069 resource and will return a boolean indicating whether the resource was 00070 acquired. Otherwise we use the flag in the IrpContext and raise 00071 if the resource is not acquired. 00072 00073 Type - Indicates how we should try to get the resource. 00074 00075 Return Value: 00076 00077 BOOLEAN - TRUE if the resource is acquired. FALSE if not acquired and 00078 IgnoreWait is specified. Otherwise we raise CANT_WAIT. 00079 00080 --*/ 00081 00082 { 00083 BOOLEAN Wait = FALSE; 00084 BOOLEAN Acquired; 00085 PAGED_CODE(); 00086 00087 // 00088 // We look first at the IgnoreWait flag, next at the flag in the Irp 00089 // Context to decide how to acquire this resource. 00090 // 00091 00092 if (!IgnoreWait && FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT )) { 00093 00094 Wait = TRUE; 00095 } 00096 00097 // 00098 // Attempt to acquire the resource either shared or exclusively. 00099 // 00100 00101 switch (Type) { 00102 case AcquireExclusive: 00103 00104 Acquired = ExAcquireResourceExclusive( Resource, Wait ); 00105 break; 00106 00107 case AcquireShared: 00108 00109 Acquired = ExAcquireResourceShared( Resource, Wait ); 00110 break; 00111 00112 case AcquireSharedStarveExclusive: 00113 00114 Acquired = ExAcquireSharedStarveExclusive( Resource, Wait ); 00115 break; 00116 00117 default: 00118 ASSERT( FALSE ); 00119 } 00120 00121 // 00122 // If not acquired and the user didn't specifiy IgnoreWait then 00123 // raise CANT_WAIT. 00124 // 00125 00126 if (!Acquired && !IgnoreWait) { 00127 00128 UdfRaiseStatus( IrpContext, STATUS_CANT_WAIT ); 00129 } 00130 00131 return Acquired; 00132 }

BOOLEAN UdfNoopAcquire IN PVOID  Fcb,
IN BOOLEAN  Wait
 

Definition at line 208 of file resrcsup.c.

References PAGED_CODE, and TRUE.

Referenced by UdfInitializeGlobalData().

00215 : 00216 00217 This routine does nothing. 00218 00219 Arguments: 00220 00221 Fcb - The Fcb/Vcb which was specified as a context parameter for this 00222 routine. 00223 00224 Wait - TRUE if the caller is willing to block. 00225 00226 Return Value: 00227 00228 TRUE 00229 00230 --*/ 00231 00232 { 00233 PAGED_CODE(); 00234 return TRUE; 00235 }

VOID UdfNoopRelease IN PVOID  Fcb  ) 
 

Definition at line 239 of file resrcsup.c.

References PAGED_CODE.

Referenced by UdfInitializeGlobalData().

00245 : 00246 00247 This routine does nothing. 00248 00249 Arguments: 00250 00251 Fcb - The Fcb/Vcb which was specified as a context parameter for this 00252 routine. 00253 00254 Return Value: 00255 00256 None 00257 00258 --*/ 00259 00260 { 00261 PAGED_CODE(); 00262 return; 00263 }

VOID UdfReleaseForCreateSection IN PFILE_OBJECT  FileObject  ) 
 

Definition at line 302 of file resrcsup.c.

References ExReleaseResource, and PAGED_CODE.

Referenced by UdfInitializeGlobalData().

00308 : 00309 00310 This is the callback routine for MM to use to release a file acquired with 00311 the AcquireForCreateSection call above. 00312 00313 Arguments: 00314 00315 FileObject - File object for a Udffs stream. 00316 00317 Return Value: 00318 00319 None 00320 00321 --*/ 00322 00323 { 00324 PAGED_CODE(); 00325 00326 // 00327 // Release the resource in the Fcb. 00328 // 00329 00330 ExReleaseResource( &((PFCB) FileObject->FsContext)->FcbNonpaged->FcbResource ); 00331 00332 return; 00333 } }

VOID UdfReleaseFromCache IN PFCB  Fcb  ) 
 

Definition at line 172 of file resrcsup.c.

References ASSERT, ExReleaseResource, FSRTL_CACHE_TOP_LEVEL_IRP, IoGetTopLevelIrp(), IoSetTopLevelIrp(), NULL, and PAGED_CODE.

Referenced by UdfInitializeGlobalData().

00178 : 00179 00180 The address of this routine is specified when creating a CacheMap for 00181 a virtual file. It is subsequently called by the Lazy Writer to release 00182 a resource acquired above. 00183 00184 Arguments: 00185 00186 Fcb - The pointer supplied as context to the cache initialization 00187 routine. 00188 00189 Return Value: 00190 00191 None 00192 00193 --*/ 00194 00195 { 00196 PAGED_CODE(); 00197 00198 ASSERT(IoGetTopLevelIrp() == (PIRP)FSRTL_CACHE_TOP_LEVEL_IRP); 00199 IoSetTopLevelIrp( NULL ); 00200 00201 ExReleaseResource( Fcb->Resource ); 00202 00203 return; 00204 }


Generated on Sat May 15 19:45:29 2004 for test by doxygen 1.3.7