]> arthur.barton.de Git - netatalk.git/commitdiff
MFH: Add support for BDB 4.0.x.
authorjmarcus <jmarcus>
Mon, 17 Jun 2002 21:09:01 +0000 (21:09 +0000)
committerjmarcus <jmarcus>
Mon, 17 Jun 2002 21:09:01 +0000 (21:09 +0000)
cnid_close.c : Rev 1.24
cnid_lookup.c : Rev 1.13
cnid_open.c : Rev 1.41

libatalk/cnid/cnid_close.c
libatalk/cnid/cnid_lookup.c
libatalk/cnid/cnid_open.c

index de35433f1879ff766fa1308e4bd06bcd6771232c..59866a8652ac67aec7aa34d52f6b99b5ed083b28 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cnid_close.c,v 1.12.2.4 2002-02-09 20:29:02 jmarcus Exp $
+ * $Id: cnid_close.c,v 1.12.2.5 2002-06-17 21:09:01 jmarcus Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -45,12 +45,22 @@ void cnid_close(void *CNID) {
 
             /* Checkpoint the databases until we can checkpoint no
              * more. */
+#if DB_VERSION_MAJOR >= 4
+           rc = db->dbenv->txn_checkpoint(db->dbenv, 0, 0, 0);
+#else
             rc = txn_checkpoint(db->dbenv, 0, 0, 0);
+#endif
             while (rc == DB_INCOMPLETE) {
+#if DB_VERSION_MAJOR >= 4
+               rc = db->dbenv->txn_checkpoint(db->dbenv, 0, 0, 0);
+#else
                 rc = txn_checkpoint(db->dbenv, 0, 0, 0);
+#endif
             }
 
-#if DB_VERSION_MINOR > 2
+#if DB_VERSION_MAJOR >= 4
+            if ((rc = db->dbenv->log_archive(db->dbenv, &list, DB_ARCH_ABS)) != 0) {
+#elif DB_VERSION_MINOR > 2
             if ((rc = log_archive(db->dbenv, &list, DB_ARCH_ABS)) != 0) {
 #else /* DB_VERSION_MINOR < 2 */
             if ((rc = log_archive(db->dbenv, &list, DB_ARCH_ABS, NULL)) != 0) {
index 039bcc77e9372bf43ff1f41ebc76de97030cf05b..d32baf9dfac1a00c62b9d29c489c8a8f54c79004 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cnid_lookup.c,v 1.9.2.4 2002-02-09 20:29:02 jmarcus Exp $
+ * $Id: cnid_lookup.c,v 1.9.2.5 2002-06-17 21:09:01 jmarcus Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -47,7 +47,11 @@ cnid_t cnid_lookup(void *CNID, const struct stat *st, const cnid_t did,
 #ifdef DEBUG
         syslog(LOG_INFO, "cnid_lookup: Running database checkpoint");
 #endif
+#if DB_VERSION_MAJOR >= 4
+       switch (rc = db->dbenv->txn_checkpoint(db->dbenv, LOGFILEMAX, CHECKTIMEMAX, 0)) {
+#else
         switch (rc = txn_checkpoint(db->dbenv, LOGFILEMAX, CHECKTIMEMAX, 0)) {
+#endif
         case 0:
         case DB_INCOMPLETE:
             break;
index 19673daeafe6910b68667ffff7324713138e3261..dde3d478c73a0ef8b94189afa2f341400792921b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cnid_open.c,v 1.19.2.5 2002-06-17 20:32:29 jmarcus Exp $
+ * $Id: cnid_open.c,v 1.19.2.6 2002-06-17 21:09:01 jmarcus Exp $
  *
  * Copyright (c) 1999. Adrian Sun (asun@zoology.washington.edu)
  * All Rights Reserved. See COPYRIGHT.
@@ -89,7 +89,7 @@
 #define DBVERSION1       0x00000001U
 #define DBVERSION        DBVERSION1
 
-#if DB_VERSION_MINOR > 1
+#if DB_VERSION_MAJOR >= 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR > 1)
 #define DBOPTIONS    (DB_CREATE | DB_INIT_MPOOL | DB_INIT_LOCK | \
 DB_INIT_LOG | DB_INIT_TXN)
 #else /* DB_VERSION_MINOR < 1 */
@@ -122,7 +122,7 @@ static __inline__ int compare_did(const DBT *a, const DBT *b)
 
 /* sort did's and then names. this is for unix paths.
  * i.e., did/unixname lookups. */
-#if DB_VERSION_MINOR > 1
+#if DB_VERSION_MAJOR >= 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR > 1)
 static int compare_unix(DB *db, const DBT *a, const DBT *b)
 #else /* DB_VERSION_MINOR < 1 */
 static int compare_unix(const DBT *a, const DBT *b)
@@ -148,7 +148,7 @@ static int compare_unix(const DBT *a, const DBT *b)
  * did/macname, and did/shortname. i think did/longname needs a
  * unicode table to work. also, we can't use strdiacasecmp as that
  * returns a match if a < b. */
-#if DB_VERSION_MINOR > 1
+#if DB_VERSION_MAJOR >= 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR > 1)
 static int compare_mac(DB *db, const DBT *a, const DBT *b)
 #else /* DB_VERSION_MINOR < 1 */
 static int compare_mac(const DBT *a, const DBT *b)
@@ -172,13 +172,13 @@ static int compare_mac(const DBT *a, const DBT *b)
 
 
 /* for unicode names -- right now it's the same as compare_mac. */
-#if DB_VERSION_MINOR > 1
+#if DB_VERSION_MAJOR >= 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR > 1)
 static int compare_unicode(DB *db, const DBT *a, const DBT *b)
 #else /* DB_VERSION_MINOR < 1 */
 static int compare_unicode(const DBT *a, const DBT *b)
 #endif /* DB_VERSION_MINOR */
 {
-#if DB_VERSION_MINOR > 1
+#if DB_VERSION_MAJOR >= 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR > 1)
     return compare_mac(db,a,b);
 #else /* DB_VERSION_MINOR < 1 */
     return compare_mac(a,b);
@@ -271,7 +271,7 @@ void *cnid_open(const char *dir) {
         goto fail_lock;
     }
 
-#if DB_VERSION_MINOR > 1
+#if DB_VERSION_MAJOR >= 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR > 1)
 #if 0
     /* Take care of setting the DB_TXN_NOSYNC flag in db3 > 3.1.x. */
     if ((rc = db->dbenv->set_flags(db->dbenv, DB_TXN_NOSYNC, 1)) != 0) {