]> arthur.barton.de Git - netatalk.git/commitdiff
Clean up the code with astyle.
authorjmarcus <jmarcus>
Sat, 4 Jan 2003 20:49:33 +0000 (20:49 +0000)
committerjmarcus <jmarcus>
Sat, 4 Jan 2003 20:49:33 +0000 (20:49 +0000)
libatalk/cnid/cnid_add.c
libatalk/cnid/cnid_close.c
libatalk/cnid/cnid_lookup.c
libatalk/cnid/cnid_mangle_add.c
libatalk/cnid/cnid_mangle_get.c
libatalk/cnid/cnid_open.c

index d69600409a6ae475798bf426ecc66aad872fe492..eec441f4c1b3549a763323713d184eb5758aea8a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cnid_add.c,v 1.31 2002-11-14 17:09:38 srittau Exp $
+ * $Id: cnid_add.c,v 1.32 2003-01-04 20:49:33 jmarcus Exp $
  *
  * Copyright (c) 1999. Adrian Sun (asun@zoology.washington.edu)
  * All Rights Reserved. See COPYRIGHT.
@@ -254,7 +254,7 @@ retry:
         if ((rc = txn_abort(tid)) != 0) {
             LOG(log_error, logtype_default, "cnid_add: txn_abort: %s", db_strerror(rc));
             errno = CNID_ERR_DB;
-            return CNID_INVALID; 
+            return CNID_INVALID;
         }
         goto retry;
 #endif /* CNID_DB_CDB */
index 41382315ab1be681ef1f059db2fcc40d5b6f56ca..dab7b8d87d8ab88ee03e48d97bbb9942d4c38e78 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cnid_close.c,v 1.27 2003-01-04 19:33:20 jmarcus Exp $
+ * $Id: cnid_close.c,v 1.28 2003-01-04 20:49:33 jmarcus Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -36,10 +36,10 @@ void cnid_close(void *CNID) {
     if ((db->lockfd > -1) && ((db->flags & CNIDFLAG_DB_RO) == 0)) {
         struct flock lock;
 
-        lock.l_type = F_WRLCK;
-        lock.l_whence = SEEK_SET;
-        lock.l_start = lock.l_len = 0;
-        if (fcntl(db->lockfd, F_SETLK, &lock) == 0) {
+    lock.l_type = F_WRLCK;
+    lock.l_whence = SEEK_SET;
+    lock.l_start = lock.l_len = 0;
+    if (fcntl(db->lockfd, F_SETLK, &lock) == 0) {
             char **list, **first;
 
 
@@ -47,7 +47,7 @@ void cnid_close(void *CNID) {
              * more. */
 #if DB_VERSION_MAJOR >= 4
 #if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1
-           db->dbenv->txn_checkpoint(db->dbenv, 0, 0, 0);
+            db->dbenv->txn_checkpoint(db->dbenv, 0, 0, 0);
 #else
             rc = db->dbenv->txn_checkpoint(db->dbenv, 0, 0, 0);
 #endif /* DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1 */
@@ -57,9 +57,9 @@ void cnid_close(void *CNID) {
 #if DB_VERSION_MAJOR < 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR < 1)
             while (rc == DB_INCOMPLETE) {
 #if DB_VERSION_MAJOR >= 4
-                   rc = db->dbenv->txn_checkpoint(db->dbenv, 0, 0, 0);
+                rc = db->dbenv->txn_checkpoint(db->dbenv, 0, 0, 0);
 #else
-                   rc = txn_checkpoint(db->dbenv, 0, 0, 0);
+                rc = txn_checkpoint(db->dbenv, 0, 0, 0);
 #endif /* DB_VERSION_MAJOR >= 4 */
             }
 #endif /* DB_VERSION_MAJOR < 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR < 1) */
@@ -78,9 +78,9 @@ void cnid_close(void *CNID) {
                 for (first = list; *list != NULL; ++list) {
                     if ((rc = remove(*list)) != 0) {
 #ifdef DEBUG
-                        LOG(log_info, logtype_default, "cnid_close: failed to remove %s: %s", *list, strerror(rc));
+                            LOG(log_info, logtype_default, "cnid_close: failed to remove %s: %s", *list, strerror(rc));
 #endif
-                    }
+                        }
                 }
                 free(first);
             }
index 145233b7011c7ae8d6c06b556ba7ebe47f490db5..139788603633f07c67e5a01eef46f1f1e22c7e58 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cnid_lookup.c,v 1.15 2003-01-04 19:33:20 jmarcus Exp $
+ * $Id: cnid_lookup.c,v 1.16 2003-01-04 20:49:33 jmarcus Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -49,7 +49,7 @@ cnid_t cnid_lookup(void *CNID, const struct stat *st, const cnid_t did,
         LOG(log_info, logtype_default, "cnid_lookup: Running database checkpoint");
 #endif
 #if DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)
-       db->dbenv->txn_checkpoint(db->dbenv, LOGFILEMAX, CHECKTIMEMAX, 0)
+        db->dbenv->txn_checkpoint(db->dbenv, LOGFILEMAX, CHECKTIMEMAX, 0)
 #else
 #if DB_VERSION_MAJOR >= 4
         switch (rc = db->dbenv->txn_checkpoint(db->dbenv, LOGFILEMAX, CHECKTIMEMAX, 0)) {
@@ -68,81 +68,81 @@ cnid_t cnid_lookup(void *CNID, const struct stat *st, const cnid_t did,
 #endif /* DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1) */
 #endif /* CNID_DB_CDB */
 
-    if ((buf = make_cnid_data(st, did, name, len)) == NULL) {
-        LOG(log_error, logtype_default, "cnid_lookup: Pathname is too long");
-        return 0;
-    }
+        if ((buf = make_cnid_data(st, did, name, len)) == NULL) {
+            LOG(log_error, logtype_default, "cnid_lookup: Pathname is too long");
+            return 0;
+        }
 
-    memset(&key, 0, sizeof(key));
-    memset(&devdata, 0, sizeof(devdata));
-    memset(&diddata, 0, sizeof(diddata));
+        memset(&key, 0, sizeof(key));
+        memset(&devdata, 0, sizeof(devdata));
+        memset(&diddata, 0, sizeof(diddata));
 
-    /* Look for a CNID.  We have two options: dev/ino or did/name.  If we
-     * only get a match in one of them, that means a file has moved. */
-    key.data = buf;
-    key.size = CNID_DEVINO_LEN;
-    while ((rc = db->db_devino->get(db->db_devino, NULL, &key, &devdata, 0))) {
+        /* Look for a CNID.  We have two options: dev/ino or did/name.  If we
+         * only get a match in one of them, that means a file has moved. */
+        key.data = buf;
+        key.size = CNID_DEVINO_LEN;
+        while ((rc = db->db_devino->get(db->db_devino, NULL, &key, &devdata, 0))) {
 #ifndef CNID_DB_CDB
-        if (rc == DB_LOCK_DEADLOCK) {
-            continue;
-        }
+            if (rc == DB_LOCK_DEADLOCK) {
+                continue;
+            }
 #endif /* CNID_DB_CDB */
 
-        if (rc == DB_NOTFOUND) {
-            devino = 0;
-            break;
-        }
+            if (rc == DB_NOTFOUND) {
+                devino = 0;
+                break;
+            }
 
-        LOG(log_error, logtype_default, "cnid_lookup: Unable to get CNID dev %u, ino %u: %s",
-            st->st_dev, st->st_ino, db_strerror(rc));
-        return 0;
-    }
+            LOG(log_error, logtype_default, "cnid_lookup: Unable to get CNID dev %u, ino %u: %s",
+                st->st_dev, st->st_ino, db_strerror(rc));
+            return 0;
+        }
 
-    /* did/name now */
-    key.data = buf + CNID_DEVINO_LEN;
-    key.size = CNID_DID_LEN + len + 1;
-    while ((rc = db->db_didname->get(db->db_didname, NULL, &key, &diddata, 0))) {
+        /* did/name now */
+        key.data = buf + CNID_DEVINO_LEN;
+        key.size = CNID_DID_LEN + len + 1;
+        while ((rc = db->db_didname->get(db->db_didname, NULL, &key, &diddata, 0))) {
 #ifndef CNID_DB_CDB
-        if (rc == DB_LOCK_DEADLOCK) {
-            continue;
-        }
+            if (rc == DB_LOCK_DEADLOCK) {
+                continue;
+            }
 #endif /* CNID_DB_CDB */
 
-        if (rc == DB_NOTFOUND) {
-            didname = 0;
-            break;
-        }
+            if (rc == DB_NOTFOUND) {
+                didname = 0;
+                break;
+            }
 
-        LOG(log_error, logtype_default, "cnid_lookup: Unable to get CNID %u, name %s: %s",
-            ntohl(did), name, db_strerror(rc));
-        return 0;
-    }
+            LOG(log_error, logtype_default, "cnid_lookup: Unable to get CNID %u, name %s: %s",
+                ntohl(did), name, db_strerror(rc));
+            return 0;
+        }
 
-    /* Set id.  Honor did/name over dev/ino as dev/ino isn't necessarily
-     * 1-1. */
-    if (didname) {
-        memcpy(&id, diddata.data, sizeof(id));
-    }
-    else if (devino) {
-        memcpy(&id, devdata.data, sizeof(id));
-    }
+        /* Set id.  Honor did/name over dev/ino as dev/ino isn't necessarily
+         * 1-1. */
+        if (didname) {
+            memcpy(&id, diddata.data, sizeof(id));
+        }
+        else if (devino) {
+            memcpy(&id, devdata.data, sizeof(id));
+        }
 
-    /* Either entries are in both databases or neither of them. */
-    if ((devino && didname) || !(devino || didname)) {
+        /* Either entries are in both databases or neither of them. */
+        if ((devino && didname) || !(devino || didname)) {
 #ifdef DEBUG
-        LOG(log_info, logtype_default, "cnid_lookup: Looked up did %u, name %s, as %u",
-            ntohl(did), name, ntohl(id));
+            LOG(log_info, logtype_default, "cnid_lookup: Looked up did %u, name %s, as %u",
+                ntohl(did), name, ntohl(id));
 #endif
-        return id;
-    }
+            return id;
+        }
 
-    /* Fix up the database. */
-    cnid_update(db, id, st, did, name, len);
+        /* Fix up the database. */
+        cnid_update(db, id, st, did, name, len);
 #ifdef DEBUG
-    LOG(log_info, logtype_default, "cnid_lookup: Looked up did %u, name %s, as %u (needed update)", ntohl(did), name, ntohl(id));
+        LOG(log_info, logtype_default, "cnid_lookup: Looked up did %u, name %s, as %u (needed update)", ntohl(did), name, ntohl(id));
 #endif
-    return id;
-}
+        return id;
+    }
 #endif /* CNID_DB */
 
 
index 80336d0e780a532c02cf3e9b662eae27a5190016..ef37a315446eaabde3991bd0ece113d7bc7f9c44 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cnid_mangle_add.c,v 1.4 2002-08-30 03:12:52 jmarcus Exp $
+ * $Id: cnid_mangle_add.c,v 1.5 2003-01-04 20:49:33 jmarcus Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -67,12 +67,12 @@ retry:
 #endif /* CNID_DB_CDB */
         switch (rc) {
 #ifndef CNID_DB_CDB
-            case DB_LOCK_DEADLOCK:
-                goto retry;
+        case DB_LOCK_DEADLOCK:
+            goto retry;
 #endif /* CNID_DB_CDB */
-            default:
-                LOG(log_error, logtype_default, "cnid_mangle_add: Failed to add mangled filename to the database: %s", db_strerror(rc));
-                return -1;
+        default:
+            LOG(log_error, logtype_default, "cnid_mangle_add: Failed to add mangled filename to the database: %s", db_strerror(rc));
+            return -1;
         }
     }
 
index 2679a26ac83dbd5749f748206af9718b33c0efa7..b0c3d289de68b6bbab2b44f32d2b435d1b5ccf6c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cnid_mangle_get.c,v 1.6 2002-08-30 03:12:52 jmarcus Exp $
+ * $Id: cnid_mangle_get.c,v 1.7 2003-01-04 20:49:33 jmarcus Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -49,12 +49,12 @@ cnid_mangle_get(void *CNID, char *mfilename)
         }
 
         if (rc == DB_NOTFOUND) {
-           LOG(log_debug, logtype_default, "cnid_mangle_get: Failed to find mangled entry for %s", mfilename);
-           return NULL;
+            LOG(log_debug, logtype_default, "cnid_mangle_get: Failed to find mangled entry for %s", mfilename);
+            return NULL;
 
         }
 
-       LOG(log_error, logtype_default, "cnid_mangle_get: Failed to get mangle entry from the database: %s", db_strerror(rc));
+        LOG(log_error, logtype_default, "cnid_mangle_get: Failed to get mangle entry from the database: %s", db_strerror(rc));
         return NULL;
     }
 
index f90deb1f016de73daf52f2723aaaf80dfba0f846..ccf069c38a9372edad0bdb5aacd89fbf9bd2c096 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cnid_open.c,v 1.45 2003-01-04 19:33:20 jmarcus Exp $
+ * $Id: cnid_open.c,v 1.46 2003-01-04 20:49:33 jmarcus Exp $
  *
  * Copyright (c) 1999. Adrian Sun (asun@zoology.washington.edu)
  * All Rights Reserved. See COPYRIGHT.
@@ -33,7 +33,7 @@
  * CNIDs 4-16 are reserved according to page 31 of the AFP 3.0 spec so, 
  * CNID_START begins at 17.
  */
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
@@ -197,7 +197,7 @@ void *cnid_open(const char *dir, mode_t mask) {
 #ifndef CNID_DB_CDB
     struct flock lock;
 #endif /* CNID_DB_CDB */
-    char path[MAXPATHLEN + 1];
+char path[MAXPATHLEN + 1];
     CNID_private *db;
     DBT key, data;
     DB_TXN *tid;
@@ -330,7 +330,7 @@ void *cnid_open(const char *dir, mode_t mask) {
     /*db->db_didname->set_bt_compare(db->db_didname, &compare_unix);*/
 #if DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)
     if ((rc = db->db_didname->open(db->db_didname, NULL, DBDIDNAME, NULL,
-                                  DB_HASH, open_flag DB_AUTO_COMMIT, 0666 & ~mask))) {
+                                   DB_HASH, open_flag DB_AUTO_COMMIT, 0666 & ~mask))) {
 #else
     if ((rc = db->db_didname->open(db->db_didname, DBDIDNAME, NULL,
                                    DB_HASH, open_flag, 0666 & ~mask))) {
@@ -404,7 +404,7 @@ dbversion_retry:
                 }
                 else if (ret == DB_RUNRECOVERY) {
                     /* At this point, we don't care if the transaction aborts
-                     * successfully or not. */
+                    * successfully or not. */
                     txn_abort(tid);
                     LOG(log_error, logtype_default, "cnid_open: Error putting new version: %s",
                         db_strerror(ret));