]> arthur.barton.de Git - netatalk.git/commitdiff
Remove #ifdef DEBUG stuff, its not neccessary anymore as we have a fast LOG macro...
authorfranklahm <franklahm>
Mon, 4 May 2009 09:09:43 +0000 (09:09 +0000)
committerfranklahm <franklahm>
Mon, 4 May 2009 09:09:43 +0000 (09:09 +0000)
etc/cnid_dbd/dbd_add.c
etc/cnid_dbd/dbd_delete.c
etc/cnid_dbd/dbd_get.c
etc/cnid_dbd/dbd_lookup.c
etc/cnid_dbd/dbd_resolve.c
etc/cnid_dbd/dbd_update.c
etc/cnid_dbd/pack.c
etc/cnid_dbd/pack.h

index 25a3afce040f48e3ed6023dca0dd1319df790495..75d8eefef6448a6333fa9f3839963940d16a3314 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: dbd_add.c,v 1.3 2009-04-21 08:55:44 franklahm Exp $
+ * $Id: dbd_add.c,v 1.4 2009-05-04 09:09:43 franklahm Exp $
  *
  * Copyright (C) Joerg Lenneis 2003
  * All Rights Reserved.  See COPYING.
@@ -169,9 +169,7 @@ int dbd_add(struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply)
 
     if (rply->result == CNID_DBD_RES_OK) {
         /* Found it. rply->cnid is the correct CNID now. */
-#ifdef DEBUG
-        LOG(log_info, logtype_cnid, "dbd_add: dbd_lookup success, cnid %u", ntohl(rply->cnid));
-#endif
+        LOG(log_debug, logtype_cnid, "dbd_add: dbd_lookup success, cnid %u", ntohl(rply->cnid));
         return 1;
     }
 
@@ -196,11 +194,10 @@ int dbd_add(struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply)
             return -1;
         }
     }
-#ifdef DEBUG
-    LOG(log_info, logtype_cnid, "dbd_add: Added dev/ino %s did %u name %s cnid %u",
-       stringify_devino(rqst->dev, rqst->ino),
-       ntohl(rqst->did), rqst->name, ntohl(rply->cnid));
-#endif
+    LOG(log_info, logtype_cnid, "dbd_add: Added dev/ino 0x%llx/0x%llx did %u name %s cnid %u",
+        ntoh64((unsigned long long int)rqst->dev), ntoh64((unsigned long long int)rqst->ino),
+        ntohl(rqst->did), rqst->name, ntohl(rply->cnid));
+
     rply->result = CNID_DBD_RES_OK;
     return 1;
 }
index d54d2686d7ec1e9746f0b47af6af9b557bb25106..49d24860df8c6496e137f8a512829df623773abb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: dbd_delete.c,v 1.2 2005-04-28 20:49:48 bfernhomberg Exp $
+ * $Id: dbd_delete.c,v 1.3 2009-05-04 09:09:43 franklahm Exp $
  *
  * Copyright (C) Joerg Lenneis 2003
  * All Rights Reserved.  See COPYING.
@@ -38,14 +38,10 @@ int dbd_delete(struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply)
     }
 
     if (rc) {
-#ifdef DEBUG
-        LOG(log_info, logtype_cnid, "cnid_delete: CNID %u deleted", ntohl(rqst->cnid));
-#endif
+        LOG(log_debug, logtype_cnid, "cnid_delete: CNID %u deleted", ntohl(rqst->cnid));
         rply->result = CNID_DBD_RES_OK;
     } else {
-#ifdef DEBUG
-        LOG(log_info, logtype_cnid, "cnid_delete: CNID %u not in database", ntohl(rqst->cnid));
-#endif
+        LOG(log_debug, logtype_cnid, "cnid_delete: CNID %u not in database", ntohl(rqst->cnid));
         rply->result = CNID_DBD_RES_NOTFOUND;
     }
     return 1;
index c71ab71594190d67b1bfcf469ef2c55212d2ae82..59d819ee0d00cb65a76d9622431eb3e2639e804b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: dbd_get.c,v 1.2 2005-04-28 20:49:48 bfernhomberg Exp $
+ * $Id: dbd_get.c,v 1.3 2009-05-04 09:09:43 franklahm Exp $
  *
  * Copyright (C) Joerg Lenneis 2003
  * All Rights Reserved.  See COPYING.
@@ -50,19 +50,17 @@ int dbd_get(struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply)
     }
 
     if (rc == 0) {
-#ifdef DEBUG
-       LOG(log_info, logtype_cnid, "cnid_get: CNID not found for did %u name %s",
+       LOG(log_debug, logtype_cnid, "cnid_get: CNID not found for did %u name %s",
            ntohl(rqst->did), rqst->name);
-#endif
-        rply->result = CNID_DBD_RES_NOTFOUND;
-        return 1;
+    rply->result = CNID_DBD_RES_NOTFOUND;
+    return 1;
     }
 
     memcpy(&rply->cnid, data.data, sizeof(rply->cnid));
-#ifdef DEBUG
-    LOG(log_info, logtype_cnid, "cnid_get: Returning CNID did %u name %s as %u",
+
+    LOG(log_debug, logtype_cnid, "cnid_get: Returning CNID did %u name %s as %u",
         ntohl(rqst->did), rqst->name, ntohl(rply->cnid));
-#endif
+
     rply->result = CNID_DBD_RES_OK;
     return 1;
 }
index 0c7e59a033f90012ddc4b8350747601b58ea2f63..4a008beb7e94650093a51138977cea8fe8534842 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: dbd_lookup.c,v 1.4 2009-04-21 08:55:44 franklahm Exp $
+ * $Id: dbd_lookup.c,v 1.5 2009-05-04 09:09:43 franklahm Exp $
  *
  * Copyright (C) Joerg Lenneis 2003
  * All Rights Reserved.  See COPYING.
@@ -98,8 +98,8 @@ int dbd_lookup(struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply)
     if (!devino && !didname) {  
         /* not found */
 
-        LOG(log_debug, logtype_cnid, "cnid_lookup: dev/ino %s did %u name %s neither in devino nor didname", 
-            stringify_devino(rqst->dev, rqst->ino), ntohl(rqst->did), rqst->name);
+        LOG(log_debug, logtype_cnid, "cnid_lookup: dev/ino 0x%llx/0x%llx did %u name %s neither in devino nor didname", 
+            ntoh64((unsigned long long int)rqst->dev), ntoh64((unsigned long long int)rqst->ino), ntohl(rqst->did), rqst->name);
 
         rply->result = CNID_DBD_RES_NOTFOUND;
         return 1;
@@ -108,8 +108,8 @@ int dbd_lookup(struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply)
     if (devino && didname && id_devino == id_didname && type_devino == rqst->type) {
         /* the same */
 
-        LOG(log_debug, logtype_cnid, "cnid_lookup: Looked up dev/ino %s did %u name %s as %u", 
-            stringify_devino(rqst->dev, rqst->ino), ntohl(rqst->did), rqst->name, ntohl(id_didname));
+        LOG(log_debug, logtype_cnid, "cnid_lookup: Looked up dev/ino 0x%llx/0x%llx did %u name %s as %u", 
+            ntoh64((unsigned long long int)rqst->dev), ntoh64((unsigned long long int)rqst->ino), ntohl(rqst->did), rqst->name, ntohl(id_didname));
 
         rply->cnid = id_didname;
         rply->result = CNID_DBD_RES_OK;
@@ -157,8 +157,8 @@ int dbd_lookup(struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply)
         rply->cnid = rqst->cnid;
     }
 
-    LOG(log_debug, logtype_cnid, "cnid_lookup: Looked up dev/ino %s did %u name %s as %u (needed update)", 
-        stringify_devino(rqst->dev, rqst->ino), ntohl(rqst->did), rqst->name, ntohl(rply->cnid));
+    LOG(log_debug, logtype_cnid, "cnid_lookup: Looked up dev/ino 0x%llx/0x%llx did %u name %s as %u (needed update)", 
+        ntoh64((unsigned long long int)rqst->dev), ntoh64((unsigned long long int)rqst->ino), ntohl(rqst->did), rqst->name, ntohl(rply->cnid));
 
     return rc;
 }
index 4be2343d9423cded0ba523e8bbafa51ac9fc37da..14f22cf4d24973d3ae132eed1b5597eaf5a72380 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: dbd_resolve.c,v 1.2 2005-04-28 20:49:48 bfernhomberg Exp $
+ * $Id: dbd_resolve.c,v 1.3 2009-05-04 09:09:43 franklahm Exp $
  *
  * Copyright (C) Joerg Lenneis 2003
  * All Rights Reserved.  See COPYING.
@@ -41,10 +41,9 @@ int dbd_resolve(struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply)
     }
      
     if (rc == 0) {
-#ifdef DEBUG
-       LOG(log_info, logtype_cnid, "dbd_resolve: Could not resolve CNID %u",
-           ntohl(rqst->cnid));
-#endif
+
+        LOG(log_debug, logtype_cnid, "dbd_resolve: Could not resolve CNID %u", ntohl(rqst->cnid));
+    
         rply->result = CNID_DBD_RES_NOTFOUND;
         return 1;
     }
@@ -54,10 +53,9 @@ int dbd_resolve(struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply)
     rply->namelen = data.size - CNID_NAME_OFS;
     rply->name = (char *)data.data + CNID_NAME_OFS;
 
-#ifdef DEBUG
-    LOG(log_info, logtype_cnid, "dbd_resolve: Resolving CNID %u to did %u name %s",
+    LOG(log_debug, logtype_cnid, "dbd_resolve: Resolving CNID %u to did %u name %s",
         ntohl(rqst->cnid), ntohl(rply->did), rply->name);
-#endif
+
     rply->result = CNID_DBD_RES_OK;
     return 1;
 }
index 184feaab2cce8286f08179e95dab5dd3e6efd8bd..8fb79622a0d30d7a8edf0ce00e1aeab688b91620 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: dbd_update.c,v 1.3 2005-05-03 14:55:11 didg Exp $
+ * $Id: dbd_update.c,v 1.4 2009-05-04 09:09:43 franklahm Exp $
  *
  * Copyright (C) Joerg Lenneis 2003
  * All Rights Reserved.  See COPYING.
@@ -39,9 +39,7 @@ int dbd_update(struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply)
     unsigned char *buf;                            
     int notfound = 0;
     char getbuf[CNID_HEADER_LEN + MAXPATHLEN +1];
-#ifdef DEBUG
     cnid_t tmpcnid;
-#endif
 
     memset(&key, 0, sizeof(key));
     memset(&pkey, 0, sizeof(pkey));
@@ -59,16 +57,15 @@ int dbd_update(struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply)
         goto err_db;
     }
     else if  (rc > 0) {
-#ifdef DEBUG
-       memcpy(&tmpcnid, pkey.data, sizeof(cnid_t));
-       LOG(log_info, logtype_cnid, "dbd_update: Deleting %u corresponding to dev/ino %s from cnid2.db",
-           ntohl(tmpcnid), stringify_devino(rqst->dev, rqst->ino));
-#endif
+        memcpy(&tmpcnid, pkey.data, sizeof(cnid_t));
+        LOG(log_debug, logtype_cnid, "dbd_update: Deleting %u corresponding to dev/ino 0x%llx/0x%llx from cnid2.db",
+            ntohl(tmpcnid), ntoh64((unsigned long long int)rqst->dev), ntoh64((unsigned long long int)rqst->ino));
+
         if ((rc = dbif_del(DBIF_IDX_CNID, &pkey, 0)) < 0 ) {
             goto err_db;
         }
         else if (!rc) {
-               LOG(log_error, logtype_cnid, "dbd_update: delete DEVINO %u %s", ntohl(rqst->cnid), db_strerror(errno));
+            LOG(log_error, logtype_cnid, "dbd_update: delete DEVINO %u %s", ntohl(rqst->cnid), db_strerror(errno));
         }
     }
     if (!rc) {
@@ -84,11 +81,12 @@ int dbd_update(struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply)
         goto err_db;
     }
     else if  (rc > 0) {
-#ifdef DEBUG
+
        memcpy(&tmpcnid, pkey.data, sizeof(cnid_t));
-       LOG(log_info, logtype_cnid, "dbd_update: Deleting %u corresponding to did %u name %s from cnid2.db",
+
+       LOG(log_debug, logtype_cnid, "dbd_update: Deleting %u corresponding to did %u name %s from cnid2.db",
            ntohl(tmpcnid), ntohl(rqst->did), rqst->name);
-#endif
+
         if ((rc = dbif_del(DBIF_IDX_CNID, &pkey, 0)) < 0) {
             goto err_db;
         }
@@ -112,19 +110,20 @@ int dbd_update(struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply)
 
     if (dbif_put(DBIF_IDX_CNID, &key, &data, 0) < 0)
         goto err_db;
-#ifdef DEBUG
-    LOG(log_info, logtype_cnid, "dbd_update: Updated cnid2.db with dev/ino %s did %u name %s cnid %u",
-       stringify_devino(rqst->dev, rqst->ino),
-       ntohl(rqst->did), rqst->name, ntohl(rqst->cnid));
-#endif
+
+    LOG(log_info, logtype_cnid, "dbd_update: Updated cnid2.db with dev/ino 0x%llx/0x%llx did %u name %s cnid %u",
+        ntoh64((unsigned long long int)rqst->dev), ntoh64((unsigned long long int)rqst->ino),
+        ntohl(rqst->did), rqst->name, ntohl(rqst->cnid));
+
     rply->result = CNID_DBD_RES_OK;
     return 1;
 
 err_db:
-#ifdef DEBUG
-    LOG(log_error, logtype_cnid, "dbd_update: Unable to update CNID %u dev/ino %s, DID %x:%s",
-        ntohl(rqst->cnid), stringify_devino(rqst->ino, rqst->did), rqst->name);
-#endif
+    LOG(log_error, logtype_cnid, "dbd_update: Unable to update CNID %u dev/ino 0x%llx/0x%llx, DID %ul: %s",
+        ntohl(rqst->cnid),
+        ntoh64((unsigned long long int)rqst->dev), ntoh64((unsigned long long int)rqst->ino),
+        rqst->did, rqst->name);
+
     rply->result = CNID_DBD_RES_ERR_DB;
     return -1;
 }
index 02a73075f953d295f763b629d43f99794566f060..039a79cded46f080cd42ab8227dc82357ae488b5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: pack.c,v 1.4 2009-04-28 13:01:24 franklahm Exp $
+ * $Id: pack.c,v 1.5 2009-05-04 09:09:43 franklahm Exp $
  *
  * Copyright (C) Joerg Lenneis 2003
  * All Rights Reserved.  See COPYING.
 #include <atalk/cnid_dbd_private.h>
 #include "pack.h"
 
-#ifdef DEBUG
-/*
- *  Auxiliary stuff for stringify_devino. See comments below.
- */
-static char hexchars[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
-#endif
-
 /* --------------- */
 /*
  *  This implementation is portable, but could probably be faster by using htonl
@@ -111,43 +104,3 @@ unsigned char *pack_cnid_data(struct cnid_dbd_rqst *rqst)
     return start;
 }
 
-#ifdef DEBUG
-
-/*
- *  Whack 4 or 8 byte dev/ino numbers into something printable for DEBUG
- *  logging. This function must not be used more that once per printf() style
- *  invocation. This (or something improved) should probably migrate to
- *  libatalk logging. Checking for printf() %ll support would be an alternative.
- */
-
-char *stringify_devino(dev_t dev, ino_t ino)
-{
-    static char rbuf[CNID_DEV_LEN * 2 + 1 + CNID_INO_LEN * 2 + 1] = {0};
-    char buf[CNID_DEV_LEN + CNID_INO_LEN];
-    char *c1;
-    char *c2;
-    char *middle;
-    char *end;
-    int   ci;
-
-    pack_devino((unsigned char *)buf, dev, ino);
-    
-    middle = buf + CNID_DEV_LEN;
-    end = buf + CNID_DEV_LEN + CNID_INO_LEN;
-    c1  = buf;
-    c2  = rbuf;  
-    
-    while (c1 < end) {
-       if (c1 == middle) {
-           *c2 = '/';
-           c2++;
-       }    
-       ci = *c1;
-       c2[0] = hexchars[(ci & 0xf0) >> 4];
-       c2[1] = hexchars[ci & 0x0f];
-       c1++;
-       c2 += 2;
-    }
-    return rbuf;
-}
-#endif
index 63f18ad47cc3a668d967b14c8861006f25e14d11..fb6984991d666e9caad2011c14abb63ad0674931 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: pack.h,v 1.4 2009-04-28 13:01:24 franklahm Exp $
+ * $Id: pack.h,v 1.5 2009-05-04 09:09:43 franklahm Exp $
  *
  * Copyright (C) Joerg Lenneis 2003
  * All Rights Reserved.  See COPYING.
@@ -24,8 +24,4 @@ extern unsigned char *pack_cnid_data(struct cnid_dbd_rqst *);
 extern int didname(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey);
 extern int devino(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey);
 
-#ifdef DEBUG
-extern char *stringify_devino(dev_t dev, ino_t ino);
-#endif
-
 #endif /* CNID_DBD_PACK_H */