summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/call-stub.c
diff options
context:
space:
mode:
authorVikas Gorur <vikas@zresearch.com>2009-03-03 16:00:58 +0530
committerAnand V. Avati <avati@amp.gluster.com>2009-03-07 02:08:41 +0530
commit0991858fca6dc93de685e9527fb9ff47d77f616f (patch)
treeadcdf627d40c1fe90a8535c7b0bc27d057901788 /libglusterfs/src/call-stub.c
parentd092dff9a6e23d5fdef64154b6f3d6211f7482a6 (diff)
added fgetxattr and fsetxattr FOPs
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'libglusterfs/src/call-stub.c')
-rw-r--r--libglusterfs/src/call-stub.c184
1 files changed, 181 insertions, 3 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c
index c1288d90530..92301a2ddb8 100644
--- a/libglusterfs/src/call-stub.c
+++ b/libglusterfs/src/call-stub.c
@@ -1537,6 +1537,105 @@ out:
return stub;
}
+
+call_stub_t *
+fop_fsetxattr_stub (call_frame_t *frame,
+ fop_fsetxattr_t fn,
+ fd_t *fd,
+ dict_t *dict,
+ int32_t flags)
+{
+ call_stub_t *stub = NULL;
+
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", fd, out);
+
+ stub = stub_new (frame, 1, GF_FOP_FSETXATTR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ stub->args.fsetxattr.fn = fn;
+ stub->args.fsetxattr.fd = fd_ref (fd);
+
+ /* TODO */
+ if (dict)
+ stub->args.fsetxattr.dict = dict_ref (dict);
+ stub->args.fsetxattr.flags = flags;
+out:
+ return stub;
+}
+
+
+call_stub_t *
+fop_fsetxattr_cbk_stub (call_frame_t *frame,
+ fop_fsetxattr_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno)
+{
+ call_stub_t *stub = NULL;
+
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+
+ stub = stub_new (frame, 0, GF_FOP_FSETXATTR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ stub->args.fsetxattr_cbk.fn = fn;
+ stub->args.fsetxattr_cbk.op_ret = op_ret;
+ stub->args.fsetxattr_cbk.op_errno = op_errno;
+out:
+ return stub;
+}
+
+
+call_stub_t *
+fop_fgetxattr_stub (call_frame_t *frame,
+ fop_fgetxattr_t fn,
+ fd_t *fd,
+ const char *name)
+{
+ call_stub_t *stub = NULL;
+
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", fd, out);
+
+ stub = stub_new (frame, 1, GF_FOP_FGETXATTR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ stub->args.fgetxattr.fn = fn;
+ stub->args.fgetxattr.fd = fd_ref (fd);
+
+ if (name)
+ stub->args.fgetxattr.name = strdup (name);
+out:
+ return stub;
+}
+
+
+call_stub_t *
+fop_fgetxattr_cbk_stub (call_frame_t *frame,
+ fop_fgetxattr_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ dict_t *dict)
+{
+ call_stub_t *stub = NULL;
+
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+
+ stub = stub_new (frame, 0, GF_FOP_GETXATTR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ stub->args.fgetxattr_cbk.fn = fn;
+ stub->args.fgetxattr_cbk.op_ret = op_ret;
+ stub->args.fgetxattr_cbk.op_errno = op_errno;
+
+ /* TODO */
+ if (dict)
+ stub->args.fgetxattr_cbk.dict = dict_ref (dict);
+out:
+ return stub;
+}
+
+
call_stub_t *
fop_removexattr_stub (call_frame_t *frame,
fop_removexattr_t fn,
@@ -2340,6 +2439,25 @@ call_resume_wind (call_stub_t *stub)
break;
}
+ case GF_FOP_FSETXATTR:
+ {
+ stub->args.fsetxattr.fn (stub->frame,
+ stub->frame->this,
+ stub->args.fsetxattr.fd,
+ stub->args.fsetxattr.dict,
+ stub->args.fsetxattr.flags);
+ break;
+ }
+
+ case GF_FOP_FGETXATTR:
+ {
+ stub->args.fgetxattr.fn (stub->frame,
+ stub->frame->this,
+ stub->args.fgetxattr.fd,
+ stub->args.fgetxattr.name);
+ break;
+ }
+
case GF_FOP_REMOVEXATTR:
{
stub->args.removexattr.fn (stub->frame,
@@ -2953,7 +3071,41 @@ call_resume_unwind (call_stub_t *stub)
stub->args.getxattr_cbk.dict);
break;
}
-
+
+ case GF_FOP_FSETXATTR:
+ {
+ if (!stub->args.fsetxattr_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.fsetxattr_cbk.op_ret,
+ stub->args.fsetxattr_cbk.op_errno);
+
+ else
+ stub->args.fsetxattr_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.fsetxattr_cbk.op_ret,
+ stub->args.fsetxattr_cbk.op_errno);
+
+ break;
+ }
+
+ case GF_FOP_FGETXATTR:
+ {
+ if (!stub->args.fgetxattr_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.fgetxattr_cbk.op_ret,
+ stub->args.fgetxattr_cbk.op_errno,
+ stub->args.fgetxattr_cbk.dict);
+ else
+ stub->args.fgetxattr_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.fgetxattr_cbk.op_ret,
+ stub->args.fgetxattr_cbk.op_errno,
+ stub->args.fgetxattr_cbk.dict);
+ break;
+ }
+
case GF_FOP_REMOVEXATTR:
{
if (!stub->args.removexattr_cbk.fn)
@@ -3518,13 +3670,29 @@ call_stub_destroy_wind (call_stub_t *stub)
break;
}
+ case GF_FOP_FSETXATTR:
+ {
+ fd_unref (stub->args.fsetxattr.fd);
+ if (stub->args.fsetxattr.dict)
+ dict_unref (stub->args.fsetxattr.dict);
+ break;
+ }
+
+ case GF_FOP_FGETXATTR:
+ {
+ if (stub->args.fgetxattr.name)
+ FREE (stub->args.fgetxattr.name);
+ fd_unref (stub->args.fgetxattr.fd);
+ break;
+ }
+
case GF_FOP_REMOVEXATTR:
{
loc_wipe (&stub->args.removexattr.loc);
FREE (stub->args.removexattr.name);
break;
}
-
+
case GF_FOP_OPENDIR:
{
loc_wipe (&stub->args.opendir.loc);
@@ -3805,9 +3973,19 @@ call_stub_destroy_unwind (call_stub_t *stub)
}
break;
+ case GF_FOP_FSETXATTR:
+ break;
+
+ case GF_FOP_FGETXATTR:
+ {
+ if (stub->args.fgetxattr_cbk.dict)
+ dict_unref (stub->args.fgetxattr_cbk.dict);
+ }
+ break;
+
case GF_FOP_REMOVEXATTR:
break;
-
+
case GF_FOP_OPENDIR:
{
if (stub->args.opendir_cbk.fd)