/tools/glusterfind/

ret = TRY_LOCK(&lk_ctx->lock); if (ret != 0) { ret = -1; goto out; } } else { LOCK(&lk_ctx->lock); } ret = list_empty(&lk_ctx->lk_list); UNLOCK(&lk_ctx->lock); out: return ret; } clnt_fd_ctx_t * this_fd_del_ctx(fd_t *file, xlator_t *this) { int dict_ret = -1; uint64_t ctxaddr = 0; GF_VALIDATE_OR_GOTO("client", this, out); GF_VALIDATE_OR_GOTO(this->name, file, out); dict_ret = fd_ctx_del(file, this, &ctxaddr); if (dict_ret < 0) { ctxaddr = 0; } out: return (clnt_fd_ctx_t *)(unsigned long)ctxaddr; } clnt_fd_ctx_t * this_fd_get_ctx(fd_t *file, xlator_t *this) { int dict_ret = -1; uint64_t ctxaddr = 0; GF_VALIDATE_OR_GOTO("client", this, out); GF_VALIDATE_OR_GOTO(this->name, file, out); dict_ret = fd_ctx_get(file, this, &ctxaddr); if (dict_ret < 0) { ctxaddr = 0; } out: return (clnt_fd_ctx_t *)(unsigned long)ctxaddr; } void this_fd_set_ctx(fd_t *file, xlator_t *this, loc_t *loc, clnt_fd_ctx_t *ctx) { uint64_t oldaddr = 0; int32_t ret = -1; GF_VALIDATE_OR_GOTO("client", this, out); GF_VALIDATE_OR_GOTO(this->name, file, out); ret = fd_ctx_get(file, this, &oldaddr); if (ret >= 0) { if (loc) gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_FD_DUPLICATE_TRY, "%s (%s): trying duplicate remote fd set. ", loc->path, uuid_utoa(loc->inode->gfid)); else gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_FD_DUPLICATE_TRY, "%p: trying duplicate remote fd set. ", file); } ret = fd_ctx_set(file, this, (uint64_t)(unsigned long)ctx); if (ret < 0) { if (loc) gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FD_SET_FAIL, "%s (%s): failed to set remote fd", loc->path, uuid_utoa(loc->inode->gfid)); else gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FD_SET_FAIL, "%p: failed to set remote fd", file); } out: return; } int client_local_wipe(clnt_local_t *local) { if (local) { loc_wipe(&local->loc); loc_wipe(&local->loc2); if (local->fd) { fd_unref(local->fd); } if (local->iobref) { iobref_unref(local->iobref); } GF_FREE(local->name); mem_put(local); } return 0; } int unserialize_rsp_dirent(xlator_t *this, struct gfs3_readdir_rsp *rsp, gf_dirent_t *entries) { struct gfs3_dirlist *trav = NULL; gf_dirent_t *entry = NULL; int entry_len = 0; int ret = -1; clnt_conf_t *conf = NULL; conf = this->private; trav = rsp->reply; while (trav) { entry_len = gf_dirent_size(trav->name); entry = GF_CALLOC(1, entry_len, gf_common_mt_gf_dirent_t); if (!entry) goto out; entry->d_ino = trav->d_