Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
4.5 KiB

  1. /* critical section guards szDatabaseName and fWait,
  2. /* fWait gaurds hf open and close
  3. /* logged modifications counter for database
  4. /**/
  5. typedef struct _atchchk
  6. {
  7. LGPOS lgposAttach;
  8. LGPOS lgposConsistent;
  9. SIGNATURE signDb;
  10. } ATCHCHK;
  11. typedef struct _rangelock
  12. {
  13. PGNO pgnoStart;
  14. PGNO pgnoEnd;
  15. struct _rangelock *prangelockNext;
  16. } RANGELOCK;
  17. typedef struct _fmp
  18. {
  19. HANDLE hf; /* file handle for read/write the file */
  20. CHAR *szDatabaseName; /* database file name */
  21. CRIT critExtendDB; /* critical section for file extension */
  22. ULONG ulFileSizeLow; /* database file size low DWORD */
  23. ULONG ulFileSizeHigh; /* database file size high DWORD */
  24. PIB *ppib; /* exclusive open session */
  25. union {
  26. UINT fFlags;
  27. struct {
  28. UINT fWait:1; /* Semaphore for entry being used */
  29. UINT fExtendingDB:1; /* Semaphore for extending DB file */
  30. UINT fCreate:1; /* Semaphore for creating DB */
  31. UINT fExclusive:1; /* DB Opened exclusively */
  32. UINT fReadOnly:1; /* ReadOnly database? */
  33. UINT fLogOn:1; /* logging enabled flag */
  34. UINT fVersioningOff:1; /* disable versioning flag */
  35. UINT fAttachNullDb:1; /* db is missing for attachment */
  36. UINT fAttached:1; /* DB is in attached state. */
  37. UINT fFakedAttach:1; /* faked attachement during recovery */
  38. #ifdef DEBUG
  39. UINT fFlush:1; /* DB is in flushing state. */
  40. #endif
  41. };
  42. };
  43. QWORD qwDBTimeCurrent; /* timestamp from DB redo operations */
  44. ERR errPatch; /* patch file write error */
  45. HANDLE hfPatch; /* file handle for patch file */
  46. CHAR *szPatchPath;
  47. INT cpage; /* patch page count */
  48. CRIT critCheckPatch;
  49. ULONG cPatchIO; /* active IO on patch file */
  50. PGNO pgnoMost; /* pgno of last database page */
  51. /* at backup begin */
  52. PGNO pgnoCopyMost; /* pgno of last page copied during */
  53. /* backup, 0 == no backup */
  54. RANGELOCK *prangelock;
  55. ATCHCHK *patchchk;
  56. ATCHCHK *patchchkRestored;
  57. DBFILEHDR *pdbfilehdr;
  58. } FMP;
  59. extern FMP *rgfmp;
  60. #define FFMPAttached( pfmp ) ( (pfmp)->fAttached )
  61. #define FMPSetAttached( pfmp ) ( (pfmp)->fAttached = 1 )
  62. #define FMPResetAttached( pfmp ) ( (pfmp)->fAttached = 0 )
  63. #define FDBIDWait( dbid ) ( rgfmp[dbid].fWait )
  64. #define DBIDSetWait( dbid ) ( rgfmp[dbid].fWait = 1 )
  65. #define DBIDResetWait( dbid ) ( rgfmp[dbid].fWait = 0 )
  66. #define FDBIDExclusive( dbid ) ( rgfmp[dbid].fExclusive )
  67. #define FDBIDExclusiveByAnotherSession( dbid, ppib ) \
  68. ( ( FDBIDExclusive( dbid ) ) \
  69. && ( rgfmp[dbid].ppib != ppib ) )
  70. #define FDBIDExclusiveBySession( dbid, ppib ) \
  71. ( ( FDBIDExclusive( dbid ) ) \
  72. && ( rgfmp[dbid].ppib == ppib ) )
  73. #define DBIDSetExclusive( dbid, ppib ) \
  74. rgfmp[dbid].fExclusive = 1; \
  75. rgfmp[dbid].ppib = ppib;
  76. #define DBIDResetExclusive( dbid ) ( rgfmp[dbid].fExclusive = 0 )
  77. #define FDBIDReadOnly( dbid ) ( rgfmp[dbid].fReadOnly )
  78. #define DBIDSetReadOnly( dbid ) ( rgfmp[dbid].fReadOnly = 1 )
  79. #define DBIDResetReadOnly( dbid ) ( rgfmp[dbid].fReadOnly = 0 )
  80. #define FDBIDAttachNullDb( dbid ) ( rgfmp[dbid].fAttachNullDb )
  81. #define DBIDSetAttachNullDb( dbid ) ( rgfmp[dbid].fAttachNullDb = 1 )
  82. #define DBIDResetAttachNullDb( dbid ) ( rgfmp[dbid].fAttachNullDb = 0 )
  83. #define FDBIDAttached( dbid ) ( rgfmp[dbid].fAttached )
  84. #define DBIDSetAttached( dbid ) ( rgfmp[dbid].fAttached = 1 )
  85. #define DBIDResetAttached( dbid ) ( rgfmp[dbid].fAttached = 0 )
  86. #define FDBIDExtendingDB( dbid ) ( rgfmp[dbid].fExtendingDB )
  87. #define DBIDSetExtendingDB( dbid ) ( rgfmp[dbid].fExtendingDB = 1 )
  88. #define DBIDResetExtendingDB( dbid) ( rgfmp[dbid].fExtendingDB = 0 )
  89. #define FDBIDFlush( dbid ) ( rgfmp[dbid].fFlush )
  90. #define DBIDSetFlush( dbid ) ( rgfmp[dbid].fFlush = 1 )
  91. #define DBIDResetFlush( dbid ) ( rgfmp[dbid].fFlush = 0 )
  92. #define FDBIDCreate( dbid ) ( rgfmp[dbid].fCreate )
  93. #define DBIDSetCreate( dbid ) ( rgfmp[dbid].fCreate = 1 )
  94. #define DBIDResetCreate( dbid ) ( rgfmp[dbid].fCreate = 0 )
  95. #define FDBIDLogOn( dbid ) ( rgfmp[dbid].fLogOn )
  96. #define DBIDSetLogOn( dbid ) ( rgfmp[dbid].fLogOn = 1 )
  97. #define DBIDResetLogOn( dbid ) ( rgfmp[dbid].fLogOn = 0 )
  98. #define FDBIDVersioningOff( dbid ) ( rgfmp[dbid].fVersioningOff )
  99. #define DBIDSetVersioningOff( dbid ) ( rgfmp[dbid].fVersioningOff = 1 )
  100. #define DBIDResetVersioningOff( dbid ) ( rgfmp[dbid].fVersioningOff = 0 )
  101. #define HfFMPOfDbid( dbid ) ( rgfmp[dbid].hf )
  102.