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

sysinit.c File Reference

#include "lfsprocs.h"

Go to the source code of this file.

Defines

#define Dbg   (DEBUG_TRACE_INITIALIZATION)
#define MODULE_POOL_TAG   ('IsfL')

Functions

BOOLEAN LfsInitializeLogFileService ()

Variables

USHORT LfsUsaSeqNumber


Define Documentation

#define Dbg   (DEBUG_TRACE_INITIALIZATION)
 

Definition at line 27 of file sysinit.c.

#define MODULE_POOL_TAG   ('IsfL')
 

Definition at line 30 of file sysinit.c.


Function Documentation

BOOLEAN LfsInitializeLogFileService  ) 
 

Definition at line 40 of file sysinit.c.

References _LFS_DATA::Buffer1, _LFS_DATA::Buffer2, _LFS_DATA::BufferLock, _LFS_DATA::BufferNotification, ClearFlag, Dbg, DebugTrace, ExInitializeFastMutex, FALSE, FlagOn, _LFS_DATA::Flags, KeInitializeEvent, KeQuerySystemTime(), _LFS_DATA::LfcbLinks, LFS_BUFFER_SIZE, LFS_DATA, LFS_DATA_INIT_FAILED, LFS_DATA_INITIALIZED, LFS_NTC_DATA, LfsAllocatePoolNoRaise, LfsData, _LFS_DATA::LfsDataLock, LfsFreePool, LfsUsaSeqNumber, _LFS_DATA::NodeByteSize, _LFS_DATA::NodeTypeCode, NULL, PAGED_CODE, PagedPool, SetFlag, TRUE, and USHORT.

00045 : 00046 00047 This routine must be called during system initialization before the 00048 first call to logging service, to allow the Log File Service to initialize 00049 its global data structures. This routine has no dependencies on other 00050 system components being initialized. 00051 00052 This routine will initialize the global structures used by the logging 00053 service and start the Lfs worker thread. 00054 00055 Arguments: 00056 00057 None 00058 00059 Return Value: 00060 00061 TRUE if initialization was successful 00062 00063 --*/ 00064 00065 { 00066 LARGE_INTEGER CurrentTime; 00067 00068 PAGED_CODE(); 00069 00070 DebugTrace( +1, Dbg, "LfsInitializeLogFileService: Enter\n", 0 ); 00071 00072 // 00073 // If the structure has already been initialized then we can return 00074 // immediately. 00075 // 00076 00077 if (LfsData.NodeTypeCode == LFS_NTC_DATA 00078 && LfsData.NodeByteSize == sizeof( LFS_DATA ) 00079 && FlagOn( LfsData.Flags, LFS_DATA_INITIALIZED )) { 00080 00081 DebugTrace( -1, Dbg, "LfsInitializeLogFileService: Exit -> %01x\n", TRUE ); 00082 00083 return TRUE; 00084 } 00085 00086 // 00087 // Zero out the structure initially. 00088 // 00089 00090 RtlZeroMemory( &LfsData, sizeof( LFS_DATA )); 00091 00092 // 00093 // Assume the operation will fail. 00094 // 00095 00096 LfsData.Flags = LFS_DATA_INIT_FAILED; 00097 00098 // 00099 // Initialize the global structure for Lfs. 00100 // 00101 00102 LfsData.NodeTypeCode = LFS_NTC_DATA; 00103 LfsData.NodeByteSize = sizeof( LFS_DATA ); 00104 00105 InitializeListHead( &LfsData.LfcbLinks ); 00106 00107 // 00108 // Initialize the synchronization objects. 00109 // 00110 00111 ExInitializeFastMutex( &LfsData.LfsDataLock ); 00112 00113 // 00114 // Initialize the buffer allocation. System will be robust enough to tolerate 00115 // allocation failures. 00116 // 00117 00118 ExInitializeFastMutex( &LfsData.BufferLock ); 00119 KeInitializeEvent( &LfsData.BufferNotification, NotificationEvent, TRUE ); 00120 LfsData.Buffer1 = LfsAllocatePoolNoRaise( PagedPool, LFS_BUFFER_SIZE ); 00121 00122 if (LfsData.Buffer1 == NULL) { 00123 00124 return FALSE; 00125 } 00126 00127 LfsData.Buffer2 = LfsAllocatePoolNoRaise( PagedPool, LFS_BUFFER_SIZE ); 00128 00129 // 00130 // Make sure we got both. 00131 // 00132 00133 if (LfsData.Buffer2 == NULL) { 00134 00135 LfsFreePool( LfsData.Buffer1 ); 00136 LfsData.Buffer1 = NULL; 00137 return FALSE; 00138 } 00139 00140 // 00141 // Initialization has been successful. 00142 // 00143 00144 ClearFlag( LfsData.Flags, LFS_DATA_INIT_FAILED ); 00145 SetFlag( LfsData.Flags, LFS_DATA_INITIALIZED ); 00146 00147 // 00148 // Get a random number as a seed for the Usa sequence numbers. Use the lower 00149 // bits of the current time. 00150 // 00151 00152 KeQuerySystemTime( &CurrentTime ); 00153 LfsUsaSeqNumber = (USHORT) CurrentTime.LowPart; 00154 00155 DebugTrace( -1, Dbg, "LfsInitializeLogFileService: Exit -> %01x\n", TRUE ); 00156 00157 return TRUE; 00158 } }


Variable Documentation

USHORT LfsUsaSeqNumber
 

Definition at line 36 of file sysinit.c.

Referenced by LfsFlushLfcb(), and LfsInitializeLogFileService().


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