]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/catsearch.c
New MySQL CNID backend
[netatalk.git] / etc / afpd / catsearch.c
index 09e3ff52196dd6770768e57876fe27ba78744359..bec7b15245b195e1311fde72d72eba838108a9d2 100644 (file)
@@ -46,7 +46,7 @@
 #include <atalk/adouble.h>
 #include <atalk/logger.h>
 #include <atalk/cnid.h>
-#include <atalk/cnid_dbd_private.h>
+#include <atalk/cnid_bdb_private.h>
 #include <atalk/util.h>
 #include <atalk/bstradd.h>
 #include <atalk/unicode.h>
@@ -137,7 +137,6 @@ static void clearstack(void)
 static int addstack(char *uname, struct dir *dir, int pidx)
 {
        struct dsitem *ds;
-       size_t         l, u;
     struct dsitem *tmpds = NULL;
 
        /* check if we have some space on stack... */
@@ -551,7 +550,7 @@ static int catsearch(const AFPObj *obj,
                        dirpos = opendir(".");
 
                if (dirpos == NULL)
-                       dirpos = opendir(bdata(currentdir->d_fullpath));
+                       dirpos = opendir(cfrombstr(currentdir->d_fullpath));
 
                if (error || dirpos == NULL) {
                        switch (errno) {
@@ -744,11 +743,14 @@ static int catsearch_db(const AFPObj *obj,
 
         LOG(log_debug, logtype_afpd, "catsearch_db: %s", buffer);
 
-        if ((num_matches = cnid_find(vol->v_cdb,
-                                     buffer,
-                                     strlen(uname),
-                                     resbuf,
-                                     sizeof(resbuf))) == -1) {
+        AFP_CNID_START("cnid_find");
+        num_matches = cnid_find(vol->v_cdb,
+                                buffer,
+                                strlen(uname),
+                                resbuf,
+                                sizeof(resbuf));
+        AFP_CNID_DONE();
+        if (num_matches == -1) {
             result = AFPERR_MISC;
             goto catsearch_end;
         }
@@ -764,8 +766,12 @@ static int catsearch_db(const AFPObj *obj,
         memcpy(&cnid, resbuf + cur_pos * sizeof(cnid_t), sizeof(cnid_t));
         did = cnid;
 
-        if ((name = cnid_resolve(vol->v_cdb, &did, resolvebuf, 12 + MAXPATHLEN + 1)) == NULL)
+        AFP_CNID_START("cnid_resolve");
+        name = cnid_resolve(vol->v_cdb, &did, resolvebuf, 12 + MAXPATHLEN + 1);
+        AFP_CNID_DONE();
+        if (name == NULL)
             goto next;
+
         LOG(log_debug, logtype_afpd, "catsearch_db: {pos: %u, name:%s, cnid: %u}",
             cur_pos, name, ntohl(cnid));
         if ((dir = dirlookup(vol, did)) == NULL)