Source code of Windows XP (NT5)
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.

91 lines
3.4 KiB

  1. /* critical section guards szDatabaseName and fWait,
  2. /* fWait gaurds hf open and close
  3. /* fLoggable is fFALSE if logging is currently OFF for database
  4. /* fDBLoggable FALSE if logging is always OFF for database
  5. /* logged modifications counter for database
  6. /**/
  7. typedef struct _fmp /* FILE MAP for database. */
  8. {
  9. HANDLE hf; /* File handle for read/write the file */
  10. BYTE *szDatabaseName; /* This database file name */
  11. BYTE *szRestorePath; /* Database restored to. */
  12. INT ffmp; /* Flags for FMP */
  13. CRIT critExtendDB;
  14. PIB *ppib; /* Exclusive open session */
  15. INT cdbidExclusive; /* Exclusive open count */
  16. BOOL fLogOn; /* Logging is on/off? used in createdb */
  17. BOOL fDBLoggable; /* Cache of pbRoot->loggable */
  18. ULONG ulDBTime; /* Timestamp from DB operations. */
  19. ULONG ulDBTimeCurrent; /* Timestamp from DB redo operations. */
  20. CHAR *szFirst; /* first db name shown in log redo. */
  21. BOOL fLogOnFirst; /* the status of first attached db */
  22. INT cDetach; /* detach operation counters. for Redo */
  23. HANDLE hfPatch; /* File handle for patch file */
  24. INT cpage; /* patch page count. */
  25. PGNO pgnoCopied; /* during backup, last copied page's # */
  26. /* 0 - no back up is going on. */
  27. #ifdef DEBUG
  28. LONG lBFFlushPattern; /* in-complete flush to simulate soft crash */
  29. BOOL fPrevVersion; /* previous release version database */
  30. #endif
  31. } FMP;
  32. extern FMP * __near rgfmp;
  33. /* flags for dbid
  34. /**/
  35. #define ffmpWait (1<<0)
  36. #define ffmpExclusive (1<<1)
  37. #define ffmpReadOnly (1<<2)
  38. #define ffmpAttached (1<<3)
  39. #define ffmpExtendingDB (1<<4)
  40. #ifdef DEBUG
  41. #define ffmpFlush (1<<5)
  42. #endif
  43. #define FDBIDWait( dbid ) ( rgfmp[dbid].ffmp & ffmpWait )
  44. #define DBIDSetWait( dbid ) ( rgfmp[dbid].ffmp |= ffmpWait )
  45. #define DBIDResetWait( dbid ) ( rgfmp[dbid].ffmp &= ~(ffmpWait) )
  46. #define FDBIDExclusive( dbid ) ( rgfmp[dbid].ffmp & ffmpExclusive )
  47. #define FDBIDExclusiveByAnotherSession( dbid, ppib ) \
  48. ( ( FDBIDExclusive( dbid ) ) \
  49. && ( rgfmp[dbid].ppib != ppib ) )
  50. #define FDBIDExclusiveBySession( dbid, ppib ) \
  51. ( ( FDBIDExclusive( dbid ) ) \
  52. && ( rgfmp[dbid].ppib == ppib ) )
  53. #define DBIDSetExclusive( dbid, ppib ) \
  54. rgfmp[dbid].ffmp |= ffmpExclusive; \
  55. rgfmp[dbid].ppib = ppib;
  56. #define DBIDResetExclusive( dbid ) ( rgfmp[dbid].ffmp &= ~(ffmpExclusive) )
  57. #define FDBIDReadOnly( dbid ) ( rgfmp[dbid].ffmp & ffmpReadOnly )
  58. #define DBIDSetReadOnly( dbid ) ( rgfmp[dbid].ffmp |= ffmpReadOnly )
  59. #define DBIDResetReadOnly( dbid ) ( rgfmp[dbid].ffmp &= ~(ffmpReadOnly) )
  60. #define FDBIDAttached( dbid ) ( rgfmp[dbid].ffmp & ffmpAttached )
  61. #define DBIDSetAttached( dbid ) ( rgfmp[dbid].ffmp |= ffmpAttached )
  62. #define DBIDResetAttached( dbid ) ( rgfmp[dbid].ffmp &= ~(ffmpAttached) )
  63. #define FDBIDExtendingDB( dbid ) ( rgfmp[dbid].ffmp & ffmpExtendingDB )
  64. #define DBIDSetExtendingDB( dbid ) ( rgfmp[dbid].ffmp |= ffmpExtendingDB )
  65. #define DBIDResetExtendingDB( dbid) ( rgfmp[dbid].ffmp &= ~(ffmpExtendingDB) )
  66. #define FDBIDFlush( dbid ) ( rgfmp[dbid].ffmp & ffmpFlush )
  67. #define DBIDSetFlush( dbid ) ( rgfmp[dbid].ffmp |= ffmpFlush )
  68. #define DBIDResetFlush( dbid ) ( rgfmp[dbid].ffmp &= ~(ffmpFlush) )
  69. #ifdef MULTI_PROCESS
  70. HANDLE Hf(DBID dbid);
  71. extern HANDLE *rghfUser;
  72. extern HANDLE __near hfLog;
  73. #else /* !MULTI_PROCESS */
  74. #define Hf(dbid) (rgfmp[dbid].hf)
  75. #endif