db.h (14288) | db.h (93032) |
---|---|
1/*- 2 * Copyright (c) 1990, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)db.h 8.7 (Berkeley) 6/16/94 | 1/*- 2 * Copyright (c) 1990, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)db.h 8.7 (Berkeley) 6/16/94 |
34 * $FreeBSD: head/include/db.h 93032 2002-03-23 17:24:55Z imp $ |
|
34 */ 35 36#ifndef _DB_H_ 37#define _DB_H_ 38 39#include <sys/types.h> 40#include <sys/cdefs.h> 41 --- 52 unchanged lines hidden (view full) --- 94#define DB_LOCK 0x2000 /* Do locking. */ 95#define DB_SHMEM 0x4000 /* Use shared memory. */ 96#define DB_TXN 0x8000 /* Do transactions. */ 97#endif 98 99/* Access method description structure. */ 100typedef struct __db { 101 DBTYPE type; /* Underlying db type. */ | 35 */ 36 37#ifndef _DB_H_ 38#define _DB_H_ 39 40#include <sys/types.h> 41#include <sys/cdefs.h> 42 --- 52 unchanged lines hidden (view full) --- 95#define DB_LOCK 0x2000 /* Do locking. */ 96#define DB_SHMEM 0x4000 /* Use shared memory. */ 97#define DB_TXN 0x8000 /* Do transactions. */ 98#endif 99 100/* Access method description structure. */ 101typedef struct __db { 102 DBTYPE type; /* Underlying db type. */ |
102 int (*close) __P((struct __db *)); 103 int (*del) __P((const struct __db *, const DBT *, u_int)); 104 int (*get) __P((const struct __db *, const DBT *, DBT *, u_int)); 105 int (*put) __P((const struct __db *, DBT *, const DBT *, u_int)); 106 int (*seq) __P((const struct __db *, DBT *, DBT *, u_int)); 107 int (*sync) __P((const struct __db *, u_int)); | 103 int (*close)(struct __db *); 104 int (*del)(const struct __db *, const DBT *, u_int); 105 int (*get)(const struct __db *, const DBT *, DBT *, u_int); 106 int (*put)(const struct __db *, DBT *, const DBT *, u_int); 107 int (*seq)(const struct __db *, DBT *, DBT *, u_int); 108 int (*sync)(const struct __db *, u_int); |
108 void *internal; /* Access method private. */ | 109 void *internal; /* Access method private. */ |
109 int (*fd) __P((const struct __db *)); | 110 int (*fd)(const struct __db *); |
110} DB; 111 112#define BTREEMAGIC 0x053162 113#define BTREEVERSION 3 114 115/* Structure used to pass parameters to the btree routines. */ 116typedef struct { 117#define R_DUP 0x01 /* duplicate keys */ 118 u_long flags; 119 u_int cachesize; /* bytes to cache */ 120 int maxkeypage; /* maximum keys per page */ 121 int minkeypage; /* minimum keys per page */ 122 u_int psize; /* page size */ 123 int (*compare) /* comparison function */ | 111} DB; 112 113#define BTREEMAGIC 0x053162 114#define BTREEVERSION 3 115 116/* Structure used to pass parameters to the btree routines. */ 117typedef struct { 118#define R_DUP 0x01 /* duplicate keys */ 119 u_long flags; 120 u_int cachesize; /* bytes to cache */ 121 int maxkeypage; /* maximum keys per page */ 122 int minkeypage; /* minimum keys per page */ 123 u_int psize; /* page size */ 124 int (*compare) /* comparison function */ |
124 __P((const DBT *, const DBT *)); | 125(const DBT *, const DBT *); |
125 size_t (*prefix) /* prefix function */ | 126 size_t (*prefix) /* prefix function */ |
126 __P((const DBT *, const DBT *)); | 127(const DBT *, const DBT *); |
127 int lorder; /* byte order */ 128} BTREEINFO; 129 130#define HASHMAGIC 0x061561 131#define HASHVERSION 2 132 133/* Structure used to pass parameters to the hashing routines. */ 134typedef struct { 135 u_int bsize; /* bucket size */ 136 u_int ffactor; /* fill factor */ 137 u_int nelem; /* number of elements */ 138 u_int cachesize; /* bytes to cache */ 139 u_int32_t /* hash function */ | 128 int lorder; /* byte order */ 129} BTREEINFO; 130 131#define HASHMAGIC 0x061561 132#define HASHVERSION 2 133 134/* Structure used to pass parameters to the hashing routines. */ 135typedef struct { 136 u_int bsize; /* bucket size */ 137 u_int ffactor; /* fill factor */ 138 u_int nelem; /* number of elements */ 139 u_int cachesize; /* bytes to cache */ 140 u_int32_t /* hash function */ |
140 (*hash) __P((const void *, size_t)); | 141 (*hash)(const void *, size_t); |
141 int lorder; /* byte order */ 142} HASHINFO; 143 144/* Structure used to pass parameters to the record routines. */ 145typedef struct { 146#define R_FIXEDLEN 0x01 /* fixed-length records */ 147#define R_NOKEY 0x02 /* key not required */ 148#define R_SNAPSHOT 0x04 /* snapshot the input */ --- 52 unchanged lines hidden (view full) --- 201} 202#define P_16_COPY(a, b) { \ 203 ((char *)&(b))[0] = ((char *)&(a))[1]; \ 204 ((char *)&(b))[1] = ((char *)&(a))[0]; \ 205} 206#endif 207 208__BEGIN_DECLS | 142 int lorder; /* byte order */ 143} HASHINFO; 144 145/* Structure used to pass parameters to the record routines. */ 146typedef struct { 147#define R_FIXEDLEN 0x01 /* fixed-length records */ 148#define R_NOKEY 0x02 /* key not required */ 149#define R_SNAPSHOT 0x04 /* snapshot the input */ --- 52 unchanged lines hidden (view full) --- 202} 203#define P_16_COPY(a, b) { \ 204 ((char *)&(b))[0] = ((char *)&(a))[1]; \ 205 ((char *)&(b))[1] = ((char *)&(a))[0]; \ 206} 207#endif 208 209__BEGIN_DECLS |
209DB *dbopen __P((const char *, int, int, DBTYPE, const void *)); | 210DB *dbopen(const char *, int, int, DBTYPE, const void *); |
210 211#ifdef __DBINTERFACE_PRIVATE | 211 212#ifdef __DBINTERFACE_PRIVATE |
212DB *__bt_open __P((const char *, int, int, const BTREEINFO *, int)); 213DB *__hash_open __P((const char *, int, int, const HASHINFO *, int)); 214DB *__rec_open __P((const char *, int, int, const RECNOINFO *, int)); 215void __dbpanic __P((DB *dbp)); | 213DB *__bt_open(const char *, int, int, const BTREEINFO *, int); 214DB *__hash_open(const char *, int, int, const HASHINFO *, int); 215DB *__rec_open(const char *, int, int, const RECNOINFO *, int); 216void __dbpanic(DB *dbp); |
216#endif 217__END_DECLS 218#endif /* !_DB_H_ */ | 217#endif 218__END_DECLS 219#endif /* !_DB_H_ */ |