summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-04-16 23:55:12 -0700
committerAnand V. Avati <avati@amp.gluster.com>2009-04-17 13:43:30 +0530
commit67561c965210f299b8a7e4ea1be0a702095b19f6 (patch)
tree82514261c8facc3d37a34a544571e62b14aeaaf3 /libglusterfsclient
parent01a48790c4a0c9805eb55bfe1c60860ee91f48a1 (diff)
libglusterfsclient: Add fchmod API
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'libglusterfsclient')
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index ea4998f12c0..094992dbc19 100755
--- a/libglusterfsclient/src/libglusterfsclient.c
+++ b/libglusterfsclient/src/libglusterfsclient.c
@@ -3615,6 +3615,62 @@ out:
return op_ret;
}
+int
+libgf_client_fchmod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno,
+ struct stat *buf)
+{
+ libgf_client_local_t *local = frame->local;
+
+ local->reply_stub = fop_fchmod_cbk_stub (frame, NULL, op_ret, op_errno,
+ buf);
+ LIBGF_REPLY_NOTIFY (local);
+
+ return 0;
+}
+
+int
+libgf_client_fchmod (libglusterfs_client_ctx_t *ctx, fd_t *fd, mode_t mode)
+{
+ int op_ret = -1;
+ libgf_client_local_t *local = NULL;
+ call_stub_t *stub = NULL;
+
+ LIBGF_CLIENT_FOP (ctx, stub, fchmod, local, fd, mode);
+
+ op_ret = stub->args.fchmod_cbk.op_ret;
+ errno = stub->args.fchmod_cbk.op_errno;
+
+ if (op_ret == -1)
+ goto out;
+
+ libgf_update_iattr_cache (fd->inode, LIBGF_UPDATE_STAT,
+ &stub->args.fchmod_cbk.buf);
+out:
+ call_stub_destroy (stub);
+ return op_ret;
+}
+
+int
+glusterfs_fchmod (glusterfs_file_t fd, mode_t mode)
+{
+ 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);
+
+ if (!fdctx) {
+ errno = EBADF;
+ goto out;
+ }
+
+ op_ret = libgf_client_fchmod (fdctx->ctx, fd, mode);
+
+out:
+ return op_ret;
+}
+
static struct xlator_fops libgf_client_fops = {
};