diff options
author | Shehjar Tikoo <shehjart@zresearch.com> | 2009-04-07 05:43:31 -0700 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-04-08 15:06:22 +0530 |
commit | b976536e616e6dd23dd4a3981d150b168f9d2bef (patch) | |
tree | 6ec04a3e777d0e6c334f828ae344b4b2aaf9a682 | |
parent | ca32040f350a7b8ad2e24ee68b417d6bec266038 (diff) |
libglusterfsclient: Complete support for rmdir fop
glusterfs_rmdir code path wasnt implemented completely. Here is an
attempt to complete it.
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
-rwxr-xr-x | libglusterfsclient/src/libglusterfsclient.c | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index e7f47240b07..ae0b055ff7b 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -3403,14 +3403,46 @@ out: return op_ret; } - static int32_t -libgf_client_rmdir (libglusterfs_client_ctx_t *ctx, - loc_t *loc) +libgf_client_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno) { - return 0; + libgf_client_local_t *local = frame->local; + + local->reply_stub = fop_rmdir_cbk_stub (frame, NULL, op_ret, op_errno); + + pthread_mutex_lock (&local->lock); + { + local->complete = 1; + pthread_cond_broadcast (&local->reply_cond); + } + pthread_mutex_unlock (&local->lock); + + return 0; } +static int32_t +libgf_client_rmdir (libglusterfs_client_ctx_t *ctx, loc_t *loc) +{ + int32_t op_ret = -1; + call_stub_t *stub = NULL; + libgf_client_local_t *local = NULL; + + LIBGF_CLIENT_FOP (ctx, stub, rmdir, local, loc); + + op_ret = stub->args.rmdir_cbk.op_ret; + errno = stub->args.rmdir_cbk.op_errno; + + if (stub->args.rmdir_cbk.op_ret != 0) + goto out; + + inode_unlink (loc->inode, loc->parent, loc->name); + +out: + call_stub_destroy (stub); + + return op_ret; +} int32_t glusterfs_rmdir (glusterfs_handle_t handle, |