Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /*- |
michael@0 | 3 | * Copyright (c) 1990, 1993, 1994 |
michael@0 | 4 | * The Regents of the University of California. All rights reserved. |
michael@0 | 5 | * |
michael@0 | 6 | * Redistribution and use in source and binary forms, with or without |
michael@0 | 7 | * modification, are permitted provided that the following conditions |
michael@0 | 8 | * are met: |
michael@0 | 9 | * 1. Redistributions of source code must retain the above copyright |
michael@0 | 10 | * notice, this list of conditions and the following disclaimer. |
michael@0 | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
michael@0 | 12 | * notice, this list of conditions and the following disclaimer in the |
michael@0 | 13 | * documentation and/or other materials provided with the distribution. |
michael@0 | 14 | * 3. ***REMOVED*** - see |
michael@0 | 15 | * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change |
michael@0 | 16 | * 4. Neither the name of the University nor the names of its contributors |
michael@0 | 17 | * may be used to endorse or promote products derived from this software |
michael@0 | 18 | * without specific prior written permission. |
michael@0 | 19 | * |
michael@0 | 20 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
michael@0 | 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
michael@0 | 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
michael@0 | 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
michael@0 | 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
michael@0 | 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
michael@0 | 26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
michael@0 | 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
michael@0 | 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
michael@0 | 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@0 | 30 | * SUCH DAMAGE. |
michael@0 | 31 | * |
michael@0 | 32 | * @(#)db.h 8.7 (Berkeley) 6/16/94 |
michael@0 | 33 | */ |
michael@0 | 34 | |
michael@0 | 35 | #ifndef _DB_H_ |
michael@0 | 36 | #define _DB_H_ |
michael@0 | 37 | |
michael@0 | 38 | #ifndef macintosh |
michael@0 | 39 | #include <sys/types.h> |
michael@0 | 40 | #endif |
michael@0 | 41 | #include "prtypes.h" |
michael@0 | 42 | |
michael@0 | 43 | #if !defined(XP_BEOS) && !defined(XP_OS2) && !defined(XP_UNIX) || defined(NTO) |
michael@0 | 44 | typedef PRUintn uint; |
michael@0 | 45 | #endif |
michael@0 | 46 | typedef PRUint8 uint8; |
michael@0 | 47 | typedef PRUint16 uint16; |
michael@0 | 48 | /* On AIX 5.2, sys/inttypes.h (which is included by sys/types.h) |
michael@0 | 49 | * defines the types int8, int16, int32, and int64. */ |
michael@0 | 50 | #if !defined(AIX) |
michael@0 | 51 | typedef PRInt32 int32; |
michael@0 | 52 | #endif |
michael@0 | 53 | typedef PRUint32 uint32; |
michael@0 | 54 | |
michael@0 | 55 | #include <limits.h> |
michael@0 | 56 | |
michael@0 | 57 | #ifdef __DBINTERFACE_PRIVATE |
michael@0 | 58 | |
michael@0 | 59 | #ifdef HAVE_SYS_CDEFS_H |
michael@0 | 60 | #include <sys/cdefs.h> |
michael@0 | 61 | #else |
michael@0 | 62 | #include "cdefs.h" |
michael@0 | 63 | #endif |
michael@0 | 64 | |
michael@0 | 65 | #ifdef HAVE_SYS_BYTEORDER_H |
michael@0 | 66 | #include <sys/byteorder.h> |
michael@0 | 67 | #endif |
michael@0 | 68 | |
michael@0 | 69 | #if defined(__linux) || defined(__BEOS__) |
michael@0 | 70 | #include <endian.h> |
michael@0 | 71 | #ifndef BYTE_ORDER |
michael@0 | 72 | #define BYTE_ORDER __BYTE_ORDER |
michael@0 | 73 | #define BIG_ENDIAN __BIG_ENDIAN |
michael@0 | 74 | #define LITTLE_ENDIAN __LITTLE_ENDIAN |
michael@0 | 75 | #endif |
michael@0 | 76 | #endif /* __linux */ |
michael@0 | 77 | |
michael@0 | 78 | #ifdef __sgi |
michael@0 | 79 | #define BYTE_ORDER BIG_ENDIAN |
michael@0 | 80 | #define BIG_ENDIAN 4321 |
michael@0 | 81 | #define LITTLE_ENDIAN 1234 /* LSB first: i386, vax, all NT risc */ |
michael@0 | 82 | #endif |
michael@0 | 83 | |
michael@0 | 84 | #ifdef __sun |
michael@0 | 85 | #define BIG_ENDIAN 4321 |
michael@0 | 86 | #define LITTLE_ENDIAN 1234 /* LSB first: i386, vax, all NT risc */ |
michael@0 | 87 | |
michael@0 | 88 | #ifndef __SVR4 |
michael@0 | 89 | /* compat.h is only in 4.1.3 machines. - dp */ |
michael@0 | 90 | #include <compat.h> |
michael@0 | 91 | #endif |
michael@0 | 92 | |
michael@0 | 93 | /* XXX - dp |
michael@0 | 94 | * Need to find a general way of defining endian-ness in SunOS 5.3 |
michael@0 | 95 | * SunOS 5.4 defines _BIG_ENDIAN and _LITTLE_ENDIAN |
michael@0 | 96 | * SunOS 5.3 does nothing like this. |
michael@0 | 97 | */ |
michael@0 | 98 | |
michael@0 | 99 | #ifndef BYTE_ORDER |
michael@0 | 100 | |
michael@0 | 101 | #if defined(_BIG_ENDIAN) |
michael@0 | 102 | #define BYTE_ORDER BIG_ENDIAN |
michael@0 | 103 | #elif defined(_LITTLE_ENDIAN) |
michael@0 | 104 | #define BYTE_ORDER LITTLE_ENDIAN |
michael@0 | 105 | #elif !defined(__SVR4) |
michael@0 | 106 | /* 4.1.3 is always BIG_ENDIAN as it was released only on sparc platforms. */ |
michael@0 | 107 | #define BYTE_ORDER BIG_ENDIAN |
michael@0 | 108 | #elif !defined(vax) && !defined(ntohl) && !defined(lint) && !defined(i386) |
michael@0 | 109 | /* 5.3 big endian. Copied this above line from sys/byteorder.h */ |
michael@0 | 110 | /* Now we are in a 5.3 SunOS rather non 5.4 or above SunOS */ |
michael@0 | 111 | #define BYTE_ORDER BIG_ENDIAN |
michael@0 | 112 | #else |
michael@0 | 113 | #define BYTE_ORDER LITTLE_ENDIAN |
michael@0 | 114 | #endif |
michael@0 | 115 | |
michael@0 | 116 | #endif /* !BYTE_ORDER */ |
michael@0 | 117 | #endif /* __sun */ |
michael@0 | 118 | |
michael@0 | 119 | #if defined(__hpux) || defined(__hppa) |
michael@0 | 120 | #define BYTE_ORDER BIG_ENDIAN |
michael@0 | 121 | #define BIG_ENDIAN 4321 |
michael@0 | 122 | #define LITTLE_ENDIAN 1234 /* LSB first: i386, vax, all NT risc */ |
michael@0 | 123 | #endif |
michael@0 | 124 | |
michael@0 | 125 | #if defined(AIXV3) || defined(AIX) |
michael@0 | 126 | /* BYTE_ORDER, LITTLE_ENDIAN, BIG_ENDIAN are all defined here */ |
michael@0 | 127 | #include <sys/machine.h> |
michael@0 | 128 | #endif |
michael@0 | 129 | |
michael@0 | 130 | /* Digital Unix */ |
michael@0 | 131 | #ifdef __osf__ |
michael@0 | 132 | #include <machine/endian.h> |
michael@0 | 133 | #endif |
michael@0 | 134 | |
michael@0 | 135 | #ifdef __alpha |
michael@0 | 136 | #ifndef WIN32 |
michael@0 | 137 | #else |
michael@0 | 138 | /* Alpha NT */ |
michael@0 | 139 | #define BYTE_ORDER LITTLE_ENDIAN |
michael@0 | 140 | #define BIG_ENDIAN 4321 |
michael@0 | 141 | #define LITTLE_ENDIAN 1234 |
michael@0 | 142 | #endif |
michael@0 | 143 | #endif |
michael@0 | 144 | |
michael@0 | 145 | #ifdef NCR |
michael@0 | 146 | #include <sys/endian.h> |
michael@0 | 147 | #endif |
michael@0 | 148 | |
michael@0 | 149 | #ifdef __QNX__ |
michael@0 | 150 | #ifdef __QNXNTO__ |
michael@0 | 151 | #include <sys/param.h> |
michael@0 | 152 | #else |
michael@0 | 153 | #define LITTLE_ENDIAN 1234 |
michael@0 | 154 | #define BIG_ENDIAN 4321 |
michael@0 | 155 | #define BYTE_ORDER LITTLE_ENDIAN |
michael@0 | 156 | #endif |
michael@0 | 157 | #endif |
michael@0 | 158 | |
michael@0 | 159 | #ifdef SNI |
michael@0 | 160 | /* #include <sys/hetero.h> */ |
michael@0 | 161 | #define BYTE_ORDER BIG_ENDIAN |
michael@0 | 162 | #define BIG_ENDIAN 4321 |
michael@0 | 163 | #define LITTLE_ENDIAN 1234 |
michael@0 | 164 | #endif |
michael@0 | 165 | |
michael@0 | 166 | #ifdef _WINDOWS |
michael@0 | 167 | #ifdef BYTE_ORDER |
michael@0 | 168 | #undef BYTE_ORDER |
michael@0 | 169 | #endif |
michael@0 | 170 | |
michael@0 | 171 | #define BYTE_ORDER LITTLE_ENDIAN |
michael@0 | 172 | #define LITTLE_ENDIAN 1234 /* LSB first: i386, vax, all NT risc */ |
michael@0 | 173 | #define BIG_ENDIAN 4321 |
michael@0 | 174 | #endif |
michael@0 | 175 | |
michael@0 | 176 | #ifdef macintosh |
michael@0 | 177 | #define BIG_ENDIAN 4321 |
michael@0 | 178 | #define LITTLE_ENDIAN 1234 |
michael@0 | 179 | #define BYTE_ORDER BIG_ENDIAN |
michael@0 | 180 | #endif |
michael@0 | 181 | |
michael@0 | 182 | #endif /* __DBINTERFACE_PRIVATE */ |
michael@0 | 183 | |
michael@0 | 184 | #ifdef SCO |
michael@0 | 185 | #define MAXPATHLEN 1024 |
michael@0 | 186 | #endif |
michael@0 | 187 | |
michael@0 | 188 | #include <fcntl.h> |
michael@0 | 189 | |
michael@0 | 190 | #if defined(_WINDOWS) || defined(XP_OS2) |
michael@0 | 191 | #include <stdio.h> |
michael@0 | 192 | #include <io.h> |
michael@0 | 193 | |
michael@0 | 194 | #ifndef XP_OS2 |
michael@0 | 195 | #define MAXPATHLEN 1024 |
michael@0 | 196 | #endif |
michael@0 | 197 | |
michael@0 | 198 | #define EFTYPE EINVAL /* POSIX 1003.1 format errno. */ |
michael@0 | 199 | |
michael@0 | 200 | #ifndef STDERR_FILENO |
michael@0 | 201 | #define STDIN_FILENO 0 /* ANSI C #defines */ |
michael@0 | 202 | #define STDOUT_FILENO 1 |
michael@0 | 203 | #define STDERR_FILENO 2 |
michael@0 | 204 | #endif |
michael@0 | 205 | |
michael@0 | 206 | #ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */ |
michael@0 | 207 | #define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) |
michael@0 | 208 | #endif |
michael@0 | 209 | #endif |
michael@0 | 210 | |
michael@0 | 211 | #ifdef macintosh |
michael@0 | 212 | #include <stdio.h> |
michael@0 | 213 | #include "xp_mcom.h" |
michael@0 | 214 | #define O_ACCMODE 3 /* Mask for file access modes */ |
michael@0 | 215 | #define EFTYPE 2000 |
michael@0 | 216 | PR_BEGIN_EXTERN_C |
michael@0 | 217 | int mkstemp(const char *path); |
michael@0 | 218 | PR_END_EXTERN_C |
michael@0 | 219 | #endif /* MACINTOSH */ |
michael@0 | 220 | |
michael@0 | 221 | #if !defined(_WINDOWS) && !defined(macintosh) |
michael@0 | 222 | #include <sys/stat.h> |
michael@0 | 223 | #include <errno.h> |
michael@0 | 224 | #endif |
michael@0 | 225 | |
michael@0 | 226 | /* define EFTYPE since most don't */ |
michael@0 | 227 | #ifndef EFTYPE |
michael@0 | 228 | #define EFTYPE EINVAL /* POSIX 1003.1 format errno. */ |
michael@0 | 229 | #endif |
michael@0 | 230 | |
michael@0 | 231 | #define RET_ERROR -1 /* Return values. */ |
michael@0 | 232 | #define RET_SUCCESS 0 |
michael@0 | 233 | #define RET_SPECIAL 1 |
michael@0 | 234 | |
michael@0 | 235 | #define MAX_PAGE_NUMBER 0xffffffff /* >= # of pages in a file */ |
michael@0 | 236 | |
michael@0 | 237 | #ifndef __sgi |
michael@0 | 238 | typedef uint32 pgno_t; |
michael@0 | 239 | #endif |
michael@0 | 240 | |
michael@0 | 241 | #define MAX_PAGE_OFFSET 65535 /* >= # of bytes in a page */ |
michael@0 | 242 | typedef uint16 indx_t; |
michael@0 | 243 | #define MAX_REC_NUMBER 0xffffffff /* >= # of records in a tree */ |
michael@0 | 244 | typedef uint32 recno_t; |
michael@0 | 245 | |
michael@0 | 246 | /* Key/data structure -- a Data-Base Thang. */ |
michael@0 | 247 | typedef struct { |
michael@0 | 248 | void *data; /* data */ |
michael@0 | 249 | size_t size; /* data length */ |
michael@0 | 250 | } DBT; |
michael@0 | 251 | |
michael@0 | 252 | /* Routine flags. */ |
michael@0 | 253 | #define R_CURSOR 1 /* del, put, seq */ |
michael@0 | 254 | #define __R_UNUSED 2 /* UNUSED */ |
michael@0 | 255 | #define R_FIRST 3 /* seq */ |
michael@0 | 256 | #define R_IAFTER 4 /* put (RECNO) */ |
michael@0 | 257 | #define R_IBEFORE 5 /* put (RECNO) */ |
michael@0 | 258 | #define R_LAST 6 /* seq (BTREE, RECNO) */ |
michael@0 | 259 | #define R_NEXT 7 /* seq */ |
michael@0 | 260 | #define R_NOOVERWRITE 8 /* put */ |
michael@0 | 261 | #define R_PREV 9 /* seq (BTREE, RECNO) */ |
michael@0 | 262 | #define R_SETCURSOR 10 /* put (RECNO) */ |
michael@0 | 263 | #define R_RECNOSYNC 11 /* sync (RECNO) */ |
michael@0 | 264 | |
michael@0 | 265 | typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE; |
michael@0 | 266 | |
michael@0 | 267 | typedef enum { LockOutDatabase, UnlockDatabase } DBLockFlagEnum; |
michael@0 | 268 | |
michael@0 | 269 | /* |
michael@0 | 270 | * !!! |
michael@0 | 271 | * The following flags are included in the dbopen(3) call as part of the |
michael@0 | 272 | * open(2) flags. In order to avoid conflicts with the open flags, start |
michael@0 | 273 | * at the top of the 16 or 32-bit number space and work our way down. If |
michael@0 | 274 | * the open flags were significantly expanded in the future, it could be |
michael@0 | 275 | * a problem. Wish I'd left another flags word in the dbopen call. |
michael@0 | 276 | * |
michael@0 | 277 | * !!! |
michael@0 | 278 | * None of this stuff is implemented yet. The only reason that it's here |
michael@0 | 279 | * is so that the access methods can skip copying the key/data pair when |
michael@0 | 280 | * the DB_LOCK flag isn't set. |
michael@0 | 281 | */ |
michael@0 | 282 | #if UINT_MAX > 65535 |
michael@0 | 283 | #define DB_LOCK 0x20000000 /* Do locking. */ |
michael@0 | 284 | #define DB_SHMEM 0x40000000 /* Use shared memory. */ |
michael@0 | 285 | #define DB_TXN 0x80000000 /* Do transactions. */ |
michael@0 | 286 | #else |
michael@0 | 287 | #define DB_LOCK 0x2000 /* Do locking. */ |
michael@0 | 288 | #define DB_SHMEM 0x4000 /* Use shared memory. */ |
michael@0 | 289 | #define DB_TXN 0x8000 /* Do transactions. */ |
michael@0 | 290 | #endif |
michael@0 | 291 | |
michael@0 | 292 | /* Access method description structure. */ |
michael@0 | 293 | typedef struct __db { |
michael@0 | 294 | DBTYPE type; /* Underlying db type. */ |
michael@0 | 295 | int (*close) (struct __db *); |
michael@0 | 296 | int (*del) (const struct __db *, const DBT *, uint); |
michael@0 | 297 | int (*get) (const struct __db *, const DBT *, DBT *, uint); |
michael@0 | 298 | int (*put) (const struct __db *, DBT *, const DBT *, uint); |
michael@0 | 299 | int (*seq) (const struct __db *, DBT *, DBT *, uint); |
michael@0 | 300 | int (*sync) (const struct __db *, uint); |
michael@0 | 301 | void *internal; /* Access method private. */ |
michael@0 | 302 | int (*fd) (const struct __db *); |
michael@0 | 303 | } DB; |
michael@0 | 304 | |
michael@0 | 305 | #define BTREEMAGIC 0x053162 |
michael@0 | 306 | #define BTREEVERSION 3 |
michael@0 | 307 | |
michael@0 | 308 | /* Structure used to pass parameters to the btree routines. */ |
michael@0 | 309 | typedef struct { |
michael@0 | 310 | #define R_DUP 0x01 /* duplicate keys */ |
michael@0 | 311 | uint32 flags; |
michael@0 | 312 | uint cachesize; /* bytes to cache */ |
michael@0 | 313 | int maxkeypage; /* maximum keys per page */ |
michael@0 | 314 | int minkeypage; /* minimum keys per page */ |
michael@0 | 315 | uint psize; /* page size */ |
michael@0 | 316 | int (*compare) /* comparison function */ |
michael@0 | 317 | (const DBT *, const DBT *); |
michael@0 | 318 | size_t (*prefix) /* prefix function */ |
michael@0 | 319 | (const DBT *, const DBT *); |
michael@0 | 320 | int lorder; /* byte order */ |
michael@0 | 321 | } BTREEINFO; |
michael@0 | 322 | |
michael@0 | 323 | #define HASHMAGIC 0x061561 |
michael@0 | 324 | #define HASHVERSION 2 |
michael@0 | 325 | |
michael@0 | 326 | /* Structure used to pass parameters to the hashing routines. */ |
michael@0 | 327 | typedef struct { |
michael@0 | 328 | uint bsize; /* bucket size */ |
michael@0 | 329 | uint ffactor; /* fill factor */ |
michael@0 | 330 | uint nelem; /* number of elements */ |
michael@0 | 331 | uint cachesize; /* bytes to cache */ |
michael@0 | 332 | uint32 /* hash function */ |
michael@0 | 333 | (*hash) (const void *, size_t); |
michael@0 | 334 | int lorder; /* byte order */ |
michael@0 | 335 | } HASHINFO; |
michael@0 | 336 | |
michael@0 | 337 | /* Structure used to pass parameters to the record routines. */ |
michael@0 | 338 | typedef struct { |
michael@0 | 339 | #define R_FIXEDLEN 0x01 /* fixed-length records */ |
michael@0 | 340 | #define R_NOKEY 0x02 /* key not required */ |
michael@0 | 341 | #define R_SNAPSHOT 0x04 /* snapshot the input */ |
michael@0 | 342 | uint32 flags; |
michael@0 | 343 | uint cachesize; /* bytes to cache */ |
michael@0 | 344 | uint psize; /* page size */ |
michael@0 | 345 | int lorder; /* byte order */ |
michael@0 | 346 | size_t reclen; /* record length (fixed-length records) */ |
michael@0 | 347 | uint8 bval; /* delimiting byte (variable-length records */ |
michael@0 | 348 | char *bfname; /* btree file name */ |
michael@0 | 349 | } RECNOINFO; |
michael@0 | 350 | |
michael@0 | 351 | #ifdef __DBINTERFACE_PRIVATE |
michael@0 | 352 | /* |
michael@0 | 353 | * Little endian <==> big endian 32-bit swap macros. |
michael@0 | 354 | * M_32_SWAP swap a memory location |
michael@0 | 355 | * P_32_SWAP swap a referenced memory location |
michael@0 | 356 | * P_32_COPY swap from one location to another |
michael@0 | 357 | */ |
michael@0 | 358 | #define M_32_SWAP(a) { \ |
michael@0 | 359 | uint32 _tmp = a; \ |
michael@0 | 360 | ((char *)&a)[0] = ((char *)&_tmp)[3]; \ |
michael@0 | 361 | ((char *)&a)[1] = ((char *)&_tmp)[2]; \ |
michael@0 | 362 | ((char *)&a)[2] = ((char *)&_tmp)[1]; \ |
michael@0 | 363 | ((char *)&a)[3] = ((char *)&_tmp)[0]; \ |
michael@0 | 364 | } |
michael@0 | 365 | #define P_32_SWAP(a) { \ |
michael@0 | 366 | uint32 _tmp = *(uint32 *)a; \ |
michael@0 | 367 | ((char *)a)[0] = ((char *)&_tmp)[3]; \ |
michael@0 | 368 | ((char *)a)[1] = ((char *)&_tmp)[2]; \ |
michael@0 | 369 | ((char *)a)[2] = ((char *)&_tmp)[1]; \ |
michael@0 | 370 | ((char *)a)[3] = ((char *)&_tmp)[0]; \ |
michael@0 | 371 | } |
michael@0 | 372 | #define P_32_COPY(a, b) { \ |
michael@0 | 373 | ((char *)&(b))[0] = ((char *)&(a))[3]; \ |
michael@0 | 374 | ((char *)&(b))[1] = ((char *)&(a))[2]; \ |
michael@0 | 375 | ((char *)&(b))[2] = ((char *)&(a))[1]; \ |
michael@0 | 376 | ((char *)&(b))[3] = ((char *)&(a))[0]; \ |
michael@0 | 377 | } |
michael@0 | 378 | |
michael@0 | 379 | /* |
michael@0 | 380 | * Little endian <==> big endian 16-bit swap macros. |
michael@0 | 381 | * M_16_SWAP swap a memory location |
michael@0 | 382 | * P_16_SWAP swap a referenced memory location |
michael@0 | 383 | * P_16_COPY swap from one location to another |
michael@0 | 384 | */ |
michael@0 | 385 | #define M_16_SWAP(a) { \ |
michael@0 | 386 | uint16 _tmp = a; \ |
michael@0 | 387 | ((char *)&a)[0] = ((char *)&_tmp)[1]; \ |
michael@0 | 388 | ((char *)&a)[1] = ((char *)&_tmp)[0]; \ |
michael@0 | 389 | } |
michael@0 | 390 | #define P_16_SWAP(a) { \ |
michael@0 | 391 | uint16 _tmp = *(uint16 *)a; \ |
michael@0 | 392 | ((char *)a)[0] = ((char *)&_tmp)[1]; \ |
michael@0 | 393 | ((char *)a)[1] = ((char *)&_tmp)[0]; \ |
michael@0 | 394 | } |
michael@0 | 395 | #define P_16_COPY(a, b) { \ |
michael@0 | 396 | ((char *)&(b))[0] = ((char *)&(a))[1]; \ |
michael@0 | 397 | ((char *)&(b))[1] = ((char *)&(a))[0]; \ |
michael@0 | 398 | } |
michael@0 | 399 | #endif |
michael@0 | 400 | |
michael@0 | 401 | PR_BEGIN_EXTERN_C |
michael@0 | 402 | |
michael@0 | 403 | extern DB * |
michael@0 | 404 | dbopen (const char *, int, int, DBTYPE, const void *); |
michael@0 | 405 | |
michael@0 | 406 | /* set or unset a global lock flag to disable the |
michael@0 | 407 | * opening of any DBM file |
michael@0 | 408 | */ |
michael@0 | 409 | void dbSetOrClearDBLock(DBLockFlagEnum type); |
michael@0 | 410 | |
michael@0 | 411 | #ifdef __DBINTERFACE_PRIVATE |
michael@0 | 412 | DB *__bt_open (const char *, int, int, const BTREEINFO *, int); |
michael@0 | 413 | DB *__hash_open (const char *, int, int, const HASHINFO *, int); |
michael@0 | 414 | DB *__rec_open (const char *, int, int, const RECNOINFO *, int); |
michael@0 | 415 | void __dbpanic (DB *dbp); |
michael@0 | 416 | #endif |
michael@0 | 417 | |
michael@0 | 418 | PR_END_EXTERN_C |
michael@0 | 419 | |
michael@0 | 420 | #endif /* !_DB_H_ */ |