diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-01-02 06:01:06 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-01-02 06:01:06 +0000 |
commit | 8d6f1731fcd082e4f744ba9cb4bde4be7c08f1b3 (patch) | |
tree | 099a250d7366aef2ab028fdb24f0d692cd784b4a /db2/include | |
parent | 9a6450d578556c11e7c173d2f28362345b8f1258 (diff) | |
download | glibc-8d6f1731fcd082e4f744ba9cb4bde4be7c08f1b3.tar.gz glibc-8d6f1731fcd082e4f744ba9cb4bde4be7c08f1b3.tar.xz glibc-8d6f1731fcd082e4f744ba9cb4bde4be7c08f1b3.zip |
Update.
* Makeconfig (all-subdirs): Remove db and db2. * db/*: Removed. * db2/*: Removed.
Diffstat (limited to 'db2/include')
37 files changed, 0 insertions, 5322 deletions
diff --git a/db2/include/btree.h b/db2/include/btree.h deleted file mode 100644 index b0c04b1508..0000000000 --- a/db2/include/btree.h +++ /dev/null @@ -1,263 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1996, 1997, 1998 - * Sleepycat Software. All rights reserved. - */ -/* - * Copyright (c) 1990, 1993, 1994, 1995, 1996 - * Keith Bostic. All rights reserved. - */ -/* - * Copyright (c) 1990, 1993, 1994, 1995 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Mike Olson. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)btree.h 10.26 (Sleepycat) 12/16/98 - */ - -/* Forward structure declarations. */ -struct __btree; typedef struct __btree BTREE; -struct __cursor; typedef struct __cursor CURSOR; -struct __epg; typedef struct __epg EPG; -struct __recno; typedef struct __recno RECNO; - -#define DEFMINKEYPAGE (2) - -#define ISINTERNAL(p) (TYPE(p) == P_IBTREE || TYPE(p) == P_IRECNO) -#define ISLEAF(p) (TYPE(p) == P_LBTREE || TYPE(p) == P_LRECNO) - -/* - * If doing transactions we have to hold the locks associated with a data item - * from a page for the entire transaction. However, we don't have to hold the - * locks associated with walking the tree. Distinguish between the two so that - * we don't tie up the internal pages of the tree longer than necessary. - */ -#define __BT_LPUT(dbc, lock) \ - (F_ISSET((dbc)->dbp, DB_AM_LOCKING) ? \ - lock_put((dbc)->dbp->dbenv->lk_info, lock) : 0) -#define __BT_TLPUT(dbc, lock) \ - (F_ISSET((dbc)->dbp, DB_AM_LOCKING) && (dbc)->txn == NULL ? \ - lock_put((dbc)->dbp->dbenv->lk_info, lock) : 0) - -/* - * Flags to __bam_search() and __bam_rsearch(). - * - * Note, internal page searches must find the largest record less than key in - * the tree so that descents work. Leaf page searches must find the smallest - * record greater than key so that the returned index is the record's correct - * position for insertion. - * - * The flags parameter to the search routines describes three aspects of the - * search: the type of locking required (including if we're locking a pair of - * pages), the item to return in the presence of duplicates and whether or not - * to return deleted entries. To simplify both the mnemonic representation - * and the code that checks for various cases, we construct a set of bitmasks. - */ -#define S_READ 0x00001 /* Read locks. */ -#define S_WRITE 0x00002 /* Write locks. */ - -#define S_APPEND 0x00040 /* Append to the tree. */ -#define S_DELNO 0x00080 /* Don't return deleted items. */ -#define S_DUPFIRST 0x00100 /* Return first duplicate. */ -#define S_DUPLAST 0x00200 /* Return last duplicate. */ -#define S_EXACT 0x00400 /* Exact items only. */ -#define S_PARENT 0x00800 /* Lock page pair. */ -#define S_STACK 0x01000 /* Need a complete stack. */ -#define S_PAST_EOF 0x02000 /* If doing insert search (or keyfirst - * or keylast operations), or a split - * on behalf of an insert, it's okay to - * return an entry one past end-of-page. - */ - -#define S_DELETE (S_WRITE | S_DUPFIRST | S_DELNO | S_EXACT | S_STACK) -#define S_FIND (S_READ | S_DUPFIRST | S_DELNO) -#define S_FIND_WR (S_WRITE | S_DUPFIRST | S_DELNO) -#define S_INSERT (S_WRITE | S_DUPLAST | S_PAST_EOF | S_STACK) -#define S_KEYFIRST (S_WRITE | S_DUPFIRST | S_PAST_EOF | S_STACK) -#define S_KEYLAST (S_WRITE | S_DUPLAST | S_PAST_EOF | S_STACK) -#define S_WRPAIR (S_WRITE | S_DUPLAST | S_PAST_EOF | S_PARENT) - -/* - * Flags to __bam_iitem(). - */ -#define BI_DELETED 0x01 /* Key/data pair only placeholder. */ -#define BI_DOINCR 0x02 /* Increment the record count. */ -#define BI_NEWKEY 0x04 /* New key. */ - -/* - * Various routines pass around page references. A page reference can be a - * pointer to the page or a page number; for either, an indx can designate - * an item on the page. - */ -struct __epg { - PAGE *page; /* The page. */ - db_indx_t indx; /* The index on the page. */ - DB_LOCK lock; /* The page's lock. */ -}; - -/* - * We maintain a stack of the pages that we're locking in the tree. Btree's - * (currently) only save two levels of the tree at a time, so the default - * stack is always large enough. Recno trees have to lock the entire tree to - * do inserts/deletes, however. Grow the stack as necessary. - */ -#define BT_STK_CLR(c) \ - ((c)->csp = (c)->sp) - -#define BT_STK_ENTER(c, pagep, page_indx, lock, ret) do { \ - if ((ret = \ - (c)->csp == (c)->esp ? __bam_stkgrow(c) : 0) == 0) { \ - (c)->csp->page = pagep; \ - (c)->csp->indx = page_indx; \ - (c)->csp->lock = lock; \ - } \ -} while (0) - -#define BT_STK_PUSH(c, pagep, page_indx, lock, ret) do { \ - BT_STK_ENTER(c, pagep, page_indx, lock, ret); \ - ++(c)->csp; \ -} while (0) - -#define BT_STK_POP(c) \ - ((c)->csp == (c)->stack ? NULL : --(c)->csp) - -/* - * Arguments passed to __bam_ca_replace(). - */ -typedef enum { - REPLACE_SETUP, - REPLACE_SUCCESS, - REPLACE_FAILED -} ca_replace_arg; - -/* Arguments passed to __ram_ca(). */ -typedef enum { - CA_DELETE, - CA_IAFTER, - CA_IBEFORE -} ca_recno_arg; - -#define RECNO_OOB 0 /* Illegal record number. */ - -/* Btree/Recno cursor. */ -struct __cursor { - DBC *dbc; /* Enclosing DBC. */ - - /* Per-thread information: shared by btree/recno. */ - EPG *sp; /* Stack pointer. */ - EPG *csp; /* Current stack entry. */ - EPG *esp; /* End stack pointer. */ - EPG stack[5]; - - /* Per-thread information: btree private. */ - PAGE *page; /* Cursor page. */ - - db_pgno_t pgno; /* Page. */ - db_indx_t indx; /* Page item ref'd by the cursor. */ - - db_pgno_t dpgno; /* Duplicate page. */ - db_indx_t dindx; /* Page item ref'd by the cursor. */ - - DB_LOCK lock; /* Cursor read lock. */ - db_lockmode_t mode; /* Lock mode. */ - - /* Per-thread information: recno private. */ - db_recno_t recno; /* Current record number. */ - - /* - * Btree: - * We set a flag in the cursor structure if the underlying object has - * been deleted. It's not strictly necessary, we could get the same - * information by looking at the page itself. - * - * Recno: - * When renumbering recno databases during deletes, cursors referencing - * "deleted" records end up positioned between two records, and so must - * be specially adjusted on the next operation. - */ -#define C_DELETED 0x0001 /* Record was deleted. */ - u_int32_t flags; -}; - -/* - * The in-memory recno data structure. - * - * !!! - * These fields are ignored as far as multi-threading is concerned. There - * are no transaction semantics associated with backing files, nor is there - * any thread protection. - */ -struct __recno { - int re_delim; /* Variable-length delimiting byte. */ - int re_pad; /* Fixed-length padding byte. */ - u_int32_t re_len; /* Length for fixed-length records. */ - - char *re_source; /* Source file name. */ - int re_fd; /* Source file descriptor */ - db_recno_t re_last; /* Last record number read. */ - void *re_cmap; /* Current point in mapped space. */ - void *re_smap; /* Start of mapped space. */ - void *re_emap; /* End of mapped space. */ - size_t re_msize; /* Size of mapped region. */ - /* Recno input function. */ - int (*re_irec) __P((DBC *, db_recno_t)); - -#define RECNO_EOF 0x0001 /* EOF on backing source file. */ -#define RECNO_MODIFIED 0x0002 /* Tree was modified. */ - u_int32_t flags; -}; - -/* - * The in-memory, per-tree btree data structure. - */ -struct __btree { - db_pgno_t bt_lpgno; /* Last insert location. */ - - db_indx_t bt_maxkey; /* Maximum keys per page. */ - db_indx_t bt_minkey; /* Minimum keys per page. */ - - int (*bt_compare) /* Comparison function. */ - __P((const DBT *, const DBT *)); - size_t(*bt_prefix) /* Prefix function. */ - __P((const DBT *, const DBT *)); - - db_indx_t bt_ovflsize; /* Maximum key/data on-page size. */ - - RECNO *recno; /* Private recno structure. */ -}; - -#include "btree_auto.h" -#include "btree_ext.h" -#include "db_am.h" -#include "common_ext.h" diff --git a/db2/include/btree_auto.h b/db2/include/btree_auto.h deleted file mode 100644 index 041b80f196..0000000000 --- a/db2/include/btree_auto.h +++ /dev/null @@ -1,127 +0,0 @@ -/* Do not edit: automatically built by dist/db_gen.sh. */ -#ifndef bam_AUTO_H -#define bam_AUTO_H - -#define DB_bam_pg_alloc (DB_bam_BEGIN + 1) - -typedef struct _bam_pg_alloc_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - DB_LSN meta_lsn; - DB_LSN page_lsn; - db_pgno_t pgno; - u_int32_t ptype; - db_pgno_t next; -} __bam_pg_alloc_args; - - -#define DB_bam_pg_free (DB_bam_BEGIN + 2) - -typedef struct _bam_pg_free_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t pgno; - DB_LSN meta_lsn; - DBT header; - db_pgno_t next; -} __bam_pg_free_args; - - -#define DB_bam_split (DB_bam_BEGIN + 3) - -typedef struct _bam_split_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t left; - DB_LSN llsn; - db_pgno_t right; - DB_LSN rlsn; - u_int32_t indx; - db_pgno_t npgno; - DB_LSN nlsn; - DBT pg; -} __bam_split_args; - - -#define DB_bam_rsplit (DB_bam_BEGIN + 4) - -typedef struct _bam_rsplit_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t pgno; - DBT pgdbt; - db_pgno_t nrec; - DBT rootent; - DB_LSN rootlsn; -} __bam_rsplit_args; - - -#define DB_bam_adj (DB_bam_BEGIN + 5) - -typedef struct _bam_adj_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t pgno; - DB_LSN lsn; - u_int32_t indx; - u_int32_t indx_copy; - u_int32_t is_insert; -} __bam_adj_args; - - -#define DB_bam_cadjust (DB_bam_BEGIN + 6) - -typedef struct _bam_cadjust_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t pgno; - DB_LSN lsn; - u_int32_t indx; - int32_t adjust; - int32_t total; -} __bam_cadjust_args; - - -#define DB_bam_cdel (DB_bam_BEGIN + 7) - -typedef struct _bam_cdel_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t pgno; - DB_LSN lsn; - u_int32_t indx; -} __bam_cdel_args; - - -#define DB_bam_repl (DB_bam_BEGIN + 8) - -typedef struct _bam_repl_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t pgno; - DB_LSN lsn; - u_int32_t indx; - u_int32_t isdeleted; - DBT orig; - DBT repl; - u_int32_t prefix; - u_int32_t suffix; -} __bam_repl_args; - -#endif diff --git a/db2/include/btree_ext.h b/db2/include/btree_ext.h deleted file mode 100644 index fbc2ed958f..0000000000 --- a/db2/include/btree_ext.h +++ /dev/null @@ -1,132 +0,0 @@ -/* DO NOT EDIT: automatically built by dist/distrib. */ -#ifndef _btree_ext_h_ -#define _btree_ext_h_ -int __bam_cmp __P((DB *, const DBT *, - PAGE *, u_int32_t, int (*)(const DBT *, const DBT *))); -int __bam_defcmp __P((const DBT *, const DBT *)); -size_t __bam_defpfx __P((const DBT *, const DBT *)); -int __bam_pgin __P((db_pgno_t, void *, DBT *)); -int __bam_pgout __P((db_pgno_t, void *, DBT *)); -int __bam_mswap __P((PAGE *)); -int __bam_cprint __P((DB *)); -int __bam_ca_delete __P((DB *, db_pgno_t, u_int32_t, int)); -void __bam_ca_di __P((DB *, db_pgno_t, u_int32_t, int)); -void __bam_ca_dup __P((DB *, - db_pgno_t, u_int32_t, u_int32_t, db_pgno_t, u_int32_t)); -void __bam_ca_rsplit __P((DB *, db_pgno_t, db_pgno_t)); -void __bam_ca_split __P((DB *, - db_pgno_t, db_pgno_t, db_pgno_t, u_int32_t, int)); -int __bam_c_init __P((DBC *)); -int __bam_dup __P((DBC *, CURSOR *, u_int32_t, int)); -int __bam_delete __P((DB *, DB_TXN *, DBT *, u_int32_t)); -int __bam_ditem __P((DBC *, PAGE *, u_int32_t)); -int __bam_adjindx __P((DBC *, PAGE *, u_int32_t, u_int32_t, int)); -int __bam_dpage __P((DBC *, const DBT *)); -int __bam_dpages __P((DBC *)); -int __bam_open __P((DB *, DB_INFO *)); -int __bam_close __P((DB *)); -void __bam_setovflsize __P((DB *)); -int __bam_read_root __P((DB *)); -int __bam_new __P((DBC *, u_int32_t, PAGE **)); -int __bam_lput __P((DBC *, DB_LOCK)); -int __bam_free __P((DBC *, PAGE *)); -int __bam_lt __P((DBC *)); -int __bam_lget - __P((DBC *, int, db_pgno_t, db_lockmode_t, DB_LOCK *)); -int __bam_iitem __P((DBC *, - PAGE **, db_indx_t *, DBT *, DBT *, u_int32_t, u_int32_t)); -int __bam_ritem __P((DBC *, PAGE *, u_int32_t, DBT *)); -int __bam_pg_alloc_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_pg_free_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_split_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_rsplit_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_adj_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_cadjust_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_cdel_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_repl_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __ram_open __P((DB *, DB_INFO *)); -int __ram_close __P((DB *)); -int __ram_c_del __P((DBC *, u_int32_t)); -int __ram_c_get __P((DBC *, DBT *, DBT *, u_int32_t)); -int __ram_c_put __P((DBC *, DBT *, DBT *, u_int32_t)); -void __ram_ca __P((DB *, db_recno_t, ca_recno_arg)); -int __ram_getno __P((DBC *, const DBT *, db_recno_t *, int)); -int __bam_rsearch __P((DBC *, db_recno_t *, u_int32_t, int, int *)); -int __bam_adjust __P((DBC *, int32_t)); -int __bam_nrecs __P((DBC *, db_recno_t *)); -db_recno_t __bam_total __P((PAGE *)); -int __bam_search __P((DBC *, - const DBT *, u_int32_t, int, db_recno_t *, int *)); -int __bam_stkrel __P((DBC *, int)); -int __bam_stkgrow __P((CURSOR *)); -int __bam_split __P((DBC *, void *)); -int __bam_copy __P((DB *, PAGE *, PAGE *, u_int32_t, u_int32_t)); -int __bam_stat __P((DB *, void *, void *(*)(size_t), u_int32_t)); -int __bam_pg_alloc_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, DB_LSN *, DB_LSN *, db_pgno_t, - u_int32_t, db_pgno_t)); -int __bam_pg_alloc_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_pg_alloc_read __P((void *, __bam_pg_alloc_args **)); -int __bam_pg_free_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, DB_LSN *, const DBT *, - db_pgno_t)); -int __bam_pg_free_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_pg_free_read __P((void *, __bam_pg_free_args **)); -int __bam_split_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, - DB_LSN *, u_int32_t, db_pgno_t, DB_LSN *, - const DBT *)); -int __bam_split_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_split_read __P((void *, __bam_split_args **)); -int __bam_rsplit_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, const DBT *, db_pgno_t, - const DBT *, DB_LSN *)); -int __bam_rsplit_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_rsplit_read __P((void *, __bam_rsplit_args **)); -int __bam_adj_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, - u_int32_t, u_int32_t)); -int __bam_adj_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_adj_read __P((void *, __bam_adj_args **)); -int __bam_cadjust_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, - int32_t, int32_t)); -int __bam_cadjust_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_cadjust_read __P((void *, __bam_cadjust_args **)); -int __bam_cdel_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, DB_LSN *, u_int32_t)); -int __bam_cdel_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_cdel_read __P((void *, __bam_cdel_args **)); -int __bam_repl_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, - u_int32_t, const DBT *, const DBT *, u_int32_t, - u_int32_t)); -int __bam_repl_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_repl_read __P((void *, __bam_repl_args **)); -int __bam_init_print __P((DB_ENV *)); -int __bam_init_recover __P((DB_ENV *)); -#endif /* _btree_ext_h_ */ diff --git a/db2/include/clib_ext.h b/db2/include/clib_ext.h deleted file mode 100644 index 2566b849ce..0000000000 --- a/db2/include/clib_ext.h +++ /dev/null @@ -1,59 +0,0 @@ -/* DO NOT EDIT: automatically built by dist/distrib. */ -#ifndef _clib_ext_h_ -#define _clib_ext_h_ -#ifdef __STDC__ -void err __P((int eval, const char *, ...)); -#else -void err(); -#endif -#ifdef __STDC__ -void errx __P((int eval, const char *, ...)); -#else -void errx(); -#endif -#ifdef __STDC__ -void warn __P((const char *, ...)); -#else -void warn(); -#endif -#ifdef __STDC__ -void warnx __P((const char *, ...)); -#else -void warnx(); -#endif -#ifndef HAVE_GETCWD -char *getcwd __P((char *, size_t)); -#endif -void get_long __P((char *, long, long, long *)); -#ifndef HAVE_GETOPT -int getopt __P((int, char * const *, const char *)); -#endif -#ifndef HAVE_MEMCMP -int memcmp __P((const void *, const void *, size_t)); -#endif -#ifndef HAVE_MEMCPY -void *memcpy __P((void *, const void *, size_t)); -#endif -#ifndef HAVE_MEMMOVE -void *memmove __P((void *, const void *, size_t)); -#endif -#ifndef HAVE_RAISE -int raise __P((int)); -#endif -#ifndef HAVE_SNPRINTF -#ifdef __STDC__ -int snprintf __P((char *, size_t, const char *, ...)); -#else -int snprintf(); -#endif -#endif -#ifndef HAVE_STRERROR -char *strerror __P((int)); -#endif -#ifndef HAVE_STRSEP -char *strsep __P((char **, const char *)); -#endif -#ifndef HAVE_VSNPRINTF -int vsnprintf(); -#endif -#endif /* _clib_ext_h_ */ diff --git a/db2/include/common_ext.h b/db2/include/common_ext.h deleted file mode 100644 index 33fb0cb218..0000000000 --- a/db2/include/common_ext.h +++ /dev/null @@ -1,34 +0,0 @@ -/* DO NOT EDIT: automatically built by dist/distrib. */ -#ifndef _common_ext_h_ -#define _common_ext_h_ -int __db_appname __P((DB_ENV *, - APPNAME, const char *, const char *, u_int32_t, int *, char **)); -int __db_apprec __P((DB_ENV *, u_int32_t)); -int __db_byteorder __P((DB_ENV *, int)); -int __db_fchk __P((DB_ENV *, const char *, u_int32_t, u_int32_t)); -int __db_fcchk - __P((DB_ENV *, const char *, u_int32_t, u_int32_t, u_int32_t)); -int __db_ferr __P((const DB_ENV *, const char *, int)); -#ifdef __STDC__ -void __db_err __P((const DB_ENV *dbenv, const char *fmt, ...)); -#else -void __db_err(); -#endif -int __db_pgerr __P((DB *, db_pgno_t)); -int __db_pgfmt __P((DB *, db_pgno_t)); -int __db_panic __P((DB_ENV *, int)); -u_int32_t __db_log2 __P((u_int32_t)); -int __db_rattach __P((REGINFO *)); -int __db_rdetach __P((REGINFO *)); -int __db_runlink __P((REGINFO *, int)); -int __db_rgrow __P((REGINFO *, size_t)); -int __db_rreattach __P((REGINFO *, size_t)); -void __db_shalloc_init __P((void *, size_t)); -int __db_shalloc __P((void *, size_t, size_t, void *)); -void __db_shalloc_free __P((void *, void *)); -size_t __db_shalloc_count __P((void *)); -size_t __db_shsizeof __P((void *)); -void __db_shalloc_dump __P((void *, FILE *)); -int __db_tablesize __P((u_int32_t)); -void __db_hashinit __P((void *, u_int32_t)); -#endif /* _common_ext_h_ */ diff --git a/db2/include/cxx_int.h b/db2/include/cxx_int.h deleted file mode 100644 index 0a59de4391..0000000000 --- a/db2/include/cxx_int.h +++ /dev/null @@ -1,118 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997, 1998 - * Sleepycat Software. All rights reserved. - * - * @(#)cxx_int.h 10.5 (Sleepycat) 4/10/98 - */ - -#ifndef _CXX_INT_H_ -#define _CXX_INT_H_ - -// private data structures known to the implementation only - -#include <assert.h> // used by defines below - -// -// Using FooImp classes will allow the implementation to change in the -// future without any modification to user code or even to header files -// that the user includes. FooImp * is just like void * except that it -// provides a little extra protection, since you cannot randomly assign -// any old pointer to a FooImp* as you can with void *. Currently, a -// pointer to such an opaque class is always just a pointer to the -// appropriate underlying implementation struct. These are converted -// back and forth using the various overloaded wrap()/unwrap() methods. -// This is essentially a use of the "Bridge" Design Pattern. -// -// WRAPPED_CLASS implements the appropriate wrap() and unwrap() methods -// for a wrapper class that has an underlying pointer representation. -// -#define WRAPPED_CLASS(_WRAPPER_CLASS, _IMP_CLASS, _WRAPPED_TYPE) \ - \ - class _IMP_CLASS {}; \ - \ - inline _WRAPPED_TYPE unwrap(_WRAPPER_CLASS *val) \ - { \ - if (!val) return 0; \ - return (_WRAPPED_TYPE)(val->imp()); \ - } \ - \ - inline const _WRAPPED_TYPE unwrapConst(const _WRAPPER_CLASS *val) \ - { \ - if (!val) return 0; \ - return (const _WRAPPED_TYPE)(val->imp()); \ - } \ - \ - inline _IMP_CLASS *wrap(_WRAPPED_TYPE val) \ - { \ - return (_IMP_CLASS*)val; \ - } - -WRAPPED_CLASS(DbLockTab, DbLockTabImp, DB_LOCKTAB*) -WRAPPED_CLASS(DbLog, DbLogImp, DB_LOG*) -WRAPPED_CLASS(DbMpool, DbMpoolImp, DB_MPOOL*) -WRAPPED_CLASS(DbMpoolFile, DbMpoolFileImp, DB_MPOOLFILE*) -WRAPPED_CLASS(Db, DbImp, DB*) -WRAPPED_CLASS(DbTxn, DbTxnImp, DB_TXN*) -WRAPPED_CLASS(DbTxnMgr, DbTxnMgrImp, DB_TXNMGR*) - -// Macros that handle detected errors, in case we want to -// change the default behavior. runtime_error() throws an -// exception by default. -// -// Since it's unusual to throw an exception in a destructor, -// we have a separate macro. For now, we silently ignore such -// detected errors. -// -#define DB_ERROR(caller, ecode) \ - DbEnv::runtime_error(caller, ecode) - -#define DB_DESTRUCTOR_ERROR(caller, ecode) \ - DbEnv::runtime_error(caller, ecode, 1) - - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// These defines are for tedious flag or field set/get access methods. -// - -// Define setName() and getName() methods that twiddle -// the _flags field. -// -#define DB_FLAG_METHODS(_class, _flags, _cxx_name, _flag_name) \ - \ -void _class::set##_cxx_name(int onOrOff) \ -{ \ - if (onOrOff) \ - _flags |= _flag_name; \ - else \ - _flags &= ~(_flag_name); \ -} \ - \ -int _class::get##_cxx_name() const \ -{ \ - return (_flags & _flag_name) ? 1 : 0; \ -} - - -#define DB_RO_ACCESS(_class, _type, _cxx_name, _field) \ - \ -_type _class::get_##_cxx_name() const \ -{ \ - return _field; \ -} - -#define DB_WO_ACCESS(_class, _type, _cxx_name, _field) \ - \ -void _class::set_##_cxx_name(_type value) \ -{ \ - _field = value; \ -} \ - -#define DB_RW_ACCESS(_class, _type, _cxx_name, _field) \ - DB_RO_ACCESS(_class, _type, _cxx_name, _field) \ - DB_WO_ACCESS(_class, _type, _cxx_name, _field) - -#endif /* !_CXX_INT_H_ */ diff --git a/db2/include/db_185.h.src b/db2/include/db_185.h.src deleted file mode 100644 index a928ca8fd5..0000000000 --- a/db2/include/db_185.h.src +++ /dev/null @@ -1,178 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1996, 1997, 1998 - * Sleepycat Software. All rights reserved. - */ -/* - * Copyright (c) 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)db_185.h.src 8.7 (Sleepycat) 4/10/98 - */ - -#ifndef _DB_185_H_ -#define _DB_185_H_ - -#include <sys/types.h> - -#include <limits.h> - -/* - * XXX - * Handle function prototypes and the keyword "const". This steps on name - * space that DB doesn't control, but all of the other solutions are worse. - */ -#undef __P -#if defined(__STDC__) || defined(__cplusplus) -#define __P(protos) protos /* ANSI C prototypes */ -#else -#define const -#define __P(protos) () /* K&R C preprocessor */ -#endif - -#define RET_ERROR -1 /* Return values. */ -#define RET_SUCCESS 0 -#define RET_SPECIAL 1 - -#ifndef __BIT_TYPES_DEFINED__ -#define __BIT_TYPES_DEFINED__ -@u_int8_decl@ -@int16_decl@ -@u_int16_decl@ -@int32_decl@ -@u_int32_decl@ -#endif - -/* - * XXX - * SGI/IRIX already has a pgno_t. - */ -#ifdef sgi -#define pgno_t db_pgno_t -#endif - -#define MAX_PAGE_NUMBER 0xffffffff /* >= # of pages in a file */ -typedef u_int32_t pgno_t; -#define MAX_PAGE_OFFSET 65535 /* >= # of bytes in a page */ -typedef u_int16_t indx_t; -#define MAX_REC_NUMBER 0xffffffff /* >= # of records in a tree */ -typedef u_int32_t recno_t; - -/* Key/data structure -- a Data-Base Thang. */ -typedef struct { - void *data; /* data */ - size_t size; /* data length */ -} DBT; - -/* Routine flags. */ -#define R_CURSOR 1 /* del, put, seq */ -#define __R_UNUSED 2 /* UNUSED */ -#define R_FIRST 3 /* seq */ -#define R_IAFTER 4 /* put (RECNO) */ -#define R_IBEFORE 5 /* put (RECNO) */ -#define R_LAST 6 /* seq (BTREE, RECNO) */ -#define R_NEXT 7 /* seq */ -#define R_NOOVERWRITE 8 /* put */ -#define R_PREV 9 /* seq (BTREE, RECNO) */ -#define R_SETCURSOR 10 /* put (RECNO) */ -#define R_RECNOSYNC 11 /* sync (RECNO) */ - -typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE; - -/* Access method description structure. */ -typedef struct __db { - DBTYPE type; /* Underlying db type. */ - int (*close) __P((struct __db *)); - int (*del) __P((const struct __db *, const DBT *, u_int)); - int (*get) __P((const struct __db *, const DBT *, DBT *, u_int)); - int (*put) __P((const struct __db *, DBT *, const DBT *, u_int)); - int (*seq) __P((const struct __db *, DBT *, DBT *, u_int)); - int (*sync) __P((const struct __db *, u_int)); - void *internal; /* Access method private. */ - int (*fd) __P((const struct __db *)); -} DB; - -#define BTREEMAGIC 0x053162 -#define BTREEVERSION 3 - -/* Structure used to pass parameters to the btree routines. */ -typedef struct { -#define R_DUP 0x01 /* duplicate keys */ - u_int32_t flags; - u_int32_t cachesize; /* bytes to cache */ - u_int32_t maxkeypage; /* maximum keys per page */ - u_int32_t minkeypage; /* minimum keys per page */ - u_int32_t psize; /* page size */ - int (*compare) /* comparison function */ - __P((const DBT *, const DBT *)); - size_t (*prefix) /* prefix function */ - __P((const DBT *, const DBT *)); - int lorder; /* byte order */ -} BTREEINFO; - -#define HASHMAGIC 0x061561 -#define HASHVERSION 2 - -/* Structure used to pass parameters to the hashing routines. */ -typedef struct { - u_int32_t bsize; /* bucket size */ - u_int32_t ffactor; /* fill factor */ - u_int32_t nelem; /* number of elements */ - u_int32_t cachesize; /* bytes to cache */ - u_int32_t /* hash function */ - (*hash) __P((const void *, size_t)); - int lorder; /* byte order */ -} HASHINFO; - -/* Structure used to pass parameters to the record routines. */ -typedef struct { -#define R_FIXEDLEN 0x01 /* fixed-length records */ -#define R_NOKEY 0x02 /* key not required */ -#define R_SNAPSHOT 0x04 /* snapshot the input */ - u_int32_t flags; - u_int32_t cachesize; /* bytes to cache */ - u_int32_t psize; /* page size */ - int lorder; /* byte order */ - size_t reclen; /* record length (fixed-length records) */ - u_char bval; /* delimiting byte (variable-length records */ - char *bfname; /* btree file name */ -} RECNOINFO; - -#if defined(__cplusplus) -extern "C" { -#endif -DB *dbopen __P((const char *, int, int, DBTYPE, const void *)); - -#if defined(__cplusplus) -} -#endif -#endif /* !_DB_185_H_ */ diff --git a/db2/include/db_am.h b/db2/include/db_am.h deleted file mode 100644 index fe2176d772..0000000000 --- a/db2/include/db_am.h +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1996, 1997, 1998 - * Sleepycat Software. All rights reserved. - * - * @(#)db_am.h 10.15 (Sleepycat) 11/22/98 - */ -#ifndef _DB_AM_H -#define _DB_AM_H - -#define DB_ISBIG 0x01 -#define DB_ADD_DUP 0x10 -#define DB_REM_DUP 0x20 -#define DB_ADD_BIG 0x30 -#define DB_REM_BIG 0x40 -#define DB_SPLITOLD 0x50 -#define DB_SPLITNEW 0x60 -#define DB_ADD_PAGE 0x70 -#define DB_REM_PAGE 0x80 - -/* - * Standard initialization and shutdown macros for all recovery functions. - * - * Requires the following local variables: - * - * DB *file_dbp, *mdbp; - * DB_MPOOLFILE *mpf; - * int ret; - */ -#define REC_INTRO(func) { \ - file_dbp = NULL; \ - dbc = NULL; \ - if ((ret = func(dbtp->data, &argp)) != 0) \ - goto out; \ - if ((ret = \ - __db_fileid_to_db(logp, &file_dbp, argp->fileid)) != 0) { \ - if (ret == DB_DELETED) { \ - ret = 0; \ - goto done; \ - } \ - goto out; \ - } \ - if (file_dbp == NULL) \ - goto out; \ - if ((ret = file_dbp->cursor(file_dbp, NULL, &dbc, 0)) != 0) \ - goto out; \ - F_SET(dbc, DBC_RECOVER); \ - mpf = file_dbp->mpf; \ -} - -#define REC_CLOSE { \ - if (argp != NULL) \ - __os_free(argp, sizeof(*argp)); \ - if (dbc != NULL) \ - dbc->c_close(dbc); \ - return (ret); \ -} - -/* - * No-op versions of the same macros. - */ -#define REC_NOOP_INTRO(func) { \ - if ((ret = func(dbtp->data, &argp)) != 0) \ - return (ret); \ -} -#define REC_NOOP_CLOSE { \ - if (argp != NULL) \ - __os_free(argp, sizeof(*argp)); \ - return (ret); \ -} - -/* - * Standard debugging macro for all recovery functions. - */ -#ifdef DEBUG_RECOVER -#define REC_PRINT(func) \ - (void)func(logp, dbtp, lsnp, redo, info); -#else -#define REC_PRINT(func) \ - COMPQUIET(info, NULL); -#endif - -#include "db_auto.h" -#include "db_ext.h" -#endif diff --git a/db2/include/db_auto.h b/db2/include/db_auto.h deleted file mode 100644 index 0d1e43a26a..0000000000 --- a/db2/include/db_auto.h +++ /dev/null @@ -1,111 +0,0 @@ -/* Do not edit: automatically built by dist/db_gen.sh. */ -#ifndef db_AUTO_H -#define db_AUTO_H - -#define DB_db_addrem (DB_db_BEGIN + 1) - -typedef struct _db_addrem_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t opcode; - u_int32_t fileid; - db_pgno_t pgno; - u_int32_t indx; - size_t nbytes; - DBT hdr; - DBT dbt; - DB_LSN pagelsn; -} __db_addrem_args; - - -#define DB_db_split (DB_db_BEGIN + 2) - -typedef struct _db_split_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t opcode; - u_int32_t fileid; - db_pgno_t pgno; - DBT pageimage; - DB_LSN pagelsn; -} __db_split_args; - - -#define DB_db_big (DB_db_BEGIN + 3) - -typedef struct _db_big_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t opcode; - u_int32_t fileid; - db_pgno_t pgno; - db_pgno_t prev_pgno; - db_pgno_t next_pgno; - DBT dbt; - DB_LSN pagelsn; - DB_LSN prevlsn; - DB_LSN nextlsn; -} __db_big_args; - - -#define DB_db_ovref (DB_db_BEGIN + 4) - -typedef struct _db_ovref_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t pgno; - int32_t adjust; - DB_LSN lsn; -} __db_ovref_args; - - -#define DB_db_relink (DB_db_BEGIN + 5) - -typedef struct _db_relink_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t opcode; - u_int32_t fileid; - db_pgno_t pgno; - DB_LSN lsn; - db_pgno_t prev; - DB_LSN lsn_prev; - db_pgno_t next; - DB_LSN lsn_next; -} __db_relink_args; - - -#define DB_db_addpage (DB_db_BEGIN + 6) - -typedef struct _db_addpage_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t pgno; - DB_LSN lsn; - db_pgno_t nextpgno; - DB_LSN nextlsn; -} __db_addpage_args; - - -#define DB_db_debug (DB_db_BEGIN + 7) - -typedef struct _db_debug_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - DBT op; - u_int32_t fileid; - DBT key; - DBT data; - u_int32_t arg_flags; -} __db_debug_args; - -#endif diff --git a/db2/include/db_cxx.h b/db2/include/db_cxx.h deleted file mode 100644 index f415d594b5..0000000000 --- a/db2/include/db_cxx.h +++ /dev/null @@ -1,861 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997, 1998 - * Sleepycat Software. All rights reserved. - * - * @(#)db_cxx.h 10.30 (Sleepycat) 11/22/98 - */ - -#ifndef _DB_CXX_H_ -#define _DB_CXX_H_ -// -// C++ assumptions: -// -// To ensure portability to many platforms, both new and old, we make -// few assumptions about the C++ compiler and library. For example, -// we do not expect STL, templates or namespaces to be available. The -// "newest" C++ feature used is exceptions, which are used liberally -// to transmit error information. Even the use of exceptions can be -// disabled at runtime, see setErrorModel(). -// -// C++ naming conventions: -// -// - All top level class names start with Db. -// - All class members start with lower case letter. -// - All private data members are suffixed with underscore. -// - Use underscores to divide names into multiple words. -// - Simple data accessors are named with get_ or set_ prefix. -// - All method names are taken from names of functions in the C -// layer of db (usually by dropping a prefix like "db_"). -// These methods have the same argument types and order, -// other than dropping the explicit arg that acts as "this". -// -// As a rule, each DbFoo object has exactly one underlying DB_FOO struct -// (defined in db.h) associated with it. In many cases, we inherit directly -// from the DB_FOO structure to make this relationship explicit. Often, -// the underlying C layer allocates and deallocates these structures, so -// there is no easy way to add any data to the DbFoo class. When you see -// a comment about whether data is permitted to be added, this is what -// is going on. Of course, if we need to add data to such C++ classes -// in the future, we will arrange to have an indirect pointer to the -// DB_FOO struct (as some of the classes already have). -// - - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Forward declarations -// - -#include <iostream.h> -#include <db.h> - -class Db; // forward -class Dbc; // forward -class DbEnv; // forward -class DbException; // forward -class DbInfo; // forward -class DbLock; // forward -class DbLockTab; // forward -class DbLog; // forward -class DbLsn; // forward -class DbMpool; // forward -class DbMpoolFile; // forward -class Dbt; // forward -class DbTxn; // forward -class DbTxnMgr; // forward - -// These classes are not defined here and should be invisible -// to the user, but some compilers require forward references. -// There is one for each use of the DEFINE_DB_CLASS macro. - -class DbLockTabImp; -class DbLogImp; -class DbMpoolImp; -class DbMpoolFileImp; -class DbImp; -class DbTxnImp; -class DbTxnMgrImp; - - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Mechanisms for declaring classes -// - -// -// Every class defined in this file has an _exported next to the class name. -// This is needed for WinTel machines so that the class methods can -// be exported or imported in a DLL as appropriate. Users of the DLL -// use the define DB_USE_DLL. When the DLL is built, DB_CREATE_DLL -// must be defined. -// -#if defined(_MSC_VER) - -# if defined(DB_CREATE_DLL) -# define _exported __declspec(dllexport) // creator of dll -# elif defined(DB_USE_DLL) -# define _exported __declspec(dllimport) // user of dll -# else -# define _exported // static lib creator or user -# endif - -#else - -# define _exported - -#endif - -// DEFINE_DB_CLASS defines an imp_ data member and imp() accessor. -// The underlying type is a pointer to an opaque *Imp class, that -// gets converted to the correct implementation class by the implementation. -// -// Since these defines use "private/public" labels, and leave the access -// being "private", we always use these by convention before any data -// members in the private section of a class. Keeping them in the -// private section also emphasizes that they are off limits to user code. -// -#define DEFINE_DB_CLASS(name) \ - public: class name##Imp* imp() { return imp_; } \ - public: const class name##Imp* imp() const { return imp_; } \ - private: class name##Imp* imp_ - - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Turn off inappropriate compiler warnings -// - -#ifdef _MSC_VER - -// These are level 4 warnings that are explicitly disabled. -// With Visual C++, by default you do not see above level 3 unless -// you use /W4. But we like to compile with the highest level -// warnings to catch other errors. -// -// 4201: nameless struct/union -// triggered by standard include file <winnt.h> -// -// 4514: unreferenced inline function has been removed -// certain include files in MSVC define methods that are not called -// -#pragma warning(disable: 4201 4514) - -#endif - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Exception classes -// - -// Almost any error in the DB library throws a DbException. -// Every exception should be considered an abnormality -// (e.g. bug, misuse of DB, file system error). -// -// NOTE: We would like to inherit from class exception and -// let it handle what(), but there are -// MSVC++ problems when <exception> is included. -// -class _exported DbException -{ -public: - virtual ~DbException(); - DbException(int err); - DbException(const char *description); - DbException(const char *prefix, int err); - DbException(const char *prefix1, const char *prefix2, int err); - const int get_errno(); - virtual const char *what() const; - - DbException(const DbException &); - DbException &operator = (const DbException &); - -private: - char *what_; - int err_; // errno -}; - - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Lock classes -// - -class _exported DbLock -{ - friend class DbLockTab; - -public: - DbLock(); - - int put(DbLockTab *locktab); - - DbLock(const DbLock &); - DbLock &operator = (const DbLock &); - -protected: - // We can add data to this class if needed - // since its contained class is not allocated by db. - // (see comment at top) - - DbLock(DB_LOCK); - DB_LOCK lock_; -}; - -class _exported DbLockTab -{ - friend class DbEnv; - -public: - int close(); - int detect(u_int32_t flags, int atype); - int get(u_int32_t locker, u_int32_t flags, const Dbt *obj, - db_lockmode_t lock_mode, DbLock *lock); - int id(u_int32_t *idp); - int stat(DB_LOCK_STAT **statp, void *(*db_malloc)(size_t)); - int vec(u_int32_t locker, u_int32_t flags, DB_LOCKREQ list[], - int nlist, DB_LOCKREQ **elistp); - - // Create or remove new locktab files - // - static int open(const char *dir, u_int32_t flags, int mode, - DbEnv* dbenv, DbLockTab **regionp); - static int unlink(const char *dir, int force, DbEnv* dbenv); - -private: - // We can add data to this class if needed - // since it is implemented via a pointer. - // (see comment at top) - - // copying not allowed - // - DbLockTab(const DbLockTab &); - DbLockTab &operator = (const DbLockTab &); - - // Note: use DbLockTab::open() or DbEnv::get_lk_info() - // to get pointers to a DbLockTab, - // and call DbLockTab::close() rather than delete to release them. - // - DbLockTab(); - ~DbLockTab(); - - DEFINE_DB_CLASS(DbLockTab); -}; - - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Log classes -// - -class _exported DbLsn : protected DB_LSN -{ - friend class DbLog; // friendship needed to cast to base class - friend class DbMpool; -}; - -class _exported DbLog -{ - friend class DbEnv; - -public: - int archive(char **list[], u_int32_t flags, void *(*db_malloc)(size_t)); - int close(); - static int compare(const DbLsn *lsn0, const DbLsn *lsn1); - int file(DbLsn *lsn, char *namep, int len); - int flush(const DbLsn *lsn); - int get(DbLsn *lsn, Dbt *data, u_int32_t flags); - int put(DbLsn *lsn, const Dbt *data, u_int32_t flags); - - // Normally these would be called register and unregister to - // parallel the C interface, but "register" is a reserved word. - // - int db_register(Db *dbp, const char *name, DBTYPE type, u_int32_t *fidp); - int db_unregister(u_int32_t fid); - - // Create or remove new log files - // - static int open(const char *dir, u_int32_t flags, int mode, - DbEnv* dbenv, DbLog **regionp); - static int unlink(const char *dir, int force, DbEnv* dbenv); - -private: - // We can add data to this class if needed - // since it is implemented via a pointer. - // (see comment at top) - - // Note: use DbLog::open() or DbEnv::get_lg_info() - // to get pointers to a DbLog, - // and call DbLog::close() rather than delete to release them. - // - DbLog(); - ~DbLog(); - - // no copying - DbLog(const DbLog &); - operator = (const DbLog &); - - DEFINE_DB_CLASS(DbLog); -}; - - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Memory pool classes -// - -class _exported DbMpoolFile -{ - friend class DbEnv; - -public: - int close(); - int get(db_pgno_t *pgnoaddr, u_int32_t flags, void *pagep); - int put(void *pgaddr, u_int32_t flags); - int set(void *pgaddr, u_int32_t flags); - int sync(); - - static int open(DbMpool *mp, const char *file, - u_int32_t flags, int mode, size_t pagesize, - DB_MPOOL_FINFO *finfop, DbMpoolFile **mpf); - -private: - // We can add data to this class if needed - // since it is implemented via a pointer. - // (see comment at top) - - // Note: use DbMpoolFile::open() - // to get pointers to a DbMpoolFile, - // and call DbMpoolFile::close() rather than delete to release them. - // - DbMpoolFile(); - - // Shut g++ up. -protected: - ~DbMpoolFile(); - -private: - // no copying - DbMpoolFile(const DbMpoolFile &); - operator = (const DbMpoolFile &); - - DEFINE_DB_CLASS(DbMpoolFile); -}; - -class _exported DbMpool -{ - friend class DbEnv; - -public: - int close(); - - // access to low level interface - // Normally this would be called register to parallel - // the C interface, but "register" is a reserved word. - // - int db_register(int ftype, - int (*pgin)(db_pgno_t pgno, void *pgaddr, DBT *pgcookie), - int (*pgout)(db_pgno_t pgno, void *pgaddr, DBT *pgcookie)); - - int stat(DB_MPOOL_STAT **gsp, DB_MPOOL_FSTAT ***fsp, - void *(*db_malloc)(size_t)); - int sync(DbLsn *lsn); - int trickle(int pct, int *nwrotep); - - // Create or remove new mpool files - // - static int open(const char *dir, u_int32_t flags, int mode, - DbEnv* dbenv, DbMpool **regionp); - static int unlink(const char *dir, int force, DbEnv* dbenv); - -private: - // We can add data to this class if needed - // since it is implemented via a pointer. - // (see comment at top) - - // Note: use DbMpool::open() or DbEnv::get_mp_info() - // to get pointers to a DbMpool, - // and call DbMpool::close() rather than delete to release them. - // - DbMpool(); - ~DbMpool(); - - // no copying - DbMpool(const DbMpool &); - DbMpool &operator = (const DbMpool &); - - DEFINE_DB_CLASS(DbMpool); -}; - - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Transaction classes -// - -class _exported DbTxnMgr -{ - friend class DbEnv; - -public: - int begin(DbTxn *pid, DbTxn **tid); - int checkpoint(u_int32_t kbyte, u_int32_t min) const; - int close(); - int stat(DB_TXN_STAT **statp, void *(*db_malloc)(size_t)); - - // Create or remove new txnmgr files - // - static int open(const char *dir, u_int32_t flags, int mode, - DbEnv* dbenv, DbTxnMgr **regionp); - static int unlink(const char *dir, int force, DbEnv* dbenv); - -private: - // We can add data to this class if needed - // since it is implemented via a pointer. - // (see comment at top) - - // Note: use DbTxnMgr::open() or DbEnv::get_tx_info() - // to get pointers to a DbTxnMgr, - // and call DbTxnMgr::close() rather than delete to release them. - // - DbTxnMgr(); - ~DbTxnMgr(); - - // no copying - DbTxnMgr(const DbTxnMgr &); - operator = (const DbTxnMgr &); - - DEFINE_DB_CLASS(DbTxnMgr); -}; - -class _exported DbTxn -{ - friend class DbTxnMgr; - -public: - int abort(); - int commit(); - u_int32_t id(); - int prepare(); - -private: - // We can add data to this class if needed - // since it is implemented via a pointer. - // (see comment at top) - - // Note: use DbTxnMgr::begin() to get pointers to a DbTxn, - // and call DbTxn::abort() or DbTxn::commit rather than - // delete to release them. - // - DbTxn(); - ~DbTxn(); - - // no copying - DbTxn(const DbTxn &); - operator = (const DbTxn &); - - DEFINE_DB_CLASS(DbTxn); -}; - - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Application classes -// - -// -// A set of application options - define how this application uses -// the db library. -// -class _exported DbInfo : protected DB_INFO -{ - friend class DbEnv; - friend class Db; - -public: - DbInfo(); - ~DbInfo(); - - // Byte order. - void set_lorder(int); - - // Underlying cache size. - void set_cachesize(size_t); - - // Underlying page size. - void set_pagesize(size_t); - - // Local heap allocation. - typedef void *(*db_malloc_fcn)(size_t); - void set_malloc(db_malloc_fcn); - - // Duplicate compare function. - typedef int (*dup_compare_fcn)(const DBT *, const DBT *); - void set_dup_compare(dup_compare_fcn); - - //////////////////////////////////////////////////////////////// - // Btree access method. - - // Maximum keys per page. - void set_bt_maxkey(int); - - // Minimum keys per page. - void set_bt_minkey(int); - - // Comparison function. - typedef int (*bt_compare_fcn)(const DBT *, const DBT *); - void set_bt_compare(bt_compare_fcn); - - // Prefix function. - typedef size_t (*bt_prefix_fcn)(const DBT *, const DBT *); - void set_bt_prefix(bt_prefix_fcn); - - //////////////////////////////////////////////////////////////// - // Hash access method. - - // Fill factor. - void set_h_ffactor(u_int32_t); - - // Number of elements. - void set_h_nelem(u_int32_t); - - // Hash function. - typedef u_int32_t (*h_hash_fcn)(const void *, u_int32_t); - void set_h_hash(h_hash_fcn); - - //////////////////////////////////////////////////////////////// - // Recno access method. - - // Fixed-length padding byte. - void set_re_pad(int); - - // Variable-length delimiting byte. - void set_re_delim(int); - - // Length for fixed-length records. - void set_re_len(u_int32_t); - - // Source file name. - void set_re_source(char *); - - // Note: some flags are set as side effects of calling - // above "set" methods. - // - void set_flags(u_int32_t); - - - // (deep) copying of this object is allowed. - // - DbInfo(const DbInfo &); - DbInfo &operator = (const DbInfo &); - -private: - // We can add data to this class if needed - // since parent class is not allocated by db. - // (see comment at top) -}; - -// -// Base application class. Provides functions for opening a database. -// User of this library can use this class as a starting point for -// developing a DB application - derive their application class from -// this one, add application control logic. -// -// Note that if you use the default constructor, you must explicitly -// call appinit() before any other db activity (e.g. opening files) -// -class _exported DbEnv : protected DB_ENV -{ - friend class DbTxnMgr; - friend class DbLog; - friend class DbLockTab; - friend class DbMpool; - friend class Db; - -public: - - ~DbEnv(); - - // This constructor can be used to immediately initialize the - // application with these arguments. Do not use it if you - // need to set other parameters via the access methods. - // - DbEnv(const char *homeDir, char *const *db_config, u_int32_t flags); - - // Use this constructor if you wish to *delay* the initialization - // of the db library. This is useful if you need to set - // any particular parameters via the access methods below. - // Then call appinit() to complete the initialization. - // - DbEnv(); - - // Used in conjunction with the default constructor to - // complete the initialization of the db library. - // - int appinit(const char *homeDir, char *const *db_config, u_int32_t flags); - - // Called automatically when DbEnv is destroyed, or can be - // called at any time to shut down Db. - // - int appexit(); - - // Version information. A static method so it can be obtained anytime. - // - static char *version(int *major, int *minor, int *patch); - - //////////////////////////////////////////////////////////////// - // simple get/set access methods - // - // If you are calling set_ methods, you need to - // use the default constructor along with appinit(). - - // Byte order. - void set_lorder(int); - - // Panic callback. - typedef void (*db_paniccall_fcn)(DbEnv *, int); - void set_paniccall(db_paniccall_fcn); - - // Error message callback. - typedef void (*db_errcall_fcn)(const char *, char *); - void set_errcall(db_errcall_fcn); - - // Error message file stream. - void set_errfile(FILE *); - - // Error message prefix. - void set_errpfx(const char *); - - // Generate debugging messages. - void set_verbose(int); - - //////////////////////////////////////////////////////////////// - // Locking. - - // Return from lock_open(). - DbLockTab *get_lk_info() const; - - // Two dimensional conflict matrix. - void set_lk_conflicts(u_int8_t *); - - // Number of lock modes in table. - void set_lk_modes(int); - - // Maximum number of locks. - void set_lk_max(u_int32_t); - - // Deadlock detect on every conflict. - void set_lk_detect(u_int32_t); - - - //////////////////////////////////////////////////////////////// - // Logging. - - // Return from log_open(). - DbLog *get_lg_info() const; - - // Maximum file size. - void set_lg_max(u_int32_t); - - - //////////////////////////////////////////////////////////////// - // Memory pool. - - // Return from memp_open(). - DbMpool *get_mp_info() const; - - // Maximum file size for mmap. - void set_mp_mmapsize(size_t); - - // Bytes in the mpool cache. - void set_mp_size(size_t); - - - //////////////////////////////////////////////////////////////// - // Transactions. - - // Return from txn_open(). - DbTxnMgr *get_tx_info() const; - - // Maximum number of transactions. - void set_tx_max(u_int32_t); - - // Dispatch function for recovery. - typedef int (*tx_recover_fcn)(DB_LOG *, DBT *, DB_LSN *, int, void *); - void set_tx_recover(tx_recover_fcn); - - // Flags. - void set_flags(u_int32_t); - - //////////////////////////////////////////////////////////////// - // The default error model is to throw an exception whenever - // an error occurs. This generally allows for cleaner logic - // for transaction processing, as a try block can surround a - // single transaction. Alternatively, since almost every method - // returns an error code (errno), the error model can be set to - // not throw exceptions, and instead return the appropriate code. - // - enum ErrorModel { Exception, ErrorReturn }; - void set_error_model(ErrorModel); - - // If an error is detected and the error call function - // or stream is set, a message is dispatched or printed. - // If a prefix is set, each message is prefixed. - // - // You can use set_errcall() or set_errfile() above to control - // error functionality using a C model. Alternatively, you can - // call set_error_stream() to force all errors to a C++ stream. - // It is unwise to mix these approaches. - // - void set_error_stream(class ostream*); - - // used internally - static int runtime_error(const char *caller, int err, - int in_destructor = 0, int force_throw = 0); - -private: - // We can add data to this class if needed - // since parent class is not allocated by db. - // (see comment at top) - - // no copying - DbEnv(const DbEnv &); - operator = (const DbEnv &); - - ErrorModel error_model_; - static void stream_error_function(const char *, char *); - static ostream *error_stream_; -}; - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Table access classes -// - -// -// Represents a database table = a set of keys with associated values. -// -class _exported Db -{ - friend class DbEnv; - -public: - int close(u_int32_t flags); - int cursor(DbTxn *txnid, Dbc **cursorp, u_int32_t flags); - int del(DbTxn *txnid, Dbt *key, u_int32_t flags); - int fd(int *fdp); - int get(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t flags); - int join(Dbc **curslist, u_int32_t flags, Dbc **dbcp); - int put(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t flags); - int stat(void *sp, void *(*db_malloc)(size_t), u_int32_t flags); - int sync(u_int32_t flags); - - int get_byteswapped() const; - DBTYPE get_type() const; - - static int open(const char *fname, DBTYPE type, u_int32_t flags, - int mode, DbEnv *dbenv, DbInfo *info, Db **dbpp); - - static int xa_open(const char *fname, DBTYPE type, u_int32_t flags, - int mode, DbInfo *info, Db **dbpp); -private: - // We can add data to this class if needed - // since it is implemented via a pointer. - // (see comment at top) - - // Note: use Db::open() to get initialize pointers to a Db, - // and call Db::close() rather than delete to release them. - Db(); - ~Db(); - - // no copying - Db(const Db &); - Db &operator = (const Db &); - - DEFINE_DB_CLASS(Db); -}; - -// -// A chunk of data, maybe a key or value. -// -class _exported Dbt : private DBT -{ - friend class Dbc; - friend class Db; - friend class DbLog; - friend class DbMpoolFile; - friend class DbLockTab; - -public: - - // key/data - void *get_data() const; - void set_data(void *); - - // key/data length - u_int32_t get_size() const; - void set_size(u_int32_t); - - // RO: length of user buffer. - u_int32_t get_ulen() const; - void set_ulen(u_int32_t); - - // RO: get/put record length. - u_int32_t get_dlen() const; - void set_dlen(u_int32_t); - - // RO: get/put record offset. - u_int32_t get_doff() const; - void set_doff(u_int32_t); - - // flags - u_int32_t get_flags() const; - void set_flags(u_int32_t); - - Dbt(void *data, size_t size); - Dbt(); - ~Dbt(); - Dbt(const Dbt &); - Dbt &operator = (const Dbt &); - -private: - // We can add data to this class if needed - // since parent class is not allocated by db. - // (see comment at top) -}; - -class _exported Dbc : protected DBC -{ - friend class Db; - -public: - int close(); - int del(u_int32_t flags); - int get(Dbt* key, Dbt *data, u_int32_t flags); - int put(Dbt* key, Dbt *data, u_int32_t flags); - -private: - // No data is permitted in this class (see comment at top) - - // Note: use Db::cursor() to get pointers to a Dbc, - // and call Dbc::close() rather than delete to release them. - // - Dbc(); - ~Dbc(); - - // no copying - Dbc(const Dbc &); - Dbc &operator = (const Dbc &); -}; -#endif /* !_DB_CXX_H_ */ diff --git a/db2/include/db_dispatch.h b/db2/include/db_dispatch.h deleted file mode 100644 index 8f5e217402..0000000000 --- a/db2/include/db_dispatch.h +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1996, 1997, 1998 - * Sleepycat Software. All rights reserved. - */ -/* - * Copyright (c) 1995, 1996 - * The President and Fellows of Harvard University. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)db_dispatch.h 10.4 (Sleepycat) 5/3/98 - */ - -#ifndef _DB_DISPATCH_H -#define _DB_DISPATCH_H - -struct __db_txnhead; typedef struct __db_txnhead DB_TXNHEAD; -struct __db_txnlist; typedef struct __db_txnlist DB_TXNLIST; - -/* - * Declarations and typedefs for the list of transaction IDs used during - * recovery. - */ -struct __db_txnhead { - LIST_HEAD(__db_headlink, __db_txnlist) head; - u_int32_t maxid; - int32_t generation; -}; - -struct __db_txnlist { - LIST_ENTRY(__db_txnlist) links; - u_int32_t txnid; - int32_t generation; -}; - -#define DB_log_BEGIN 0 -#define DB_txn_BEGIN 5 -#define DB_ham_BEGIN 20 -#define DB_db_BEGIN 40 -#define DB_bam_BEGIN 50 -#define DB_ram_BEGIN 100 -#define DB_user_BEGIN 150 - -#define TXN_UNDO 0 -#define TXN_REDO 1 -#define TXN_BACKWARD_ROLL -1 -#define TXN_FORWARD_ROLL -2 -#define TXN_OPENFILES -3 -#endif diff --git a/db2/include/db_ext.h b/db2/include/db_ext.h deleted file mode 100644 index 1ad1643bfa..0000000000 --- a/db2/include/db_ext.h +++ /dev/null @@ -1,132 +0,0 @@ -/* DO NOT EDIT: automatically built by dist/distrib. */ -#ifndef _db_ext_h_ -#define _db_ext_h_ -int __db_close __P((DB *, u_int32_t)); -int __db_init_wrapper __P((DB *)); -int __db_cprint __P((DB *)); -int __db_c_destroy __P((DBC *)); -int __db_sync __P((DB *, u_int32_t)); -int __db_addrem_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, u_int32_t, db_pgno_t, u_int32_t, - size_t, const DBT *, const DBT *, DB_LSN *)); -int __db_addrem_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __db_addrem_read __P((void *, __db_addrem_args **)); -int __db_split_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, u_int32_t, db_pgno_t, const DBT *, - DB_LSN *)); -int __db_split_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __db_split_read __P((void *, __db_split_args **)); -int __db_big_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, u_int32_t, db_pgno_t, db_pgno_t, - db_pgno_t, const DBT *, DB_LSN *, DB_LSN *, - DB_LSN *)); -int __db_big_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __db_big_read __P((void *, __db_big_args **)); -int __db_ovref_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, int32_t, DB_LSN *)); -int __db_ovref_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __db_ovref_read __P((void *, __db_ovref_args **)); -int __db_relink_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, u_int32_t, db_pgno_t, DB_LSN *, - db_pgno_t, DB_LSN *, db_pgno_t, DB_LSN *)); -int __db_relink_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __db_relink_read __P((void *, __db_relink_args **)); -int __db_addpage_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, - DB_LSN *)); -int __db_addpage_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __db_addpage_read __P((void *, __db_addpage_args **)); -int __db_debug_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - const DBT *, u_int32_t, const DBT *, const DBT *, - u_int32_t)); -int __db_debug_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __db_debug_read __P((void *, __db_debug_args **)); -int __db_init_print __P((DB_ENV *)); -int __db_init_recover __P((DB_ENV *)); -int __db_pgin __P((db_pgno_t, size_t, void *)); -int __db_pgout __P((db_pgno_t, size_t, void *)); -int __db_dispatch __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __db_add_recovery __P((DB_ENV *, - int (*)(DB_LOG *, DBT *, DB_LSN *, int, void *), u_int32_t)); -int __db_txnlist_init __P((void *)); -int __db_txnlist_add __P((void *, u_int32_t)); -int __db_txnlist_find __P((void *, u_int32_t)); -void __db_txnlist_end __P((void *)); -void __db_txnlist_gen __P((void *, int)); -void __db_txnlist_print __P((void *)); -int __db_dput __P((DBC *, DBT *, - PAGE **, db_indx_t *, int (*)(DBC *, u_int32_t, PAGE **))); -int __db_drem __P((DBC *, - PAGE **, u_int32_t, int (*)(DBC *, PAGE *))); -int __db_dend __P((DBC *, db_pgno_t, PAGE **)); - int __db_ditem __P((DBC *, PAGE *, u_int32_t, u_int32_t)); -int __db_pitem - __P((DBC *, PAGE *, u_int32_t, u_int32_t, DBT *, DBT *)); -int __db_relink __P((DBC *, u_int32_t, PAGE *, PAGE **, int)); -int __db_ddup __P((DBC *, db_pgno_t, int (*)(DBC *, PAGE *))); -int __db_dsearch __P((DBC *, - int, DBT *, db_pgno_t, db_indx_t *, PAGE **, int *)); -int __db_cdelchk __P((const DB *, u_int32_t, int, int)); -int __db_cgetchk __P((const DB *, DBT *, DBT *, u_int32_t, int)); -int __db_cputchk __P((const DB *, - const DBT *, DBT *, u_int32_t, int, int)); -int __db_closechk __P((const DB *, u_int32_t)); -int __db_delchk __P((const DB *, DBT *, u_int32_t, int)); -int __db_getchk __P((const DB *, const DBT *, DBT *, u_int32_t)); -int __db_joinchk __P((const DB *, u_int32_t)); -int __db_putchk - __P((const DB *, DBT *, const DBT *, u_int32_t, int, int)); -int __db_statchk __P((const DB *, u_int32_t)); -int __db_syncchk __P((const DB *, u_int32_t)); -int __db_eopnotsup __P((const DB_ENV *)); -int __db_join __P((DB *, DBC **, u_int32_t, DBC **)); -int __db_goff __P((DB *, DBT *, - u_int32_t, db_pgno_t, void **, u_int32_t *)); -int __db_poff __P((DBC *, const DBT *, db_pgno_t *, - int (*)(DBC *, u_int32_t, PAGE **))); -int __db_ovref __P((DBC *, db_pgno_t, int32_t)); -int __db_doff __P((DBC *, db_pgno_t, int (*)(DBC *, PAGE *))); -int __db_moff __P((DB *, const DBT *, db_pgno_t, u_int32_t, - int (*)(const DBT *, const DBT *), int *)); -void __db_loadme __P((void)); -FILE *__db_prinit __P((FILE *)); -int __db_dump __P((DB *, char *, int)); -int __db_prdb __P((DB *)); -int __db_prbtree __P((DB *)); -int __db_prhash __P((DB *)); -int __db_prtree __P((DB_MPOOLFILE *, int)); -int __db_prnpage __P((DB_MPOOLFILE *, db_pgno_t)); -int __db_prpage __P((PAGE *, int)); -int __db_isbad __P((PAGE *, int)); -void __db_pr __P((u_int8_t *, u_int32_t)); -int __db_prdbt __P((DBT *, int, FILE *)); -void __db_prflags __P((u_int32_t, const FN *, FILE *)); -int __db_addrem_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __db_split_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __db_big_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __db_ovref_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __db_relink_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __db_addpage_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __db_debug_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __db_ret __P((DB *, - PAGE *, u_int32_t, DBT *, void **, u_int32_t *)); -int __db_retcopy __P((DBT *, - void *, u_int32_t, void **, u_int32_t *, void *(*)(size_t))); -#endif /* _db_ext_h_ */ diff --git a/db2/include/db_join.h b/db2/include/db_join.h deleted file mode 100644 index cb27e21f68..0000000000 --- a/db2/include/db_join.h +++ /dev/null @@ -1,23 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1998 - * Sleepycat Software. All rights reserved. - * - * @(#)db_join.h 10.2 (Sleepycat) 10/4/98 - */ - -#ifndef _DB_JOIN_H -#define _DB_JOIN_H -/* - * Joins use a join cursor that is similar to a regular DB cursor except - * that it only supports c_get and c_close functionality. Also, it does - * not support the full range of flags for get. - */ -typedef struct __join_cursor { - u_int32_t j_init; /* Set when cursor is initialized. */ - DBC **j_curslist; /* Array of cursors in the join. */ - DB *j_primary; /* Primary dbp. */ - DBT j_key; /* Used to do lookups. */ -} JOIN_CURSOR; -#endif diff --git a/db2/include/db_page.h b/db2/include/db_page.h deleted file mode 100644 index 5c9ca674f1..0000000000 --- a/db2/include/db_page.h +++ /dev/null @@ -1,512 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1996, 1997, 1998 - * Sleepycat Software. All rights reserved. - * - * @(#)db_page.h 10.18 (Sleepycat) 12/2/98 - */ - -#ifndef _DB_PAGE_H_ -#define _DB_PAGE_H_ - -/* - * DB page formats. - * - * This implementation requires that values within the following structures - * NOT be padded -- note, ANSI C permits random padding within structures. - * If your compiler pads randomly you can just forget ever making DB run on - * your system. In addition, no data type can require larger alignment than - * its own size, e.g., a 4-byte data element may not require 8-byte alignment. - * - * Note that key/data lengths are often stored in db_indx_t's -- this is - * not accidental, nor does it limit the key/data size. If the key/data - * item fits on a page, it's guaranteed to be small enough to fit into a - * db_indx_t, and storing it in one saves space. - */ - -#define PGNO_METADATA 0 /* Metadata page number. */ -#define PGNO_INVALID 0 /* Metadata page number, therefore illegal. */ -#define PGNO_ROOT 1 /* Root is page #1. */ - -/* - * When we create pages in mpool, we ask mpool to clear some number of bytes - * in the header. This number must be at least as big as the regular page - * headers and cover enough of the btree and hash meta-data pages to obliterate - * the magic and version numbers. - */ -#define DB_PAGE_CLEAR_LEN 32 - -/************************************************************************ - BTREE METADATA PAGE LAYOUT - ************************************************************************/ - -/* - * Btree metadata page layout: - */ -typedef struct _btmeta { - DB_LSN lsn; /* 00-07: LSN. */ - db_pgno_t pgno; /* 08-11: Current page number. */ - u_int32_t magic; /* 12-15: Magic number. */ - u_int32_t version; /* 16-19: Version. */ - u_int32_t pagesize; /* 20-23: Pagesize. */ - u_int32_t maxkey; /* 24-27: Btree: Maxkey. */ - u_int32_t minkey; /* 28-31: Btree: Minkey. */ - u_int32_t free; /* 32-35: Free list page number. */ -#define BTM_DUP 0x001 /* Duplicates. */ -#define BTM_RECNO 0x002 /* Recno tree. */ -#define BTM_RECNUM 0x004 /* Btree: maintain record count. */ -#define BTM_FIXEDLEN 0x008 /* Recno: fixed length records. */ -#define BTM_RENUMBER 0x010 /* Recno: renumber on insert/delete. */ -#define BTM_MASK 0x01f - u_int32_t flags; /* 36-39: Flags. */ - u_int32_t re_len; /* 40-43: Recno: fixed-length record length. */ - u_int32_t re_pad; /* 44-47: Recno: fixed-length record pad. */ - /* 48-67: Unique file ID. */ - u_int8_t uid[DB_FILE_ID_LEN]; -} BTMETA; - -/************************************************************************ - HASH METADATA PAGE LAYOUT - ************************************************************************/ - -/* - * Hash metadata page layout: - */ -/* Hash Table Information */ -typedef struct hashhdr { /* Disk resident portion */ - DB_LSN lsn; /* 00-07: LSN of the header page */ - db_pgno_t pgno; /* 08-11: Page number (btree compatibility). */ - u_int32_t magic; /* 12-15: Magic NO for hash tables */ - u_int32_t version; /* 16-19: Version ID */ - u_int32_t pagesize; /* 20-23: Bucket/Page Size */ - u_int32_t ovfl_point; /* 24-27: Overflow page allocation location */ - u_int32_t last_freed; /* 28-31: Last freed overflow page pgno */ - u_int32_t max_bucket; /* 32-35: ID of Maximum bucket in use */ - u_int32_t high_mask; /* 36-39: Modulo mask into table */ - u_int32_t low_mask; /* 40-43: Modulo mask into table lower half */ - u_int32_t ffactor; /* 44-47: Fill factor */ - u_int32_t nelem; /* 48-51: Number of keys in hash table */ - u_int32_t h_charkey; /* 52-55: Value of hash(CHARKEY) */ -#define DB_HASH_DUP 0x01 - u_int32_t flags; /* 56-59: Allow duplicates. */ -#define NCACHED 32 /* number of spare points */ - /* 60-187: Spare pages for overflow */ - u_int32_t spares[NCACHED]; - /* 188-207: Unique file ID. */ - u_int8_t uid[DB_FILE_ID_LEN]; - - /* - * Minimum page size is 256. - */ -} HASHHDR; - -/************************************************************************ - MAIN PAGE LAYOUT - ************************************************************************/ - -/* - * +-----------------------------------+ - * | lsn | pgno | prev pgno | - * +-----------------------------------+ - * | next pgno | entries | hf offset | - * +-----------------------------------+ - * | level | type | index | - * +-----------------------------------+ - * | index | free --> | - * +-----------+-----------------------+ - * | F R E E A R E A | - * +-----------------------------------+ - * | <-- free | item | - * +-----------------------------------+ - * | item | item | item | - * +-----------------------------------+ - * - * sizeof(PAGE) == 26 bytes, and the following indices are guaranteed to be - * two-byte aligned. - * - * For hash and btree leaf pages, index items are paired, e.g., inp[0] is the - * key for inp[1]'s data. All other types of pages only contain single items. - */ -typedef struct _db_page { - DB_LSN lsn; /* 00-07: Log sequence number. */ - db_pgno_t pgno; /* 08-11: Current page number. */ - db_pgno_t prev_pgno; /* 12-15: Previous page number. */ - db_pgno_t next_pgno; /* 16-19: Next page number. */ - db_indx_t entries; /* 20-21: Number of item pairs on the page. */ - db_indx_t hf_offset; /* 22-23: High free byte page offset. */ - - /* - * The btree levels are numbered from the leaf to the root, starting - * with 1, so the leaf is level 1, its parent is level 2, and so on. - * We maintain this level on all btree pages, but the only place that - * we actually need it is on the root page. It would not be difficult - * to hide the byte on the root page once it becomes an internal page, - * so we could get this byte back if we needed it for something else. - */ -#define LEAFLEVEL 1 -#define MAXBTREELEVEL 255 - u_int8_t level; /* 24: Btree tree level. */ - -#define P_INVALID 0 /* Invalid page type. */ -#define P_DUPLICATE 1 /* Duplicate. */ -#define P_HASH 2 /* Hash. */ -#define P_IBTREE 3 /* Btree internal. */ -#define P_IRECNO 4 /* Recno internal. */ -#define P_LBTREE 5 /* Btree leaf. */ -#define P_LRECNO 6 /* Recno leaf. */ -#define P_OVERFLOW 7 /* Overflow. */ - u_int8_t type; /* 25: Page type. */ - db_indx_t inp[1]; /* Variable length index of items. */ -} PAGE; - -/* Element macros. */ -#define LSN(p) (((PAGE *)p)->lsn) -#define PGNO(p) (((PAGE *)p)->pgno) -#define PREV_PGNO(p) (((PAGE *)p)->prev_pgno) -#define NEXT_PGNO(p) (((PAGE *)p)->next_pgno) -#define NUM_ENT(p) (((PAGE *)p)->entries) -#define HOFFSET(p) (((PAGE *)p)->hf_offset) -#define LEVEL(p) (((PAGE *)p)->level) -#define TYPE(p) (((PAGE *)p)->type) - -/* - * !!! - * The next_pgno and prev_pgno fields are not maintained for btree and recno - * internal pages. It's a minor performance improvement, and more, it's - * hard to do when deleting internal pages, and it decreases the chance of - * deadlock during deletes and splits. - * - * !!! - * The btree/recno access method needs db_recno_t bytes of space on the root - * page to specify how many records are stored in the tree. (The alternative - * is to store the number of records in the meta-data page, which will create - * a second hot spot in trees being actively modified, or recalculate it from - * the BINTERNAL fields on each access.) Overload the prev_pgno field. - */ -#define RE_NREC(p) \ - (TYPE(p) == P_LBTREE ? NUM_ENT(p) / 2 : \ - TYPE(p) == P_LRECNO ? NUM_ENT(p) : PREV_PGNO(p)) -#define RE_NREC_ADJ(p, adj) \ - PREV_PGNO(p) += adj; -#define RE_NREC_SET(p, num) \ - PREV_PGNO(p) = num; - -/* - * Initialize a page. - * - * !!! - * Don't modify the page's LSN, code depends on it being unchanged after a - * P_INIT call. - */ -#define P_INIT(pg, pg_size, n, pg_prev, pg_next, btl, pg_type) do { \ - PGNO(pg) = n; \ - PREV_PGNO(pg) = pg_prev; \ - NEXT_PGNO(pg) = pg_next; \ - NUM_ENT(pg) = 0; \ - HOFFSET(pg) = pg_size; \ - LEVEL(pg) = btl; \ - TYPE(pg) = pg_type; \ -} while (0) - -/* Page header length (offset to first index). */ -#define P_OVERHEAD (SSZA(PAGE, inp)) - -/* First free byte. */ -#define LOFFSET(pg) (P_OVERHEAD + NUM_ENT(pg) * sizeof(db_indx_t)) - -/* Free space on the page. */ -#define P_FREESPACE(pg) (HOFFSET(pg) - LOFFSET(pg)) - -/* Get a pointer to the bytes at a specific index. */ -#define P_ENTRY(pg, indx) ((u_int8_t *)pg + ((PAGE *)pg)->inp[indx]) - -/************************************************************************ - OVERFLOW PAGE LAYOUT - ************************************************************************/ - -/* - * Overflow items are referenced by HOFFPAGE and BOVERFLOW structures, which - * store a page number (the first page of the overflow item) and a length - * (the total length of the overflow item). The overflow item consists of - * some number of overflow pages, linked by the next_pgno field of the page. - * A next_pgno field of PGNO_INVALID flags the end of the overflow item. - * - * Overflow page overloads: - * The amount of overflow data stored on each page is stored in the - * hf_offset field. - * - * The implementation reference counts overflow items as it's possible - * for them to be promoted onto btree internal pages. The reference - * count is stored in the entries field. - */ -#define OV_LEN(p) (((PAGE *)p)->hf_offset) -#define OV_REF(p) (((PAGE *)p)->entries) - -/* Maximum number of bytes that you can put on an overflow page. */ -#define P_MAXSPACE(psize) ((psize) - P_OVERHEAD) - -/************************************************************************ - HASH PAGE LAYOUT - ************************************************************************/ - -/* Each index references a group of bytes on the page. */ -#define H_KEYDATA 1 /* Key/data item. */ -#define H_DUPLICATE 2 /* Duplicate key/data item. */ -#define H_OFFPAGE 3 /* Overflow key/data item. */ -#define H_OFFDUP 4 /* Overflow page of duplicates. */ - -/* - * !!! - * Items on hash pages are (potentially) unaligned, so we can never cast the - * (page + offset) pointer to an HKEYDATA, HOFFPAGE or HOFFDUP structure, as - * we do with B+tree on-page structures. Because we frequently want the type - * field, it requires no alignment, and it's in the same location in all three - * structures, there's a pair of macros. - */ -#define HPAGE_PTYPE(p) (*(u_int8_t *)p) -#define HPAGE_TYPE(pg, indx) (*P_ENTRY(pg, indx)) - -/* - * The first and second types are H_KEYDATA and H_DUPLICATE, represented - * by the HKEYDATA structure: - * - * +-----------------------------------+ - * | type | key/data ... | - * +-----------------------------------+ - * - * For duplicates, the data field encodes duplicate elements in the data - * field: - * - * +---------------------------------------------------------------+ - * | type | len1 | element1 | len1 | len2 | element2 | len2 | - * +---------------------------------------------------------------+ - * - * Thus, by keeping track of the offset in the element, we can do both - * backward and forward traversal. - */ -typedef struct _hkeydata { - u_int8_t type; /* 00: Page type. */ - u_int8_t data[1]; /* Variable length key/data item. */ -} HKEYDATA; -#define HKEYDATA_DATA(p) (((u_int8_t *)p) + SSZA(HKEYDATA, data)) - -/* - * The length of any HKEYDATA item. Note that indx is an element index, - * not a PAIR index. - */ -#define LEN_HITEM(pg, pgsize, indx) \ - (((indx) == 0 ? pgsize : pg->inp[indx - 1]) - pg->inp[indx]) - -#define LEN_HKEYDATA(pg, psize, indx) \ - (((indx) == 0 ? psize : pg->inp[indx - 1]) - \ - pg->inp[indx] - HKEYDATA_SIZE(0)) - -/* - * Page space required to add a new HKEYDATA item to the page, with and - * without the index value. - */ -#define HKEYDATA_SIZE(len) \ - ((len) + SSZA(HKEYDATA, data)) -#define HKEYDATA_PSIZE(len) \ - (HKEYDATA_SIZE(len) + sizeof(db_indx_t)) - -/* Put a HKEYDATA item at the location referenced by a page entry. */ -#define PUT_HKEYDATA(pe, kd, len, type) { \ - ((HKEYDATA *)pe)->type = type; \ - memcpy((u_int8_t *)pe + sizeof(u_int8_t), kd, len); \ -} - -/* - * Macros the describe the page layout in terms of key-data pairs. - * The use of "pindex" indicates that the argument is the index - * expressed in pairs instead of individual elements. - */ -#define H_NUMPAIRS(pg) (NUM_ENT(pg) / 2) -#define H_KEYINDEX(pindx) (2 * (pindx)) -#define H_DATAINDEX(pindx) ((2 * (pindx)) + 1) -#define H_PAIRKEY(pg, pindx) P_ENTRY(pg, H_KEYINDEX(pindx)) -#define H_PAIRDATA(pg, pindx) P_ENTRY(pg, H_DATAINDEX(pindx)) -#define H_PAIRSIZE(pg, psize, pindx) \ - (LEN_HITEM(pg, psize, H_KEYINDEX(pindx)) + \ - LEN_HITEM(pg, psize, H_DATAINDEX(pindx))) -#define LEN_HDATA(p, psize, pindx) LEN_HKEYDATA(p, psize, H_DATAINDEX(pindx)) -#define LEN_HKEY(p, psize, pindx) LEN_HKEYDATA(p, psize, H_KEYINDEX(pindx)) - -/* - * The third type is the H_OFFPAGE, represented by the HOFFPAGE structure: - */ -typedef struct _hoffpage { - u_int8_t type; /* 00: Page type and delete flag. */ - u_int8_t unused[3]; /* 01-03: Padding, unused. */ - db_pgno_t pgno; /* 04-07: Offpage page number. */ - u_int32_t tlen; /* 08-11: Total length of item. */ -} HOFFPAGE; - -#define HOFFPAGE_PGNO(p) (((u_int8_t *)p) + SSZ(HOFFPAGE, pgno)) -#define HOFFPAGE_TLEN(p) (((u_int8_t *)p) + SSZ(HOFFPAGE, tlen)) - -/* - * Page space required to add a new HOFFPAGE item to the page, with and - * without the index value. - */ -#define HOFFPAGE_SIZE (sizeof(HOFFPAGE)) -#define HOFFPAGE_PSIZE (HOFFPAGE_SIZE + sizeof(db_indx_t)) - -/* - * The fourth type is H_OFFDUP represented by the HOFFDUP structure: - */ -typedef struct _hoffdup { - u_int8_t type; /* 00: Page type and delete flag. */ - u_int8_t unused[3]; /* 01-03: Padding, unused. */ - db_pgno_t pgno; /* 04-07: Offpage page number. */ -} HOFFDUP; -#define HOFFDUP_PGNO(p) (((u_int8_t *)p) + SSZ(HOFFDUP, pgno)) - -/* - * Page space required to add a new HOFFDUP item to the page, with and - * without the index value. - */ -#define HOFFDUP_SIZE (sizeof(HOFFDUP)) -#define HOFFDUP_PSIZE (HOFFDUP_SIZE + sizeof(db_indx_t)) - -/************************************************************************ - BTREE PAGE LAYOUT - ************************************************************************/ - -/* Each index references a group of bytes on the page. */ -#define B_KEYDATA 1 /* Key/data item. */ -#define B_DUPLICATE 2 /* Duplicate key/data item. */ -#define B_OVERFLOW 3 /* Overflow key/data item. */ - -/* - * We have to store a deleted entry flag in the page. The reason is complex, - * but the simple version is that we can't delete on-page items referenced by - * a cursor -- the return order of subsequent insertions might be wrong. The - * delete flag is an overload of the top bit of the type byte. - */ -#define B_DELETE (0x80) -#define B_DCLR(t) (t) &= ~B_DELETE -#define B_DSET(t) (t) |= B_DELETE -#define B_DISSET(t) ((t) & B_DELETE) - -#define B_TYPE(t) ((t) & ~B_DELETE) -#define B_TSET(t, type, deleted) { \ - (t) = (type); \ - if (deleted) \ - B_DSET(t); \ -} - -/* - * The first type is B_KEYDATA, represented by the BKEYDATA structure: - */ -typedef struct _bkeydata { - db_indx_t len; /* 00-01: Key/data item length. */ - u_int8_t type; /* 02: Page type AND DELETE FLAG. */ - u_int8_t data[1]; /* Variable length key/data item. */ -} BKEYDATA; - -/* Get a BKEYDATA item for a specific index. */ -#define GET_BKEYDATA(pg, indx) \ - ((BKEYDATA *)P_ENTRY(pg, indx)) - -/* - * Page space required to add a new BKEYDATA item to the page, with and - * without the index value. - */ -#define BKEYDATA_SIZE(len) \ - ALIGN((len) + SSZA(BKEYDATA, data), 4) -#define BKEYDATA_PSIZE(len) \ - (BKEYDATA_SIZE(len) + sizeof(db_indx_t)) - -/* - * The second and third types are B_DUPLICATE and B_OVERFLOW, represented - * by the BOVERFLOW structure. - */ -typedef struct _boverflow { - db_indx_t unused1; /* 00-01: Padding, unused. */ - u_int8_t type; /* 02: Page type AND DELETE FLAG. */ - u_int8_t unused2; /* 03: Padding, unused. */ - db_pgno_t pgno; /* 04-07: Next page number. */ - u_int32_t tlen; /* 08-11: Total length of item. */ -} BOVERFLOW; - -/* Get a BOVERFLOW item for a specific index. */ -#define GET_BOVERFLOW(pg, indx) \ - ((BOVERFLOW *)P_ENTRY(pg, indx)) - -/* - * Page space required to add a new BOVERFLOW item to the page, with and - * without the index value. - */ -#define BOVERFLOW_SIZE \ - ALIGN(sizeof(BOVERFLOW), 4) -#define BOVERFLOW_PSIZE \ - (BOVERFLOW_SIZE + sizeof(db_indx_t)) - -/* - * Btree leaf and hash page layouts group indices in sets of two, one - * for the key and one for the data. Everything else does it in sets - * of one to save space. I use the following macros so that it's real - * obvious what's going on... - */ -#define O_INDX 1 -#define P_INDX 2 - -/************************************************************************ - BTREE INTERNAL PAGE LAYOUT - ************************************************************************/ - -/* - * Btree internal entry. - */ -typedef struct _binternal { - db_indx_t len; /* 00-01: Key/data item length. */ - u_int8_t type; /* 02: Page type AND DELETE FLAG. */ - u_int8_t unused; /* 03: Padding, unused. */ - db_pgno_t pgno; /* 04-07: Page number of referenced page. */ - db_recno_t nrecs; /* 08-11: Subtree record count. */ - u_int8_t data[1]; /* Variable length key item. */ -} BINTERNAL; - -/* Get a BINTERNAL item for a specific index. */ -#define GET_BINTERNAL(pg, indx) \ - ((BINTERNAL *)P_ENTRY(pg, indx)) - -/* - * Page space required to add a new BINTERNAL item to the page, with and - * without the index value. - */ -#define BINTERNAL_SIZE(len) \ - ALIGN((len) + SSZA(BINTERNAL, data), 4) -#define BINTERNAL_PSIZE(len) \ - (BINTERNAL_SIZE(len) + sizeof(db_indx_t)) - -/************************************************************************ - RECNO INTERNAL PAGE LAYOUT - ************************************************************************/ - -/* - * The recno internal entry. - * - * XXX - * Why not fold this into the db_indx_t structure, it's fixed length? - */ -typedef struct _rinternal { - db_pgno_t pgno; /* 00-03: Page number of referenced page. */ - db_recno_t nrecs; /* 04-07: Subtree record count. */ -} RINTERNAL; - -/* Get a RINTERNAL item for a specific index. */ -#define GET_RINTERNAL(pg, indx) \ - ((RINTERNAL *)P_ENTRY(pg, indx)) - -/* - * Page space required to add a new RINTERNAL item to the page, with and - * without the index value. - */ -#define RINTERNAL_SIZE \ - ALIGN(sizeof(RINTERNAL), 4) -#define RINTERNAL_PSIZE \ - (RINTERNAL_SIZE + sizeof(db_indx_t)) -#endif /* _DB_PAGE_H_ */ diff --git a/db2/include/db_shash.h b/db2/include/db_shash.h deleted file mode 100644 index 35ade395fc..0000000000 --- a/db2/include/db_shash.h +++ /dev/null @@ -1,106 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1996, 1997, 1998 - * Sleepycat Software. All rights reserved. - * - * @(#)db_shash.h 10.3 (Sleepycat) 4/10/98 - */ - -/* Hash Headers */ -typedef SH_TAILQ_HEAD(hash_head) DB_HASHTAB; - -/* - * HASHLOOKUP -- - * - * Look up something in a shared memory hash table. The "elt" argument - * should be a key, and cmp_func must know how to compare a key to whatever - * structure it is that appears in the hash table. The comparison function - * cmp_func is called as: cmp_func(lookup_elt, table_elt); - * begin: address of the beginning of the hash table. - * type: the structure type of the elements that are linked in each bucket. - * field: the name of the field by which the "type" structures are linked. - * elt: the item for which we are searching in the hash table. - * result: the variable into which we'll store the element if we find it. - * nelems: the number of buckets in the hash table. - * hash_func: the hash function that operates on elements of the type of elt - * cmp_func: compare elements of the type of elt with those in the table (of - * type "type"). - * - * If the element is not in the hash table, this macro exits with result - * set to NULL. - */ -#define HASHLOOKUP(begin, type, field, elt, r, n, hash, cmp) do { \ - DB_HASHTAB *__bucket; \ - u_int32_t __ndx; \ - \ - __ndx = hash(elt) % (n); \ - __bucket = &begin[__ndx]; \ - for (r = SH_TAILQ_FIRST(__bucket, type); \ - r != NULL; r = SH_TAILQ_NEXT(r, field, type)) \ - if (cmp(elt, r)) \ - break; \ -} while(0) - -/* - * HASHINSERT -- - * - * Insert a new entry into the hash table. This assumes that lookup has - * failed; don't call it if you haven't already called HASHLOOKUP. - * begin: the beginning address of the hash table. - * type: the structure type of the elements that are linked in each bucket. - * field: the name of the field by which the "type" structures are linked. - * elt: the item to be inserted. - * nelems: the number of buckets in the hash table. - * hash_func: the hash function that operates on elements of the type of elt - */ -#define HASHINSERT(begin, type, field, elt, n, hash) do { \ - u_int32_t __ndx; \ - DB_HASHTAB *__bucket; \ - \ - __ndx = hash(elt) % (n); \ - __bucket = &begin[__ndx]; \ - SH_TAILQ_INSERT_HEAD(__bucket, elt, field, type); \ -} while(0) - -/* - * HASHREMOVE -- - * Remove the entry with a key == elt. - * begin: address of the beginning of the hash table. - * type: the structure type of the elements that are linked in each bucket. - * field: the name of the field by which the "type" structures are linked. - * elt: the item to be deleted. - * nelems: the number of buckets in the hash table. - * hash_func: the hash function that operates on elements of the type of elt - * cmp_func: compare elements of the type of elt with those in the table (of - * type "type"). - */ -#define HASHREMOVE(begin, type, field, elt, n, hash, cmp) { \ - u_int32_t __ndx; \ - DB_HASHTAB *__bucket; \ - SH_TAILQ_ENTRY *__entp; \ - \ - __ndx = hash(elt) % (n); \ - __bucket = &begin[__ndx]; \ - HASHLOOKUP(begin, type, field, elt, __entp, n, hash, cmp); \ - SH_TAILQ_REMOVE(__bucket, __entp, field, type); \ -} - -/* - * HASHREMOVE_EL -- - * Given the object "obj" in the table, remove it. - * begin: address of the beginning of the hash table. - * type: the structure type of the elements that are linked in each bucket. - * field: the name of the field by which the "type" structures are linked. - * obj: the object in the table that we with to delete. - * nelems: the number of buckets in the hash table. - * hash_func: the hash function that operates on elements of the type of elt - */ -#define HASHREMOVE_EL(begin, type, field, obj, n, hash) { \ - u_int32_t __ndx; \ - DB_HASHTAB *__bucket; \ - \ - __ndx = hash(obj) % (n); \ - __bucket = &begin[__ndx]; \ - SH_TAILQ_REMOVE(__bucket, obj, field, type); \ -} diff --git a/db2/include/db_swap.h b/db2/include/db_swap.h deleted file mode 100644 index 9f94ed721b..0000000000 --- a/db2/include/db_swap.h +++ /dev/null @@ -1,105 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1996, 1997, 1998 - * Sleepycat Software. All rights reserved. - */ -/* - * Copyright (c) 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)db_swap.h 10.5 (Sleepycat) 4/10/98 - */ - -#ifndef _DB_SWAP_H_ -#define _DB_SWAP_H_ - -/* - * Little endian <==> big endian 32-bit swap macros. - * M_32_SWAP swap a memory location - * P_32_COPY copy potentially unaligned 4 byte quantities - * P_32_SWAP swap a referenced memory location - */ -#define M_32_SWAP(a) { \ - u_int32_t _tmp; \ - _tmp = a; \ - ((u_int8_t *)&a)[0] = ((u_int8_t *)&_tmp)[3]; \ - ((u_int8_t *)&a)[1] = ((u_int8_t *)&_tmp)[2]; \ - ((u_int8_t *)&a)[2] = ((u_int8_t *)&_tmp)[1]; \ - ((u_int8_t *)&a)[3] = ((u_int8_t *)&_tmp)[0]; \ -} -#define P_32_COPY(a, b) { \ - ((u_int8_t *)b)[0] = ((u_int8_t *)a)[0]; \ - ((u_int8_t *)b)[1] = ((u_int8_t *)a)[1]; \ - ((u_int8_t *)b)[2] = ((u_int8_t *)a)[2]; \ - ((u_int8_t *)b)[3] = ((u_int8_t *)a)[3]; \ -} -#define P_32_SWAP(a) { \ - u_int32_t _tmp; \ - P_32_COPY(a, &_tmp); \ - ((u_int8_t *)a)[0] = ((u_int8_t *)&_tmp)[3]; \ - ((u_int8_t *)a)[1] = ((u_int8_t *)&_tmp)[2]; \ - ((u_int8_t *)a)[2] = ((u_int8_t *)&_tmp)[1]; \ - ((u_int8_t *)a)[3] = ((u_int8_t *)&_tmp)[0]; \ -} - -/* - * Little endian <==> big endian 16-bit swap macros. - * M_16_SWAP swap a memory location - * P_16_COPY copy potentially unaligned 2 byte quantities - * P_16_SWAP swap a referenced memory location - */ -#define M_16_SWAP(a) { \ - u_int16_t _tmp; \ - _tmp = (u_int16_t)a; \ - ((u_int8_t *)&a)[0] = ((u_int8_t *)&_tmp)[1]; \ - ((u_int8_t *)&a)[1] = ((u_int8_t *)&_tmp)[0]; \ -} -#define P_16_COPY(a, b) { \ - ((u_int8_t *)b)[0] = ((u_int8_t *)a)[0]; \ - ((u_int8_t *)b)[1] = ((u_int8_t *)a)[1]; \ -} -#define P_16_SWAP(a) { \ - u_int16_t _tmp; \ - P_16_COPY(a, &_tmp); \ - ((u_int8_t *)a)[0] = ((u_int8_t *)&_tmp)[1]; \ - ((u_int8_t *)a)[1] = ((u_int8_t *)&_tmp)[0]; \ -} - -#define SWAP32(p) { \ - P_32_SWAP(p); \ - (p) += sizeof(u_int32_t); \ -} -#define SWAP16(p) { \ - P_16_SWAP(p); \ - (p) += sizeof(u_int16_t); \ -} -#endif /* !_DB_SWAP_H_ */ diff --git a/db2/include/hash.h b/db2/include/hash.h deleted file mode 100644 index 5d85a2a3a7..0000000000 --- a/db2/include/hash.h +++ /dev/null @@ -1,199 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1996, 1997, 1998 - * Sleepycat Software. All rights reserved. - */ -/* - * Copyright (c) 1990, 1993, 1994 - * Margo Seltzer. All rights reserved. - */ -/* - * Copyright (c) 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Margo Seltzer. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)hash.h 10.14 (Sleepycat) 10/4/98 - */ - -/* Cursor structure definitions. */ -typedef struct cursor_t { - DBC *dbc; - - /* Per-thread information */ - DB_LOCK hlock; /* Metadata page lock. */ - HASHHDR *hdr; /* Pointer to meta-data page. */ - PAGE *split_buf; /* Temporary buffer for splits. */ - struct __db_h_stat stats; /* Hash statistics. */ - - /* Hash cursor information */ - db_pgno_t bucket; /* Bucket we are traversing. */ - db_pgno_t lbucket; /* Bucket for which we are locked. */ - DB_LOCK lock; /* Lock held on the current bucket. */ - PAGE *pagep; /* The current page. */ - db_pgno_t pgno; /* Current page number. */ - db_indx_t bndx; /* Index within the current page. */ - PAGE *dpagep; /* Duplicate page pointer. */ - db_pgno_t dpgno; /* Duplicate page number. */ - db_indx_t dndx; /* Index within a duplicate set. */ - db_indx_t dup_off; /* Offset within a duplicate set. */ - db_indx_t dup_len; /* Length of current duplicate. */ - db_indx_t dup_tlen; /* Total length of duplicate entry. */ - u_int32_t seek_size; /* Number of bytes we need for add. */ - db_pgno_t seek_found_page;/* Page on which we can insert. */ - -#define H_DELETED 0x0001 /* Cursor item is deleted. */ -#define H_DUPONLY 0x0002 /* Dups only; do not change key. */ -#define H_EXPAND 0x0004 /* Table expanded. */ -#define H_ISDUP 0x0008 /* Cursor is within duplicate set. */ -#define H_NOMORE 0x0010 /* No more entries in bucket. */ -#define H_OK 0x0020 /* Request succeeded. */ -#define H_DIRTY 0x0040 /* Meta-data page needs to be written */ -#define H_ORIGINAL 0x0080 /* Bucket lock existed on entry. */ - u_int32_t flags; -} HASH_CURSOR; - -#define IS_VALID(C) ((C)->bucket != BUCKET_INVALID) - -#define SAVE_CURSOR(ORIG, COPY) { \ - F_SET((ORIG), H_ORIGINAL); \ - *(COPY) = *(ORIG); \ -} - -#define RESTORE_CURSOR(D, ORIG, COPY, RET) { \ - if ((RET) == 0) { \ - if ((ORIG)->dbc->txn == NULL && \ - (COPY)->lock != 0 && (ORIG)->lock != (COPY)->lock) \ - (void)lock_put((D)->dbenv->lk_info, (COPY)->lock); \ - } else { \ - if ((ORIG)->dbc->txn == NULL && \ - (ORIG)->lock != 0 && (ORIG)->lock != (COPY)->lock) \ - (void)lock_put((D)->dbenv->lk_info, (ORIG)->lock); \ - *ORIG = *COPY; \ - } \ -} - -/* - * More interface macros used to get/release the meta data page. - */ -#define GET_META(D, I, R) { \ - if (F_ISSET(D, DB_AM_LOCKING) && \ - !F_ISSET((I)->dbc, DBC_RECOVER)) { \ - (I)->dbc->lock.pgno = BUCKET_INVALID; \ - (R) = lock_get((D)->dbenv->lk_info, (I)->dbc->locker, \ - 0, &(I)->dbc->lock_dbt, DB_LOCK_READ, &(I)->hlock); \ - (R) = (R) < 0 ? EAGAIN : (R); \ - } \ - if ((R) == 0 && \ - ((R) = __ham_get_page(D, 0, (PAGE **)&((I)->hdr))) != 0 && \ - (I)->hlock != LOCK_INVALID) { \ - (void)lock_put((D)->dbenv->lk_info, (I)->hlock); \ - (I)->hlock = LOCK_INVALID; \ - } \ -} - -#define RELEASE_META(D, I) { \ - if ((I)->hdr) \ - (void)__ham_put_page(D, (PAGE *)(I)->hdr, \ - F_ISSET(I, H_DIRTY) ? 1 : 0); \ - (I)->hdr = NULL; \ - if (!F_ISSET((I)->dbc, DBC_RECOVER) && \ - (I)->dbc->txn == NULL && (I)->hlock) \ - (void)lock_put((D)->dbenv->lk_info, (I)->hlock); \ - (I)->hlock = LOCK_INVALID; \ - F_CLR(I, H_DIRTY); \ -} - -#define DIRTY_META(D, I, R) { \ - if (F_ISSET(D, DB_AM_LOCKING) && \ - !F_ISSET((I)->dbc, DBC_RECOVER)) { \ - DB_LOCK _tmp; \ - (I)->dbc->lock.pgno = BUCKET_INVALID; \ - if (((R) = lock_get((D)->dbenv->lk_info, \ - (I)->dbc->locker, 0, &(I)->dbc->lock_dbt, \ - DB_LOCK_WRITE, &_tmp)) == 0) \ - (R) = lock_put((D)->dbenv->lk_info, (I)->hlock);\ - else if ((R) < 0) \ - (R) = EAGAIN; \ - (I)->hlock = _tmp; \ - } \ - F_SET((I), H_DIRTY); \ -} - -/* Test string. */ -#define CHARKEY "%$sniglet^&" - -/* Overflow management */ -/* - * Overflow page numbers are allocated per split point. At each doubling of - * the table, we can allocate extra pages. We keep track of how many pages - * we've allocated at each point to calculate bucket to page number mapping. - */ -#define BUCKET_TO_PAGE(I, B) \ - ((B) + 1 + ((B) ? (I)->hdr->spares[__db_log2((B)+1)-1] : 0)) - -#define PGNO_OF(I, S, O) (BUCKET_TO_PAGE((I), (1 << (S)) - 1) + (O)) - -/* Constraints about number of pages and how much data goes on a page. */ - -#define MAX_PAGES(H) UINT32_T_MAX -#define MINFILL 4 -#define ISBIG(I, N) (((N) > ((I)->hdr->pagesize / MINFILL)) ? 1 : 0) - -/* Shorthands for accessing structure */ -#define NDX_INVALID 0xFFFF -#define BUCKET_INVALID 0xFFFFFFFF - -/* On page duplicates are stored as a string of size-data-size triples. */ -#define DUP_SIZE(len) ((len) + 2 * sizeof(db_indx_t)) - -/* Log messages types (these are subtypes within a record type) */ -#define PAIR_KEYMASK 0x1 -#define PAIR_DATAMASK 0x2 -#define PAIR_ISKEYBIG(N) (N & PAIR_KEYMASK) -#define PAIR_ISDATABIG(N) (N & PAIR_DATAMASK) -#define OPCODE_OF(N) (N & ~(PAIR_KEYMASK | PAIR_DATAMASK)) - -#define PUTPAIR 0x20 -#define DELPAIR 0x30 -#define PUTOVFL 0x40 -#define DELOVFL 0x50 -#define ALLOCPGNO 0x60 -#define DELPGNO 0x70 -#define SPLITOLD 0x80 -#define SPLITNEW 0x90 - -#include "hash_auto.h" -#include "hash_ext.h" -#include "db_am.h" -#include "common_ext.h" diff --git a/db2/include/hash_auto.h b/db2/include/hash_auto.h deleted file mode 100644 index 2b8aea8d86..0000000000 --- a/db2/include/hash_auto.h +++ /dev/null @@ -1,132 +0,0 @@ -/* Do not edit: automatically built by dist/db_gen.sh. */ -#ifndef ham_AUTO_H -#define ham_AUTO_H - -#define DB_ham_insdel (DB_ham_BEGIN + 1) - -typedef struct _ham_insdel_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t opcode; - u_int32_t fileid; - db_pgno_t pgno; - u_int32_t ndx; - DB_LSN pagelsn; - DBT key; - DBT data; -} __ham_insdel_args; - - -#define DB_ham_newpage (DB_ham_BEGIN + 2) - -typedef struct _ham_newpage_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t opcode; - u_int32_t fileid; - db_pgno_t prev_pgno; - DB_LSN prevlsn; - db_pgno_t new_pgno; - DB_LSN pagelsn; - db_pgno_t next_pgno; - DB_LSN nextlsn; -} __ham_newpage_args; - - -#define DB_ham_splitmeta (DB_ham_BEGIN + 3) - -typedef struct _ham_splitmeta_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - u_int32_t bucket; - u_int32_t ovflpoint; - u_int32_t spares; - DB_LSN metalsn; -} __ham_splitmeta_args; - - -#define DB_ham_splitdata (DB_ham_BEGIN + 4) - -typedef struct _ham_splitdata_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - u_int32_t opcode; - db_pgno_t pgno; - DBT pageimage; - DB_LSN pagelsn; -} __ham_splitdata_args; - - -#define DB_ham_replace (DB_ham_BEGIN + 5) - -typedef struct _ham_replace_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t pgno; - u_int32_t ndx; - DB_LSN pagelsn; - int32_t off; - DBT olditem; - DBT newitem; - u_int32_t makedup; -} __ham_replace_args; - - -#define DB_ham_newpgno (DB_ham_BEGIN + 6) - -typedef struct _ham_newpgno_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t opcode; - u_int32_t fileid; - db_pgno_t pgno; - db_pgno_t free_pgno; - u_int32_t old_type; - db_pgno_t old_pgno; - u_int32_t new_type; - DB_LSN pagelsn; - DB_LSN metalsn; -} __ham_newpgno_args; - - -#define DB_ham_ovfl (DB_ham_BEGIN + 7) - -typedef struct _ham_ovfl_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t start_pgno; - u_int32_t npages; - db_pgno_t free_pgno; - u_int32_t ovflpoint; - DB_LSN metalsn; -} __ham_ovfl_args; - - -#define DB_ham_copypage (DB_ham_BEGIN + 8) - -typedef struct _ham_copypage_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t pgno; - DB_LSN pagelsn; - db_pgno_t next_pgno; - DB_LSN nextlsn; - db_pgno_t nnext_pgno; - DB_LSN nnextlsn; - DBT page; -} __ham_copypage_args; - -#endif diff --git a/db2/include/hash_ext.h b/db2/include/hash_ext.h deleted file mode 100644 index fe17dc7b39..0000000000 --- a/db2/include/hash_ext.h +++ /dev/null @@ -1,130 +0,0 @@ -/* DO NOT EDIT: automatically built by dist/distrib. */ -#ifndef _hash_ext_h_ -#define _hash_ext_h_ -int __ham_open __P((DB *, DB_INFO *)); -int __ham_close __P((DB *)); -int __ham_c_init __P((DBC *)); -u_int32_t __ham_call_hash __P((HASH_CURSOR *, u_int8_t *, int32_t)); -int __ham_init_dbt __P((DBT *, u_int32_t, void **, u_int32_t *)); -void __ham_c_update - __P((HASH_CURSOR *, db_pgno_t, u_int32_t, int, int)); -int __ham_insdel_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, u_int32_t, db_pgno_t, u_int32_t, - DB_LSN *, const DBT *, const DBT *)); -int __ham_insdel_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __ham_insdel_read __P((void *, __ham_insdel_args **)); -int __ham_newpage_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, u_int32_t, db_pgno_t, DB_LSN *, - db_pgno_t, DB_LSN *, db_pgno_t, DB_LSN *)); -int __ham_newpage_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __ham_newpage_read __P((void *, __ham_newpage_args **)); -int __ham_splitmeta_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, u_int32_t, u_int32_t, u_int32_t, - DB_LSN *)); -int __ham_splitmeta_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __ham_splitmeta_read __P((void *, __ham_splitmeta_args **)); -int __ham_splitdata_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, u_int32_t, db_pgno_t, const DBT *, - DB_LSN *)); -int __ham_splitdata_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __ham_splitdata_read __P((void *, __ham_splitdata_args **)); -int __ham_replace_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, u_int32_t, DB_LSN *, - int32_t, const DBT *, const DBT *, u_int32_t)); -int __ham_replace_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __ham_replace_read __P((void *, __ham_replace_args **)); -int __ham_newpgno_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, u_int32_t, db_pgno_t, db_pgno_t, - u_int32_t, db_pgno_t, u_int32_t, DB_LSN *, - DB_LSN *)); -int __ham_newpgno_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __ham_newpgno_read __P((void *, __ham_newpgno_args **)); -int __ham_ovfl_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, u_int32_t, db_pgno_t, - u_int32_t, DB_LSN *)); -int __ham_ovfl_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __ham_ovfl_read __P((void *, __ham_ovfl_args **)); -int __ham_copypage_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, - DB_LSN *, db_pgno_t, DB_LSN *, const DBT *)); -int __ham_copypage_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __ham_copypage_read __P((void *, __ham_copypage_args **)); -int __ham_init_print __P((DB_ENV *)); -int __ham_init_recover __P((DB_ENV *)); -int __ham_pgin __P((db_pgno_t, void *, DBT *)); -int __ham_pgout __P((db_pgno_t, void *, DBT *)); -int __ham_mswap __P((void *)); -int __ham_add_dup __P((DBC *, DBT *, u_int32_t)); -void __ham_move_offpage __P((DBC *, PAGE *, u_int32_t, db_pgno_t)); -void __ham_dsearch __P((DBC *, DBT *, u_int32_t *, int *)); -u_int32_t __ham_func2 __P((const void *, u_int32_t)); -u_int32_t __ham_func3 __P((const void *, u_int32_t)); -u_int32_t __ham_func4 __P((const void *, u_int32_t)); -u_int32_t __ham_func5 __P((const void *, u_int32_t)); -int __ham_item __P((DBC *, db_lockmode_t)); -int __ham_item_reset __P((DBC *)); -void __ham_item_init __P((HASH_CURSOR *)); -int __ham_item_done __P((DBC *, int)); -int __ham_item_last __P((DBC *, db_lockmode_t)); -int __ham_item_first __P((DBC *, db_lockmode_t)); -int __ham_item_prev __P((DBC *, db_lockmode_t)); -int __ham_item_next __P((DBC *, db_lockmode_t)); -void __ham_putitem __P((PAGE *p, const DBT *, int)); -void __ham_reputpair - __P((PAGE *p, u_int32_t, u_int32_t, const DBT *, const DBT *)); -int __ham_del_pair __P((DBC *, int)); -int __ham_replpair __P((DBC *, DBT *, u_int32_t)); -void __ham_onpage_replace __P((PAGE *, size_t, u_int32_t, int32_t, - int32_t, DBT *)); -int __ham_split_page __P((DBC *, u_int32_t, u_int32_t)); -int __ham_add_el __P((DBC *, const DBT *, const DBT *, int)); -void __ham_copy_item __P((size_t, PAGE *, u_int32_t, PAGE *)); -int __ham_add_ovflpage __P((DBC *, PAGE *, int, PAGE **)); -int __ham_new_page __P((DB *, u_int32_t, u_int32_t, PAGE **)); -int __ham_del_page __P((DBC *, PAGE *)); -int __ham_put_page __P((DB *, PAGE *, int32_t)); -int __ham_dirty_page __P((DB *, PAGE *)); -int __ham_get_page __P((DB *, db_pgno_t, PAGE **)); -int __ham_overflow_page - __P((DBC *, u_int32_t, PAGE **)); -#ifdef DEBUG -db_pgno_t __bucket_to_page __P((HASH_CURSOR *, db_pgno_t)); -#endif -void __ham_init_ovflpages __P((DBC *)); -int __ham_get_cpage __P((DBC *, db_lockmode_t)); -int __ham_next_cpage __P((DBC *, db_pgno_t, int, u_int32_t)); -void __ham_dpair __P((DB *, PAGE *, u_int32_t)); -int __ham_insdel_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __ham_newpage_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __ham_replace_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __ham_newpgno_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __ham_splitmeta_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __ham_splitdata_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __ham_ovfl_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __ham_copypage_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __ham_stat __P((DB *, void *, void *(*)(size_t), u_int32_t)); -#endif /* _hash_ext_h_ */ diff --git a/db2/include/lock.h b/db2/include/lock.h deleted file mode 100644 index 13364ca7a5..0000000000 --- a/db2/include/lock.h +++ /dev/null @@ -1,197 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1996, 1997, 1998 - * Sleepycat Software. All rights reserved. - * - * @(#)lock.h 10.17 (Sleepycat) 1/3/99 - */ - -typedef struct __db_lockobj DB_LOCKOBJ; - -#define DB_DEFAULT_LOCK_FILE "__db_lock.share" - -#ifndef DB_LOCK_DEFAULT_N -#define DB_LOCK_DEFAULT_N 5000 /* Default # of locks in region. */ -#endif - -/* - * The locker id space is divided between the transaction manager and the lock - * manager. Lockid's start at 0 and go to DB_LOCK_MAXID. Txn Id's start at - * DB_LOCK_MAXID + 1 and go up to TXN_INVALID. - */ -#define DB_LOCK_MAXID 0x7fffffff - -/* Check for region catastrophic shutdown. */ -#define LOCK_PANIC_CHECK(lt) { \ - if ((lt)->region->hdr.panic) \ - return (DB_RUNRECOVERY); \ -} - -/* - * The lock region consists of: - * The DB_LOCKREGION structure (sizeof(DB_LOCKREGION)). - * The conflict matrix of nmodes * nmodes bytes (nmodes * nmodes). - * The hash table for object lookup (hashsize * sizeof(DB_OBJ *)). - * The locks themselves (maxlocks * sizeof(struct __db_lock). - * The objects being locked (maxlocks * sizeof(DB_OBJ)). - * String space to represent the DBTs that are the objects being locked. - */ -struct __db_lockregion { - RLAYOUT hdr; /* Shared region header. */ - u_int32_t magic; /* lock magic number */ - u_int32_t version; /* version number */ - u_int32_t id; /* unique id generator */ - u_int32_t need_dd; /* flag for deadlock detector */ - u_int32_t detect; /* run dd on every conflict */ - SH_TAILQ_HEAD(lock_header) free_locks; /* free lock header */ - SH_TAILQ_HEAD(obj_header) free_objs; /* free obj header */ - u_int32_t maxlocks; /* maximum number of locks in table */ - u_int32_t table_size; /* size of hash table */ - u_int32_t nmodes; /* number of lock modes */ - u_int32_t numobjs; /* number of objects */ - u_int32_t nlockers; /* number of lockers */ - size_t increment; /* how much to grow region */ - size_t hash_off; /* offset of hash table */ - size_t mem_off; /* offset of memory region */ - size_t mem_bytes; /* number of bytes in memory region */ - u_int32_t nconflicts; /* number of lock conflicts */ - u_int32_t nrequests; /* number of lock gets */ - u_int32_t nreleases; /* number of lock puts */ - u_int32_t ndeadlocks; /* number of deadlocks */ -}; - -/* Macros to lock/unlock the region. */ -#define LOCK_LOCKREGION(lt) \ - (void)__db_mutex_lock(&(lt)->region->hdr.lock, (lt)->reginfo.fd) -#define UNLOCK_LOCKREGION(lt) \ - (void)__db_mutex_unlock(&(lt)->region->hdr.lock, (lt)->reginfo.fd) - -/* - * Since we will be keeping DBTs in shared memory, we need the equivalent - * of a DBT that will work in shared memory. - */ -typedef struct __sh_dbt { - u_int32_t size; - ssize_t off; -} SH_DBT; - -#define SH_DBT_PTR(p) ((void *)(((u_int8_t *)(p)) + (p)->off)) - -struct __db_lockobj { - SH_DBT lockobj; /* Identifies object locked. */ - SH_TAILQ_ENTRY links; /* Links for free list. */ - union { - SH_TAILQ_HEAD(_wait) _waiters; /* List of waiting locks. */ - u_int32_t _dd_id; /* Deadlock detector id. */ - } wlinks; - union { - SH_LIST_HEAD(_held) _heldby; /* Locks held by this locker. */ - SH_TAILQ_HEAD(_hold) _holders; /* List of held locks. */ - } dlinks; -#define DB_LOCK_OBJTYPE 1 -#define DB_LOCK_LOCKER 2 - /* Allocate room in the object to - * hold typical DB lock structures - * so that we do not have to - * allocate them from shalloc. */ - u_int8_t objdata[sizeof(struct __db_ilock)]; - u_int8_t type; /* Real object or locker id. */ -}; - -#define dd_id wlinks._dd_id -#define waiters wlinks._waiters -#define holders dlinks._holders -#define heldby dlinks._heldby - -/* - * The lock table is the per-process cookie returned from a lock_open call. - */ -struct __db_locktab { - DB_ENV *dbenv; /* Environment. */ - REGINFO reginfo; /* Region information. */ - DB_LOCKREGION *region; /* Address of shared memory region. */ - DB_HASHTAB *hashtab; /* Beginning of hash table. */ - void *mem; /* Beginning of string space. */ - u_int8_t *conflicts; /* Pointer to conflict matrix. */ -}; - -/* Test for conflicts. */ -#define CONFLICTS(T, HELD, WANTED) \ - T->conflicts[HELD * T->region->nmodes + WANTED] - -/* - * Resources in the lock region. Used to indicate which resource - * is running low when we need to grow the region. - */ -typedef enum { - DB_LOCK_MEM, DB_LOCK_OBJ, DB_LOCK_LOCK -} db_resource_t; - -struct __db_lock { - /* - * Wait on mutex to wait on lock. You reference your own mutex with - * ID 0 and others reference your mutex with ID 1. - */ - db_mutex_t mutex; - - u_int32_t holder; /* Who holds this lock. */ - SH_TAILQ_ENTRY links; /* Free or holder/waiter list. */ - SH_LIST_ENTRY locker_links; /* List of locks held by a locker. */ - u_int32_t refcount; /* Reference count the lock. */ - db_lockmode_t mode; /* What sort of lock. */ - ssize_t obj; /* Relative offset of object struct. */ - size_t txnoff; /* Offset of holding transaction. */ - db_status_t status; /* Status of this lock. */ -}; - -/* - * This is a serious layering violation. To support nested transactions, we - * need to be able to tell that a lock is held by a transaction (as opposed to - * some other locker) and to be able to traverse the parent/descendent chain. - * In order to do this, each lock held by a transaction maintains a reference - * to the shared memory transaction structure so it can be accessed during lock - * promotion. As the structure is in shared memory, we cannot store a pointer - * to it, so we use the offset within the region. As nothing lives at region - * offset 0, we use that to indicate that there is no transaction associated - * with the current lock. - */ -#define TXN_IS_HOLDING(L) ((L)->txnoff != 0 /* INVALID_REG_OFFSET */) - -/* - * We cannot return pointers to the user (else we cannot easily grow regions), - * so we return offsets in the region. These must be converted to and from - * regular pointers. Always use the macros below. - */ -#define OFFSET_TO_LOCK(lt, off) \ - ((struct __db_lock *)((u_int8_t *)((lt)->region) + (off))) -#define LOCK_TO_OFFSET(lt, lock) \ - ((size_t)((u_int8_t *)(lock) - (u_int8_t *)lt->region)) -#define OFFSET_TO_OBJ(lt, off) \ - ((DB_LOCKOBJ *)((u_int8_t *)((lt)->region) + (off))) -#define OBJ_TO_OFFSET(lt, obj) \ - ((size_t)((u_int8_t *)(obj) - (u_int8_t *)lt->region)) - -/* - * The lock header contains the region structure and the conflict matrix. - * Aligned to a large boundary because we don't know what the underlying - * type of the hash table elements are. - */ -#define LOCK_HASH_ALIGN 8 -#define LOCK_HEADER_SIZE(M) \ - ((size_t)(sizeof(DB_LOCKREGION) + ALIGN((M * M), LOCK_HASH_ALIGN))) - -/* - * For the full region, we need to add the locks, the objects, the hash table - * and the string space (which is 16 bytes per lock). - */ -#define STRING_SIZE(N) (16 * N) - -#define LOCK_REGION_SIZE(M, N, H) \ - (ALIGN(LOCK_HEADER_SIZE(M) + \ - (H) * sizeof(DB_HASHTAB), MUTEX_ALIGNMENT) + \ - (N) * ALIGN(sizeof(struct __db_lock), MUTEX_ALIGNMENT) + \ - ALIGN((N) * sizeof(DB_LOCKOBJ), sizeof(size_t)) + \ - ALIGN(STRING_SIZE(N), sizeof(size_t))) - -#include "lock_ext.h" diff --git a/db2/include/lock_ext.h b/db2/include/lock_ext.h deleted file mode 100644 index ce7994774a..0000000000 --- a/db2/include/lock_ext.h +++ /dev/null @@ -1,20 +0,0 @@ -/* DO NOT EDIT: automatically built by dist/distrib. */ -#ifndef _lock_ext_h_ -#define _lock_ext_h_ -int __lock_is_locked - __P((DB_LOCKTAB *, u_int32_t, DBT *, db_lockmode_t)); -void __lock_printlock __P((DB_LOCKTAB *, struct __db_lock *, int)); -int __lock_getobj __P((DB_LOCKTAB *, - u_int32_t, const DBT *, u_int32_t type, DB_LOCKOBJ **)); -int __lock_downgrade __P((DB_LOCKTAB *, - DB_LOCK, db_lockmode_t, u_int32_t)); -void __lock_panic __P((DB_ENV *)); -int __lock_validate_region __P((DB_LOCKTAB *)); -int __lock_grow_region __P((DB_LOCKTAB *, int, size_t)); -void __lock_dump_region __P((DB_LOCKTAB *, char *, FILE *)); -int __lock_cmp __P((const DBT *, DB_LOCKOBJ *)); -int __lock_locker_cmp __P((u_int32_t, DB_LOCKOBJ *)); -u_int32_t __lock_ohash __P((const DBT *)); -u_int32_t __lock_lhash __P((DB_LOCKOBJ *)); -u_int32_t __lock_locker_hash __P((u_int32_t)); -#endif /* _lock_ext_h_ */ diff --git a/db2/include/log.h b/db2/include/log.h deleted file mode 100644 index 50309085aa..0000000000 --- a/db2/include/log.h +++ /dev/null @@ -1,204 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1996, 1997, 1998 - * Sleepycat Software. All rights reserved. - * - * @(#)log.h 10.30 (Sleepycat) 10/11/98 - */ - -#ifndef _LOG_H_ -#define _LOG_H_ - -struct __fname; typedef struct __fname FNAME; -struct __hdr; typedef struct __hdr HDR; -struct __log; typedef struct __log LOG; -struct __log_persist; typedef struct __log_persist LOGP; - -#ifndef MAXLFNAME -#define LFPREFIX "log." /* Log file name prefix. */ -#define LFNAME "log.%010d" /* Log file name template. */ -#define LFNAME_V1 "log.%05d" /* Log file name template, rev 1. */ -#define MAXLFNAME 2000000000 /* Maximum log file name. */ -#endif - /* Default log name. */ -#define DB_DEFAULT_LOG_FILE "__db_log.share" - -#define DEFAULT_MAX (10 * MEGABYTE) /* 10 Mb. */ - -/* Macros to lock/unlock the region and threads. */ -#define LOCK_LOGTHREAD(dblp) \ - if (F_ISSET(dblp, DB_AM_THREAD)) \ - (void)__db_mutex_lock((dblp)->mutexp, -1) -#define UNLOCK_LOGTHREAD(dblp) \ - if (F_ISSET(dblp, DB_AM_THREAD)) \ - (void)__db_mutex_unlock((dblp)->mutexp, -1); -#define LOCK_LOGREGION(dblp) \ - (void)__db_mutex_lock(&((RLAYOUT *)(dblp)->lp)->lock, \ - (dblp)->reginfo.fd) -#define UNLOCK_LOGREGION(dblp) \ - (void)__db_mutex_unlock(&((RLAYOUT *)(dblp)->lp)->lock, \ - (dblp)->reginfo.fd) - -/* Check for region catastrophic shutdown. */ -#define LOG_PANIC_CHECK(dblp) { \ - if ((dblp)->lp->rlayout.panic) \ - return (DB_RUNRECOVERY); \ -} - -/* - * The per-process table that maps log file-id's to DB structures. - */ -typedef struct __db_entry { - DB *dbp; /* Associated DB structure. */ - u_int32_t refcount; /* Reference counted. */ - int deleted; /* File was not found during open. */ -} DB_ENTRY; - -/* - * DB_LOG - * Per-process log structure. - */ -struct __db_log { -/* These fields need to be protected for multi-threaded support. */ - db_mutex_t *mutexp; /* Mutex for thread protection. */ - - DB_ENTRY *dbentry; /* Recovery file-id mapping. */ -#define DB_GROW_SIZE 64 - u_int32_t dbentry_cnt; /* Entries. Grows by DB_GROW_SIZE. */ - -/* - * These fields are always accessed while the region lock is held, so they do - * not have to be protected by the thread lock as well OR, they are only used - * when threads are not being used, i.e. most cursor operations are disallowed - * on threaded logs. - */ - u_int32_t lfname; /* Log file "name". */ - int lfd; /* Log file descriptor. */ - - DB_LSN c_lsn; /* Cursor: current LSN. */ - DBT c_dbt; /* Cursor: return DBT structure. */ - int c_fd; /* Cursor: file descriptor. */ - u_int32_t c_off; /* Cursor: previous record offset. */ - u_int32_t c_len; /* Cursor: current record length. */ - -/* These fields are not protected. */ - LOG *lp; /* Address of the shared LOG. */ - - DB_ENV *dbenv; /* Reference to error information. */ - REGINFO reginfo; /* Region information. */ - - void *addr; /* Address of shalloc() region. */ - - char *dir; /* Directory argument. */ - -/* - * These fields are used by XA; since XA forbids threaded execution, these - * do not have to be protected. - */ - void *xa_info; /* Committed transaction list that - * has to be carried between calls - * to xa_recover. */ - DB_LSN xa_lsn; /* Position of an XA recovery scan. */ - DB_LSN xa_first; /* LSN to which we need to roll back - for this XA recovery scan. */ - - /* - * !!! - * Currently used to hold: - * DB_AM_THREAD (a DB flag) - * DBC_RECOVER (a DBC flag) - * If they are ever the same bits, we're in serious trouble. - */ -#if DB_AM_THREAD == DBC_RECOVER - DB_AM_THREAD, DBC_RECOVER, FLAG MISMATCH -#endif - u_int32_t flags; -}; - -/* - * HDR -- - * Log record header. - */ -struct __hdr { - u_int32_t prev; /* Previous offset. */ - u_int32_t cksum; /* Current checksum. */ - u_int32_t len; /* Current length. */ -}; - -struct __log_persist { - u_int32_t magic; /* DB_LOGMAGIC */ - u_int32_t version; /* DB_LOGVERSION */ - - u_int32_t lg_max; /* Maximum file size. */ - int mode; /* Log file mode. */ -}; - -/* - * LOG -- - * Shared log region. One of these is allocated in shared memory, - * and describes the log. - */ -struct __log { - RLAYOUT rlayout; /* General region information. */ - - LOGP persist; /* Persistent information. */ - - SH_TAILQ_HEAD(__fq) fq; /* List of file names. */ - - /* - * The lsn LSN is the file offset that we're about to write and which - * we will return to the user. - */ - DB_LSN lsn; /* LSN at current file offset. */ - - /* - * The s_lsn LSN is the last LSN that we know is on disk, not just - * written, but synced. - */ - DB_LSN s_lsn; /* LSN of the last sync. */ - - u_int32_t len; /* Length of the last record. */ - - u_int32_t w_off; /* Current write offset in the file. */ - - DB_LSN chkpt_lsn; /* LSN of the last checkpoint. */ - time_t chkpt; /* Time of the last checkpoint. */ - - DB_LOG_STAT stat; /* Log statistics. */ - - /* - * The f_lsn LSN is the LSN (returned to the user) that "owns" the - * first byte of the buffer. If the record associated with the LSN - * spans buffers, it may not reflect the physical file location of - * the first byte of the buffer. - */ - DB_LSN f_lsn; /* LSN of first byte in the buffer. */ - size_t b_off; /* Current offset in the buffer. */ - u_int8_t buf[4 * 1024]; /* Log buffer. */ -}; - -/* - * FNAME -- - * File name and id. - */ -struct __fname { - SH_TAILQ_ENTRY q; /* File name queue. */ - - u_int16_t ref; /* Reference count. */ - - u_int32_t id; /* Logging file id. */ - DBTYPE s_type; /* Saved DB type. */ - - size_t name_off; /* Name offset. */ - u_int8_t ufid[DB_FILE_ID_LEN]; /* Unique file id. */ -}; - -/* File open/close register log record opcodes. */ -#define LOG_CHECKPOINT 1 /* Checkpoint: file name/id dump. */ -#define LOG_CLOSE 2 /* File close. */ -#define LOG_OPEN 3 /* File open. */ - -#include "log_auto.h" -#include "log_ext.h" -#endif /* _LOG_H_ */ diff --git a/db2/include/log_auto.h b/db2/include/log_auto.h deleted file mode 100644 index 5717e140d7..0000000000 --- a/db2/include/log_auto.h +++ /dev/null @@ -1,18 +0,0 @@ -/* Do not edit: automatically built by dist/db_gen.sh. */ -#ifndef log_AUTO_H -#define log_AUTO_H - -#define DB_log_register (DB_log_BEGIN + 1) - -typedef struct _log_register_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t opcode; - DBT name; - DBT uid; - u_int32_t id; - DBTYPE ftype; -} __log_register_args; - -#endif diff --git a/db2/include/log_ext.h b/db2/include/log_ext.h deleted file mode 100644 index 842a3f4265..0000000000 --- a/db2/include/log_ext.h +++ /dev/null @@ -1,26 +0,0 @@ -/* DO NOT EDIT: automatically built by dist/distrib. */ -#ifndef _log_ext_h_ -#define _log_ext_h_ -void __log_panic __P((DB_ENV *)); -int __log_find __P((DB_LOG *, int, int *)); -int __log_valid __P((DB_LOG *, u_int32_t, int)); -int __log_register_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, const DBT *, const DBT *, u_int32_t, - DBTYPE)); -int __log_register_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __log_register_read __P((void *, __log_register_args **)); -int __log_init_print __P((DB_ENV *)); -int __log_init_recover __P((DB_ENV *)); -int __log_findckp __P((DB_LOG *, DB_LSN *)); -int __log_get __P((DB_LOG *, DB_LSN *, DBT *, u_int32_t, int)); -int __log_put __P((DB_LOG *, DB_LSN *, const DBT *, u_int32_t)); -int __log_name __P((DB_LOG *, u_int32_t, char **, int *, u_int32_t)); -int __log_register_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __log_add_logid __P((DB_LOG *, DB *, u_int32_t)); -int __db_fileid_to_db __P((DB_LOG *, DB **, u_int32_t)); -void __log_close_files __P((DB_LOG *)); -void __log_rem_logid __P((DB_LOG *, u_int32_t)); -#endif /* _log_ext_h_ */ diff --git a/db2/include/mp.h b/db2/include/mp.h deleted file mode 100644 index 904bccfe98..0000000000 --- a/db2/include/mp.h +++ /dev/null @@ -1,299 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1996, 1997, 1998 - * Sleepycat Software. All rights reserved. - * - * @(#)mp.h 10.37 (Sleepycat) 1/1/99 - */ - -struct __bh; typedef struct __bh BH; -struct __db_mpreg; typedef struct __db_mpreg DB_MPREG; -struct __mpool; typedef struct __mpool MPOOL; -struct __mpoolfile; typedef struct __mpoolfile MPOOLFILE; - - /* Default mpool name. */ -#define DB_DEFAULT_MPOOL_FILE "__db_mpool.share" - -/* - * We default to 256K (32 8K pages) if the user doesn't specify, and - * require a minimum of 20K. - */ -#ifndef DB_CACHESIZE_DEF -#define DB_CACHESIZE_DEF (256 * 1024) -#endif -#define DB_CACHESIZE_MIN ( 20 * 1024) - -#define INVALID 0 /* Invalid shared memory offset. */ - -/* - * There are three ways we do locking in the mpool code: - * - * Locking a handle mutex to provide concurrency for DB_THREAD operations. - * Locking the region mutex to provide mutual exclusion while reading and - * writing structures in the shared region. - * Locking buffer header mutexes during I/O. - * - * The first will not be further described here. We use the shared mpool - * region lock to provide mutual exclusion while reading/modifying all of - * the data structures, including the buffer headers. We use a per-buffer - * header lock to wait on buffer I/O. The order of locking is as follows: - * - * Searching for a buffer: - * Acquire the region lock. - * Find the buffer header. - * Increment the reference count (guarantee the buffer stays). - * While the BH_LOCKED flag is set (I/O is going on) { - * Release the region lock. - * Explicitly yield the processor if it's not the first pass - * through this loop, otherwise, we can simply spin because - * we'll be simply switching between the two locks. - * Request the buffer lock. - * The I/O will complete... - * Acquire the buffer lock. - * Release the buffer lock. - * Acquire the region lock. - * } - * Return the buffer. - * - * Reading/writing a buffer: - * Acquire the region lock. - * Find/create the buffer header. - * If reading, increment the reference count (guarantee the buffer stays). - * Set the BH_LOCKED flag. - * Acquire the buffer lock (guaranteed not to block). - * Release the region lock. - * Do the I/O and/or initialize the buffer contents. - * Release the buffer lock. - * At this point, the buffer lock is available, but the logical - * operation (flagged by BH_LOCKED) is not yet completed. For - * this reason, among others, threads checking the BH_LOCKED flag - * must loop around their test. - * Acquire the region lock. - * Clear the BH_LOCKED flag. - * Release the region lock. - * Return/discard the buffer. - * - * Pointers to DB_MPOOL, MPOOL, DB_MPOOLFILE and MPOOLFILE structures are not - * reacquired when a region lock is reacquired because they couldn't have been - * closed/discarded and because they never move in memory. - */ -#define LOCKINIT(dbmp, mutexp) \ - if (F_ISSET(dbmp, MP_LOCKHANDLE | MP_LOCKREGION)) \ - (void)__db_mutex_init(mutexp, \ - MUTEX_LOCK_OFFSET((dbmp)->reginfo.addr, mutexp)) - -#define LOCKHANDLE(dbmp, mutexp) \ - if (F_ISSET(dbmp, MP_LOCKHANDLE)) \ - (void)__db_mutex_lock(mutexp, (dbmp)->reginfo.fd) -#define UNLOCKHANDLE(dbmp, mutexp) \ - if (F_ISSET(dbmp, MP_LOCKHANDLE)) \ - (void)__db_mutex_unlock(mutexp, (dbmp)->reginfo.fd) - -#define LOCKREGION(dbmp) \ - if (F_ISSET(dbmp, MP_LOCKREGION)) \ - (void)__db_mutex_lock(&((RLAYOUT *)(dbmp)->mp)->lock, \ - (dbmp)->reginfo.fd) -#define UNLOCKREGION(dbmp) \ - if (F_ISSET(dbmp, MP_LOCKREGION)) \ - (void)__db_mutex_unlock(&((RLAYOUT *)(dbmp)->mp)->lock, \ - (dbmp)->reginfo.fd) - -#define LOCKBUFFER(dbmp, bhp) \ - if (F_ISSET(dbmp, MP_LOCKREGION)) \ - (void)__db_mutex_lock(&(bhp)->mutex, (dbmp)->reginfo.fd) -#define UNLOCKBUFFER(dbmp, bhp) \ - if (F_ISSET(dbmp, MP_LOCKREGION)) \ - (void)__db_mutex_unlock(&(bhp)->mutex, (dbmp)->reginfo.fd) - -/* Check for region catastrophic shutdown. */ -#define MP_PANIC_CHECK(dbmp) { \ - if ((dbmp)->mp->rlayout.panic) \ - return (DB_RUNRECOVERY); \ -} - -/* - * DB_MPOOL -- - * Per-process memory pool structure. - */ -struct __db_mpool { -/* These fields need to be protected for multi-threaded support. */ - db_mutex_t *mutexp; /* Structure lock. */ - - /* List of pgin/pgout routines. */ - LIST_HEAD(__db_mpregh, __db_mpreg) dbregq; - - /* List of DB_MPOOLFILE's. */ - TAILQ_HEAD(__db_mpoolfileh, __db_mpoolfile) dbmfq; - -/* These fields are not protected. */ - DB_ENV *dbenv; /* Reference to error information. */ - REGINFO reginfo; /* Region information. */ - - MPOOL *mp; /* Address of the shared MPOOL. */ - - void *addr; /* Address of shalloc() region. */ - - DB_HASHTAB *htab; /* Hash table of bucket headers. */ - -#define MP_LOCKHANDLE 0x01 /* Threaded, lock handles and region. */ -#define MP_LOCKREGION 0x02 /* Concurrent access, lock region. */ - u_int32_t flags; -}; - -/* - * DB_MPREG -- - * DB_MPOOL registry of pgin/pgout functions. - */ -struct __db_mpreg { - LIST_ENTRY(__db_mpreg) q; /* Linked list. */ - - int ftype; /* File type. */ - /* Pgin, pgout routines. */ - int (DB_CALLBACK *pgin) __P((db_pgno_t, void *, DBT *)); - int (DB_CALLBACK *pgout) __P((db_pgno_t, void *, DBT *)); -}; - -/* - * DB_MPOOLFILE -- - * Per-process DB_MPOOLFILE information. - */ -struct __db_mpoolfile { -/* These fields need to be protected for multi-threaded support. */ - db_mutex_t *mutexp; /* Structure lock. */ - - int fd; /* Underlying file descriptor. */ - - u_int32_t ref; /* Reference count. */ - - /* - * !!! - * This field is a special case -- it's protected by the region lock - * NOT the thread lock. The reason for this is that we always have - * the region lock immediately before or after we modify the field, - * and we don't want to use the structure lock to protect it because - * then I/O (which is done with the structure lock held because of - * the race between the seek and write of the file descriptor) will - * block any other put/get calls using this DB_MPOOLFILE structure. - */ - u_int32_t pinref; /* Pinned block reference count. */ - -/* These fields are not protected. */ - TAILQ_ENTRY(__db_mpoolfile) q; /* Linked list of DB_MPOOLFILE's. */ - - DB_MPOOL *dbmp; /* Overlying DB_MPOOL. */ - MPOOLFILE *mfp; /* Underlying MPOOLFILE. */ - - void *addr; /* Address of mmap'd region. */ - size_t len; /* Length of mmap'd region. */ - -/* These fields need to be protected for multi-threaded support. */ -#define MP_READONLY 0x01 /* File is readonly. */ -#define MP_UPGRADE 0x02 /* File descriptor is readwrite. */ -#define MP_UPGRADE_FAIL 0x04 /* Upgrade wasn't possible. */ - u_int32_t flags; -}; - -/* - * MPOOL -- - * Shared memory pool region. One of these is allocated in shared - * memory, and describes the pool. - */ -struct __mpool { - RLAYOUT rlayout; /* General region information. */ - - SH_TAILQ_HEAD(__bhq) bhq; /* LRU list of buckets. */ - SH_TAILQ_HEAD(__bhfq) bhfq; /* Free buckets. */ - SH_TAILQ_HEAD(__mpfq) mpfq; /* List of MPOOLFILEs. */ - - /* - * We make the assumption that the early pages of the file are far - * more likely to be retrieved than the later pages, which means - * that the top bits are more interesting for hashing since they're - * less likely to collide. On the other hand, since 512 4K pages - * represents a 2MB file, only the bottom 9 bits of the page number - * are likely to be set. We XOR in the offset in the MPOOL of the - * MPOOLFILE that backs this particular page, since that should also - * be unique for the page. - */ -#define BUCKET(mp, mf_offset, pgno) \ - (((pgno) ^ ((mf_offset) << 9)) % (mp)->htab_buckets) - - size_t htab; /* Hash table offset. */ - size_t htab_buckets; /* Number of hash table entries. */ - - DB_LSN lsn; /* Maximum checkpoint LSN. */ - u_int32_t lsn_cnt; /* Checkpoint buffers left to write. */ - - DB_MPOOL_STAT stat; /* Global mpool statistics. */ - -#define MP_LSN_RETRY 0x01 /* Retry all BH_WRITE buffers. */ - u_int32_t flags; -}; - -/* - * MPOOLFILE -- - * Shared DB_MPOOLFILE information. - */ -struct __mpoolfile { - SH_TAILQ_ENTRY q; /* List of MPOOLFILEs */ - - u_int32_t ref; /* Reference count. */ - - int ftype; /* File type. */ - - int32_t lsn_off; /* Page's LSN offset. */ - u_int32_t clear_len; /* Bytes to clear on page create. */ - - size_t path_off; /* File name location. */ - size_t fileid_off; /* File identification location. */ - - size_t pgcookie_len; /* Pgin/pgout cookie length. */ - size_t pgcookie_off; /* Pgin/pgout cookie location. */ - - u_int32_t lsn_cnt; /* Checkpoint buffers left to write. */ - - db_pgno_t last_pgno; /* Last page in the file. */ - db_pgno_t orig_last_pgno; /* Original last page in the file. */ - -#define MP_CAN_MMAP 0x01 /* If the file can be mmap'd. */ -#define MP_TEMP 0x02 /* Backing file is a temporary. */ - u_int32_t flags; - - DB_MPOOL_FSTAT stat; /* Per-file mpool statistics. */ -}; - -/* - * BH -- - * Buffer header. - */ -struct __bh { - db_mutex_t mutex; /* Structure lock. */ - - u_int16_t ref; /* Reference count. */ - -#define BH_CALLPGIN 0x001 /* Page needs to be reworked... */ -#define BH_DIRTY 0x002 /* Page was modified. */ -#define BH_DISCARD 0x004 /* Page is useless. */ -#define BH_LOCKED 0x008 /* Page is locked (I/O in progress). */ -#define BH_TRASH 0x010 /* Page is garbage. */ -#define BH_WRITE 0x020 /* Page scheduled for writing. */ - u_int16_t flags; - - SH_TAILQ_ENTRY q; /* LRU queue. */ - SH_TAILQ_ENTRY hq; /* MPOOL hash bucket queue. */ - - db_pgno_t pgno; /* Underlying MPOOLFILE page number. */ - size_t mf_offset; /* Associated MPOOLFILE offset. */ - - /* - * !!! - * This array must be size_t aligned -- the DB access methods put PAGE - * and other structures into it, and expect to be able to access them - * directly. (We guarantee size_t alignment in the db_mpool(3) manual - * page as well.) - */ - u_int8_t buf[1]; /* Variable length data. */ -}; - -#include "mp_ext.h" diff --git a/db2/include/mp_ext.h b/db2/include/mp_ext.h deleted file mode 100644 index 8b46334408..0000000000 --- a/db2/include/mp_ext.h +++ /dev/null @@ -1,21 +0,0 @@ -/* DO NOT EDIT: automatically built by dist/distrib. */ -#ifndef _mp_ext_h_ -#define _mp_ext_h_ -int __memp_bhwrite - __P((DB_MPOOL *, MPOOLFILE *, BH *, int *, int *)); -int __memp_pgread __P((DB_MPOOLFILE *, BH *, int)); -int __memp_pgwrite __P((DB_MPOOLFILE *, BH *, int *, int *)); -int __memp_pg __P((DB_MPOOLFILE *, BH *, int)); -void __memp_bhfree __P((DB_MPOOL *, MPOOLFILE *, BH *, int)); -int __memp_fopen __P((DB_MPOOL *, MPOOLFILE *, const char *, - u_int32_t, int, size_t, int, DB_MPOOL_FINFO *, DB_MPOOLFILE **)); -void __memp_panic __P((DB_ENV *)); -char * __memp_fn __P((DB_MPOOLFILE *)); -char * __memp_fns __P((DB_MPOOL *, MPOOLFILE *)); -void __memp_dump_region __P((DB_MPOOL *, char *, FILE *)); -int __memp_reg_alloc __P((DB_MPOOL *, size_t, size_t *, void *)); -int __memp_alloc __P((DB_MPOOL *, size_t, size_t *, void *)); -int __memp_ropen - __P((DB_MPOOL *, const char *, size_t, int, int, u_int32_t)); -int __mp_xxx_fd __P((DB_MPOOLFILE *, int *)); -#endif /* _mp_ext_h_ */ diff --git a/db2/include/mutex_ext.h b/db2/include/mutex_ext.h deleted file mode 100644 index b48da5d2f4..0000000000 --- a/db2/include/mutex_ext.h +++ /dev/null @@ -1,7 +0,0 @@ -/* DO NOT EDIT: automatically built by dist/distrib. */ -#ifndef _mutex_ext_h_ -#define _mutex_ext_h_ -int __db_mutex_init __P((db_mutex_t *, u_int32_t)); -int __db_mutex_lock __P((db_mutex_t *, int)); -int __db_mutex_unlock __P((db_mutex_t *, int)); -#endif /* _mutex_ext_h_ */ diff --git a/db2/include/os.h b/db2/include/os.h deleted file mode 100644 index f173d1f610..0000000000 --- a/db2/include/os.h +++ /dev/null @@ -1,24 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997, 1998 - * Sleepycat Software. All rights reserved. - * - * @(#)os.h 10.11 (Sleepycat) 10/12/98 - */ - -/* - * We group seek/write calls into a single function so that we can use - * pread(2)/pwrite(2) where they're available. - */ -#define DB_IO_READ 1 -#define DB_IO_WRITE 2 -typedef struct __io { - int fd_io; /* I/O file descriptor. */ - int fd_lock; /* Locking file descriptor. */ - db_mutex_t *mutexp; /* Mutex to lock. */ - size_t pagesize; /* Page size. */ - db_pgno_t pgno; /* Page number. */ - u_int8_t *buf; /* Buffer. */ - size_t bytes; /* Bytes read/written. */ -} DB_IO; diff --git a/db2/include/os_ext.h b/db2/include/os_ext.h deleted file mode 100644 index 346210975f..0000000000 --- a/db2/include/os_ext.h +++ /dev/null @@ -1,40 +0,0 @@ -/* DO NOT EDIT: automatically built by dist/distrib. */ -#ifndef _os_ext_h_ -#define _os_ext_h_ -int __os_abspath __P((const char *)); -int __os_strdup __P((const char *, void *)); -int __os_calloc __P((size_t, size_t, void *)); -int __os_malloc __P((size_t, void *(*)(size_t), void *)); -int __os_realloc __P((void *, size_t)); -void __os_free __P((void *, size_t)); -void __os_freestr __P((void *)); -int __os_dirlist __P((const char *, char ***, int *)); -void __os_dirfree __P((char **, int)); -int __os_fileid __P((DB_ENV *, const char *, int, u_int8_t *)); -int __os_fsync __P((int)); -int __db_mapanon_ok __P((int)); -int __db_mapinit __P((void)); -int __db_mapregion __P((char *, REGINFO *)); -int __db_unmapregion __P((REGINFO *)); -int __db_unlinkregion __P((char *, REGINFO *)); -int __db_mapfile __P((char *, int, size_t, int, void **)); -int __db_unmapfile __P((void *, size_t)); -u_int32_t __db_oflags __P((int)); -int __db_omode __P((const char *)); -int __db_open __P((const char *, u_int32_t, u_int32_t, int, int *)); -int __os_open __P((const char *, int, int, int *)); -int __os_close __P((int)); -char *__db_rpath __P((const char *)); -int __os_io __P((DB_IO *, int, ssize_t *)); -int __os_read __P((int, void *, size_t, ssize_t *)); -int __os_write __P((int, const void *, size_t, ssize_t *)); -int __os_seek __P((int, size_t, db_pgno_t, u_int32_t, int, int)); -int __os_sleep __P((u_long, u_long)); -int __os_spin __P((void)); -void __os_yield __P((u_long)); -int __os_exists __P((const char *, int *)); -int __os_ioinfo - __P((const char *, int, u_int32_t *, u_int32_t *, u_int32_t *)); -int __os_tmpdir __P((DB_ENV *, u_int32_t)); -int __os_unlink __P((const char *)); -#endif /* _os_ext_h_ */ diff --git a/db2/include/os_jump.h b/db2/include/os_jump.h deleted file mode 100644 index e2d577ff10..0000000000 --- a/db2/include/os_jump.h +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997, 1998 - * Sleepycat Software. All rights reserved. - * - * @(#)os_jump.h 10.1 (Sleepycat) 10/17/98 - */ - -/* Calls which can be replaced by the application. */ -struct __db_jumptab { - int (*j_close) __P((int)); /* DB_FUNC_CLOSE */ - void (*j_dirfree) __P((char **, int)); /* DB_FUNC_DIRFREE */ - int (*j_dirlist) /* DB_FUNC_DIRLIST */ - __P((const char *, char ***, int *)); - int (*j_exists) /* DB_FUNC_EXISTS */ - __P((const char *, int *)); - void (*j_free) __P((void *)); /* DB_FUNC_FREE */ - int (*j_fsync) __P((int)); /* DB_FUNC_FSYNC */ - int (*j_ioinfo) __P((const char *, /* DB_FUNC_IOINFO */ - int, u_int32_t *, u_int32_t *, u_int32_t *)); - void *(*j_malloc) __P((size_t)); /* DB_FUNC_MALLOC */ - int (*j_map) /* DB_FUNC_MAP */ - __P((char *, int, size_t, int, int, int, void **)); - int (*j_open) /* DB_FUNC_OPEN */ - __P((const char *, int, ...)); - ssize_t (*j_read) __P((int, void *, size_t)); /* DB_FUNC_READ */ - void *(*j_realloc) __P((void *, size_t)); /* DB_FUNC_REALLOC */ - int (*j_runlink) __P((char *)); /* DB_FUNC_RUNLINK */ - int (*j_seek) /* DB_FUNC_SEEK */ - __P((int, size_t, db_pgno_t, u_int32_t, int, int)); - int (*j_sleep) __P((u_long, u_long)); /* DB_FUNC_SLEEP */ - int (*j_unlink) __P((const char *)); /* DB_FUNC_UNLINK */ - int (*j_unmap) __P((void *, size_t)); /* DB_FUNC_UNMAP */ - ssize_t (*j_write) /* DB_FUNC_WRITE */ - __P((int, const void *, size_t)); - int (*j_yield) __P((void)); /* DB_FUNC_YIELD */ -}; - -extern struct __db_jumptab __db_jump; diff --git a/db2/include/queue.h b/db2/include/queue.h deleted file mode 100644 index f606eb0497..0000000000 --- a/db2/include/queue.h +++ /dev/null @@ -1,275 +0,0 @@ -/* BSDI $Id$ */ - -/* - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)queue.h 8.5 (Berkeley) 8/20/94 - */ - -#ifndef _SYS_QUEUE_H_ -#define _SYS_QUEUE_H_ - -/* - * This file defines three types of data structures: lists, tail queues, - * and circular queues. - * - * A list is headed by a single forward pointer (or an array of forward - * pointers for a hash table header). The elements are doubly linked - * so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before - * or after an existing element or at the head of the list. A list - * may only be traversed in the forward direction. - * - * A tail queue is headed by a pair of pointers, one to the head of the - * list and the other to the tail of the list. The elements are doubly - * linked so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before or - * after an existing element, at the head of the list, or at the end of - * the list. A tail queue may only be traversed in the forward direction. - * - * A circle queue is headed by a pair of pointers, one to the head of the - * list and the other to the tail of the list. The elements are doubly - * linked so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before or after - * an existing element, at the head of the list, or at the end of the list. - * A circle queue may be traversed in either direction, but has a more - * complex end of list detection. - * - * For details on the use of these macros, see the queue(3) manual page. - */ - -/* - * List definitions. - */ -#define LIST_HEAD(name, type) \ -struct name { \ - struct type *lh_first; /* first element */ \ -} - -#define LIST_ENTRY(type) \ -struct { \ - struct type *le_next; /* next element */ \ - struct type **le_prev; /* address of previous next element */ \ -} - -#define LIST_FIRST(head) ((head)->lh_first) -#define LIST_NEXT(elm, field) ((elm)->field.le_next) -#define LIST_END(head) NULL - -/* - * List functions. - */ -#define LIST_INIT(head) { \ - (head)->lh_first = NULL; \ -} - -#define LIST_INSERT_AFTER(listelm, elm, field) do { \ - if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ - (listelm)->field.le_next->field.le_prev = \ - &(elm)->field.le_next; \ - (listelm)->field.le_next = (elm); \ - (elm)->field.le_prev = &(listelm)->field.le_next; \ -} while (0) - -#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.le_prev = (listelm)->field.le_prev; \ - (elm)->field.le_next = (listelm); \ - *(listelm)->field.le_prev = (elm); \ - (listelm)->field.le_prev = &(elm)->field.le_next; \ -} while (0) - -#define LIST_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.le_next = (head)->lh_first) != NULL) \ - (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ - (head)->lh_first = (elm); \ - (elm)->field.le_prev = &(head)->lh_first; \ -} while (0) - -#define LIST_REMOVE(elm, field) do { \ - if ((elm)->field.le_next != NULL) \ - (elm)->field.le_next->field.le_prev = \ - (elm)->field.le_prev; \ - *(elm)->field.le_prev = (elm)->field.le_next; \ -} while (0) - -/* - * Tail queue definitions. - */ -#define TAILQ_HEAD(name, type) \ -struct name { \ - struct type *tqh_first; /* first element */ \ - struct type **tqh_last; /* addr of last next element */ \ -} - -#define TAILQ_ENTRY(type) \ -struct { \ - struct type *tqe_next; /* next element */ \ - struct type **tqe_prev; /* address of previous next element */ \ -} - -#define TAILQ_FIRST(head) ((head)->tqh_first) -#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) -#define TAILQ_END(head) NULL - -/* - * Tail queue functions. - */ -#define TAILQ_INIT(head) do { \ - (head)->tqh_first = NULL; \ - (head)->tqh_last = &(head)->tqh_first; \ -} while (0) - -#define TAILQ_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ - (head)->tqh_first->field.tqe_prev = \ - &(elm)->field.tqe_next; \ - else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ - (head)->tqh_first = (elm); \ - (elm)->field.tqe_prev = &(head)->tqh_first; \ -} while (0) - -#define TAILQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.tqe_next = NULL; \ - (elm)->field.tqe_prev = (head)->tqh_last; \ - *(head)->tqh_last = (elm); \ - (head)->tqh_last = &(elm)->field.tqe_next; \ -} while (0) - -#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ - (elm)->field.tqe_next->field.tqe_prev = \ - &(elm)->field.tqe_next; \ - else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ - (listelm)->field.tqe_next = (elm); \ - (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ -} while (0) - -#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ - (elm)->field.tqe_next = (listelm); \ - *(listelm)->field.tqe_prev = (elm); \ - (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ -} while (0) - -#define TAILQ_REMOVE(head, elm, field) do { \ - if (((elm)->field.tqe_next) != NULL) \ - (elm)->field.tqe_next->field.tqe_prev = \ - (elm)->field.tqe_prev; \ - else \ - (head)->tqh_last = (elm)->field.tqe_prev; \ - *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ -} while (0) - -/* - * Circular queue definitions. - */ -#define CIRCLEQ_HEAD(name, type) \ -struct name { \ - struct type *cqh_first; /* first element */ \ - struct type *cqh_last; /* last element */ \ -} - -#define CIRCLEQ_ENTRY(type) \ -struct { \ - struct type *cqe_next; /* next element */ \ - struct type *cqe_prev; /* previous element */ \ -} - -#define CIRCLEQ_FIRST(head) ((head)->cqh_first) -#define CIRCLEQ_LAST(head) ((head)->cqh_last) -#define CIRCLEQ_END(head) ((void *)(head)) -#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) -#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) - -/* - * Circular queue functions. - */ -#define CIRCLEQ_INIT(head) do { \ - (head)->cqh_first = (void *)(head); \ - (head)->cqh_last = (void *)(head); \ -} while (0) - -#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ - (elm)->field.cqe_next = (listelm)->field.cqe_next; \ - (elm)->field.cqe_prev = (listelm); \ - if ((listelm)->field.cqe_next == (void *)(head)) \ - (head)->cqh_last = (elm); \ - else \ - (listelm)->field.cqe_next->field.cqe_prev = (elm); \ - (listelm)->field.cqe_next = (elm); \ -} while (0) - -#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ - (elm)->field.cqe_next = (listelm); \ - (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ - if ((listelm)->field.cqe_prev == (void *)(head)) \ - (head)->cqh_first = (elm); \ - else \ - (listelm)->field.cqe_prev->field.cqe_next = (elm); \ - (listelm)->field.cqe_prev = (elm); \ -} while (0) - -#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ - (elm)->field.cqe_next = (head)->cqh_first; \ - (elm)->field.cqe_prev = (void *)(head); \ - if ((head)->cqh_last == (void *)(head)) \ - (head)->cqh_last = (elm); \ - else \ - (head)->cqh_first->field.cqe_prev = (elm); \ - (head)->cqh_first = (elm); \ -} while (0) - -#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.cqe_next = (void *)(head); \ - (elm)->field.cqe_prev = (head)->cqh_last; \ - if ((head)->cqh_first == (void *)(head)) \ - (head)->cqh_first = (elm); \ - else \ - (head)->cqh_last->field.cqe_next = (elm); \ - (head)->cqh_last = (elm); \ -} while (0) - -#define CIRCLEQ_REMOVE(head, elm, field) do { \ - if ((elm)->field.cqe_next == (void *)(head)) \ - (head)->cqh_last = (elm)->field.cqe_prev; \ - else \ - (elm)->field.cqe_next->field.cqe_prev = \ - (elm)->field.cqe_prev; \ - if ((elm)->field.cqe_prev == (void *)(head)) \ - (head)->cqh_first = (elm)->field.cqe_next; \ - else \ - (elm)->field.cqe_prev->field.cqe_next = \ - (elm)->field.cqe_next; \ -} while (0) -#endif /* !_SYS_QUEUE_H_ */ diff --git a/db2/include/shqueue.h b/db2/include/shqueue.h deleted file mode 100644 index 00e5d76251..0000000000 --- a/db2/include/shqueue.h +++ /dev/null @@ -1,334 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1996, 1997, 1998 - * Sleepycat Software. All rights reserved. - * - * @(#)shqueue.h 8.13 (Sleepycat) 4/10/98 - */ -#ifndef _SYS_SHQUEUE_H_ -#define _SYS_SHQUEUE_H_ - -/* - * This file defines three types of data structures: lists, tail queues, and - * circular queues, similarly to the include file <sys/queue.h>. - * - * The difference is that this set of macros can be used for structures that - * reside in shared memory that may be mapped at different addresses in each - * process. In most cases, the macros for shared structures exactly mirror - * the normal macros, although the macro calls require an additional type - * parameter, only used by the HEAD and ENTRY macros of the standard macros. - * - * For details on the use of these macros, see the queue(3) manual page. - */ - -/* - * Shared list definitions. - */ -#define SH_LIST_HEAD(name) \ -struct name { \ - ssize_t slh_first; /* first element */ \ -} - -#define SH_LIST_ENTRY \ -struct { \ - ssize_t sle_next; /* relative offset next element */ \ - ssize_t sle_prev; /* relative offset of prev element */ \ -} - -/* - * Shared list functions. Since we use relative offsets for pointers, - * 0 is a valid offset. Therefore, we use -1 to indicate end of list. - * The macros ending in "P" return pointers without checking for end - * of list, the others check for end of list and evaluate to either a - * pointer or NULL. - */ - -#define SH_LIST_FIRSTP(head, type) \ - ((struct type *)(((u_int8_t *)(head)) + (head)->slh_first)) - -#define SH_LIST_FIRST(head, type) \ - ((head)->slh_first == -1 ? NULL : \ - ((struct type *)(((u_int8_t *)(head)) + (head)->slh_first))) - -#define SH_LIST_NEXTP(elm, field, type) \ - ((struct type *)(((u_int8_t *)(elm)) + (elm)->field.sle_next)) - -#define SH_LIST_NEXT(elm, field, type) \ - ((elm)->field.sle_next == -1 ? NULL : \ - ((struct type *)(((u_int8_t *)(elm)) + (elm)->field.sle_next))) - -#define SH_LIST_PREV(elm, field) \ - ((ssize_t *)(((u_int8_t *)(elm)) + (elm)->field.sle_prev)) - -#define SH_PTR_TO_OFF(src, dest) \ - ((ssize_t)(((u_int8_t *)(dest)) - ((u_int8_t *)(src)))) - -#define SH_LIST_END(head) NULL - -/* - * Take the element's next pointer and calculate what the corresponding - * Prev pointer should be -- basically it is the negation plus the offset - * of the next field in the structure. - */ -#define SH_LIST_NEXT_TO_PREV(elm, field) \ - (-(elm)->field.sle_next + SH_PTR_TO_OFF(elm, &(elm)->field.sle_next)) - -#define SH_LIST_INIT(head) (head)->slh_first = -1 - -#define SH_LIST_INSERT_AFTER(listelm, elm, field, type) do { \ - if ((listelm)->field.sle_next != -1) { \ - (elm)->field.sle_next = SH_PTR_TO_OFF(elm, \ - SH_LIST_NEXTP(listelm, field, type)); \ - SH_LIST_NEXTP(listelm, field, type)->field.sle_prev = \ - SH_LIST_NEXT_TO_PREV(elm, field); \ - } else \ - (elm)->field.sle_next = -1; \ - (listelm)->field.sle_next = SH_PTR_TO_OFF(listelm, elm); \ - (elm)->field.sle_prev = SH_LIST_NEXT_TO_PREV(listelm, field); \ -} while (0) - -#define SH_LIST_INSERT_HEAD(head, elm, field, type) do { \ - if ((head)->slh_first != -1) { \ - (elm)->field.sle_next = \ - (head)->slh_first - SH_PTR_TO_OFF(head, elm); \ - SH_LIST_FIRSTP(head, type)->field.sle_prev = \ - SH_LIST_NEXT_TO_PREV(elm, field); \ - } else \ - (elm)->field.sle_next = -1; \ - (head)->slh_first = SH_PTR_TO_OFF(head, elm); \ - (elm)->field.sle_prev = SH_PTR_TO_OFF(elm, &(head)->slh_first); \ -} while (0) - -#define SH_LIST_REMOVE(elm, field, type) do { \ - if ((elm)->field.sle_next != -1) { \ - SH_LIST_NEXTP(elm, field, type)->field.sle_prev = \ - (elm)->field.sle_prev - (elm)->field.sle_next; \ - *SH_LIST_PREV(elm, field) += (elm)->field.sle_next; \ - } else \ - *SH_LIST_PREV(elm, field) = -1; \ -} while (0) - -/* - * Shared tail queue definitions. - */ -#define SH_TAILQ_HEAD(name) \ -struct name { \ - ssize_t stqh_first; /* relative offset of first element */ \ - ssize_t stqh_last; /* relative offset of last's next */ \ -} - -#define SH_TAILQ_ENTRY \ -struct { \ - ssize_t stqe_next; /* relative offset of next element */ \ - ssize_t stqe_prev; /* relative offset of prev's next */ \ -} - -/* - * Shared tail queue functions. - */ -#define SH_TAILQ_FIRSTP(head, type) \ - ((struct type *)((u_int8_t *)(head) + (head)->stqh_first)) - -#define SH_TAILQ_FIRST(head, type) \ - ((head)->stqh_first == -1 ? NULL : SH_TAILQ_FIRSTP(head, type)) - -#define SH_TAILQ_NEXTP(elm, field, type) \ - ((struct type *)((u_int8_t *)(elm) + (elm)->field.stqe_next)) - -#define SH_TAILQ_NEXT(elm, field, type) \ - ((elm)->field.stqe_next == -1 ? NULL : SH_TAILQ_NEXTP(elm, field, type)) - -#define SH_TAILQ_PREVP(elm, field) \ - ((ssize_t *)((u_int8_t *)(elm) + (elm)->field.stqe_prev)) - -#define SH_TAILQ_LAST(head) \ - ((ssize_t *)(((u_int8_t *)(head)) + (head)->stqh_last)) - -#define SH_TAILQ_NEXT_TO_PREV(elm, field) \ - (-(elm)->field.stqe_next + SH_PTR_TO_OFF(elm, &(elm)->field.stqe_next)) - -#define SH_TAILQ_END(head) NULL - -#define SH_TAILQ_INIT(head) { \ - (head)->stqh_first = -1; \ - (head)->stqh_last = SH_PTR_TO_OFF(head, &(head)->stqh_first); \ -} - -#define SH_TAILQ_INSERT_HEAD(head, elm, field, type) do { \ - if ((head)->stqh_first != -1) { \ - (elm)->field.stqe_next = \ - (head)->stqh_first - SH_PTR_TO_OFF(head, elm); \ - SH_TAILQ_FIRSTP(head, type)->field.stqe_prev = \ - SH_TAILQ_NEXT_TO_PREV(elm, field); \ - } else { \ - (elm)->field.stqe_next = -1; \ - (head)->stqh_last = \ - SH_PTR_TO_OFF(head, &(elm)->field.stqe_next); \ - } \ - (head)->stqh_first = SH_PTR_TO_OFF(head, elm); \ - (elm)->field.stqe_prev = \ - SH_PTR_TO_OFF(elm, &(head)->stqh_first); \ -} while (0) - -#define SH_TAILQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.stqe_next = -1; \ - (elm)->field.stqe_prev = \ - -SH_PTR_TO_OFF(head, elm) + (head)->stqh_last; \ - if ((head)->stqh_last == \ - SH_PTR_TO_OFF((head), &(head)->stqh_first)) \ - (head)->stqh_first = SH_PTR_TO_OFF(head, elm); \ - else \ - *SH_TAILQ_LAST(head) = -(head)->stqh_last + \ - SH_PTR_TO_OFF((elm), &(elm)->field.stqe_next) + \ - SH_PTR_TO_OFF(head, elm); \ - (head)->stqh_last = \ - SH_PTR_TO_OFF(head, &((elm)->field.stqe_next)); \ -} while (0) - -#define SH_TAILQ_INSERT_AFTER(head, listelm, elm, field, type) do { \ - if ((listelm)->field.stqe_next != -1) { \ - (elm)->field.stqe_next = (listelm)->field.stqe_next - \ - SH_PTR_TO_OFF(listelm, elm); \ - SH_TAILQ_NEXTP(listelm, field, type)->field.stqe_prev = \ - SH_TAILQ_NEXT_TO_PREV(elm, field); \ - } else { \ - (elm)->field.stqe_next = -1; \ - (head)->stqh_last = \ - SH_PTR_TO_OFF(head, &elm->field.stqe_next); \ - } \ - (listelm)->field.stqe_next = SH_PTR_TO_OFF(listelm, elm); \ - (elm)->field.stqe_prev = SH_TAILQ_NEXT_TO_PREV(listelm, field); \ -} while (0) - -#define SH_TAILQ_REMOVE(head, elm, field, type) do { \ - if ((elm)->field.stqe_next != -1) { \ - SH_TAILQ_NEXTP(elm, field, type)->field.stqe_prev = \ - (elm)->field.stqe_prev + \ - SH_PTR_TO_OFF(SH_TAILQ_NEXTP(elm, \ - field, type), elm); \ - *SH_TAILQ_PREVP(elm, field) += elm->field.stqe_next; \ - } else { \ - (head)->stqh_last = (elm)->field.stqe_prev + \ - SH_PTR_TO_OFF(head, elm); \ - *SH_TAILQ_PREVP(elm, field) = -1; \ - } \ -} while (0) - -/* - * Shared circular queue definitions. - */ -#define SH_CIRCLEQ_HEAD(name) \ -struct name { \ - ssize_t scqh_first; /* first element */ \ - ssize_t scqh_last; /* last element */ \ -} - -#define SH_CIRCLEQ_ENTRY \ -struct { \ - ssize_t scqe_next; /* next element */ \ - ssize_t scqe_prev; /* previous element */ \ -} - -/* - * Shared circular queue functions. - */ -#define SH_CIRCLEQ_FIRSTP(head, type) \ - ((struct type *)(((u_int8_t *)(head)) + (head)->scqh_first)) - -#define SH_CIRCLEQ_FIRST(head, type) \ - ((head)->scqh_first == -1 ? \ - (void *)head : SH_CIRCLEQ_FIRSTP(head, type)) - -#define SH_CIRCLEQ_LASTP(head, type) \ - ((struct type *)(((u_int8_t *)(head)) + (head)->scqh_last)) - -#define SH_CIRCLEQ_LAST(head, type) \ - ((head)->scqh_last == -1 ? (void *)head : SH_CIRCLEQ_LASTP(head, type)) - -#define SH_CIRCLEQ_NEXTP(elm, field, type) \ - ((struct type *)(((u_int8_t *)(elm)) + (elm)->field.scqe_next)) - -#define SH_CIRCLEQ_NEXT(head, elm, field, type) \ - ((elm)->field.scqe_next == SH_PTR_TO_OFF(elm, head) ? \ - (void *)head : SH_CIRCLEQ_NEXTP(elm, field, type)) - -#define SH_CIRCLEQ_PREVP(elm, field, type) \ - ((struct type *)(((u_int8_t *)(elm)) + (elm)->field.scqe_prev)) - -#define SH_CIRCLEQ_PREV(head, elm, field, type) \ - ((elm)->field.scqe_prev == SH_PTR_TO_OFF(elm, head) ? \ - (void *)head : SH_CIRCLEQ_PREVP(elm, field, type)) - -#define SH_CIRCLEQ_END(head) ((void *)(head)) - -#define SH_CIRCLEQ_INIT(head) { \ - (head)->scqh_first = 0; \ - (head)->scqh_last = 0; \ -} - -#define SH_CIRCLEQ_INSERT_AFTER(head, listelm, elm, field, type) do { \ - (elm)->field.scqe_prev = SH_PTR_TO_OFF(elm, listelm); \ - (elm)->field.scqe_next = (listelm)->field.scqe_next + \ - (elm)->field.scqe_prev; \ - if (SH_CIRCLEQ_NEXTP(listelm, field, type) == (void *)head) \ - (head)->scqh_last = SH_PTR_TO_OFF(head, elm); \ - else \ - SH_CIRCLEQ_NEXTP(listelm, \ - field, type)->field.scqe_prev = \ - SH_PTR_TO_OFF(SH_CIRCLEQ_NEXTP(listelm, \ - field, type), elm); \ - (listelm)->field.scqe_next = -(elm)->field.scqe_prev; \ -} while (0) - -#define SH_CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field, type) do { \ - (elm)->field.scqe_next = SH_PTR_TO_OFF(elm, listelm); \ - (elm)->field.scqe_prev = (elm)->field.scqe_next - \ - SH_CIRCLEQ_PREVP(listelm, field, type)->field.scqe_next;\ - if (SH_CIRCLEQ_PREVP(listelm, field, type) == (void *)(head)) \ - (head)->scqh_first = SH_PTR_TO_OFF(head, elm); \ - else \ - SH_CIRCLEQ_PREVP(listelm, \ - field, type)->field.scqe_next = \ - SH_PTR_TO_OFF(SH_CIRCLEQ_PREVP(listelm, \ - field, type), elm); \ - (listelm)->field.scqe_prev = -(elm)->field.scqe_next; \ -} while (0) - -#define SH_CIRCLEQ_INSERT_HEAD(head, elm, field, type) do { \ - (elm)->field.scqe_prev = SH_PTR_TO_OFF(elm, head); \ - (elm)->field.scqe_next = (head)->scqh_first + \ - (elm)->field.scqe_prev; \ - if ((head)->scqh_last == 0) \ - (head)->scqh_last = -(elm)->field.scqe_prev; \ - else \ - SH_CIRCLEQ_FIRSTP(head, type)->field.scqe_prev = \ - SH_PTR_TO_OFF(SH_CIRCLEQ_FIRSTP(head, type), elm); \ - (head)->scqh_first = -(elm)->field.scqe_prev; \ -} while (0) - -#define SH_CIRCLEQ_INSERT_TAIL(head, elm, field, type) do { \ - (elm)->field.scqe_next = SH_PTR_TO_OFF(elm, head); \ - (elm)->field.scqe_prev = (head)->scqh_last + \ - (elm)->field.scqe_next; \ - if ((head)->scqh_first == 0) \ - (head)->scqh_first = -(elm)->field.scqe_next; \ - else \ - SH_CIRCLEQ_LASTP(head, type)->field.scqe_next = \ - SH_PTR_TO_OFF(SH_CIRCLEQ_LASTP(head, type), elm); \ - (head)->scqh_last = -(elm)->field.scqe_next; \ -} while (0) - -#define SH_CIRCLEQ_REMOVE(head, elm, field, type) do { \ - if (SH_CIRCLEQ_NEXTP(elm, field, type) == (void *)(head)) \ - (head)->scqh_last += (elm)->field.scqe_prev; \ - else \ - SH_CIRCLEQ_NEXTP(elm, field, type)->field.scqe_prev += \ - (elm)->field.scqe_prev; \ - if (SH_CIRCLEQ_PREVP(elm, field, type) == (void *)(head)) \ - (head)->scqh_first += (elm)->field.scqe_next; \ - else \ - SH_CIRCLEQ_PREVP(elm, field, type)->field.scqe_next += \ - (elm)->field.scqe_next; \ -} while (0) -#endif /* !_SYS_SHQUEUE_H_ */ diff --git a/db2/include/txn.h b/db2/include/txn.h deleted file mode 100644 index a6fa4db8de..0000000000 --- a/db2/include/txn.h +++ /dev/null @@ -1,148 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1996, 1997, 1998 - * Sleepycat Software. All rights reserved. - * - * @(#)txn.h 10.18 (Sleepycat) 1/3/99 - */ -#ifndef _TXN_H_ -#define _TXN_H_ - -#include "xa.h" - -/* - * The name of the transaction shared memory region is DEFAULT_TXN_FILE and - * the region is always created group RW of the group owning the directory. - */ -#define DEFAULT_TXN_FILE "__db_txn.share" -/* TXN_MINIMUM = (DB_LOCK_MAXID + 1) but this makes compilers complain. */ -#define TXN_MINIMUM 0x80000000 -#define TXN_INVALID 0xffffffff /* Maximum number of txn ids. */ - -/* - * Transaction type declarations. - */ - -/* - * Internal data maintained in shared memory for each transaction. - */ -typedef char DB_XID[XIDDATASIZE]; - -typedef struct __txn_detail { - u_int32_t txnid; /* current transaction id - used to link free list also */ - DB_LSN last_lsn; /* last lsn written for this txn */ - DB_LSN begin_lsn; /* lsn of begin record */ - size_t last_lock; /* offset in lock region of last lock - for this transaction. */ - size_t parent; /* Offset of transaction's parent. */ -#define TXN_UNALLOC 0 -#define TXN_RUNNING 1 -#define TXN_ABORTED 2 -#define TXN_PREPARED 3 -#define TXN_COMMITTED 4 - u_int32_t status; /* status of the transaction */ - SH_TAILQ_ENTRY links; /* free/active list */ - -#define TXN_XA_ABORTED 1 -#define TXN_XA_DEADLOCKED 2 -#define TXN_XA_ENDED 3 -#define TXN_XA_PREPARED 4 -#define TXN_XA_STARTED 5 -#define TXN_XA_SUSPENDED 6 - u_int32_t xa_status; /* XA status */ - - /* - * XID (xid_t) structure: because these fields are logged, the - * sizes have to be explicit. - */ - DB_XID xid; /* XA global transaction id */ - u_int32_t bqual; /* bqual_length from XID */ - u_int32_t gtrid; /* gtrid_length from XID */ - int32_t format; /* XA format */ -} TXN_DETAIL; - -/* - * The transaction manager encapsulates the transaction system. It contains - * references to the log and lock managers as well as the state that keeps - * track of the shared memory region. - */ -struct __db_txnmgr { -/* These fields need to be protected for multi-threaded support. */ - db_mutex_t *mutexp; /* Synchronization. */ - /* list of active transactions */ - TAILQ_HEAD(_chain, __db_txn) txn_chain; - -/* These fields are not protected. */ - REGINFO reginfo; /* Region information. */ - DB_ENV *dbenv; /* Environment. */ - int (*recover) /* Recovery dispatch routine */ - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); - u_int32_t flags; /* DB_TXN_NOSYNC, DB_THREAD */ - DB_TXNREGION *region; /* address of shared memory region */ - void *mem; /* address of the shalloc space */ -}; - -/* - * Layout of the shared memory region. - * The region consists of a DB_TXNREGION structure followed by a large - * pool of shalloc'd memory which is used to hold TXN_DETAIL structures - * and thread mutexes (which are dynamically allocated). - */ -struct __db_txnregion { - RLAYOUT hdr; /* Shared memory region header. */ - u_int32_t magic; /* transaction magic number */ - u_int32_t version; /* version number */ - u_int32_t maxtxns; /* maximum number of active txns */ - u_int32_t last_txnid; /* last transaction id given out */ - DB_LSN pending_ckp; /* last checkpoint did not finish */ - DB_LSN last_ckp; /* lsn of the last checkpoint */ - time_t time_ckp; /* time of last checkpoint */ - u_int32_t logtype; /* type of logging */ - u_int32_t locktype; /* lock type */ - u_int32_t naborts; /* number of aborted transactions */ - u_int32_t ncommits; /* number of committed transactions */ - u_int32_t nbegins; /* number of begun transactions */ - SH_TAILQ_HEAD(_active) active_txn; /* active transaction list */ -}; - -/* - * Make the region large enough to hold N transaction detail structures - * plus some space to hold thread handles and the beginning of the shalloc - * region. - */ -#define TXN_REGION_SIZE(N) \ - (sizeof(DB_TXNREGION) + N * sizeof(TXN_DETAIL) + 1000) - -/* Macros to lock/unlock the region and threads. */ -#define LOCK_TXNTHREAD(tmgrp) \ - if (F_ISSET(tmgrp, DB_THREAD)) \ - (void)__db_mutex_lock((tmgrp)->mutexp, -1) -#define UNLOCK_TXNTHREAD(tmgrp) \ - if (F_ISSET(tmgrp, DB_THREAD)) \ - (void)__db_mutex_unlock((tmgrp)->mutexp, -1) - -#define LOCK_TXNREGION(tmgrp) \ - (void)__db_mutex_lock(&(tmgrp)->region->hdr.lock, (tmgrp)->reginfo.fd) -#define UNLOCK_TXNREGION(tmgrp) \ - (void)__db_mutex_unlock(&(tmgrp)->region->hdr.lock, (tmgrp)->reginfo.fd) - -/* Check for region catastrophic shutdown. */ -#define TXN_PANIC_CHECK(tmgrp) { \ - if ((tmgrp)->region->hdr.panic) \ - return (DB_RUNRECOVERY); \ -} - -/* - * Log record types. - */ -#define TXN_COMMIT 1 -#define TXN_PREPARE 2 -#define TXN_CHECKPOINT 3 - -#include "txn_auto.h" -#include "txn_ext.h" - -#include "xa_ext.h" -#endif /* !_TXN_H_ */ diff --git a/db2/include/txn_auto.h b/db2/include/txn_auto.h deleted file mode 100644 index bb3de4eb17..0000000000 --- a/db2/include/txn_auto.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Do not edit: automatically built by dist/db_gen.sh. */ -#ifndef txn_AUTO_H -#define txn_AUTO_H - -#define DB_txn_regop (DB_txn_BEGIN + 1) - -typedef struct _txn_regop_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t opcode; -} __txn_regop_args; - - -#define DB_txn_ckp (DB_txn_BEGIN + 2) - -typedef struct _txn_ckp_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - DB_LSN ckp_lsn; - DB_LSN last_ckp; -} __txn_ckp_args; - - -#define DB_txn_xa_regop (DB_txn_BEGIN + 3) - -typedef struct _txn_xa_regop_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t opcode; - DBT xid; - int32_t formatID; - u_int32_t gtrid; - u_int32_t bqual; - DB_LSN begin_lsn; -} __txn_xa_regop_args; - - -#define DB_txn_child (DB_txn_BEGIN + 4) - -typedef struct _txn_child_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t opcode; - u_int32_t parent; -} __txn_child_args; - -#endif diff --git a/db2/include/txn_ext.h b/db2/include/txn_ext.h deleted file mode 100644 index e0d69c360d..0000000000 --- a/db2/include/txn_ext.h +++ /dev/null @@ -1,41 +0,0 @@ -/* DO NOT EDIT: automatically built by dist/distrib. */ -#ifndef _txn_ext_h_ -#define _txn_ext_h_ -void __txn_panic __P((DB_ENV *)); -int __txn_xa_begin __P((DB_ENV *, DB_TXN *)); -int __txn_is_ancestor __P((DB_TXNMGR *, size_t, size_t)); -int __txn_regop_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t)); -int __txn_regop_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __txn_regop_read __P((void *, __txn_regop_args **)); -int __txn_ckp_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - DB_LSN *, DB_LSN *)); -int __txn_ckp_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __txn_ckp_read __P((void *, __txn_ckp_args **)); -int __txn_xa_regop_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, const DBT *, int32_t, u_int32_t, - u_int32_t, DB_LSN *)); -int __txn_xa_regop_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __txn_xa_regop_read __P((void *, __txn_xa_regop_args **)); -int __txn_child_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, u_int32_t)); -int __txn_child_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __txn_child_read __P((void *, __txn_child_args **)); -int __txn_init_print __P((DB_ENV *)); -int __txn_init_recover __P((DB_ENV *)); -int __txn_regop_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __txn_xa_regop_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __txn_ckp_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __txn_child_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -#endif /* _txn_ext_h_ */ diff --git a/db2/include/xa.h b/db2/include/xa.h deleted file mode 100644 index ae822f3e75..0000000000 --- a/db2/include/xa.h +++ /dev/null @@ -1,179 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1998 - * Sleepycat Software. All rights reserved. - * - * @(#)xa.h 10.1 (Sleepycat) 6/22/98 - */ -/* - * Start of xa.h header - * - * Define a symbol to prevent multiple inclusions of this header file - */ -#ifndef XA_H -#define XA_H - -/* - * Transaction branch identification: XID and NULLXID: - */ -#define XIDDATASIZE 128 /* size in bytes */ -#define MAXGTRIDSIZE 64 /* maximum size in bytes of gtrid */ -#define MAXBQUALSIZE 64 /* maximum size in bytes of bqual */ - -struct xid_t { - long formatID; /* format identifier */ - long gtrid_length; /* value from 1 through 64 */ - long bqual_length; /* value from 1 through 64 */ - char data[XIDDATASIZE]; -}; -typedef struct xid_t XID; -/* - * A value of -1 in formatID means that the XID is null. - */ - -/* - * Declarations of routines by which RMs call TMs: - */ -extern int ax_reg __P((int, XID *, long)); -extern int ax_unreg __P((int, long)); - -/* - * XA Switch Data Structure - */ -#define RMNAMESZ 32 /* length of resource manager name, */ - /* including the null terminator */ -#define MAXINFOSIZE 256 /* maximum size in bytes of xa_info */ - /* strings, including the null - terminator */ -struct xa_switch_t { - char name[RMNAMESZ]; /* name of resource manager */ - long flags; /* resource manager specific options */ - long version; /* must be 0 */ - int (*xa_open_entry) /* xa_open function pointer */ - __P((char *, int, long)); - int (*xa_close_entry) /* xa_close function pointer */ - __P((char *, int, long)); - int (*xa_start_entry) /* xa_start function pointer */ - __P((XID *, int, long)); - int (*xa_end_entry) /* xa_end function pointer */ - __P((XID *, int, long)); - int (*xa_rollback_entry) /* xa_rollback function pointer */ - __P((XID *, int, long)); - int (*xa_prepare_entry) /* xa_prepare function pointer */ - __P((XID *, int, long)); - int (*xa_commit_entry) /* xa_commit function pointer */ - __P((XID *, int, long)); - int (*xa_recover_entry) /* xa_recover function pointer */ - __P((XID *, long, int, long)); - int (*xa_forget_entry) /* xa_forget function pointer */ - __P((XID *, int, long)); - int (*xa_complete_entry) /* xa_complete function pointer */ - __P((int *, int *, int, long)); -}; - -/* - * Flag definitions for the RM switch - */ -#define TMNOFLAGS 0x00000000L /* no resource manager features - selected */ -#define TMREGISTER 0x00000001L /* resource manager dynamically - registers */ -#define TMNOMIGRATE 0x00000002L /* resource manager does not support - association migration */ -#define TMUSEASYNC 0x00000004L /* resource manager supports - asynchronous operations */ -/* - * Flag definitions for xa_ and ax_ routines - */ -/* use TMNOFLAGGS, defined above, when not specifying other flags */ -#define TMASYNC 0x80000000L /* perform routine asynchronously */ -#define TMONEPHASE 0x40000000L /* caller is using one-phase commit - optimisation */ -#define TMFAIL 0x20000000L /* dissociates caller and marks - transaction branch rollback-only */ -#define TMNOWAIT 0x10000000L /* return if blocking condition - exists */ -#define TMRESUME 0x08000000L /* caller is resuming association with - suspended transaction branch */ -#define TMSUCCESS 0x04000000L /* dissociate caller from transaction - branch */ -#define TMSUSPEND 0x02000000L /* caller is suspending, not ending, - association */ -#define TMSTARTRSCAN 0x01000000L /* start a recovery scan */ -#define TMENDRSCAN 0x00800000L /* end a recovery scan */ -#define TMMULTIPLE 0x00400000L /* wait for any asynchronous - operation */ -#define TMJOIN 0x00200000L /* caller is joining existing - transaction branch */ -#define TMMIGRATE 0x00100000L /* caller intends to perform - migration */ - -/* - * ax_() return codes (transaction manager reports to resource manager) - */ -#define TM_JOIN 2 /* caller is joining existing - transaction branch */ -#define TM_RESUME 1 /* caller is resuming association with - suspended transaction branch */ -#define TM_OK 0 /* normal execution */ -#define TMER_TMERR -1 /* an error occurred in the transaction - manager */ -#define TMER_INVAL -2 /* invalid arguments were given */ -#define TMER_PROTO -3 /* routine invoked in an improper - context */ - -/* - * xa_() return codes (resource manager reports to transaction manager) - */ -#define XA_RBBASE 100 /* The inclusive lower bound of the - rollback codes */ -#define XA_RBROLLBACK XA_RBBASE /* The rollback was caused by an - unspecified reason */ -#define XA_RBCOMMFAIL XA_RBBASE+1 /* The rollback was caused by a - communication failure */ -#define XA_RBDEADLOCK XA_RBBASE+2 /* A deadlock was detected */ -#define XA_RBINTEGRITY XA_RBBASE+3 /* A condition that violates the - integrity of the resources was - detected */ -#define XA_RBOTHER XA_RBBASE+4 /* The resource manager rolled back the - transaction branch for a reason not - on this list */ -#define XA_RBPROTO XA_RBBASE+5 /* A protocol error occurred in the - resource manager */ -#define XA_RBTIMEOUT XA_RBBASE+6 /* A transaction branch took too long */ -#define XA_RBTRANSIENT XA_RBBASE+7 /* May retry the transaction branch */ -#define XA_RBEND XA_RBTRANSIENT /* The inclusive upper bound of the - rollback codes */ -#define XA_NOMIGRATE 9 /* resumption must occur where - suspension occurred */ -#define XA_HEURHAZ 8 /* the transaction branch may have - been heuristically completed */ -#define XA_HEURCOM 7 /* the transaction branch has been - heuristically committed */ -#define XA_HEURRB 6 /* the transaction branch has been - heuristically rolled back */ -#define XA_HEURMIX 5 /* the transaction branch has been - heuristically committed and rolled - back */ -#define XA_RETRY 4 /* routine returned with no effect and - may be re-issued */ -#define XA_RDONLY 3 /* the transaction branch was read-only - and has been committed */ -#define XA_OK 0 /* normal execution */ -#define XAER_ASYNC -2 /* asynchronous operation already - outstanding */ -#define XAER_RMERR -3 /* a resource manager error occurred in - the transaction branch */ -#define XAER_NOTA -4 /* the XID is not valid */ -#define XAER_INVAL -5 /* invalid arguments were given */ -#define XAER_PROTO -6 /* routine invoked in an improper - context */ -#define XAER_RMFAIL -7 /* resource manager unavailable */ -#define XAER_DUPID -8 /* the XID already exists */ -#define XAER_OUTSIDE -9 /* resource manager doing work outside - transaction */ -#endif /* ifndef XA_H */ -/* - * End of xa.h header - */ diff --git a/db2/include/xa_ext.h b/db2/include/xa_ext.h deleted file mode 100644 index 00369ccaae..0000000000 --- a/db2/include/xa_ext.h +++ /dev/null @@ -1,13 +0,0 @@ -/* DO NOT EDIT: automatically built by dist/distrib. */ -#ifndef _xa_ext_h_ -#define _xa_ext_h_ -int __db_rmid_to_env __P((int rmid, DB_ENV **envp, int open_ok)); -int __db_xid_to_txn __P((DB_ENV *, XID *, size_t *)); -int __db_map_rmid __P((int, DB_ENV *)); -int __db_unmap_rmid __P((int)); -int __db_map_xid __P((DB_ENV *, XID *, size_t)); -void __db_unmap_xid __P((DB_ENV *, XID *, size_t)); -int __db_map_rmid_name __P((int, char *)); -int __db_rmid_to_name __P((int, char **)); - void __db_unmap_rmid_name __P((int)); -#endif /* _xa_ext_h_ */ |