]> arthur.barton.de Git - netatalk.git/blobdiff - bin/ad/ad_util.c
Merge remote-tracking branch 'origin/develop' into spotlight
[netatalk.git] / bin / ad / ad_util.c
index fbe85235c2af51201ec331e5e0ea67d27ed93f86..a168eed8a201f16413eaa3637431e2cea05d9d8a 100644 (file)
@@ -233,73 +233,6 @@ int convert_dots_encoding(const afpvol_t *svol, const afpvol_t *dvol, char *path
     return 0;
 }
 
-/*!
- * ResolvesCNID of a given paths
- *
- * path might be:
- * (a) relative:
- *     "dir/subdir" with cwd: "/afp_volume/topdir"
- * (b) absolute:
- *     "/afp_volume/dir/subdir"
- *
- * path MUST be pointing inside vol, this is usually the case as vol has been build from
- * path using loadvolinfo and friends.
- *
- * @param vol  (r) pointer to afpvol_t
- * @param path (r) path, see above
- * @param did  (rw) parent CNID of returned CNID
- *
- * @returns CNID of path
- */
-cnid_t cnid_for_path(const afpvol_t *vol,
-                     const char *path,
-                     cnid_t *did)
-{
-    EC_INIT;
-
-    cnid_t cnid;
-    bstring rpath = NULL;
-    bstring statpath = NULL;
-    struct bstrList *l = NULL;
-    struct stat st;
-
-    cnid = htonl(2);
-
-    EC_NULL(rpath = rel_path_in_vol(path, vol->vol->v_path));
-    EC_NULL(statpath = bfromcstr(vol->vol->v_path));
-    EC_ZERO(bcatcstr(statpath, "/"));
-
-    l = bsplit(rpath, '/');
-    for (int i = 0; i < l->qty ; i++) {
-        *did = cnid;
-
-        EC_ZERO(bconcat(statpath, l->entry[i]));
-        EC_ZERO_LOGSTR(lstat(cfrombstr(statpath), &st),
-                       "lstat(rpath: %s, elem: %s): %s: %s",
-                       cfrombstr(rpath), cfrombstr(l->entry[i]),
-                       cfrombstr(statpath), strerror(errno));
-
-        if ((cnid = cnid_add(vol->vol->v_cdb,
-                             &st,
-                             *did,
-                             cfrombstr(l->entry[i]),
-                             blength(l->entry[i]),
-                             0)) == CNID_INVALID) {
-            EC_FAIL;
-        }
-        EC_ZERO(bcatcstr(statpath, "/"));
-    }
-
-EC_CLEANUP:
-    bdestroy(rpath);
-    bstrListDestroy(l);
-    bdestroy(statpath);
-    if (ret != 0)
-        return CNID_INVALID;
-
-    return cnid;
-}
-
 /*!
  * Resolves CNID of a given paths parent directory
  *