about summary refs log tree commit diff
path: root/nss/nss_db/dummy-db.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-01-08 05:28:22 +0000
committerUlrich Drepper <drepper@redhat.com>2000-01-08 05:28:22 +0000
commit9d8525f2a152bb949053b52e91ccae0562a0cbb8 (patch)
tree73a3efedead7b4dedef99e1e718ac070d425637a /nss/nss_db/dummy-db.h
parentf14854aab2b23d37c27c21975c5cb9f493f4ae82 (diff)
downloadglibc-9d8525f2a152bb949053b52e91ccae0562a0cbb8.tar.gz
glibc-9d8525f2a152bb949053b52e91ccae0562a0cbb8.tar.xz
glibc-9d8525f2a152bb949053b52e91ccae0562a0cbb8.zip
Update.
2000-01-07  Andreas Jaeger  <aj@suse.de>

	Add support for Berkeley db 3.0.x and merge db support:
	* nss/nss_db/dummy-db.h (struct db30): New.
	(struct dbc30): New.
	Added DB30* flags.

	* nss/makedb.c: Move all database routines to db-open.c.
	(main): Adjust to interface changes.
	Load database early to initialize version dependend variables.

	* nss/db-open.c: Merge database routines from makedb.c.
	Define version dependend constansts as variables.
	(load_db): Check also for db 3.
	(internal_setent): Call dbopen.
	(db_cursor): New function from makedb; handles db 3 now.
	(dbopen): New function from makedb; handles db 3.

	* nss/nss_db/db-XXX.c: Use db_notfound since the value is
	different in different DB versions.

	* nss/nss_db/nss_db.h: Add version dependend constants as
	variables, add exportet interfaces from db-open.c.

	* nss/Makefile ($(objpfx)makedb): Link against db-open.

2000-01-07  Ulrich Drepper  <drepper@cygnus.com>

	* misc/error.c: Don't use `defined _LIBC', only `_LIBC'.
	Reported by Jim Meyering.

	* time/strftime.c: Pretty printing.

2000-01-07  Andreas Jaeger  <aj@suse.de>

	* manual/socket.texi (Host Names): Fix example.
	Reported by Marco Budde <budde@telos.de>.
Diffstat (limited to 'nss/nss_db/dummy-db.h')
-rw-r--r--nss/nss_db/dummy-db.h140
1 files changed, 138 insertions, 2 deletions
diff --git a/nss/nss_db/dummy-db.h b/nss/nss_db/dummy-db.h
index 6ac8b77bb1..66b5416189 100644
--- a/nss/nss_db/dummy-db.h
+++ b/nss/nss_db/dummy-db.h
@@ -11,14 +11,18 @@
    Define only what we really need.  */
 #define DB_BTREE	(1)
 
-/* Permission flags are also not changed.  */
-#define DB_RDONLY	0x010000
+/* Permission flags.  */
+#define DB2x_RDONLY	0x010000
 
 /* Access methods.  */
 #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)
+
 
 /* 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.  */
@@ -173,3 +177,135 @@ struct dbc27
 #define DB27_FIRST		7
 #define DB27_NEXT		15
 #define DB27_NOOVERWRITE	17
+
+/* Versions for 3.0, incompatible with version 2.x.  */
+struct db30
+{
+  size_t pgsize;
+  void (*db_feedback) (void *, int, int);
+  void *(*db_malloc) (size_t);
+  void *(*db_realloc) (void *, size_t);
+  int (*dup_compare) (const DBT *, const DBT *);
+  void *dbenv;
+  enum { dummy30 } type;
+  void *mpf;
+  void	*mutexp;
+  u_int8_t fileid[20];
+  int32_t log_fileid;
+  void *open_txn;
+  void *saved_open_fhp;
+  struct
+  {
+    void *tqh_first;
+    void **tqh_last;
+  } free_queue;
+  struct
+  {
+    void *tqh_first;
+    void **tqh_last;
+  } active_queue;
+  void	*bt_internal;
+  void	*cj_internal;
+  void	*h_internal;
+  void	*q_internal;
+  void	*xa_internal;
+  /* Functions.  */
+  int  (*close) (void *, uint32_t);
+  int  (*cursor) (void *, void *, void **, uint32_t);
+  int  (*del) (void *, void *, DBT *, uint32_t);
+  void (*err) (void *, int, const char *, ...);
+  void (*errx) (void *, const char *, ...);
+  int  (*fd) (void *, int *);
+  int  (*get) (void *, void *, DBT *, DBT *, uint32_t);
+  int  (*get_byteswapped) (void *);
+  int (*get_type) (void *);
+  int  (*join) (void *, void **, void **, uint32_t);
+  int  (*open) (void *,	const char *, const char *, int, uint32_t, int);
+  int  (*put) (void *, void *, DBT *, DBT *, uint32_t);
+  int  (*remove) (void *, const char *, const char *, uint32_t);
+  int  (*set_cachesize) (void *, uint32_t, uint32_t, int);
+  int  (*set_dup_compare) (void *, int (*)(const DBT *, const DBT *));
+  void (*set_errcall) (void *, void (*)(const char *, char *));
+  void (*set_errfile) (void *, void *);
+  void (*set_errpfx) (void *, const char *);
+  void (*set_feedback) (void *, void (*)(void *, int, int));
+  int  (*set_flags) (void *, uint32_t);
+  int  (*set_lorder) (void *, int);
+  int  (*set_malloc) (void *, void *(*)(size_t));
+  int  (*set_pagesize) (void *, uint32_t);
+  void (*set_paniccall) (void *, void (*)(void *, int));
+  int  (*set_realloc) (void *, void *(*)(void *, size_t));
+  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);
+  int  (*set_re_source) (void *, const char *);
+
+  uint32_t am_ok;
+  uint32_t flags;
+};
+
+
+struct dbc30
+{
+  void *dbp;
+  void *txn;
+  struct
+  {
+    void *tqe_next;
+    void **tqe_prev;
+  } links;
+  uint32_t lid;			/* Default process' locker id. */
+  uint32_t locker;		/* Locker for this operation. */
+  DBT lock_dbt;		/* DBT referencing lock. */
+  struct
+  {
+    uint32_t pgno;
+    uint8_t fileid[20];
+  } lock;
+  struct
+  {
+    size_t off;
+    uint32_t ndx;
+    uint32_t gen;
+  } mylock;
+  DBT rkey;
+  DBT rdata;
+  int (*c_close) (void *);
+  int (*c_del) (void *, uint32_t);
+  int (*c_dup) (void *, void **, uint32_t);
+  int (*c_get) (void *, DBT *, DBT *, uint32_t);
+  int (*c_put) (void *, DBT *, DBT *, uint32_t);
+  int (*c_am_close) (void *);
+  int (*c_am_destroy) (void *);
+  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)