diff options
author | Shehjar Tikoo <shehjart@zresearch.com> | 2009-04-16 23:55:40 -0700 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-04-17 13:43:38 +0530 |
commit | 9193494d20a8555a90126b9d23e848b0b8ca196e (patch) | |
tree | 9b25c8a05c0bc67acea1dda8f4c7c68c73264454 /libglusterfsclient | |
parent | 912f1a8492c8c20743c8d7f0a75aeb31f2483932 (diff) |
linglusterfsclient: Add fsync API
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'libglusterfsclient')
-rwxr-xr-x | libglusterfsclient/src/libglusterfsclient.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index 107030852cb..de26203e618 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -3728,6 +3728,56 @@ out: return op_ret; } +int +libgf_client_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *xlator, + int32_t op_ret, int32_t op_errno) +{ + libgf_client_local_t *local = frame->local; + + local->reply_stub = fop_fsync_cbk_stub (frame, NULL, op_ret, op_errno); + + LIBGF_REPLY_NOTIFY (local); + + return 0; +} + +int +libgf_client_fsync (libglusterfs_client_ctx_t *ctx, fd_t *fd) +{ + libgf_client_local_t *local = NULL; + call_stub_t *stub = NULL; + int op_ret = -1; + + LIBGF_CLIENT_FOP (ctx, stub, fsync, local, fd, 0); + + op_ret = stub->args.fsync_cbk.op_ret; + errno = stub->args.fsync_cbk.op_errno; + + call_stub_destroy (stub); + + return op_ret; +} + +int +glusterfs_fsync (glusterfs_file_t *fd) +{ + libglusterfs_client_fd_ctx_t *fdctx = NULL; + int op_ret = -1; + + GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, fd, out); + + fdctx = libgf_get_fd_ctx ((fd_t *)fd); + if (!fd) { + errno = EBADF; + goto out; + } + + op_ret = libgf_client_fsync (fdctx->ctx, (fd_t *)fd); + +out: + return op_ret; +} + static struct xlator_fops libgf_client_fops = { }; |