00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
#ifndef _LFS_
00023
#define _LFS_
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 #define SEQUENCE_NUMBER_STRIDE (512)
00074
00075 typedef USHORT UPDATE_SEQUENCE_NUMBER, *
PUPDATE_SEQUENCE_NUMBER;
00076
00077
00078
00079
00080
00081
00082
#if !defined( _AUTOCHECK_ )
00083
00084 typedef struct _MULTI_SECTOR_HEADER {
00085
00086
00087
00088
00089
00090 UCHAR
Signature[4];
00091
00092
00093
00094
00095
00096
00097
00098
00099 USHORT UpdateSequenceArrayOffset;
00100
00101
00102
00103
00104
00105 USHORT UpdateSequenceArraySize;
00106
00107 }
MULTI_SECTOR_HEADER, *
PMULTI_SECTOR_HEADER;
00108
00109
#endif
00110
00111
00112
00113
00114
00115 typedef UPDATE_SEQUENCE_NUMBER UPDATE_SEQUENCE_ARRAY[1];
00116
00117 typedef UPDATE_SEQUENCE_ARRAY *
PUPDATE_SEQUENCE_ARRAY;
00118
00119
00120
00121
00122
00123
00124
00125
00126 typedef struct _LFS_WRITE_DATA {
00127
00128 LONGLONG
FileOffset;
00129 ULONG
Length;
00130 ULONG
LfsStructureSize;
00131 PVOID
Lfcb;
00132
00133 }
LFS_WRITE_DATA, *
PLFS_WRITE_DATA;
00134
00135
00136
00137
00138
00139
00140 typedef LARGE_INTEGER
LSN, *
PLSN;
00141
00142
00143
00144
00145
00146
00147 extern LSN LfsZeroLsn;
00148
00149
00150
00151
00152
00153 #define LFS_DEFAULT_LOG_PAGE_SIZE (0x1000)
00154
00155
00156
00157
00158
00159 typedef enum _LFS_RECORD_TYPE {
00160
00161
LfsClientRecord = 1,
00162
LfsClientRestart
00163
00164 }
LFS_RECORD_TYPE, *
PLFS_RECORD_TYPE;
00165
00166
00167
00168
00169
00170 typedef enum _LFS_CONTEXT_MODE {
00171
00172
LfsContextUndoNext = 1,
00173
LfsContextPrevious,
00174
LfsContextForward
00175
00176 }
LFS_CONTEXT_MODE, *
PLFS_CONTEXT_MODE;
00177
00178 typedef ULONG
TRANSACTION_ID, *
PTRANSACTION_ID;
00179
00180 typedef enum _TRANSACTION_STATE {
00181
00182
TransactionUninitialized = 0,
00183
TransactionActive,
00184
TransactionPrepared,
00185
TransactionCommitted
00186
00187 }
TRANSACTION_STATE, *
PTRANSACTION_STATE;
00188
00189 typedef enum _LFS_INFO {
00190
00191
LfsUseUsa = 1,
00192
LfsPackLog,
00193
LfsFixedPageSize
00194
00195 }
LFS_INFO, *
PLFS_INFO;
00196
00197 typedef PVOID
LFS_LOG_HANDLE, *
PLFS_LOG_HANDLE;
00198
00199 typedef PVOID
LFS_LOG_CONTEXT, *
PLFS_LOG_CONTEXT;
00200
00201
00202
00203
00204
00205
00206
00207
00208 typedef struct _LFS_WRITE_ENTRY {
00209
00210 PVOID
Buffer;
00211 ULONG
ByteLength;
00212
00213 }
LFS_WRITE_ENTRY, *
PLFS_WRITE_ENTRY;
00214
00215
00216
00217
00218
00219
00220 BOOLEAN
00221
LfsInitializeLogFileService (
00222 );
00223
00224
00225
00226
00227
00228 typedef struct _LOG_FILE_INFORMATION {
00229
00230
00231
00232
00233
00234
00235 LONGLONG
TotalAvailable;
00236
00237
00238
00239
00240
00241
00242
00243 LONGLONG
CurrentAvailable;
00244
00245
00246
00247
00248
00249
00250
00251
00252 LONGLONG
TotalUndoCommitment;
00253
00254
00255
00256
00257
00258 LONGLONG
ClientUndoCommitment;
00259
00260
00261
00262
00263
00264
00265 LSN OldestLsn;
00266 LSN LastFlushedLsn;
00267 LSN LastLsn;
00268
00269 }
LOG_FILE_INFORMATION, *
PLOG_FILE_INFORMATION;
00270
00271
VOID
00272
LfsInitializeLogFile (
00273 IN
PFILE_OBJECT LogFile,
00274 IN USHORT MaximumClients,
00275 IN ULONG LogPageSize OPTIONAL,
00276 IN LONGLONG FileSize,
00277 OUT PLFS_WRITE_DATA WriteData
00278 );
00279
00280 ULONG
00281
LfsOpenLogFile (
00282 IN
PFILE_OBJECT LogFile,
00283 IN UNICODE_STRING ClientName,
00284 IN USHORT MaximumClients,
00285 IN ULONG LogPageSize OPTIONAL,
00286 IN LONGLONG FileSize,
00287 IN OUT PLFS_INFO LfsInfo,
00288 OUT PLFS_LOG_HANDLE LogHandle,
00289 OUT PLFS_WRITE_DATA WriteData
00290 );
00291
00292
VOID
00293
LfsCloseLogFile (
00294 IN LFS_LOG_HANDLE LogHandle
00295 );
00296
00297
VOID
00298
LfsDeleteLogHandle (
00299 IN LFS_LOG_HANDLE LogHandle
00300 );
00301
00302
VOID
00303
LfsReadLogFileInformation (
00304 IN LFS_LOG_HANDLE LogHandle,
00305 IN PLOG_FILE_INFORMATION Buffer,
00306 IN OUT PULONG Length
00307 );
00308
00309 BOOLEAN
00310
LfsVerifyLogFile (
00311 IN LFS_LOG_HANDLE LogHandle,
00312 IN PVOID LogFileHeader,
00313 IN ULONG Length
00314 );
00315
00316
00317
00318
00319
00320
NTSTATUS
00321
LfsReadRestartArea (
00322 IN LFS_LOG_HANDLE LogHandle,
00323 IN OUT PULONG BufferLength,
00324 IN PVOID Buffer,
00325 OUT PLSN Lsn
00326 );
00327
00328
VOID
00329
LfsWriteRestartArea (
00330 IN LFS_LOG_HANDLE LogHandle,
00331 IN ULONG BufferLength,
00332 IN PVOID Buffer,
00333 OUT PLSN Lsn
00334 );
00335
00336
VOID
00337
LfsSetBaseLsn (
00338 IN LFS_LOG_HANDLE LogHandle,
00339 IN LSN BaseLsn
00340 );
00341
00342
00343
00344
00345
00346
00347
00348
VOID
00349
LfsResetUndoTotal (
00350 IN LFS_LOG_HANDLE LogHandle,
00351 IN ULONG NumberRecords,
00352 IN LONG ResetTotal
00353 );
00354
00355
00356
00357
00358
00359 BOOLEAN
00360
LfsWrite (
00361 IN LFS_LOG_HANDLE LogHandle,
00362 IN ULONG NumberOfWriteEntries,
00363 IN PLFS_WRITE_ENTRY WriteEntries,
00364 IN LFS_RECORD_TYPE RecordType,
00365 IN TRANSACTION_ID *TransactionId OPTIONAL,
00366 IN LSN UndoNextLsn,
00367 IN LSN PreviousLsn,
00368 IN LONG UndoRequirement,
00369 OUT PLSN Lsn
00370 );
00371
00372 BOOLEAN
00373
LfsForceWrite (
00374 IN LFS_LOG_HANDLE LogHandle,
00375 IN ULONG NumberOfWriteEntries,
00376 IN PLFS_WRITE_ENTRY WriteEntries,
00377 IN LFS_RECORD_TYPE RecordType,
00378 IN TRANSACTION_ID *TransactionId OPTIONAL,
00379 IN LSN UndoNextLsn,
00380 IN LSN PreviousLsn,
00381 IN LONG UndoRequirement,
00382 OUT PLSN Lsn
00383 );
00384
00385
VOID
00386
LfsFlushToLsn (
00387 IN LFS_LOG_HANDLE LogHandle,
00388 IN LSN Lsn
00389 );
00390
00391
VOID
00392
LfsCheckWriteRange (
00393 IN PLFS_WRITE_DATA WriteData,
00394 IN OUT PLONGLONG FlushOffset,
00395 IN OUT PULONG FlushLength
00396 );
00397
00398
00399
00400
00401
00402
VOID
00403
LfsReadLogRecord (
00404 IN LFS_LOG_HANDLE LogHandle,
00405 IN LSN FirstLsn,
00406 IN LFS_CONTEXT_MODE ContextMode,
00407 OUT PLFS_LOG_CONTEXT Context,
00408 OUT PLFS_RECORD_TYPE RecordType,
00409 OUT TRANSACTION_ID *TransactionId,
00410 OUT PLSN UndoNextLsn,
00411 OUT PLSN PreviousLsn,
00412 OUT PULONG BufferLength,
00413 OUT PVOID *Buffer
00414 );
00415
00416 BOOLEAN
00417
LfsReadNextLogRecord (
00418 IN LFS_LOG_HANDLE LogHandle,
00419 IN OUT LFS_LOG_CONTEXT Context,
00420 OUT PLFS_RECORD_TYPE RecordType,
00421 OUT TRANSACTION_ID *TransactionId,
00422 OUT PLSN UndoNextLsn,
00423 OUT PLSN PreviousLsn,
00424 OUT PLSN Lsn,
00425 OUT PULONG BufferLength,
00426 OUT PVOID *Buffer
00427 );
00428
00429
VOID
00430
LfsTerminateLogQuery (
00431 IN LFS_LOG_HANDLE LogHandle,
00432 IN LFS_LOG_CONTEXT Context
00433 );
00434
00435
LSN
00436
LfsQueryLastLsn (
00437 IN LFS_LOG_HANDLE LogHandle
00438 );
00439
00440
#endif // LFS
00441