static int resolve_deep_continue (call_frame_t *frame) { server_state_t *state = NULL; xlator_t *this = NULL; server_resolve_t *resolve = NULL; int ret = 0; state = CALL_STATE (frame); this = frame->this; resolve = state->resolve_now; resolve->op_ret = 0; resolve->op_errno = 0; if (resolve->par) ret = resolve_entry_simple (frame); else if (resolve->ino) ret = resolve_inode_simple (frame); else if (resolve->path) ret = resolve_path_simple (frame); resolve_loc_touchup (frame); server_resolve_all (frame); return 0; }
int resolve_loc_touchup (call_frame_t *frame) { server_state_t *state = NULL; server_resolve_t *resolve = NULL; loc_t *loc = NULL; char *path = NULL; int ret = 0; state = CALL_STATE (frame); resolve = state->resolve_now; loc = state->loc_now; loc_touchup (loc, resolve->bname); return 0; }
static int prepare_components (call_frame_t *frame) { server_state_t *state = NULL; xlator_t *this = NULL; server_resolve_t *resolve = NULL; char *resolved = NULL; int count = 0; struct resolve_comp *components = NULL; int i = 0; char *trav = NULL; state = CALL_STATE (frame); this = frame->this; resolve = state->resolve_now; resolved = gf_strdup (resolve->path); resolve->resolved = resolved; count = component_count (resolve->path); components = GF_CALLOC (sizeof (*components), count, gf_server_mt_resolve_comp); resolve->components = components; components[0].basename = ""; components[0].ino = 1; components[0].gen = 0; components[0].inode = state->itable->root; i = 1; for (trav = resolved; *trav; trav++) { if (*trav == '/') { components[i].basename = trav + 1; *trav = 0; i++; } } return 0; }
static int resolve_loc_touchup (call_frame_t *frame) { server_state_t *state = NULL; server_resolve_t *resolve = NULL; loc_t *loc = NULL; char *path = NULL; int ret = 0; state = CALL_STATE (frame); resolve = state->resolve_now; loc = state->loc_now; if (!loc->path) { if (loc->parent && resolve->bname) { ret = inode_path (loc->parent, resolve->bname, &path); } else if (loc->inode) { ret = inode_path (loc->inode, NULL, &path); } if (!path) path = gf_strdup (resolve->path); loc->path = path; } loc->name = strrchr (loc->path, '/'); if (loc->name) loc->name++; if (!loc->parent && loc->inode) { loc->parent = inode_parent (loc->inode, 0, NULL); } return 0; }
return 0; } static int resolve_deep_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, inode_t *inode, struct iatt *buf, dict_t *xattr, struct iatt *postparent) { server_state_t *state = NULL; server_resolve_t *resolve = NULL; struct resolve_comp *components = NULL; int i = 0; inode_t *link_inode = NULL; state = CALL_STATE (frame); resolve = state->resolve_now; components = resolve->components; i = (long) cookie; if (op_ret == -1) { goto get_out_of_here; } if (i != 0) { /* no linking for root inode */ link_inode = inode_link (inode, resolve->deep_loc.parent, resolve->deep_loc.name, buf); inode_lookup (link_inode); components[i].inode = link_inode;