mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
155e78f014
BitKeeper/deleted/.del-ex_access.wpj~3df6ae8c99bf7c5f: Delete: bdb/build_vxworks/ex_access/ex_access.wpj BitKeeper/deleted/.del-ex_btrec.wpj~a7622f1c6f432dc6: Delete: bdb/build_vxworks/ex_btrec/ex_btrec.wpj BitKeeper/deleted/.del-ex_dbclient.wpj~7345440f3b204cdd: Delete: bdb/build_vxworks/ex_dbclient/ex_dbclient.wpj BitKeeper/deleted/.del-ex_env.wpj~fbe1ab10b04e8b74: Delete: bdb/build_vxworks/ex_env/ex_env.wpj BitKeeper/deleted/.del-ex_mpool.wpj~4479cfd5c45f327d: Delete: bdb/build_vxworks/ex_mpool/ex_mpool.wpj BitKeeper/deleted/.del-ex_tpcb.wpj~f78093006e14bf41: Delete: bdb/build_vxworks/ex_tpcb/ex_tpcb.wpj BitKeeper/deleted/.del-db_buildall.dsp~bd749ff6da11682: Delete: bdb/build_win32/db_buildall.dsp BitKeeper/deleted/.del-cxx_app.cpp~ad8df8e0791011ed: Delete: bdb/cxx/cxx_app.cpp BitKeeper/deleted/.del-cxx_log.cpp~a50ff3118fe06952: Delete: bdb/cxx/cxx_log.cpp BitKeeper/deleted/.del-cxx_table.cpp~ecd751e79b055556: Delete: bdb/cxx/cxx_table.cpp BitKeeper/deleted/.del-namemap.txt~796a3acd3885d8fd: Delete: bdb/cxx/namemap.txt BitKeeper/deleted/.del-Design.fileop~3ca4da68f1727373: Delete: bdb/db/Design.fileop BitKeeper/deleted/.del-db185_int.h~61bee3736e7959ef: Delete: bdb/db185/db185_int.h BitKeeper/deleted/.del-acconfig.h~411e8854d67ad8b5: Delete: bdb/dist/acconfig.h BitKeeper/deleted/.del-mutex.m4~a13383cde18a64e1: Delete: bdb/dist/aclocal/mutex.m4 BitKeeper/deleted/.del-options.m4~b9d0ca637213750a: Delete: bdb/dist/aclocal/options.m4 BitKeeper/deleted/.del-programs.m4~3ce7890b47732b30: Delete: bdb/dist/aclocal/programs.m4 BitKeeper/deleted/.del-tcl.m4~f944e2db93c3b6db: Delete: bdb/dist/aclocal/tcl.m4 BitKeeper/deleted/.del-types.m4~59cae158c9a32cff: Delete: bdb/dist/aclocal/types.m4 BitKeeper/deleted/.del-script~d38f6d3a4f159cb4: Delete: bdb/dist/build/script BitKeeper/deleted/.del-configure.in~ac795a92c8fe049c: Delete: bdb/dist/configure.in BitKeeper/deleted/.del-ltconfig~66bbd007d8024af: Delete: bdb/dist/ltconfig BitKeeper/deleted/.del-rec_ctemp~a28554362534f00a: Delete: bdb/dist/rec_ctemp BitKeeper/deleted/.del-s_tcl~2ffe4326459fcd9f: Delete: bdb/dist/s_tcl BitKeeper/deleted/.del-.IGNORE_ME~d8148b08fa7d5d15: Delete: bdb/dist/template/.IGNORE_ME BitKeeper/deleted/.del-btree.h~179f2aefec1753d: Delete: bdb/include/btree.h BitKeeper/deleted/.del-cxx_int.h~6b649c04766508f8: Delete: bdb/include/cxx_int.h BitKeeper/deleted/.del-db.src~6b433ae615b16a8d: Delete: bdb/include/db.src BitKeeper/deleted/.del-db_185.h~ad8b373d9391d35c: Delete: bdb/include/db_185.h BitKeeper/deleted/.del-db_am.h~a714912b6b75932f: Delete: bdb/include/db_am.h BitKeeper/deleted/.del-db_cxx.h~fcafadf45f5d19e9: Delete: bdb/include/db_cxx.h BitKeeper/deleted/.del-db_dispatch.h~6844f20f7eb46904: Delete: bdb/include/db_dispatch.h BitKeeper/deleted/.del-db_int.src~419a3f48b6a01da7: Delete: bdb/include/db_int.src BitKeeper/deleted/.del-db_join.h~76f9747a42c3399a: Delete: bdb/include/db_join.h BitKeeper/deleted/.del-db_page.h~e302ca3a4db3abdc: Delete: bdb/include/db_page.h BitKeeper/deleted/.del-db_server_int.h~e1d20b6ba3bca1ab: Delete: bdb/include/db_server_int.h BitKeeper/deleted/.del-db_shash.h~5fbf2d696fac90f3: Delete: bdb/include/db_shash.h BitKeeper/deleted/.del-db_swap.h~1e60887550864a59: Delete: bdb/include/db_swap.h BitKeeper/deleted/.del-db_upgrade.h~c644eee73701fc8d: Delete: bdb/include/db_upgrade.h BitKeeper/deleted/.del-db_verify.h~b8d6c297c61f342e: Delete: bdb/include/db_verify.h BitKeeper/deleted/.del-debug.h~dc2b4f2cf27ccebc: Delete: bdb/include/debug.h BitKeeper/deleted/.del-hash.h~2aaa548b28882dfb: Delete: bdb/include/hash.h BitKeeper/deleted/.del-lock.h~a761c1b7de57b77f: Delete: bdb/include/lock.h BitKeeper/deleted/.del-log.h~ff20184238e35e4d: Delete: bdb/include/log.h BitKeeper/deleted/.del-mp.h~7e317597622f3411: Delete: bdb/include/mp.h BitKeeper/deleted/.del-mutex.h~d3ae7a2977a68137: Delete: bdb/include/mutex.h BitKeeper/deleted/.del-os.h~91867cc8757cd0e3: Delete: bdb/include/os.h BitKeeper/deleted/.del-os_jump.h~e1b939fa5151d4be: Delete: bdb/include/os_jump.h BitKeeper/deleted/.del-qam.h~6fad0c1b5723d597: Delete: bdb/include/qam.h BitKeeper/deleted/.del-queue.h~4c72c0826c123d5: Delete: bdb/include/queue.h BitKeeper/deleted/.del-region.h~513fe04d977ca0fc: Delete: bdb/include/region.h BitKeeper/deleted/.del-shqueue.h~525fc3e6c2025c36: Delete: bdb/include/shqueue.h BitKeeper/deleted/.del-tcl_db.h~c536fd61a844f23f: Delete: bdb/include/tcl_db.h BitKeeper/deleted/.del-txn.h~c8d94b221ec147e4: Delete: bdb/include/txn.h BitKeeper/deleted/.del-xa.h~ecc466493aae9d9a: Delete: bdb/include/xa.h BitKeeper/deleted/.del-DbRecoveryInit.java~756b52601a0b9023: Delete: bdb/java/src/com/sleepycat/db/DbRecoveryInit.java BitKeeper/deleted/.del-DbTxnRecover.java~74607cba7ab89d6d: Delete: bdb/java/src/com/sleepycat/db/DbTxnRecover.java BitKeeper/deleted/.del-lock_conflict.c~fc5e0f14cf597a2b: Delete: bdb/lock/lock_conflict.c BitKeeper/deleted/.del-log.src~53ac9e7b5cb023f2: Delete: bdb/log/log.src BitKeeper/deleted/.del-log_findckp.c~24287f008916e81f: Delete: bdb/log/log_findckp.c BitKeeper/deleted/.del-log_rec.c~d51711f2cac09297: Delete: bdb/log/log_rec.c BitKeeper/deleted/.del-log_register.c~b40bb4efac75ca15: Delete: bdb/log/log_register.c BitKeeper/deleted/.del-Design~b3d0f179f2767b: Delete: bdb/mp/Design BitKeeper/deleted/.del-os_finit.c~95dbefc6fe79b26c: Delete: bdb/os/os_finit.c BitKeeper/deleted/.del-os_abs.c~df95d1e7db81924: Delete: bdb/os_vxworks/os_abs.c BitKeeper/deleted/.del-os_finit.c~803b484bdb9d0122: Delete: bdb/os_vxworks/os_finit.c BitKeeper/deleted/.del-os_map.c~3a6d7926398b76d3: Delete: bdb/os_vxworks/os_map.c BitKeeper/deleted/.del-os_finit.c~19a227c6d3c78ad: Delete: bdb/os_win32/os_finit.c BitKeeper/deleted/.del-log-corruption.patch~1cf2ecc7c6408d5d: Delete: bdb/patches/log-corruption.patch BitKeeper/deleted/.del-Btree.pm~af6d0c5eaed4a98e: Delete: bdb/perl.BerkeleyDB/BerkeleyDB/Btree.pm BitKeeper/deleted/.del-BerkeleyDB.pm~7244036d4482643: Delete: bdb/perl.BerkeleyDB/BerkeleyDB.pm BitKeeper/deleted/.del-BerkeleyDB.pod~e7b18fd6132448e3: Delete: bdb/perl.BerkeleyDB/BerkeleyDB.pod BitKeeper/deleted/.del-Hash.pm~10292a26c06a5c95: Delete: bdb/perl.BerkeleyDB/BerkeleyDB/Hash.pm BitKeeper/deleted/.del-BerkeleyDB.pod.P~79f76a1495eda203: Delete: bdb/perl.BerkeleyDB/BerkeleyDB.pod.P BitKeeper/deleted/.del-BerkeleyDB.xs~80c99afbd98e392c: Delete: bdb/perl.BerkeleyDB/BerkeleyDB.xs BitKeeper/deleted/.del-Changes~729c1891efa60de9: Delete: bdb/perl.BerkeleyDB/Changes BitKeeper/deleted/.del-MANIFEST~63a1e34aecf157a0: Delete: bdb/perl.BerkeleyDB/MANIFEST BitKeeper/deleted/.del-Makefile.PL~c68797707d8df87a: Delete: bdb/perl.BerkeleyDB/Makefile.PL BitKeeper/deleted/.del-README~5f2f579b1a241407: Delete: bdb/perl.BerkeleyDB/README BitKeeper/deleted/.del-Todo~dca3c66c193adda9: Delete: bdb/perl.BerkeleyDB/Todo BitKeeper/deleted/.del-config.in~ae81681e450e0999: Delete: bdb/perl.BerkeleyDB/config.in BitKeeper/deleted/.del-dbinfo~28ad67d83be4f68e: Delete: bdb/perl.BerkeleyDB/dbinfo BitKeeper/deleted/.del-mkconsts~543ab60669c7a04e: Delete: bdb/perl.BerkeleyDB/mkconsts BitKeeper/deleted/.del-mkpod~182c0ca54e439afb: Delete: bdb/perl.BerkeleyDB/mkpod BitKeeper/deleted/.del-5.004~e008cb5a48805543: Delete: bdb/perl.BerkeleyDB/patches/5.004 BitKeeper/deleted/.del-irix_6_5.pl~61662bb08afcdec8: Delete: bdb/perl.BerkeleyDB/hints/irix_6_5.pl BitKeeper/deleted/.del-solaris.pl~6771e7182394e152: Delete: bdb/perl.BerkeleyDB/hints/solaris.pl BitKeeper/deleted/.del-typemap~783b8f5295b05f3d: Delete: bdb/perl.BerkeleyDB/typemap BitKeeper/deleted/.del-5.004_01~6081ce2fff7b0bc: Delete: bdb/perl.BerkeleyDB/patches/5.004_01 BitKeeper/deleted/.del-5.004_02~87214eac35ad9e6: Delete: bdb/perl.BerkeleyDB/patches/5.004_02 BitKeeper/deleted/.del-5.004_03~9a672becec7cb40f: Delete: bdb/perl.BerkeleyDB/patches/5.004_03 BitKeeper/deleted/.del-5.004_04~e326cb51af09d154: Delete: bdb/perl.BerkeleyDB/patches/5.004_04 BitKeeper/deleted/.del-5.004_05~7ab457a1e41a92fe: Delete: bdb/perl.BerkeleyDB/patches/5.004_05 BitKeeper/deleted/.del-5.005~f9e2d59b5964cd4b: Delete: bdb/perl.BerkeleyDB/patches/5.005 BitKeeper/deleted/.del-5.005_01~3eb9fb7b5842ea8e: Delete: bdb/perl.BerkeleyDB/patches/5.005_01 BitKeeper/deleted/.del-5.005_02~67477ce0bef717cb: Delete: bdb/perl.BerkeleyDB/patches/5.005_02 BitKeeper/deleted/.del-5.005_03~c4c29a1fb21e290a: Delete: bdb/perl.BerkeleyDB/patches/5.005_03 BitKeeper/deleted/.del-5.6.0~e1fb9897d124ee22: Delete: bdb/perl.BerkeleyDB/patches/5.6.0 BitKeeper/deleted/.del-btree.t~e4a1a3c675ddc406: Delete: bdb/perl.BerkeleyDB/t/btree.t BitKeeper/deleted/.del-db-3.0.t~d2c60991d84558f2: Delete: bdb/perl.BerkeleyDB/t/db-3.0.t BitKeeper/deleted/.del-db-3.1.t~6ee88cd13f55e018: Delete: bdb/perl.BerkeleyDB/t/db-3.1.t BitKeeper/deleted/.del-db-3.2.t~f73b6461f98fd1cf: Delete: bdb/perl.BerkeleyDB/t/db-3.2.t BitKeeper/deleted/.del-destroy.t~cc6a2ae1980a2ecd: Delete: bdb/perl.BerkeleyDB/t/destroy.t BitKeeper/deleted/.del-env.t~a8604a4499c4bd07: Delete: bdb/perl.BerkeleyDB/t/env.t BitKeeper/deleted/.del-examples.t~2571b77c3cc75574: Delete: bdb/perl.BerkeleyDB/t/examples.t BitKeeper/deleted/.del-examples.t.T~8228bdd75ac78b88: Delete: bdb/perl.BerkeleyDB/t/examples.t.T BitKeeper/deleted/.del-examples3.t.T~66a186897a87026d: Delete: bdb/perl.BerkeleyDB/t/examples3.t.T BitKeeper/deleted/.del-examples3.t~fe3822ba2f2d7f83: Delete: bdb/perl.BerkeleyDB/t/examples3.t BitKeeper/deleted/.del-filter.t~f87b045c1b708637: Delete: bdb/perl.BerkeleyDB/t/filter.t BitKeeper/deleted/.del-hash.t~616bfb4d644de3a3: Delete: bdb/perl.BerkeleyDB/t/hash.t BitKeeper/deleted/.del-join.t~29fc39f74a83ca22: Delete: bdb/perl.BerkeleyDB/t/join.t BitKeeper/deleted/.del-mldbm.t~31f5015341eea040: Delete: bdb/perl.BerkeleyDB/t/mldbm.t BitKeeper/deleted/.del-queue.t~8f338034ce44a641: Delete: bdb/perl.BerkeleyDB/t/queue.t BitKeeper/deleted/.del-recno.t~d4ddbd3743add63e: Delete: bdb/perl.BerkeleyDB/t/recno.t BitKeeper/deleted/.del-strict.t~6885cdd2ea71ca2d: Delete: bdb/perl.BerkeleyDB/t/strict.t BitKeeper/deleted/.del-subdb.t~aab62a5d5864c603: Delete: bdb/perl.BerkeleyDB/t/subdb.t BitKeeper/deleted/.del-txn.t~65033b8558ae1216: Delete: bdb/perl.BerkeleyDB/t/txn.t BitKeeper/deleted/.del-unknown.t~f3710458682665e1: Delete: bdb/perl.BerkeleyDB/t/unknown.t BitKeeper/deleted/.del-Changes~436f74a5c414c65b: Delete: bdb/perl.DB_File/Changes BitKeeper/deleted/.del-DB_File.pm~ae0951c6c7665a82: Delete: bdb/perl.DB_File/DB_File.pm BitKeeper/deleted/.del-DB_File.xs~89e49a0b5556f1d8: Delete: bdb/perl.DB_File/DB_File.xs BitKeeper/deleted/.del-DB_File_BS~290fad5dbbb87069: Delete: bdb/perl.DB_File/DB_File_BS BitKeeper/deleted/.del-MANIFEST~90ee581572bdd4ac: Delete: bdb/perl.DB_File/MANIFEST BitKeeper/deleted/.del-Makefile.PL~ac0567bb5a377e38: Delete: bdb/perl.DB_File/Makefile.PL BitKeeper/deleted/.del-README~77e924a5a9bae6b3: Delete: bdb/perl.DB_File/README BitKeeper/deleted/.del-config.in~ab4c2792b86a810b: Delete: bdb/perl.DB_File/config.in BitKeeper/deleted/.del-dbinfo~461c43b30fab2cb: Delete: bdb/perl.DB_File/dbinfo BitKeeper/deleted/.del-dynixptx.pl~50dcddfae25d17e9: Delete: bdb/perl.DB_File/hints/dynixptx.pl BitKeeper/deleted/.del-typemap~55cffb3288a9e587: Delete: bdb/perl.DB_File/typemap BitKeeper/deleted/.del-version.c~a4df0e646f8b3975: Delete: bdb/perl.DB_File/version.c BitKeeper/deleted/.del-5.004_01~d6830d0082702af7: Delete: bdb/perl.DB_File/patches/5.004_01 BitKeeper/deleted/.del-5.004_02~78b082dc80c91031: Delete: bdb/perl.DB_File/patches/5.004_02 BitKeeper/deleted/.del-5.004~4411ec2e3c9e008b: Delete: bdb/perl.DB_File/patches/5.004 BitKeeper/deleted/.del-sco.pl~1e795fe14fe4dcfe: Delete: bdb/perl.DB_File/hints/sco.pl BitKeeper/deleted/.del-5.004_03~33f274648b160d95: Delete: bdb/perl.DB_File/patches/5.004_03 BitKeeper/deleted/.del-5.004_04~8f3d1b3cf18bb20a: Delete: bdb/perl.DB_File/patches/5.004_04 BitKeeper/deleted/.del-5.004_05~9c0f02e7331e142: Delete: bdb/perl.DB_File/patches/5.004_05 BitKeeper/deleted/.del-5.005~c2108cb2e3c8d951: Delete: bdb/perl.DB_File/patches/5.005 BitKeeper/deleted/.del-5.005_01~3b45e9673afc4cfa: Delete: bdb/perl.DB_File/patches/5.005_01 BitKeeper/deleted/.del-5.005_02~9fe5766bb02a4522: Delete: bdb/perl.DB_File/patches/5.005_02 BitKeeper/deleted/.del-5.005_03~ffa1c38c19ae72ea: Delete: bdb/perl.DB_File/patches/5.005_03 BitKeeper/deleted/.del-5.6.0~373be3a5ce47be85: Delete: bdb/perl.DB_File/patches/5.6.0 BitKeeper/deleted/.del-db-btree.t~3231595a1c241eb3: Delete: bdb/perl.DB_File/t/db-btree.t BitKeeper/deleted/.del-db-hash.t~7c4ad0c795c7fad2: Delete: bdb/perl.DB_File/t/db-hash.t BitKeeper/deleted/.del-db-recno.t~6c2d3d80b9ba4a50: Delete: bdb/perl.DB_File/t/db-recno.t BitKeeper/deleted/.del-db_server.sed~cdb00ebcd48a64e2: Delete: bdb/rpc_server/db_server.sed BitKeeper/deleted/.del-db_server_proc.c~d46c8f409c3747f4: Delete: bdb/rpc_server/db_server_proc.c BitKeeper/deleted/.del-db_server_svc.sed~3f5e59f334fa4607: Delete: bdb/rpc_server/db_server_svc.sed BitKeeper/deleted/.del-db_server_util.c~a809f3a4629acda: Delete: bdb/rpc_server/db_server_util.c BitKeeper/deleted/.del-log.tcl~ff1b41f1355b97d7: Delete: bdb/test/log.tcl BitKeeper/deleted/.del-mpool.tcl~b0df4dc1b04db26c: Delete: bdb/test/mpool.tcl BitKeeper/deleted/.del-mutex.tcl~52fd5c73a150565: Delete: bdb/test/mutex.tcl BitKeeper/deleted/.del-txn.tcl~c4ff071550b5446e: Delete: bdb/test/txn.tcl BitKeeper/deleted/.del-README~e800a12a5392010a: Delete: bdb/test/upgrade/README BitKeeper/deleted/.del-pack-2.6.6.pl~89d5076d758d3e98: Delete: bdb/test/upgrade/generate-2.X/pack-2.6.6.pl BitKeeper/deleted/.del-test-2.6.patch~4a52dc83d447547b: Delete: bdb/test/upgrade/generate-2.X/test-2.6.patch
651 lines
23 KiB
C
651 lines
23 KiB
C
/*-
|
|
* See the file LICENSE for redistribution information.
|
|
*
|
|
* Copyright (c) 1996-2002
|
|
* Sleepycat Software. All rights reserved.
|
|
*
|
|
* $Id: db_page.h,v 11.52 2002/09/13 21:24:04 bostic Exp $
|
|
*/
|
|
|
|
#ifndef _DB_PAGE_H_
|
|
#define _DB_PAGE_H_
|
|
|
|
#if defined(__cplusplus)
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
* 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_INVALID 0 /* Invalid page number in any database. */
|
|
#define PGNO_BASE_MD 0 /* Base database: metadata page number. */
|
|
|
|
/* Page types. */
|
|
#define P_INVALID 0 /* Invalid page type. */
|
|
#define __P_DUPLICATE 1 /* Duplicate. DEPRECATED in 3.1 */
|
|
#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. */
|
|
#define P_HASHMETA 8 /* Hash metadata page. */
|
|
#define P_BTREEMETA 9 /* Btree metadata page. */
|
|
#define P_QAMMETA 10 /* Queue metadata page. */
|
|
#define P_QAMDATA 11 /* Queue data page. */
|
|
#define P_LDUP 12 /* Off-page duplicate leaf. */
|
|
#define P_PAGETYPE_MAX 13
|
|
|
|
/*
|
|
* 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 page type.
|
|
*/
|
|
#define DB_PAGE_DB_LEN 32
|
|
#define DB_PAGE_QUEUE_LEN 0
|
|
|
|
/************************************************************************
|
|
GENERIC METADATA PAGE HEADER
|
|
*
|
|
* !!!
|
|
* The magic and version numbers have to be in the same place in all versions
|
|
* of the metadata page as the application may not have upgraded the database.
|
|
************************************************************************/
|
|
typedef struct _dbmeta33 {
|
|
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_int8_t encrypt_alg; /* 24: Encryption algorithm. */
|
|
u_int8_t type; /* 25: Page type. */
|
|
#define DBMETA_CHKSUM 0x01
|
|
u_int8_t metaflags; /* 26: Meta-only flags */
|
|
u_int8_t unused1; /* 27: Unused. */
|
|
u_int32_t free; /* 28-31: Free list page number. */
|
|
db_pgno_t last_pgno; /* 32-35: Page number of last page in db. */
|
|
u_int32_t unused3; /* 36-39: Unused. */
|
|
u_int32_t key_count; /* 40-43: Cached key count. */
|
|
u_int32_t record_count; /* 44-47: Cached record count. */
|
|
u_int32_t flags; /* 48-51: Flags: unique to each AM. */
|
|
/* 52-71: Unique file ID. */
|
|
u_int8_t uid[DB_FILE_ID_LEN];
|
|
} DBMETA33, DBMETA;
|
|
|
|
/************************************************************************
|
|
BTREE METADATA PAGE LAYOUT
|
|
************************************************************************/
|
|
typedef struct _btmeta33 {
|
|
#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_SUBDB 0x020 /* Subdatabases. */
|
|
#define BTM_DUPSORT 0x040 /* Duplicates are sorted. */
|
|
#define BTM_MASK 0x07f
|
|
DBMETA dbmeta; /* 00-71: Generic meta-data header. */
|
|
|
|
u_int32_t maxkey; /* 72-75: Btree: Maxkey. */
|
|
u_int32_t minkey; /* 76-79: Btree: Minkey. */
|
|
u_int32_t re_len; /* 80-83: Recno: fixed-length record length. */
|
|
u_int32_t re_pad; /* 84-87: Recno: fixed-length record pad. */
|
|
u_int32_t root; /* 88-91: Root page. */
|
|
u_int32_t unused[92]; /* 92-459: Unused space */
|
|
u_int32_t crypto_magic; /* 460-463: Crypto magic number */
|
|
u_int32_t trash[3]; /* 464-475: Trash space - Do not use */
|
|
u_int8_t iv[DB_IV_BYTES]; /* 476-495: Crypto IV */
|
|
u_int8_t chksum[DB_MAC_KEY]; /* 496-511: Page chksum */
|
|
|
|
/*
|
|
* Minimum page size is 512.
|
|
*/
|
|
} BTMETA33, BTMETA;
|
|
|
|
/************************************************************************
|
|
HASH METADATA PAGE LAYOUT
|
|
************************************************************************/
|
|
typedef struct _hashmeta33 {
|
|
#define DB_HASH_DUP 0x01 /* Duplicates. */
|
|
#define DB_HASH_SUBDB 0x02 /* Subdatabases. */
|
|
#define DB_HASH_DUPSORT 0x04 /* Duplicates are sorted. */
|
|
DBMETA dbmeta; /* 00-71: Generic meta-data page header. */
|
|
|
|
u_int32_t max_bucket; /* 72-75: ID of Maximum bucket in use */
|
|
u_int32_t high_mask; /* 76-79: Modulo mask into table */
|
|
u_int32_t low_mask; /* 80-83: Modulo mask into table lower half */
|
|
u_int32_t ffactor; /* 84-87: Fill factor */
|
|
u_int32_t nelem; /* 88-91: Number of keys in hash table */
|
|
u_int32_t h_charkey; /* 92-95: Value of hash(CHARKEY) */
|
|
#define NCACHED 32 /* number of spare points */
|
|
/* 96-223: Spare pages for overflow */
|
|
u_int32_t spares[NCACHED];
|
|
u_int32_t unused[59]; /* 224-459: Unused space */
|
|
u_int32_t crypto_magic; /* 460-463: Crypto magic number */
|
|
u_int32_t trash[3]; /* 464-475: Trash space - Do not use */
|
|
u_int8_t iv[DB_IV_BYTES]; /* 476-495: Crypto IV */
|
|
u_int8_t chksum[DB_MAC_KEY]; /* 496-511: Page chksum */
|
|
|
|
/*
|
|
* Minimum page size is 512.
|
|
*/
|
|
} HMETA33, HMETA;
|
|
|
|
/************************************************************************
|
|
QUEUE METADATA PAGE LAYOUT
|
|
************************************************************************/
|
|
/*
|
|
* QAM Meta data page structure
|
|
*
|
|
*/
|
|
typedef struct _qmeta33 {
|
|
DBMETA dbmeta; /* 00-71: Generic meta-data header. */
|
|
|
|
u_int32_t first_recno; /* 72-75: First not deleted record. */
|
|
u_int32_t cur_recno; /* 76-79: Next recno to be allocated. */
|
|
u_int32_t re_len; /* 80-83: Fixed-length record length. */
|
|
u_int32_t re_pad; /* 84-87: Fixed-length record pad. */
|
|
u_int32_t rec_page; /* 88-91: Records Per Page. */
|
|
u_int32_t page_ext; /* 92-95: Pages per extent */
|
|
|
|
u_int32_t unused[91]; /* 96-459: Unused space */
|
|
u_int32_t crypto_magic; /* 460-463: Crypto magic number */
|
|
u_int32_t trash[3]; /* 464-475: Trash space - Do not use */
|
|
u_int8_t iv[DB_IV_BYTES]; /* 476-495: Crypto IV */
|
|
u_int8_t chksum[DB_MAC_KEY]; /* 496-511: Page chksum */
|
|
/*
|
|
* Minimum page size is 512.
|
|
*/
|
|
} QMETA33, QMETA;
|
|
|
|
/*
|
|
* DBMETASIZE is a constant used by __db_file_setup and DB->verify
|
|
* as a buffer which is guaranteed to be larger than any possible
|
|
* metadata page size and smaller than any disk sector.
|
|
*/
|
|
#define DBMETASIZE 512
|
|
|
|
/************************************************************************
|
|
BTREE/HASH MAIN PAGE LAYOUT
|
|
************************************************************************/
|
|
/*
|
|
* +-----------------------------------+
|
|
* | lsn | pgno | prev pgno |
|
|
* +-----------------------------------+
|
|
* | next pgno | entries | hf offset |
|
|
* +-----------------------------------+
|
|
* | level | type | chksum |
|
|
* +-----------------------------------+
|
|
* | iv | index | free --> |
|
|
* +-----------+-----------------------+
|
|
* | F R E E A R E A |
|
|
* +-----------------------------------+
|
|
* | <-- free | item |
|
|
* +-----------------------------------+
|
|
* | item | item | item |
|
|
* +-----------------------------------+
|
|
*
|
|
* sizeof(PAGE) == 26 bytes + possibly 20 bytes of checksum and possibly
|
|
* 16 bytes of IV (+ 2 bytes for alignment), and the following indices
|
|
* are guaranteed to be two-byte aligned. If we aren't doing crypto or
|
|
* checksumming the bytes are reclaimed for data storage.
|
|
*
|
|
* 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 __pg_chksum {
|
|
u_int8_t unused[2]; /* 26-27: For alignment */
|
|
u_int8_t chksum[4]; /* 28-31: Checksum */
|
|
} PG_CHKSUM;
|
|
|
|
typedef struct __pg_crypto {
|
|
u_int8_t unused[2]; /* 26-27: For alignment */
|
|
u_int8_t chksum[DB_MAC_KEY]; /* 28-47: Checksum */
|
|
u_int8_t iv[DB_IV_BYTES]; /* 48-63: IV */
|
|
/* !!!
|
|
* Must be 16-byte aligned for crypto
|
|
*/
|
|
} PG_CRYPTO;
|
|
|
|
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 items 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. */
|
|
u_int8_t type; /* 25: Page type. */
|
|
} PAGE;
|
|
|
|
#define SIZEOF_PAGE 26
|
|
/*
|
|
* !!!
|
|
* DB_AM_ENCRYPT always implies DB_AM_CHKSUM so that must come first.
|
|
*/
|
|
#define P_INP(dbp, pg) \
|
|
((db_indx_t *)((u_int8_t *)(pg) + SIZEOF_PAGE + \
|
|
(F_ISSET((dbp), DB_AM_ENCRYPT) ? sizeof(PG_CRYPTO) : \
|
|
(F_ISSET((dbp), DB_AM_CHKSUM) ? sizeof(PG_CHKSUM) : 0))))
|
|
|
|
#define P_IV(dbp, pg) \
|
|
(F_ISSET((dbp), DB_AM_ENCRYPT) ? ((u_int8_t *)(pg) + \
|
|
SIZEOF_PAGE + SSZA(PG_CRYPTO, iv)) \
|
|
: NULL)
|
|
|
|
#define P_CHKSUM(dbp, pg) \
|
|
(F_ISSET((dbp), DB_AM_ENCRYPT) ? ((u_int8_t *)(pg) + \
|
|
SIZEOF_PAGE + SSZA(PG_CRYPTO, chksum)) : \
|
|
(F_ISSET((dbp), DB_AM_CHKSUM) ? ((u_int8_t *)(pg) + \
|
|
SIZEOF_PAGE + SSZA(PG_CHKSUM, chksum)) \
|
|
: NULL))
|
|
|
|
/* 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)
|
|
|
|
/************************************************************************
|
|
QUEUE MAIN PAGE LAYOUT
|
|
************************************************************************/
|
|
/*
|
|
* Sizes of page below. Used to reclaim space if not doing
|
|
* crypto or checksumming. If you change the QPAGE below you
|
|
* MUST adjust this too.
|
|
*/
|
|
#define QPAGE_NORMAL 28
|
|
#define QPAGE_CHKSUM 48
|
|
#define QPAGE_SEC 64
|
|
|
|
typedef struct _qpage {
|
|
DB_LSN lsn; /* 00-07: Log sequence number. */
|
|
db_pgno_t pgno; /* 08-11: Current page number. */
|
|
u_int32_t unused0[3]; /* 12-23: Unused. */
|
|
u_int8_t unused1[1]; /* 24: Unused. */
|
|
u_int8_t type; /* 25: Page type. */
|
|
u_int8_t unused2[2]; /* 26-27: Unused. */
|
|
u_int8_t chksum[DB_MAC_KEY]; /* 28-47: Checksum */
|
|
u_int8_t iv[DB_IV_BYTES]; /* 48-63: IV */
|
|
} QPAGE;
|
|
|
|
#define QPAGE_SZ(dbp) \
|
|
(F_ISSET((dbp), DB_AM_ENCRYPT) ? QPAGE_SEC : \
|
|
F_ISSET((dbp), DB_AM_CHKSUM) ? QPAGE_CHKSUM : QPAGE_NORMAL)
|
|
/*
|
|
* !!!
|
|
* The next_pgno and prev_pgno fields are not maintained for btree and recno
|
|
* internal pages. Doing so only provides a minor performance improvement,
|
|
* it's hard to do when deleting internal pages, and it increases the chance
|
|
* of deadlock during deletes and splits because we have to re-link pages at
|
|
* more than the leaf level.
|
|
*
|
|
* !!!
|
|
* 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_IBTREE || TYPE(p) == P_IRECNO) ? PREV_PGNO(p) : \
|
|
(db_pgno_t)(TYPE(p) == P_LBTREE ? NUM_ENT(p) / 2 : NUM_ENT(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(dbp) P_TO_UINT16(P_INP(dbp, 0))
|
|
|
|
/* First free byte. */
|
|
#define LOFFSET(dbp, pg) \
|
|
(P_OVERHEAD(dbp) + NUM_ENT(pg) * sizeof(db_indx_t))
|
|
|
|
/* Free space on a regular page. */
|
|
#define P_FREESPACE(dbp, pg) (HOFFSET(pg) - LOFFSET(dbp, pg))
|
|
|
|
/* Get a pointer to the bytes at a specific index. */
|
|
#define P_ENTRY(dbp, pg, indx) ((u_int8_t *)pg + P_INP(dbp, pg)[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(dbp, psize) ((psize) - P_OVERHEAD(dbp))
|
|
|
|
/* Free space on an overflow page. */
|
|
#define P_OVFLSPACE(dbp, psize, pg) (P_MAXSPACE(dbp, psize) - HOFFSET(pg))
|
|
|
|
/************************************************************************
|
|
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(dbp, pg, indx) (*P_ENTRY(dbp, 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(dbp, pg, pgsize, indx) \
|
|
(((indx) == 0 ? pgsize : \
|
|
(P_INP(dbp, pg)[indx - 1])) - (P_INP(dbp, pg)[indx]))
|
|
|
|
#define LEN_HKEYDATA(dbp, pg, psize, indx) \
|
|
(db_indx_t)(LEN_HITEM(dbp, pg, psize, 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.
|
|
*/
|
|
#define H_NUMPAIRS(pg) (NUM_ENT(pg) / 2)
|
|
#define H_KEYINDEX(indx) (indx)
|
|
#define H_DATAINDEX(indx) ((indx) + 1)
|
|
#define H_PAIRKEY(dbp, pg, indx) P_ENTRY(dbp, pg, H_KEYINDEX(indx))
|
|
#define H_PAIRDATA(dbp, pg, indx) P_ENTRY(dbp, pg, H_DATAINDEX(indx))
|
|
#define H_PAIRSIZE(dbp, pg, psize, indx) \
|
|
(LEN_HITEM(dbp, pg, psize, H_KEYINDEX(indx)) + \
|
|
LEN_HITEM(dbp, pg, psize, H_DATAINDEX(indx)))
|
|
#define LEN_HDATA(dbp, p, psize, indx) \
|
|
LEN_HKEYDATA(dbp, p, psize, H_DATAINDEX(indx))
|
|
#define LEN_HKEY(dbp, p, psize, indx) \
|
|
LEN_HKEYDATA(dbp, p, psize, H_KEYINDEX(indx))
|
|
|
|
/*
|
|
* 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))
|
|
|
|
/************************************************************************
|
|
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(dbp, pg, indx) \
|
|
((BKEYDATA *)P_ENTRY(dbp, 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), sizeof(u_int32_t))
|
|
#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(dbp, pg, indx) \
|
|
((BOVERFLOW *)P_ENTRY(dbp, pg, indx))
|
|
|
|
/*
|
|
* Page space required to add a new BOVERFLOW item to the page, with and
|
|
* without the index value. The (u_int16_t) cast avoids warnings: ALIGN
|
|
* casts to db_align_t, the cast converts it to a small integral type so
|
|
* we don't get complaints when we assign the final result to an integral
|
|
* type smaller than db_align_t.
|
|
*/
|
|
#define BOVERFLOW_SIZE \
|
|
((u_int16_t)ALIGN(sizeof(BOVERFLOW), sizeof(u_int32_t)))
|
|
#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. 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(dbp, pg, indx) \
|
|
((BINTERNAL *)P_ENTRY(dbp, 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), sizeof(u_int32_t))
|
|
#define BINTERNAL_PSIZE(len) \
|
|
(BINTERNAL_SIZE(len) + sizeof(db_indx_t))
|
|
|
|
/************************************************************************
|
|
RECNO INTERNAL PAGE LAYOUT
|
|
************************************************************************/
|
|
|
|
/*
|
|
* The recno internal entry.
|
|
*/
|
|
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(dbp, pg, indx) \
|
|
((RINTERNAL *)P_ENTRY(dbp, 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), sizeof(u_int32_t))
|
|
#define RINTERNAL_PSIZE \
|
|
(RINTERNAL_SIZE + sizeof(db_indx_t))
|
|
|
|
#if defined(__cplusplus)
|
|
}
|
|
#endif
|
|
|
|
#endif /* !_DB_PAGE_H_ */
|