+ EC_INIT;
+
+ cnid_t did;
+ cnid_t cnid;
+ bstring rpath = NULL;
+ bstring statpath = NULL;
+ struct bstrList *l = NULL;
+ struct stat st;
+
+ EC_NULL(rpath = rel_path_in_vol(path, vi->v_path));
+ SLOG("vol:%s, path: %s, rpath: %s", vi->v_path, path, bdata(rpath));
+
+ cnid = htonl(2);
+
+ EC_NULL(statpath = bfromcstr(vi->v_path));
+
+ l = bsplit(rpath, '/');
+ SLOG("elem: %s, qty: %u", cfrombstr(l->entry[0]), l->qty);
+ for(int i = 0; i < l->qty ; i++) {
+ did = cnid;
+ EC_ZERO(bconcat(statpath, l->entry[i]));
+ SLOG("statpath: %s", cfrombstr(statpath));
+ EC_ZERO_LOG(stat(cfrombstr(statpath), &st));
+ SLOG("db query: did: %u, name: %s, dev: %08x, ino: %08x",
+ ntohl(did), cfrombstr(l->entry[i]), st.st_dev, st.st_ino);
+ cnid = cnid_add(vol->v_cdb,
+ &st,
+ did,
+ cfrombstr(l->entry[i]),
+ blength(l->entry[i]),
+ 0);
+
+ EC_ZERO(bcatcstr(statpath, "/"));
+ }