about summary refs log tree commit diff
path: root/nss/nss_db
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-01-02 08:45:58 +0000
committerUlrich Drepper <drepper@redhat.com>2000-01-02 08:45:58 +0000
commit793bd4d9ebc5198ac292437227bec133fc6f4dfc (patch)
treefcac05d3fe6bd9e1e8ac94df7f3450929640ad12 /nss/nss_db
parent8d6f1731fcd082e4f744ba9cb4bde4be7c08f1b3 (diff)
downloadglibc-793bd4d9ebc5198ac292437227bec133fc6f4dfc.tar.gz
glibc-793bd4d9ebc5198ac292437227bec133fc6f4dfc.tar.xz
glibc-793bd4d9ebc5198ac292437227bec133fc6f4dfc.zip
Update.
2000-01-02  Ulrich Drepper  <drepper@cygnus.com>

	* nss/nss_db/nss_db.h: Add definitions needed for makedb.
	* nss/nss_db/dummy-db.h: Likewise.
	* nss/makedb.c: New file.  Copied from file in db2, modified to not
	depend on being linked against libdb.
Diffstat (limited to 'nss/nss_db')
-rw-r--r--nss/nss_db/db-open.c4
-rw-r--r--nss/nss_db/dummy-db.h62
-rw-r--r--nss/nss_db/nss_db.h17
3 files changed, 79 insertions, 4 deletions
diff --git a/nss/nss_db/db-open.c b/nss/nss_db/db-open.c
index 2d96ffdd1b..c3a0679485 100644
--- a/nss/nss_db/db-open.c
+++ b/nss/nss_db/db-open.c
@@ -57,14 +57,14 @@ load_db (void)
   static const char *libnames[] = { "libdb.so.3" };
   int x;
 
-  for(x = 0; x < 1; ++x)
+  for(x = 0; x < sizeof (libnames) / sizeof (libnames[0]); ++x)
     {
       libdb_handle = dlopen (libnames[x], RTLD_LAZY);
       if (libdb_handle == NULL)
 	continue;
 
       libdb_db_open = dlsym (libdb_handle, "db_open");
-      if (libdb_db_open)
+      if (libdb_db_open != NULL)
 	{
 	  /* Alright, we got a library.  Now find out which version it is.  */
 	  const char *(*db_version) (int *, int *, int *);
diff --git a/nss/nss_db/dummy-db.h b/nss/nss_db/dummy-db.h
index 4414a1c9ae..600d51d984 100644
--- a/nss/nss_db/dummy-db.h
+++ b/nss/nss_db/dummy-db.h
@@ -14,6 +14,11 @@
 /* Permission flags are also not changed.  */
 #define DB_RDONLY	0x010000
 
+/* Access methods.  */
+#define DB24_FIRST		0x000020
+#define DB24_NEXT		0x000800
+#define DB24_NOOVERWRITE	0x001000
+
 
 /* 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.  */
@@ -68,7 +73,27 @@ struct db24
 };
 
 
-/* Version 2.7, slightly incompatible with version 2.4.  */
+struct dbc24
+{
+  void *dbp;
+  void *txn;
+  struct
+  {
+    void *tqe_next;
+    void **tqe_prev;
+  } links;
+  void *internal;
+  void *c_close;
+  void *c_del;
+  int (*c_get) (void *, void *, void *, uint32_t);
+  void *c_put;
+};
+
+/* Flags which changed.  */
+#define DB24_TRUNCATE	0x080000
+
+
+/* Versions for 2.7, slightly incompatible with version 2.4.  */
 struct db27
 {
   void	*mutexp;
@@ -109,3 +134,38 @@ struct db27
   int (*stat) (void *, void *, void *(*)(size_t), uint32_t);
   int (*sync) (void *, uint32_t);
 };
+
+
+struct dbc27
+{
+  void *dbp;
+  void *txn;
+  struct
+  {
+    void *tqe_next;
+    void **tqe_prev;
+  } links;
+  uint32_t lid;
+  uint32_t locker;
+  DBT lock_dbt;
+  uint32_t lock[14];
+  size_t mylock;
+  DBT rkey;
+  DBT rdata;
+  void *c_am_close;
+  void *c_am_destroy;
+  void *c_close;
+  void *c_del;
+  int (*c_get) (void *, void *, void *, uint32_t);
+  void *c_put;
+  void *internal;
+  uint32_t flags;
+};
+
+/* Flags which changed.  */
+#define DB27_TRUNCATE	0x020000
+
+/* Access methods.  */
+#define DB27_FIRST		7
+#define DB27_NEXT		15
+#define DB27_NOOVERWRITE	17
diff --git a/nss/nss_db/nss_db.h b/nss/nss_db/nss_db.h
index 8dc2a36416..dbf6ed8b54 100644
--- a/nss/nss_db/nss_db.h
+++ b/nss/nss_db/nss_db.h
@@ -24,17 +24,32 @@
 
 /* The error values kept the same values though new values were added.
    Define only those which we need.  */
+#define DB_KEYEXIST	( -3)
 #define DB_NOTFOUND	( -7)
 
+/* Flags are also unchanged.  */
+#define DB_CREATE	0x000001
+
+
+/* Similarly we have to handle the cursor object.  It is also very
+   different from version to version.  */
+typedef struct
+{
+  void *cursor;
+  int (*c_get) (void *, void *, void *, uint32_t);
+} NSS_DBC;
+
+
 /* This is the wrapper we put around the `DB' structures to provide a
    uniform interface to the higher-level functions.  */
 typedef struct
 {
   void *db;
   int (*close) (void *, uint32_t);
+  int (*cursor) (void *, void *, NSS_DBC **);
   int (*fd) (void *, int *);
   int (*get) (void *, void *, void *, void *, uint32_t);
-
+  int (*put) (void *, void *, void *, void *, uint32_t);
 } NSS_DB;