]> arthur.barton.de Git - netatalk.git/commitdiff
Add BDB 4 support to CNID.
authorjmarcus <jmarcus>
Mon, 3 Jun 2002 22:58:10 +0000 (22:58 +0000)
committerjmarcus <jmarcus>
Mon, 3 Jun 2002 22:58:10 +0000 (22:58 +0000)
Submitted by: Andre Schild <A.Schild@aarboard.ch>

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

index 2d649cfc403f9682f120b7760603449d01a4e7e0..2b76285a2702ab65e90ba2ae7d7b8e24406273a6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cnid_close.c,v 1.23 2002-05-29 18:02:59 jmarcus Exp $
+ * $Id: cnid_close.c,v 1.24 2002-06-03 22:58:10 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) {
-                rc = txn_checkpoint(db->dbenv, 0, 0, 0);
+#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 bf1d4661a11f6898b9867f057a8c7b9972dfe65e..99e453de75ab67c489be8a33140f521f049475de 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cnid_lookup.c,v 1.12 2002-01-19 21:42:08 jmarcus Exp $
+ * $Id: cnid_lookup.c,v 1.13 2002-06-03 22:58:10 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
         LOG(log_info, logtype_default, "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 8393adc79e04ed32ce61f732a4da587654420aec..3d8b5fee8d14f6b38f92c623c4a3ab2de1ff658e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cnid_open.c,v 1.40 2002-05-30 06:41:52 jmarcus Exp $
+ * $Id: cnid_open.c,v 1.41 2002-06-03 22:58:10 jmarcus Exp $
  *
  * Copyright (c) 1999. Adrian Sun (asun@zoology.washington.edu)
  * All Rights Reserved. See COPYRIGHT.
@@ -90,7 +90,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 */
@@ -123,7 +123,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)
@@ -149,7 +149,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)
@@ -173,13 +173,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);
@@ -272,7 +272,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) {