Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-05-18 08:29:45

0001 /*-
0002  * Copyright (c) 1996, 2020 Oracle and/or its affiliates.  All rights reserved.
0003  *
0004  * See the file LICENSE for license information.
0005  */
0006 /*
0007  * Copyright (c) 1990, 1993, 1994
0008  *  The Regents of the University of California.  All rights reserved.
0009  *
0010  * Redistribution and use in source and binary forms, with or without
0011  * modification, are permitted provided that the following conditions
0012  * are met:
0013  * 1. Redistributions of source code must retain the above copyright
0014  *    notice, this list of conditions and the following disclaimer.
0015  * 2. Redistributions in binary form must reproduce the above copyright
0016  *    notice, this list of conditions and the following disclaimer in the
0017  *    documentation and/or other materials provided with the distribution.
0018  * 3. Neither the name of the University nor the names of its contributors
0019  *    may be used to endorse or promote products derived from this software
0020  *    without specific prior written permission.
0021  *
0022  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
0023  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0024  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0025  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
0026  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0027  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0028  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0029  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0030  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0031  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0032  * SUCH DAMAGE.
0033  *
0034  * $Id$
0035  */
0036 
0037 #ifndef _DB_185_H_
0038 #define _DB_185_H_
0039 
0040 #include <sys/types.h>
0041 
0042 #include <limits.h>
0043 
0044 #if defined(__cplusplus)
0045 extern "C" {
0046 #endif
0047 
0048 /*
0049  * !!!
0050  * Handle function prototypes and the keyword "const".  This steps on name
0051  * space that DB doesn't control, but all of the other solutions are worse.
0052  */
0053 #undef  __P
0054 #if defined(__STDC__) || defined(__cplusplus)
0055 #define __P(protos) protos      /* ANSI C prototypes */
0056 #else
0057 #define const
0058 #define __P(protos) ()      /* K&R C preprocessor */
0059 #endif
0060 
0061 #define RET_ERROR   -1      /* Return values. */
0062 #define RET_SUCCESS  0
0063 #define RET_SPECIAL  1
0064 
0065 #ifndef __BIT_TYPES_DEFINED__
0066 #define __BIT_TYPES_DEFINED__
0067 
0068 
0069 
0070 
0071 
0072 #endif
0073 
0074 /*
0075  * XXX
0076  * SGI/IRIX already has a pgno_t.
0077  */
0078 #ifdef  __sgi
0079 #define pgno_t  db_pgno_t
0080 #endif
0081 
0082 #define MAX_PAGE_NUMBER 0xffffffff  /* >= # of pages in a file */
0083 typedef u_int32_t   pgno_t;
0084 #define MAX_PAGE_OFFSET 65535       /* >= # of bytes in a page */
0085 typedef u_int16_t   indx_t;
0086 #define MAX_REC_NUMBER  0xffffffff  /* >= # of records in a tree */
0087 typedef u_int32_t   recno_t;
0088 
0089 /* Key/data structure -- a Data-Base Thang. */
0090 typedef struct {
0091     void    *data;          /* data */
0092     size_t   size;          /* data length */
0093 } DBT;
0094 
0095 /* Routine flags. */
0096 #define R_CURSOR    1       /* del, put, seq */
0097 #define __R_UNUSED  2       /* UNUSED */
0098 #define R_FIRST     3       /* seq */
0099 #define R_IAFTER    4       /* put (RECNO) */
0100 #define R_IBEFORE   5       /* put (RECNO) */
0101 #define R_LAST      6       /* seq (BTREE, RECNO) */
0102 #define R_NEXT      7       /* seq */
0103 #define R_NOOVERWRITE   8       /* put */
0104 #define R_PREV      9       /* seq (BTREE, RECNO) */
0105 #define R_SETCURSOR 10      /* put (RECNO) */
0106 #define R_RECNOSYNC 11      /* sync (RECNO) */
0107 
0108 typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE;
0109 
0110 /* Access method description structure. */
0111 typedef struct __db {
0112     DBTYPE type;            /* Underlying db type. */
0113     int (*close)    __P((struct __db *));
0114     int (*del)  __P((const struct __db *, const DBT *, u_int));
0115     int (*get)  __P((const struct __db *, const DBT *, DBT *, u_int));
0116     int (*put)  __P((const struct __db *, DBT *, const DBT *, u_int));
0117     int (*seq)  __P((const struct __db *, DBT *, DBT *, u_int));
0118     int (*sync) __P((const struct __db *, u_int));
0119     void *internal;         /* Access method private. */
0120     int (*fd)   __P((const struct __db *));
0121 } DB;
0122 
0123 #define BTREEMAGIC  0x053162
0124 #define BTREEVERSION    3
0125 
0126 /* Structure used to pass parameters to the btree routines. */
0127 typedef struct {
0128 #define R_DUP       0x01    /* duplicate keys */
0129     u_int32_t flags;
0130     u_int32_t cachesize;    /* bytes to cache */
0131     u_int32_t maxkeypage;   /* maximum keys per page */
0132     u_int32_t minkeypage;   /* minimum keys per page */
0133     u_int32_t psize;    /* page size */
0134     int (*compare)  /* comparison function */
0135         __P((const DBT *, const DBT *));
0136     size_t  (*prefix)   /* prefix function */
0137         __P((const DBT *, const DBT *));
0138     int lorder;     /* byte order */
0139 } BTREEINFO;
0140 
0141 #define HASHMAGIC   0x061561
0142 #define HASHVERSION 2
0143 
0144 /* Structure used to pass parameters to the hashing routines. */
0145 typedef struct {
0146     u_int32_t bsize;    /* bucket size */
0147     u_int32_t ffactor;  /* fill factor */
0148     u_int32_t nelem;    /* number of elements */
0149     u_int32_t cachesize;    /* bytes to cache */
0150     u_int32_t       /* hash function */
0151         (*hash) __P((const void *, size_t));
0152     int lorder;     /* byte order */
0153 } HASHINFO;
0154 
0155 /* Structure used to pass parameters to the record routines. */
0156 typedef struct {
0157 #define R_FIXEDLEN  0x01    /* fixed-length records */
0158 #define R_NOKEY     0x02    /* key not required */
0159 #define R_SNAPSHOT  0x04    /* snapshot the input */
0160     u_int32_t flags;
0161     u_int32_t cachesize;    /* bytes to cache */
0162     u_int32_t psize;    /* page size */
0163     int lorder;     /* byte order */
0164     size_t  reclen;     /* record length (fixed-length records) */
0165     u_char  bval;       /* delimiting byte (variable-length records */
0166     char    *bfname;    /* btree file name */
0167 } RECNOINFO;
0168 
0169 /* Re-define the user's dbopen calls. */
0170 #define dbopen __db185_open
0171 
0172 #if defined(__cplusplus)
0173 }
0174 #endif
0175 
0176 #endif /* !_DB_185_H_ */
0177 
0178 /* DO NOT EDIT: automatically built by dist/s_include. */
0179 #ifndef _DB_EXT_185_PROT_IN_
0180 #define _DB_EXT_185_PROT_IN_
0181 
0182 #if defined(__cplusplus)
0183 extern "C" {
0184 #endif
0185 
0186 #ifdef _DB185_INT_H_
0187 DB185 *__db185_open __P((const char *, int, int, DBTYPE, const void *));
0188 #else
0189 DB *__db185_open __P((const char *, int, int, DBTYPE, const void *));
0190 #endif
0191 
0192 #if defined(__cplusplus)
0193 }
0194 #endif
0195 #endif /* !_DB_EXT_185_PROT_IN_ */