summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorcgd <cgd@NetBSD.org>1993-05-27 19:54:30 +0000
committercgd <cgd@NetBSD.org>1993-05-27 19:54:30 +0000
commit7a2414043226ec765db63cab84b10ed89e9e2011 (patch)
tree4b81fc486d1fa446a1188b2e261cd556f003988e /include
parent248f75d9b84daf68cb9fb9ea47477a142bb2fc9f (diff)
new vangogh db (v1.5)
Diffstat (limited to 'include')
-rw-r--r--include/db.h100
-rw-r--r--include/mpool.h4
2 files changed, 63 insertions, 41 deletions
diff --git a/include/db.h b/include/db.h
index 2b4372697e4..f48c4e648f9 100644
--- a/include/db.h
+++ b/include/db.h
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)db.h 5.21 (Berkeley) 2/14/93
+ * @(#)db.h 5.25 (Berkeley) 5/22/93
*/
#ifndef _DB_H_
@@ -59,7 +59,7 @@ typedef struct {
/* Routine flags. */
#define R_CURSOR 1 /* del, put, seq */
-#define R_CURSORLOG 2 /* put (RECNO) */
+#define __R_UNUSED 2 /* UNUSED */
#define R_FIRST 3 /* seq */
#define R_IAFTER 4 /* put (RECNO) */
#define R_IBEFORE 5 /* put (RECNO) */
@@ -68,6 +68,7 @@ typedef struct {
#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;
@@ -79,10 +80,11 @@ typedef struct __db {
DBTYPE type; /* underlying db type */
int (*close) __P((struct __db *));
int (*del) __P((const struct __db *, const DBT *, u_int));
+ int (*fd) __P((const struct __db *));
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 *));
+ int (*sync) __P((const struct __db *, u_int));
void *internal; /* access method private */
} DB;
@@ -92,15 +94,15 @@ typedef struct __db {
/* Structure used to pass parameters to the btree routines. */
typedef struct {
#define R_DUP 0x01 /* duplicate keys */
- u_long flags;
- int cachesize; /* bytes to cache */
- int maxkeypage; /* maximum keys per page */
- int minkeypage; /* minimum keys per page */
- int psize; /* page size */
+ u_long flags;
+ int cachesize; /* bytes to cache */
+ int maxkeypage; /* maximum keys per page */
+ int minkeypage; /* minimum keys per page */
+ int psize; /* page size */
/* comparison, prefix functions */
- int (*compare) __P((const DBT *, const DBT *));
- int (*prefix) __P((const DBT *, const DBT *));
- int lorder; /* byte order */
+ int (*compare) __P((const DBT *, const DBT *));
+ int (*prefix) __P((const DBT *, const DBT *));
+ int lorder; /* byte order */
} BTREEINFO;
#define HASHMAGIC 0x061561
@@ -108,12 +110,13 @@ typedef struct {
/* Structure used to pass parameters to the hashing routines. */
typedef struct {
- int bsize; /* bucket size */
- int ffactor; /* fill factor */
- int nelem; /* number of elements */
- int cachesize; /* bytes to cache */
- int (*hash)(); /* hash function */
- int lorder; /* byte order */
+ int bsize; /* bucket size */
+ int ffactor; /* fill factor */
+ int nelem; /* number of elements */
+ int cachesize; /* bytes to cache */
+ /* hash function */
+ int (*hash) __P((const void *, size_t));
+ int lorder; /* byte order */
} HASHINFO;
/* Structure used to pass parameters to the record routines. */
@@ -121,33 +124,41 @@ typedef struct {
#define R_FIXEDLEN 0x01 /* fixed-length records */
#define R_NOKEY 0x02 /* key not required */
#define R_SNAPSHOT 0x04 /* snapshot the input */
- u_long flags;
- int cachesize; /* bytes to cache */
- int lorder; /* byte order */
- size_t reclen; /* record length (fixed-length records) */
- u_char bval; /* delimiting byte (variable-length records */
+ u_long flags;
+ int cachesize; /* bytes to cache */
+ int 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;
-/* Key structure for the record routines. */
-typedef struct {
- u_long number;
- u_long offset;
- u_long length;
-#define R_LENGTH 0x01 /* length is valid */
-#define R_NUMBER 0x02 /* record number is valid */
-#define R_OFFSET 0x04 /* offset is valid */
- u_char valid;
-} RECNOKEY;
-
/*
* Little endian <==> big endian long swap macros.
* BLSWAP swap a memory location
* BLPSWAP swap a referenced memory location
* BLSWAP_COPY swap from one location to another
*/
-#define BLSWAP(a) { a = __byte_swap_long(a); }
-#define BLPSWAP(a) BLSWAP((*a))
-#define BLSWAP_COPY(a, b) { b = __byte_swap_long(a); }
+#define BLSWAP(a) { \
+ u_long _tmp = a; \
+ ((char *)&a)[0] = ((char *)&_tmp)[3]; \
+ ((char *)&a)[1] = ((char *)&_tmp)[2]; \
+ ((char *)&a)[2] = ((char *)&_tmp)[1]; \
+ ((char *)&a)[3] = ((char *)&_tmp)[0]; \
+}
+#define BLPSWAP(a) { \
+ u_long _tmp = *(u_long *)a; \
+ ((char *)a)[0] = ((char *)&_tmp)[3]; \
+ ((char *)a)[1] = ((char *)&_tmp)[2]; \
+ ((char *)a)[2] = ((char *)&_tmp)[1]; \
+ ((char *)a)[3] = ((char *)&_tmp)[0]; \
+}
+#define BLSWAP_COPY(a, b) { \
+ ((char *)&(b))[0] = ((char *)&(a))[3]; \
+ ((char *)&(b))[1] = ((char *)&(a))[2]; \
+ ((char *)&(b))[2] = ((char *)&(a))[1]; \
+ ((char *)&(b))[3] = ((char *)&(a))[0]; \
+}
/*
* Little endian <==> big endian short swap macros.
@@ -155,9 +166,20 @@ typedef struct {
* BSPSWAP swap a referenced memory location
* BSSWAP_COPY swap from one location to another
*/
-#define BSSWAP(a) { a = __byte_swap_word(a); }
-#define BSPSWAP(a) BSSWAP((*a))
-#define BSSWAP_COPY(a, b) { b = __byte_swap_word(a); }
+#define BSSWAP(a) { \
+ u_short _tmp = a; \
+ ((char *)&a)[0] = ((char *)&_tmp)[1]; \
+ ((char *)&a)[1] = ((char *)&_tmp)[0]; \
+}
+#define BSPSWAP(a) { \
+ u_short _tmp = *(u_short *)a; \
+ ((char *)a)[0] = ((char *)&_tmp)[1]; \
+ ((char *)a)[1] = ((char *)&_tmp)[0]; \
+}
+#define BSSWAP_COPY(a, b) { \
+ ((char *)&(b))[0] = ((char *)&(a))[1]; \
+ ((char *)&(b))[1] = ((char *)&(a))[0]; \
+}
__BEGIN_DECLS
DB *dbopen __P((const char *, int, int, DBTYPE, const void *));
diff --git a/include/mpool.h b/include/mpool.h
index 6358549444c..16c6d129b0d 100644
--- a/include/mpool.h
+++ b/include/mpool.h
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)mpool.h 5.2 (Berkeley) 2/14/93
+ * @(#)mpool.h 5.3 (Berkeley) 5/20/93
*/
/*
@@ -73,7 +73,7 @@ typedef struct MPOOL {
pgno_t curcache; /* Current number of cached pages. */
pgno_t maxcache; /* Max number of cached pages. */
pgno_t npages; /* Number of pages in the file. */
- indx_t pagesize; /* File page size. */
+ u_long pagesize; /* File page size. */
int fd; /* File descriptor. */
/* Page in conversion routine. */
void (*pgin) __P((void *, pgno_t, void *));