diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-05-08 04:50:45 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-05-08 04:50:45 +0000 |
commit | d1c2a14cdfd71fea547c9ec0db7eff85991bdd11 (patch) | |
tree | 200fb3d55b6d160fec0cc21978851f589e48fc40 /nss/nss_db/dummy-db.h | |
parent | 93414bb97c8d4af09fbc6ed493e5c904f27a5173 (diff) | |
download | glibc-d1c2a14cdfd71fea547c9ec0db7eff85991bdd11.tar.gz glibc-d1c2a14cdfd71fea547c9ec0db7eff85991bdd11.tar.xz glibc-d1c2a14cdfd71fea547c9ec0db7eff85991bdd11.zip |
Update.
2000-05-07 Mark Kettenis <kettenis@gnu.org> * nss/nss_db/db-open.c: Cleanup and add comments. Pretty print. Remove duplicate <errno.h> include. Remove inclusion of <libintl.h> and "nsswitch.h". (set_cloexec_flag): New function, broken out of dbopen. (dbopen): Changed return type to `enum nss_status'. Mostly rewritten to make sure that we do not report NSS_STATUS_SUCCESS if something went wrong. Remove unnecessary casts. (internal_setent): Change return type to nss_status. Document, and make sure that the function behaves accordingly. Make dynamically loading the database library really thread-safe and return NSS_STATUS_UNAVAIL if it failed. (db_cursor): Return ENOMEM is memory allocation failed. Remove unecessary casts. * nss/nss_db/dummy-db.h: Add copyright notice. Improve documentation. (struct dbc24, struct dbc27): Use DBT type in parameter lists for c_get function member. * nss/nss_db/nss_db.h: Add and tweak some comments. (DBT): Move typedef before NSS_DBC typedef. (NSS_DBC, NSS_DB): Use DBT in function member parameter lists.
Diffstat (limited to 'nss/nss_db/dummy-db.h')
-rw-r--r-- | nss/nss_db/dummy-db.h | 120 |
1 files changed, 71 insertions, 49 deletions
diff --git a/nss/nss_db/dummy-db.h b/nss/nss_db/dummy-db.h index 66b5416189..75d7bac6df 100644 --- a/nss/nss_db/dummy-db.h +++ b/nss/nss_db/dummy-db.h @@ -1,31 +1,56 @@ +/* Constants and structures from the various Berkeley DB releases. + Copyright (C) 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + #include <stdint.h> #include "nss_db.h" -/* This file contains dummy definitions of the DB structure of the - Berkeley DB. We are only interested in the function pointers since - this is the interface to the database. Unfortunately the structure - changed over time and we have to take this into account. */ +/* This file contains dummy definitions for various constants and + structures from the Berkeley release. We only provide those + definitions that are actually needed. In case of the structures, + we're only interested in the function pointers, since that's the + interface to the database. Unfortunately the structures have been + changed several times. */ -/* The values to select the database type are unchanged over the version. - Define only what we really need. */ +/* The value for the btree database type has not been changed (yet?). */ #define DB_BTREE (1) -/* Permission flags. */ +/* Permission flags for all 2.x releases. */ #define DB2x_RDONLY 0x010000 -/* Access methods. */ +/* The error values for all 2.x releases. */ +#define DB2x_KEYEXIST ( -3) +#define DB2x_NOTFOUND ( -7) + +/* For all 2.x releases up to 2.6.3 we can use the same definitions. + We'll refer to them as 2.4 since that's the version distributed + with glibc 2.1. */ + +/* Access methods from version 2.4. */ #define DB24_FIRST 0x000020 #define DB24_NEXT 0x000800 #define DB24_NOOVERWRITE 0x001000 -/* The error values that are needed. */ -#define DB2x_KEYEXIST ( -3) -#define DB2x_NOTFOUND ( -7) - +/* Permission flags from version 2.4. */ +#define DB24_TRUNCATE 0x080000 -/* This is for the db-2.x version up to 2.x.y. We use the name `db24' since - this is the version which was shipped with glibc 2.1. */ +/* The DB structure from version 2.4. */ struct db24 { void *mutexp; @@ -77,7 +102,7 @@ struct db24 uint32_t flags; }; - +/* The DBC structure for the 2.4 release. */ struct dbc24 { void *dbp; @@ -90,15 +115,21 @@ struct dbc24 void *internal; void *c_close; void *c_del; - int (*c_get) (void *, void *, void *, uint32_t); + int (*c_get) (void *, DBT *, DBT *, uint32_t); void *c_put; }; -/* Flags which changed. */ -#define DB24_TRUNCATE 0x080000 +/* The 2.7 release is slighty different. */ +/* Access methods from version 2.7. */ +#define DB27_FIRST 7 +#define DB27_NEXT 15 +#define DB27_NOOVERWRITE 17 + +/* Permission flags from version 2.7. */ +#define DB27_TRUNCATE 0x020000 -/* Versions for 2.7, slightly incompatible with version 2.4. */ +/* The DB structure from version 2.7. */ struct db27 { void *mutexp; @@ -133,14 +164,14 @@ struct db27 int (*del) (void *, void *, DBT *, uint32_t); int (*fd) (void *, int *); int (*get) (void *, void *, DBT *, DBT *, uint32_t); - int (*join) (void *, void **, uint32_t, void **); + int (*join) (void *, void **, uint32_t, void **); int (*put) (void *, void *, DBT *, DBT *, uint32_t); int (*stat) (void *, void *, void *(*)(size_t), uint32_t); int (*sync) (void *, uint32_t); uint32_t flags; }; - +/* The DBC structure for version 2.7. */ struct dbc27 { void *dbp; @@ -164,21 +195,28 @@ struct dbc27 void *c_am_destroy; void *c_close; void *c_del; - int (*c_get) (void *, void *, void *, uint32_t); + int (*c_get) (void *, DBT *, DBT *, uint32_t); void *c_put; void *internal; uint32_t flags; }; -/* Flags which changed. */ -#define DB27_TRUNCATE 0x020000 +/* Version 3.0 is mostly incompatible with 2.x. */ -/* Access methods. */ -#define DB27_FIRST 7 -#define DB27_NEXT 15 -#define DB27_NOOVERWRITE 17 +/* Access methods from version 3.0. */ +#define DB30_FIRST 9 +#define DB30_NEXT 17 +#define DB30_NOOVERWRITE 20 -/* Versions for 3.0, incompatible with version 2.x. */ +/* Error values from version 3.0. */ +#define DB30_KEYEXIST (-30997) +#define DB30_NOTFOUND (-30994) + +/* Permission flags from version 3.0. */ +#define DB30_RDONLY 0x000010 +#define DB30_TRUNCATE 0x020000 + +/* The DB structure from version 3.0. */ struct db30 { size_t pgsize; @@ -238,16 +276,16 @@ struct db30 int (*stat) (void *, void *, void *(*)(size_t), uint32_t); int (*sync) (void *, uint32_t); int (*upgrade) (void *, const char *, uint32_t); - + int (*set_bt_compare) (void *, int (*)(const DBT *, const DBT *)); int (*set_bt_maxkey) (void *, uint32_t); int (*set_bt_minkey) (void *, uint32_t); int (*set_bt_prefix) (void *, size_t (*)(const DBT *, const DBT *)); - + int (*set_h_ffactor) (void *, uint32_t); int (*set_h_hash) (void *, uint32_t (*)(const void *, uint32_t)); int (*set_h_nelem) (void *, uint32_t); - + int (*set_re_delim) (void *, int); int (*set_re_len) (void *, uint32_t); int (*set_re_pad) (void *, int); @@ -257,7 +295,7 @@ struct db30 uint32_t flags; }; - +/* The DBC structure from version 3.0. */ struct dbc30 { void *dbp; @@ -293,19 +331,3 @@ struct dbc30 void *internal; uint32_t flags; }; - -/* Flags which changed. */ -#define DB30_TRUNCATE 0x020000 - -/* Access methods. */ -#define DB30_FIRST 9 -#define DB30_NEXT 17 -#define DB30_NOOVERWRITE 20 - -/* Permission flags are changed. */ -#define DB30_RDONLY 0x000010 - - -/* The error values that are needed. */ -#define DB30_KEYEXIST (-30997) -#define DB30_NOTFOUND (-30994) |