/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /*- * 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. ***REMOVED*** - see * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change * 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.h 8.7 (Berkeley) 6/16/94
*/
#ifndef _DB_H_ #define _DB_H_
#ifndef macintosh #include <sys/types.h> #endif #include"prtypes.h"
#if !defined(XP_UNIX) || defined(NTO) typedef PRUintn uint; #endif typedef PRUint8 uint8; typedef PRUint16 uint16; /* On AIX 5.2, sys/inttypes.h (which is included by sys/types.h)
* defines the types int8, int16, int32, and int64. */ #if !defined(AIX) typedef PRInt32 int32; #endif typedef PRUint32 uint32;
#ifdef __sun #define BIG_ENDIAN 4321 #define LITTLE_ENDIAN 1234 /* LSB first: i386, vax, all NT risc */
#ifndef __SVR4 /* compat.h is only in 4.1.3 machines. - dp */ #include <compat.h> #endif
/* XXX - dp * Need to find a general way of defining endian-ness in SunOS 5.3 * SunOS 5.4 defines _BIG_ENDIAN and _LITTLE_ENDIAN * SunOS 5.3 does nothing like this.
*/
#ifndef BYTE_ORDER
#ifdefined(_BIG_ENDIAN) #define BYTE_ORDER BIG_ENDIAN #elifdefined(_LITTLE_ENDIAN) #define BYTE_ORDER LITTLE_ENDIAN #elif !defined(__SVR4) /* 4.1.3 is always BIG_ENDIAN as it was released only on sparc platforms. */ #define BYTE_ORDER BIG_ENDIAN #elif !defined(vax) && !defined(ntohl) && !defined(lint) && !defined(i386) /* 5.3 big endian. Copied this above line from sys/byteorder.h */ /* Now we are in a 5.3 SunOS rather non 5.4 or above SunOS */ #define BYTE_ORDER BIG_ENDIAN #else #define BYTE_ORDER LITTLE_ENDIAN #endif
#define MAX_PAGE_NUMBER 0xffffffff /* >= # of pages in a file */
#ifndef __sgi typedef uint32 pgno_t; #endif
#define MAX_PAGE_OFFSET 65535 /* >= # of bytes in a page */ typedef uint16 indx_t; #define MAX_REC_NUMBER 0xffffffff /* >= # of records in a tree */ typedef uint32 recno_t;
/* Key/data structure -- a Data-Base Thang. */ typedefstruct { void *data; /* data */
size_t size; /* data length */
} DBT;
/* * !!! * The following flags are included in the dbopen(3) call as part of the * open(2) flags. In order to avoid conflicts with the open flags, start * at the top of the 16 or 32-bit number space and work our way down. If * the open flags were significantly expanded in the future, it could be * a problem. Wish I'd left another flags word in the dbopen call. * * !!! * None of this stuff is implemented yet. The only reason that it's here * is so that the access methods can skip copying the key/data pair when * the DB_LOCK flag isn't set.
*/ #if UINT_MAX > 65535 #define DB_LOCK 0x20000000 /* Do locking. */ #define DB_SHMEM 0x40000000 /* Use shared memory. */ #define DB_TXN 0x80000000 /* Do transactions. */ #else #define DB_LOCK 0x2000 /* Do locking. */ #define DB_SHMEM 0x4000 /* Use shared memory. */ #define DB_TXN 0x8000 /* Do transactions. */ #endif
/* Access method description structure. */ typedefstruct dbm_db {
DBTYPE type; /* Underlying db type. */ int (*close)(struct dbm_db *); int (*del)(conststruct dbm_db *, const DBT *, uint); int (*get)(conststruct dbm_db *, const DBT *, DBT *, uint); int (*put)(conststruct dbm_db *, DBT *, const DBT *, uint); int (*seq)(conststruct dbm_db *, DBT *, DBT *, uint); int (*sync)(conststruct dbm_db *, uint); void *internal; /* Access method private. */ int (*fd)(conststruct dbm_db *);
} DB;
/* Structure used to pass parameters to the btree routines. */ typedefstruct { #define R_DUP 0x01 /* duplicate keys */
uint32 flags;
uint cachesize; /* bytes to cache */ int maxkeypage; /* maximum keys per page */ int minkeypage; /* minimum keys per page */
uint psize; /* page size */ int(*compare) /* comparison function */
(const DBT *, const DBT *);
size_t(*prefix) /* prefix function */
(const DBT *, const DBT *); int lorder; /* byte order */
} BTREEINFO;
#define HASHMAGIC 0x061561 #define HASHVERSION 2
/* Structure used to pass parameters to the hashing routines. */ typedefstruct {
uint bsize; /* bucket size */
uint ffactor; /* fill factor */
uint nelem; /* number of elements */
uint cachesize; /* bytes to cache */
uint32 /* hash function */
(*hash)(constvoid *, size_t); int lorder; /* byte order */
} HASHINFO;
/* Structure used to pass parameters to the record routines. */ typedefstruct { #define R_FIXEDLEN 0x01 /* fixed-length records */ #define R_NOKEY 0x02 /* key not required */ #define R_SNAPSHOT 0x04 /* snapshot the input */
uint32 flags;
uint cachesize; /* bytes to cache */
uint psize; /* page size */ int lorder; /* byte order */
size_t reclen; /* record length (fixed-length records) */
uint8 bval; /* delimiting byte (variable-length records */ char *bfname; /* btree file name */
} RECNOINFO;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.