status_t dlist_add(nspace *vol, ino_t vnid) { DPRINTF(0, ("dlist_add vnid %Lx\n", vnid)); ASSERT(IS_DIR_CLUSTER_VNID(vnid)); ASSERT(dlist_find(vol, CLUSTER_OF_DIR_CLUSTER_VNID(vnid)) == -1LL); ASSERT(vnid != 0); if (vol->dlist.entries == vol->dlist.allocated) { if (dlist_realloc(vol, vol->dlist.allocated + DLIST_ENTRY_QUANTUM) < 0) return -ENOMEM; } vol->dlist.vnid_list[vol->dlist.entries++] = vnid; return B_OK; }
ino_t dlist_find(nspace *vol, uint32 cluster) { int i; DPRINTF(1, ("dlist_find cluster %x\n", cluster)); ASSERT(((cluster >= 2) && (cluster < vol->total_clusters + 2)) || (cluster == 1)); for (i=0;i<vol->dlist.entries;i++) if (CLUSTER_OF_DIR_CLUSTER_VNID(vol->dlist.vnid_list[i]) == cluster) return vol->dlist.vnid_list[i]; DPRINTF(1, ("dlist_find cluster %x not found\n", cluster)); return -1LL; }
ino_t dlist_find(nspace *vol, uint32 cluster) { uint32 i; DPRINTF(1, ("dlist_find cluster %" B_PRIu32 "\n", cluster)); ASSERT(((cluster >= 2) && (cluster < vol->total_clusters + 2)) || (cluster == 1)); for (i = 0; i < vol->dlist.entries; i++) { ino_t loc; if (vcache_vnid_to_loc(vol, vol->dlist.vnid_list[i], &loc) < B_OK) loc = vol->dlist.vnid_list[i]; ASSERT(IS_DIR_CLUSTER_VNID(loc)); if (CLUSTER_OF_DIR_CLUSTER_VNID(loc) == cluster) return vol->dlist.vnid_list[i]; } DPRINTF(1, ("dlist_find cluster %" B_PRIu32 " not found\n", cluster)); return -1LL; }