Update.
[glibc.git] / db2 / include / db_am.h
blob0c189244a2dda1d2f8e456bf3baa6f4039dfac2b
1 /*-
2 * See the file LICENSE for redistribution information.
4 * Copyright (c) 1996, 1997, 1998
5 * Sleepycat Software. All rights reserved.
7 * @(#)db_am.h 10.9 (Sleepycat) 4/10/98
8 */
9 #ifndef _DB_AM_H
10 #define _DB_AM_H
12 #define DB_ISBIG 0x01
13 #define DB_ADD_DUP 0x10
14 #define DB_REM_DUP 0x20
15 #define DB_ADD_BIG 0x30
16 #define DB_REM_BIG 0x40
17 #define DB_SPLITOLD 0x50
18 #define DB_SPLITNEW 0x60
21 * Standard initialization and shutdown macros for all recovery functions.
23 * Requires the following local variables:
25 * DB *file_dbp, *mdbp;
26 * DB_MPOOLFILE *mpf;
27 * int ret;
29 #define REC_INTRO(func) { \
30 file_dbp = mdbp = NULL; \
31 if ((ret = func(dbtp->data, &argp)) != 0) \
32 goto out; \
33 if ((ret = __db_fileid_to_db(logp, &mdbp, argp->fileid)) != 0) {\
34 if (ret == DB_DELETED) \
35 ret = 0; \
36 goto out; \
37 } \
38 if (mdbp == NULL) \
39 goto out; \
40 if (F_ISSET(mdbp, DB_AM_THREAD)) { \
41 if ((ret = __db_gethandle(mdbp, \
42 mdbp->type == DB_HASH ? __ham_hdup : __bam_bdup, \
43 &file_dbp)) != 0) \
44 goto out; \
45 } else \
46 file_dbp = mdbp; \
47 F_SET(file_dbp, DB_AM_RECOVER); \
48 mpf = file_dbp->mpf; \
50 #define REC_CLOSE { \
51 if (argp != NULL) \
52 __db_free(argp); \
53 if (file_dbp != NULL) { \
54 F_CLR(file_dbp, DB_AM_RECOVER); \
55 if (F_ISSET(file_dbp, DB_AM_THREAD)) \
56 __db_puthandle(file_dbp); \
57 } \
58 return (ret); \
62 * No-op versions of the same macros.
64 #define REC_NOOP_INTRO(func) { \
65 if ((ret = func(dbtp->data, &argp)) != 0) \
66 return (ret); \
68 #define REC_NOOP_CLOSE { \
69 if (argp != NULL) \
70 __db_free(argp); \
71 return (ret); \
75 * Standard debugging macro for all recovery functions.
77 #ifdef DEBUG_RECOVER
78 #define REC_PRINT(func) \
79 (void)func(logp, dbtp, lsnp, redo, info);
80 #else
81 #define REC_PRINT(func) \
82 COMPQUIET(info, NULL);
83 #endif
85 #include "db_auto.h"
86 #include "db_ext.h"
87 #endif