summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnuradha Talur <atalur@redhat.com>2016-02-05 10:45:37 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-04-09 11:44:24 -0700
commit5ff451beecaf564b4f854b10e63a307e40660c8c (patch)
tree066fa26ce9e424d469f2483295c1fe6e05da562e
parentbe99ddd842025e0cd1a84076ee199cd4554a4575 (diff)
libglusterfs: Refactor packing of arguments
Added these changes so that they can be re-used to pack arguments required for each fop while populating the compound fop structure used by each xlator. Change-Id: Id9923e10003adafbc16a8bf3fbefa30677847313 BUG: 1303829 Signed-off-by: Anuradha Talur <atalur@redhat.com> Reviewed-on: http://review.gluster.org/13360 Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Reviewed-by: Ashish Pandey <aspandey@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r--libglusterfs/src/call-stub.c350
-rw-r--r--libglusterfs/src/call-stub.h32
-rw-r--r--libglusterfs/src/default-args.c624
-rw-r--r--libglusterfs/src/default-args.h188
-rw-r--r--libglusterfs/src/defaults.h31
5 files changed, 896 insertions, 329 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c
index e48e6c3651c..3f64cbc7d3b 100644
--- a/libglusterfs/src/call-stub.c
+++ b/libglusterfs/src/call-stub.c
@@ -52,11 +52,7 @@ fop_lookup_stub (call_frame_t *frame, fop_lookup_t fn, loc_t *loc,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.lookup = fn;
-
- loc_copy (&stub->args.loc, loc);
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
-
+ args_lookup_store (&stub->args, loc, xdata);
out:
return stub;
}
@@ -96,9 +92,7 @@ fop_stat_stub (call_frame_t *frame, fop_stat_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.stat = fn;
- loc_copy (&stub->args.loc, loc);
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_stat_store (&stub->args, loc, xdata);
out:
return stub;
}
@@ -136,11 +130,7 @@ fop_fstat_stub (call_frame_t *frame, fop_fstat_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.fstat = fn;
-
- if (fd)
- stub->args.fd = fd_ref (fd);
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_fstat_store (&stub->args, fd, xdata);
out:
return stub;
}
@@ -179,10 +169,7 @@ fop_truncate_stub (call_frame_t *frame, fop_truncate_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.truncate = fn;
- loc_copy (&stub->args.loc, loc);
- stub->args.offset = off;
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_truncate_store (&stub->args, loc, off, xdata);
out:
return stub;
}
@@ -220,12 +207,8 @@ fop_ftruncate_stub (call_frame_t *frame, fop_ftruncate_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.ftruncate = fn;
- if (fd)
- stub->args.fd = fd_ref (fd);
+ args_ftruncate_store (&stub->args, fd, off, xdata);
- stub->args.offset = off;
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
out:
return stub;
}
@@ -265,10 +248,7 @@ fop_access_stub (call_frame_t *frame, fop_access_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.access = fn;
- loc_copy (&stub->args.loc, loc);
- stub->args.mask = mask;
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_access_store (&stub->args, loc, mask, xdata);
out:
return stub;
}
@@ -305,10 +285,7 @@ fop_readlink_stub (call_frame_t *frame, fop_readlink_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.readlink = fn;
- loc_copy (&stub->args.loc, loc);
- stub->args.size = size;
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_readlink_store (&stub->args, loc, size, xdata);
out:
return stub;
}
@@ -347,12 +324,7 @@ fop_mknod_stub (call_frame_t *frame, fop_mknod_t fn, loc_t *loc, mode_t mode,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.mknod = fn;
- loc_copy (&stub->args.loc, loc);
- stub->args.mode = mode;
- stub->args.rdev = rdev;
- stub->args.umask = umask;
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_mknod_store (&stub->args, loc, mode, rdev, umask, xdata);
out:
return stub;
}
@@ -392,12 +364,7 @@ fop_mkdir_stub (call_frame_t *frame, fop_mkdir_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.mkdir = fn;
- loc_copy (&stub->args.loc, loc);
- stub->args.mode = mode;
- stub->args.umask = umask;
-
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_mkdir_store (&stub->args, loc, mode, umask, xdata);
out:
return stub;
}
@@ -437,10 +404,8 @@ fop_unlink_stub (call_frame_t *frame, fop_unlink_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.unlink = fn;
- loc_copy (&stub->args.loc, loc);
- stub->args.xflag = xflag;
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_unlink_store (&stub->args, loc, xflag, xdata);
+
out:
return stub;
}
@@ -481,10 +446,8 @@ fop_rmdir_stub (call_frame_t *frame, fop_rmdir_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.rmdir = fn;
- loc_copy (&stub->args.loc, loc);
- stub->args.flags = flags;
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_rmdir_store (&stub->args, loc, flags, xdata);
+
out:
return stub;
}
@@ -525,11 +488,7 @@ fop_symlink_stub (call_frame_t *frame, fop_symlink_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.symlink = fn;
- stub->args.linkname = gf_strdup (linkname);
- stub->args.umask = umask;
- loc_copy (&stub->args.loc, loc);
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_symlink_store (&stub->args, linkname, loc, umask, xdata);
out:
return stub;
}
@@ -571,10 +530,7 @@ fop_rename_stub (call_frame_t *frame, fop_rename_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.rename = fn;
- loc_copy (&stub->args.loc, oldloc);
- loc_copy (&stub->args.loc2, newloc);
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_rename_store (&stub->args, oldloc, newloc, xdata);
out:
return stub;
}
@@ -617,11 +573,7 @@ fop_link_stub (call_frame_t *frame, fop_link_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.link = fn;
- loc_copy (&stub->args.loc, oldloc);
- loc_copy (&stub->args.loc2, newloc);
-
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_link_store (&stub->args, oldloc, newloc, xdata);
out:
return stub;
}
@@ -663,14 +615,8 @@ fop_create_stub (call_frame_t *frame, fop_create_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.create = fn;
- loc_copy (&stub->args.loc, loc);
- stub->args.flags = flags;
- stub->args.mode = mode;
- stub->args.umask = umask;
- if (fd)
- stub->args.fd = fd_ref (fd);
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_create_store (&stub->args, loc, flags, mode,
+ umask, fd, xdata);
out:
return stub;
}
@@ -711,12 +657,7 @@ fop_open_stub (call_frame_t *frame, fop_open_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.open = fn;
- loc_copy (&stub->args.loc, loc);
- stub->args.flags = flags;
- if (fd)
- stub->args.fd = fd_ref (fd);
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_open_store (&stub->args, loc, flags, fd, xdata);
out:
return stub;
}
@@ -754,14 +695,7 @@ fop_readv_stub (call_frame_t *frame, fop_readv_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.readv = fn;
- if (fd)
- stub->args.fd = fd_ref (fd);
- stub->args.size = size;
- stub->args.offset = off;
- stub->args.flags = flags;
-
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_readv_store (&stub->args, fd, size, off, flags, xdata);
out:
return stub;
}
@@ -802,15 +736,8 @@ fop_writev_stub (call_frame_t *frame, fop_writev_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.writev = fn;
- if (fd)
- stub->args.fd = fd_ref (fd);
- stub->args.vector = iov_dup (vector, count);
- stub->args.count = count;
- stub->args.offset = off;
- stub->args.flags = flags;
- stub->args.iobref = iobref_ref (iobref);
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_writev_store (&stub->args, fd, vector, count, off, flags,
+ iobref, xdata);
out:
return stub;
}
@@ -848,10 +775,7 @@ fop_flush_stub (call_frame_t *frame, fop_flush_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.flush = fn;
- if (fd)
- stub->args.fd = fd_ref (fd);
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_flush_store (&stub->args, fd, xdata);
out:
return stub;
}
@@ -887,11 +811,7 @@ fop_fsync_stub (call_frame_t *frame, fop_fsync_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.fsync = fn;
- if (fd)
- stub->args.fd = fd_ref (fd);
- stub->args.datasync = datasync;
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_fsync_store (&stub->args, fd, datasync, xdata);
out:
return stub;
}
@@ -930,11 +850,7 @@ fop_opendir_stub (call_frame_t *frame, fop_opendir_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.opendir = fn;
- loc_copy (&stub->args.loc, loc);
- if (fd)
- stub->args.fd = fd_ref (fd);
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_opendir_store (&stub->args, loc, fd, xdata);
out:
return stub;
}
@@ -971,11 +887,7 @@ fop_fsyncdir_stub (call_frame_t *frame, fop_fsyncdir_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.fsyncdir = fn;
- if (fd)
- stub->args.fd = fd_ref (fd);
- stub->args.datasync = datasync;
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_fsyncdir_store (&stub->args, fd, datasync, xdata);
out:
return stub;
}
@@ -1012,9 +924,7 @@ fop_statfs_stub (call_frame_t *frame, fop_statfs_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.statfs = fn;
- loc_copy (&stub->args.loc, loc);
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_statfs_store (&stub->args, loc, xdata);
out:
return stub;
}
@@ -1053,13 +963,7 @@ fop_setxattr_stub (call_frame_t *frame, fop_setxattr_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.setxattr = fn;
- loc_copy (&stub->args.loc, loc);
- /* TODO */
- if (dict)
- stub->args.xattr = dict_ref (dict);
- stub->args.flags = flags;
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_setxattr_store (&stub->args, loc, dict, flags, xdata);
out:
return stub;
}
@@ -1098,12 +1002,7 @@ fop_getxattr_stub (call_frame_t *frame, fop_getxattr_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.getxattr = fn;
- loc_copy (&stub->args.loc, loc);
-
- if (name)
- stub->args.name = gf_strdup (name);
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_getxattr_store (&stub->args, loc, name, xdata);
out:
return stub;
}
@@ -1142,13 +1041,7 @@ fop_fsetxattr_stub (call_frame_t *frame, fop_fsetxattr_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.fsetxattr = fn;
- stub->args.fd = fd_ref (fd);
-
- if (dict)
- stub->args.xattr = dict_ref (dict);
- stub->args.flags = flags;
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_fsetxattr_store (&stub->args, fd, dict, flags, xdata);
out:
return stub;
}
@@ -1185,12 +1078,7 @@ fop_fgetxattr_stub (call_frame_t *frame, fop_fgetxattr_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.fgetxattr = fn;
- stub->args.fd = fd_ref (fd);
-
- if (name)
- stub->args.name = gf_strdup (name);
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_fgetxattr_store (&stub->args, fd, name, xdata);
out:
return stub;
}
@@ -1230,10 +1118,7 @@ fop_removexattr_stub (call_frame_t *frame, fop_removexattr_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.removexattr = fn;
- loc_copy (&stub->args.loc, loc);
- stub->args.name = gf_strdup (name);
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_removexattr_store (&stub->args, loc, name, xdata);
out:
return stub;
}
@@ -1271,10 +1156,7 @@ fop_fremovexattr_stub (call_frame_t *frame, fop_fremovexattr_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.fremovexattr = fn;
- stub->args.fd = fd_ref (fd);
- stub->args.name = gf_strdup (name);
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_fremovexattr_store (&stub->args, fd, name, xdata);
out:
return stub;
}
@@ -1312,12 +1194,7 @@ fop_lk_stub (call_frame_t *frame, fop_lk_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.lk = fn;
- if (fd)
- stub->args.fd = fd_ref (fd);
- stub->args.cmd = cmd;
- stub->args.lock = *lock;
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_lk_store (&stub->args, fd, cmd, lock, xdata);
out:
return stub;
}
@@ -1356,15 +1233,8 @@ fop_inodelk_stub (call_frame_t *frame, fop_inodelk_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.inodelk = fn;
-
- if (volume)
- stub->args.volume = gf_strdup (volume);
-
- loc_copy (&stub->args.loc, loc);
- stub->args.cmd = cmd;
- stub->args.lock = *lock;
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_inodelk_store (&stub->args, volume, loc, cmd,
+ lock, xdata);
out:
return stub;
}
@@ -1402,18 +1272,9 @@ fop_finodelk_stub (call_frame_t *frame, fop_finodelk_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.finodelk = fn;
+ args_finodelk_store (&stub->args, volume, fd, cmd,
+ lock, xdata);
- if (fd)
- stub->args.fd = fd_ref (fd);
-
- if (volume)
- stub->args.volume = gf_strdup (volume);
-
- stub->args.cmd = cmd;
- stub->args.lock = *lock;
-
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
out:
return stub;
}
@@ -1450,20 +1311,8 @@ fop_entrylk_stub (call_frame_t *frame, fop_entrylk_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.entrylk = fn;
+ args_entrylk_store (&stub->args, volume, loc, name, cmd, type, xdata);
- if (volume)
- stub->args.volume = gf_strdup (volume);
-
- loc_copy (&stub->args.loc, loc);
-
- stub->args.entrylkcmd = cmd;
- stub->args.entrylktype = type;
-
- if (name)
- stub->args.name = gf_strdup (name);
-
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
out:
return stub;
}
@@ -1500,19 +1349,7 @@ fop_fentrylk_stub (call_frame_t *frame, fop_fentrylk_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.fentrylk = fn;
-
- if (volume)
- stub->args.volume = gf_strdup (volume);
-
- if (fd)
- stub->args.fd = fd_ref (fd);
- stub->args.entrylkcmd = cmd;
- stub->args.entrylktype = type;
- if (name)
- stub->args.name = gf_strdup (name);
-
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_fentrylk_store (&stub->args, volume, fd, name, cmd, type, xdata);
out:
return stub;
}
@@ -1587,12 +1424,7 @@ fop_readdir_stub (call_frame_t *frame, fop_readdir_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.readdir = fn;
- stub->args.fd = fd_ref (fd);
- stub->args.size = size;
- stub->args.offset = off;
-
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_readdir_store (&stub->args, fd, size, off, xdata);
out:
return stub;
}
@@ -1608,11 +1440,7 @@ fop_readdirp_stub (call_frame_t *frame, fop_readdirp_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.readdirp = fn;
- stub->args.fd = fd_ref (fd);
- stub->args.size = size;
- stub->args.offset = off;
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_readdirp_store (&stub->args, fd, size, off, xdata);
out:
return stub;
}
@@ -1631,11 +1459,7 @@ fop_rchecksum_stub (call_frame_t *frame, fop_rchecksum_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.rchecksum = fn;
- stub->args.fd = fd_ref (fd);
- stub->args.offset = offset;
- stub->args.size = len;
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_rchecksum_store (&stub->args, fd, offset, len, xdata);
out:
return stub;
}
@@ -1714,14 +1538,7 @@ fop_xattrop_stub (call_frame_t *frame, fop_xattrop_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.xattrop = fn;
-
- loc_copy (&stub->args.loc, loc);
-
- stub->args.optype = optype;
- stub->args.xattr = dict_ref (xattr);
-
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_xattrop_store (&stub->args, loc, optype, xattr, xdata);
out:
return stub;
}
@@ -1741,14 +1558,7 @@ fop_fxattrop_stub (call_frame_t *frame, fop_fxattrop_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.fxattrop = fn;
-
- stub->args.fd = fd_ref (fd);
-
- stub->args.optype = optype;
- stub->args.xattr = dict_ref (xattr);
-
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_fxattrop_store (&stub->args, fd, optype, xattr, xdata);
out:
return stub;
}
@@ -1810,16 +1620,7 @@ fop_setattr_stub (call_frame_t *frame, fop_setattr_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.setattr = fn;
-
- loc_copy (&stub->args.loc, loc);
-
- if (stbuf)
- stub->args.stat = *stbuf;
-
- stub->args.valid = valid;
-
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_setattr_store (&stub->args, loc, stbuf, valid, xdata);
out:
return stub;
}
@@ -1839,17 +1640,7 @@ fop_fsetattr_stub (call_frame_t *frame, fop_fsetattr_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.fsetattr = fn;
-
- if (fd)
- stub->args.fd = fd_ref (fd);
-
- if (stbuf)
- stub->args.stat = *stbuf;
-
- stub->args.valid = valid;
-
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_fsetattr_store (&stub->args, fd, stbuf, valid, xdata);
out:
return stub;
}
@@ -1888,16 +1679,7 @@ fop_fallocate_stub(call_frame_t *frame, fop_fallocate_t fn, fd_t *fd,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.fallocate = fn;
-
- if (fd)
- stub->args.fd = fd_ref (fd);
-
- stub->args.flags = mode;
- stub->args.offset = offset;
- stub->args.size = len;
-
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_fallocate_store (&stub->args, fd, mode, offset, len, xdata);
out:
return stub;
@@ -1937,15 +1719,7 @@ fop_discard_stub(call_frame_t *frame, fop_discard_t fn, fd_t *fd,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.discard = fn;
-
- if (fd)
- stub->args.fd = fd_ref (fd);
-
- stub->args.offset = offset;
- stub->args.size = len;
-
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_discard_store (&stub->args, fd, offset, len, xdata);
out:
return stub;
@@ -1985,15 +1759,7 @@ fop_zerofill_stub(call_frame_t *frame, fop_zerofill_t fn, fd_t *fd,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.zerofill = fn;
-
- if (fd)
- stub->args.fd = fd_ref (fd);
-
- stub->args.offset = offset;
- stub->args.size = len;
-
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_zerofill_store (&stub->args, fd, offset, len, xdata);
out:
return stub;
@@ -2031,11 +1797,7 @@ fop_ipc_stub (call_frame_t *frame, fop_ipc_t fn,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.ipc = fn;
-
- stub->args.cmd = op;
-
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_ipc_store (&stub->args, op, xdata);
out:
return stub;
@@ -2075,15 +1837,7 @@ fop_seek_stub (call_frame_t *frame, fop_seek_t fn, fd_t *fd,
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
stub->fn.seek = fn;
-
- if (fd)
- stub->args.fd = fd_ref (fd);
-
- stub->args.offset = offset;
- stub->args.what = what;
-
- if (xdata)
- stub->args.xdata = dict_ref (xdata);
+ args_seek_store (&stub->args, fd, offset, what, xdata);
out:
return stub;
diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h
index 82a49c1d7b9..cdc96ffcc9f 100644
--- a/libglusterfs/src/call-stub.h
+++ b/libglusterfs/src/call-stub.h
@@ -125,37 +125,7 @@ typedef struct _call_stub {
fop_seek_cbk_t seek;
} fn_cbk;
- struct {
- loc_t loc; // @old in rename(), link()
- loc_t loc2; // @new in rename(), link()
- fd_t *fd;
- off_t offset;
- int mask;
- size_t size;
- mode_t mode;
- dev_t rdev;
- mode_t umask;
- int xflag;
- int flags;
- const char *linkname;
- struct iovec *vector;
- int count;
- struct iobref *iobref;
- int datasync;
- dict_t *xattr;
- const char *name;
- int cmd;
- struct gf_flock lock;
- const char *volume;
- entrylk_cmd entrylkcmd;
- entrylk_type entrylktype;
- gf_xattrop_flags_t optype;
- int valid;
- struct iatt stat;
- gf_seek_what_t what;
- dict_t *xdata;
- } args;
-
+ default_args_t args;
default_args_cbk_t args_cbk;
} call_stub_t;
diff --git a/libglusterfs/src/default-args.c b/libglusterfs/src/default-args.c
index 3563332e827..cc9da678dda 100644
--- a/libglusterfs/src/default-args.c
+++ b/libglusterfs/src/default-args.c
@@ -17,6 +17,17 @@
#include "defaults.h"
int
+args_lookup_store (default_args_t *args, loc_t *loc,
+ dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ return 0;
+}
+
+int
args_lookup_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
inode_t *inode, struct iatt *buf,
@@ -38,6 +49,16 @@ args_lookup_cbk_store (default_args_cbk_t *args,
int
+args_stat_store (default_args_t *args, loc_t *loc, dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ return 0;
+}
+
+int
args_stat_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
struct iatt *buf, dict_t *xdata)
@@ -53,6 +74,17 @@ args_stat_cbk_store (default_args_cbk_t *args,
}
int
+args_fstat_store (default_args_t *args, fd_t *fd, dict_t *xdata)
+{
+ if (fd)
+ args->fd = fd_ref (fd);
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ return 0;
+}
+
+int
args_fstat_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
struct iatt *buf, dict_t *xdata)
@@ -68,6 +100,18 @@ args_fstat_cbk_store (default_args_cbk_t *args,
}
int
+args_truncate_store (default_args_t *args, loc_t *loc, off_t off,
+ dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+ args->offset = off;
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ return 0;
+}
+
+int
args_truncate_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata)
@@ -84,6 +128,19 @@ args_truncate_cbk_store (default_args_cbk_t *args,
return 0;
}
+int
+args_ftruncate_store (default_args_t *args, fd_t *fd, off_t off,
+ dict_t *xdata)
+{
+ if (fd)
+ args->fd = fd_ref (fd);
+
+ args->offset = off;
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ return 0;
+}
int
args_ftruncate_cbk_store (default_args_cbk_t *args,
@@ -104,6 +161,18 @@ args_ftruncate_cbk_store (default_args_cbk_t *args,
int
+args_access_store (default_args_t *args, loc_t *loc, int32_t mask,
+ dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+ args->mask = mask;
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ return 0;
+}
+
+int
args_access_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
@@ -117,6 +186,18 @@ args_access_cbk_store (default_args_cbk_t *args,
int
+args_readlink_store (default_args_t *args, loc_t *loc, size_t size,
+ dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+ args->size = size;
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ return 0;
+}
+
+int
args_readlink_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
const char *path, struct iatt *stbuf, dict_t *xdata)
@@ -134,6 +215,20 @@ args_readlink_cbk_store (default_args_cbk_t *args,
}
int
+args_mknod_store (default_args_t *args, loc_t *loc, mode_t mode,
+ dev_t rdev, mode_t umask, dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+ args->mode = mode;
+ args->rdev = rdev;
+ args->umask = umask;
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ return 0;
+}
+
+int
args_mknod_cbk_store (default_args_cbk_t *args, int op_ret,
int32_t op_errno, inode_t *inode, struct iatt *buf,
struct iatt *preparent, struct iatt *postparent,
@@ -156,6 +251,20 @@ args_mknod_cbk_store (default_args_cbk_t *args, int op_ret,
}
int
+args_mkdir_store (default_args_t *args, loc_t *loc, mode_t mode,
+ mode_t umask, dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+ args->mode = mode;
+ args->umask = umask;
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ return 0;
+}
+
+int
args_mkdir_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno, inode_t *inode,
struct iatt *buf, struct iatt *preparent,
@@ -178,6 +287,17 @@ args_mkdir_cbk_store (default_args_cbk_t *args,
}
int
+args_unlink_store (default_args_t *args, loc_t *loc, int xflag, dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+ args->xflag = xflag;
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ return 0;
+}
+
+int
args_unlink_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
struct iatt *preparent, struct iatt *postparent,
@@ -196,6 +316,16 @@ args_unlink_cbk_store (default_args_cbk_t *args,
}
int
+args_rmdir_store (default_args_t *args, loc_t *loc, int flags, dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+ args->flags = flags;
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_rmdir_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
struct iatt *preparent, struct iatt *postparent,
@@ -214,6 +344,19 @@ args_rmdir_cbk_store (default_args_cbk_t *args,
}
int
+args_symlink_store (default_args_t *args, const char *linkname, loc_t *loc,
+ mode_t umask, dict_t *xdata)
+{
+ args->linkname = gf_strdup (linkname);
+ args->umask = umask;
+ loc_copy (&args->loc, loc);
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ return 0;
+}
+
+int
args_symlink_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
inode_t *inode, struct iatt *buf,
@@ -238,6 +381,18 @@ args_symlink_cbk_store (default_args_cbk_t *args,
int
+args_rename_store (default_args_t *args, loc_t *oldloc, loc_t *newloc,
+ dict_t *xdata)
+{
+ loc_copy (&args->loc, oldloc);
+ loc_copy (&args->loc2, newloc);
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ return 0;
+}
+
+int
args_rename_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno, struct iatt *buf,
struct iatt *preoldparent, struct iatt *postoldparent,
@@ -263,6 +418,19 @@ args_rename_cbk_store (default_args_cbk_t *args,
}
int
+args_link_store (default_args_t *args, loc_t *oldloc, loc_t *newloc,
+ dict_t *xdata)
+{
+ loc_copy (&args->loc, oldloc);
+ loc_copy (&args->loc2, newloc);
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ return 0;
+}
+
+int
args_link_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
inode_t *inode, struct iatt *buf,
@@ -286,6 +454,22 @@ args_link_cbk_store (default_args_cbk_t *args,
}
int
+args_create_store (default_args_t *args,
+ loc_t *loc, int32_t flags, mode_t mode,
+ mode_t umask, fd_t *fd, dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+ args->flags = flags;
+ args->mode = mode;
+ args->umask = umask;
+ if (fd)
+ args->fd = fd_ref (fd);
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_create_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
fd_t *fd, inode_t *inode, struct iatt *buf,
@@ -311,6 +495,20 @@ args_create_cbk_store (default_args_cbk_t *args,
}
int
+args_open_store (default_args_t *args, loc_t *loc, int32_t flags,
+ fd_t *fd, dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+ args->flags = flags;
+ if (fd)
+ args->fd = fd_ref (fd);
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ return 0;
+}
+
+int
args_open_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
fd_t *fd, dict_t *xdata)
@@ -326,6 +524,22 @@ args_open_cbk_store (default_args_cbk_t *args,
}
int
+args_readv_store (default_args_t *args, fd_t *fd, size_t size, off_t off,
+ uint32_t flags, dict_t *xdata)
+{
+ if (fd)
+ args->fd = fd_ref (fd);
+ args->size = size;
+ args->offset = off;
+ args->flags = flags;
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ return 0;
+}
+
+int
args_readv_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno, struct iovec *vector,
int32_t count, struct iatt *stbuf,
@@ -346,6 +560,23 @@ args_readv_cbk_store (default_args_cbk_t *args,
}
int
+args_writev_store (default_args_t *args, fd_t *fd, struct iovec *vector,
+ int32_t count, off_t off, uint32_t flags,
+ struct iobref *iobref, dict_t *xdata)
+{
+ if (fd)
+ args->fd = fd_ref (fd);
+ args->vector = iov_dup (vector, count);
+ args->count = count;
+ args->offset = off;
+ args->flags = flags;
+ args->iobref = iobref_ref (iobref);
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_writev_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
@@ -362,6 +593,15 @@ args_writev_cbk_store (default_args_cbk_t *args,
return 0;
}
+int
+args_flush_store (default_args_t *args, fd_t *fd, dict_t *xdata)
+{
+ if (fd)
+ args->fd = fd_ref (fd);
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
int
args_flush_cbk_store (default_args_cbk_t *args,
@@ -375,6 +615,17 @@ args_flush_cbk_store (default_args_cbk_t *args,
return 0;
}
+int
+args_fsync_store (default_args_t *args, fd_t *fd, int32_t datasync,
+ dict_t *xdata)
+{
+ if (fd)
+ args->fd = fd_ref (fd);
+ args->datasync = datasync;
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
int
args_fsync_cbk_store (default_args_cbk_t *args,
@@ -394,6 +645,18 @@ args_fsync_cbk_store (default_args_cbk_t *args,
}
int
+args_opendir_store (default_args_t *args, loc_t *loc, fd_t *fd, dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+ if (fd)
+ args->fd = fd_ref (fd);
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ return 0;
+}
+
+int
args_opendir_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
fd_t *fd, dict_t *xdata)
@@ -409,6 +672,17 @@ args_opendir_cbk_store (default_args_cbk_t *args,
}
int
+args_fsyncdir_store (default_args_t *args, fd_t *fd, int32_t datasync,
+ dict_t *xdata)
+{
+ if (fd)
+ args->fd = fd_ref (fd);
+ args->datasync = datasync;
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+int
args_fsyncdir_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
@@ -421,6 +695,15 @@ args_fsyncdir_cbk_store (default_args_cbk_t *args,
}
int
+args_statfs_store (default_args_t *args, loc_t *loc, dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_statfs_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
struct statvfs *buf, dict_t *xdata)
@@ -436,6 +719,21 @@ args_statfs_cbk_store (default_args_cbk_t *args,
}
int
+args_setxattr_store (default_args_t *args,
+ loc_t *loc, dict_t *dict,
+ int32_t flags, dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+ /* TODO */
+ if (dict)
+ args->xattr = dict_ref (dict);
+ args->flags = flags;
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_setxattr_cbk_store (default_args_cbk_t *args,
int32_t op_ret,
int32_t op_errno, dict_t *xdata)
@@ -449,6 +747,19 @@ args_setxattr_cbk_store (default_args_cbk_t *args,
}
int
+args_getxattr_store (default_args_t *args,
+ loc_t *loc, const char *name, dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+
+ if (name)
+ args->name = gf_strdup (name);
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_getxattr_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
dict_t *dict, dict_t *xdata)
@@ -464,6 +775,20 @@ args_getxattr_cbk_store (default_args_cbk_t *args,
}
int
+args_fsetxattr_store (default_args_t *args,
+ fd_t *fd, dict_t *dict, int32_t flags, dict_t *xdata)
+{
+ args->fd = fd_ref (fd);
+
+ if (dict)
+ args->xattr = dict_ref (dict);
+ args->flags = flags;
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_fsetxattr_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
@@ -476,6 +801,19 @@ args_fsetxattr_cbk_store (default_args_cbk_t *args,
}
int
+args_fgetxattr_store (default_args_t *args,
+ fd_t *fd, const char *name, dict_t *xdata)
+{
+ args->fd = fd_ref (fd);
+
+ if (name)
+ args->name = gf_strdup (name);
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_fgetxattr_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
dict_t *dict, dict_t *xdata)
@@ -491,6 +829,17 @@ args_fgetxattr_cbk_store (default_args_cbk_t *args,
}
int
+args_removexattr_store (default_args_t *args,
+ loc_t *loc, const char *name, dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+ args->name = gf_strdup (name);
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_removexattr_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
@@ -503,6 +852,17 @@ args_removexattr_cbk_store (default_args_cbk_t *args,
}
int
+args_fremovexattr_store (default_args_t *args,
+ fd_t *fd, const char *name, dict_t *xdata)
+{
+ args->fd = fd_ref (fd);
+ args->name = gf_strdup (name);
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_fremovexattr_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
@@ -515,6 +875,20 @@ args_fremovexattr_cbk_store (default_args_cbk_t *args,
}
int
+args_lk_store (default_args_t *args,
+ fd_t *fd, int32_t cmd,
+ struct gf_flock *lock, dict_t *xdata)
+{
+ if (fd)
+ args->fd = fd_ref (fd);
+ args->cmd = cmd;
+ args->lock = *lock;
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_lk_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
struct gf_flock *lock, dict_t *xdata)
@@ -531,6 +905,22 @@ args_lk_cbk_store (default_args_cbk_t *args,
int
+args_inodelk_store (default_args_t *args,
+ const char *volume, loc_t *loc, int32_t cmd,
+ struct gf_flock *lock, dict_t *xdata)
+{
+ if (volume)
+ args->volume = gf_strdup (volume);
+
+ loc_copy (&args->loc, loc);
+ args->cmd = cmd;
+ args->lock = *lock;
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_inodelk_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
@@ -543,6 +933,25 @@ args_inodelk_cbk_store (default_args_cbk_t *args,
}
int
+args_finodelk_store (default_args_t *args,
+ const char *volume, fd_t *fd, int32_t cmd,
+ struct gf_flock *lock, dict_t *xdata)
+{
+ if (fd)
+ args->fd = fd_ref (fd);
+
+ if (volume)
+ args->volume = gf_strdup (volume);
+
+ args->cmd = cmd;
+ args->lock = *lock;
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_finodelk_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
@@ -555,6 +964,27 @@ args_finodelk_cbk_store (default_args_cbk_t *args,
}
int
+args_entrylk_store (default_args_t *args,
+ const char *volume, loc_t *loc, const char *name,
+ entrylk_cmd cmd, entrylk_type type, dict_t *xdata)
+{
+ if (volume)
+ args->volume = gf_strdup (volume);
+
+ loc_copy (&args->loc, loc);
+
+ args->entrylkcmd = cmd;
+ args->entrylktype = type;
+
+ if (name)
+ args->name = gf_strdup (name);
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_entrylk_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
@@ -567,6 +997,26 @@ args_entrylk_cbk_store (default_args_cbk_t *args,
}
int
+args_fentrylk_store (default_args_t *args,
+ const char *volume, fd_t *fd, const char *name,
+ entrylk_cmd cmd, entrylk_type type, dict_t *xdata)
+{
+ if (volume)
+ args->volume = gf_strdup (volume);
+
+ if (fd)
+ args->fd = fd_ref (fd);
+ args->entrylkcmd = cmd;
+ args->entrylktype = type;
+ if (name)
+ args->name = gf_strdup (name);
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_fentrylk_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
@@ -580,6 +1030,18 @@ args_fentrylk_cbk_store (default_args_cbk_t *args,
int
+args_readdirp_store (default_args_t *args,
+ fd_t *fd, size_t size, off_t off, dict_t *xdata)
+{
+ args->fd = fd_ref (fd);
+ args->size = size;
+ args->offset = off;
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_readdirp_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
gf_dirent_t *entries, dict_t *xdata)
@@ -613,6 +1075,20 @@ out:
int
+args_readdir_store (default_args_t *args,
+ fd_t *fd, size_t size,
+ off_t off, dict_t *xdata)
+{
+ args->fd = fd_ref (fd);
+ args->size = size;
+ args->offset = off;
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_readdir_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
gf_dirent_t *entries, dict_t *xdata)
@@ -641,6 +1117,18 @@ out:
int
+args_rchecksum_store (default_args_t *args,
+ fd_t *fd, off_t offset, int32_t len, dict_t *xdata)
+{
+ args->fd = fd_ref (fd);
+ args->offset = offset;
+ args->size = len;
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_rchecksum_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
uint32_t weak_checksum, uint8_t *strong_checksum,
@@ -660,6 +1148,21 @@ args_rchecksum_cbk_store (default_args_cbk_t *args,
return 0;
}
+int
+args_xattrop_store (default_args_t *args,
+ loc_t *loc, gf_xattrop_flags_t optype,
+ dict_t *xattr, dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+
+ args->optype = optype;
+ args->xattr = dict_ref (xattr);
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
int
args_xattrop_cbk_store (default_args_cbk_t *args, int32_t op_ret,
@@ -677,6 +1180,21 @@ args_xattrop_cbk_store (default_args_cbk_t *args, int32_t op_ret,
int
+args_fxattrop_store (default_args_t *args,
+ fd_t *fd, gf_xattrop_flags_t optype,
+ dict_t *xattr, dict_t *xdata)
+{
+ args->fd = fd_ref (fd);
+
+ args->optype = optype;
+ args->xattr = dict_ref (xattr);
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_fxattrop_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
dict_t *xattr, dict_t *xdata)
@@ -692,6 +1210,23 @@ args_fxattrop_cbk_store (default_args_cbk_t *args,
}
int
+args_setattr_store (default_args_t *args,
+ loc_t *loc, struct iatt *stbuf,
+ int32_t valid, dict_t *xdata)
+{
+ loc_copy (&args->loc, loc);
+
+ if (stbuf)
+ args->stat = *stbuf;
+
+ args->valid = valid;
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_setattr_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
struct iatt *statpre, struct iatt *statpost,
@@ -711,6 +1246,23 @@ args_setattr_cbk_store (default_args_cbk_t *args,
int
+args_fsetattr_store (default_args_t *args,
+ fd_t *fd, struct iatt *stbuf,
+ int32_t valid, dict_t *xdata)
+{
+ if (fd)
+ args->fd = fd_ref (fd);
+
+ if (stbuf)
+ args->stat = *stbuf;
+
+ args->valid = valid;
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+int
args_fsetattr_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
struct iatt *statpre, struct iatt *statpost,
@@ -729,6 +1281,22 @@ args_fsetattr_cbk_store (default_args_cbk_t *args,
}
int
+args_fallocate_store (default_args_t *args, fd_t *fd,
+ int32_t mode, off_t offset, size_t len, dict_t *xdata)
+{
+ if (fd)
+ args->fd = fd_ref (fd);
+
+ args->flags = mode;
+ args->offset = offset;
+ args->size = len;
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_fallocate_cbk_store(default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
struct iatt *statpre, struct iatt *statpost,
@@ -747,6 +1315,21 @@ args_fallocate_cbk_store(default_args_cbk_t *args,
}
int
+args_discard_store (default_args_t *args, fd_t *fd,
+ off_t offset, size_t len, dict_t *xdata)
+{
+ if (fd)
+ args->fd = fd_ref (fd);
+
+ args->offset = offset;
+ args->size = len;
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_discard_cbk_store(default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
struct iatt *statpre, struct iatt *statpost,
@@ -765,6 +1348,21 @@ args_discard_cbk_store(default_args_cbk_t *args,
}
int
+args_zerofill_store (default_args_t *args, fd_t *fd,
+ off_t offset, off_t len, dict_t *xdata)
+{
+ if (fd)
+ args->fd = fd_ref (fd);
+
+ args->offset = offset;
+ args->size = len;
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_zerofill_cbk_store(default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno,
struct iatt *statpre, struct iatt *statpost,
@@ -783,6 +1381,17 @@ args_zerofill_cbk_store(default_args_cbk_t *args,
}
int
+args_ipc_store (default_args_t *args,
+ int32_t op, dict_t *xdata)
+{
+ args->cmd = op;
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_ipc_cbk_store (default_args_cbk_t *args,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
@@ -795,6 +1404,21 @@ args_ipc_cbk_store (default_args_cbk_t *args,
}
int
+args_seek_store (default_args_t *args, fd_t *fd,
+ off_t offset, gf_seek_what_t what, dict_t *xdata)
+{
+ if (fd)
+ args->fd = fd_ref (fd);
+
+ args->offset = offset;
+ args->what = what;
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+ return 0;
+}
+
+int
args_seek_cbk_store (default_args_cbk_t *args, int32_t op_ret,
int32_t op_errno, off_t offset, dict_t *xdata)
{
diff --git a/libglusterfs/src/default-args.h b/libglusterfs/src/default-args.h
index 80e0d3c2421..8b32a012a1d 100644
--- a/libglusterfs/src/default-args.h
+++ b/libglusterfs/src/default-args.h
@@ -271,4 +271,192 @@ args_seek_cbk_store (default_args_cbk_t *args, int32_t op_ret,
void
args_cbk_wipe (default_args_cbk_t *args_cbk);
+int
+args_lookup_store (default_args_t *args, loc_t *loc,
+ dict_t *xdata);
+
+int
+args_stat_store (default_args_t *args, loc_t *loc, dict_t *xdata);
+
+int
+args_fstat_store (default_args_t *args, fd_t *fd, dict_t *xdata);
+
+int
+args_truncate_store (default_args_t *args, loc_t *loc, off_t off,
+ dict_t *xdata);
+int
+args_ftruncate_store (default_args_t *args, fd_t *fd, off_t off,
+ dict_t *xdata);
+
+int
+args_access_store (default_args_t *args, loc_t *loc, int32_t mask,
+ dict_t *xdata);
+
+int
+args_readlink_store (default_args_t *args, loc_t *loc, size_t size,
+ dict_t *xdata);
+
+int
+args_mknod_store (default_args_t *args, loc_t *loc, mode_t mode,
+ dev_t rdev, mode_t umask, dict_t *xdata);
+
+int
+args_mkdir_store (default_args_t *args, loc_t *loc, mode_t mode,
+ mode_t umask, dict_t *xdata);
+
+int
+args_unlink_store (default_args_t *args, loc_t *loc, int xflag, dict_t *xdata);
+
+int
+args_rmdir_store (default_args_t *args, loc_t *loc, int flags, dict_t *xdata);
+
+int
+args_symlink_store (default_args_t *args, const char *linkname, loc_t *loc,
+ mode_t umask, dict_t *xdata);
+
+int
+args_rename_store (default_args_t *args, loc_t *oldloc, loc_t *newloc,
+ dict_t *xdata);
+
+int
+args_link_store (default_args_t *args, loc_t *oldloc, loc_t *newloc,
+ dict_t *xdata);
+
+int
+args_create_store (default_args_t *args,
+ loc_t *loc, int32_t flags, mode_t mode,
+ mode_t umask, fd_t *fd, dict_t *xdata);
+
+int
+args_open_store (default_args_t *args, loc_t *loc, int32_t flags,
+ fd_t *fd, dict_t *xdata);
+
+int
+args_readv_store (default_args_t *args, fd_t *fd, size_t size, off_t off,
+ uint32_t flags, dict_t *xdata);
+
+int
+args_writev_store (default_args_t *args, fd_t *fd, struct iovec *vector,
+ int32_t count, off_t off, uint32_t flags,
+ struct iobref *iobref, dict_t *xdata);
+
+int
+args_flush_store (default_args_t *args, fd_t *fd, dict_t *xdata);
+
+int
+args_fsync_store (default_args_t *args, fd_t *fd, int32_t datasync,
+ dict_t *xdata);
+
+int
+args_opendir_store (default_args_t *args, loc_t *loc, fd_t *fd, dict_t *xdata);
+
+int
+args_fsyncdir_store (default_args_t *args, fd_t *fd, int32_t datasync,
+ dict_t *xdata);
+
+int
+args_statfs_store (default_args_t *args, loc_t *loc, dict_t *xdata);
+
+int
+args_setxattr_store (default_args_t *args,
+ loc_t *loc, dict_t *dict,
+ int32_t flags, dict_t *xdata);
+
+int
+args_getxattr_store (default_args_t *args,
+ loc_t *loc, const char *name, dict_t *xdata);
+
+int
+args_fsetxattr_store (default_args_t *args,
+ fd_t *fd, dict_t *dict, int32_t flags, dict_t *xdata);
+
+int
+args_fgetxattr_store (default_args_t *args,
+ fd_t *fd, const char *name, dict_t *xdata);
+
+int
+args_removexattr_store (default_args_t *args,
+ loc_t *loc, const char *name, dict_t *xdata);
+
+int
+args_fremovexattr_store (default_args_t *args,
+ fd_t *fd, const char *name, dict_t *xdata);
+
+int
+args_lk_store (default_args_t *args,
+ fd_t *fd, int32_t cmd,
+ struct gf_flock *lock, dict_t *xdata);
+
+int
+args_inodelk_store (default_args_t *args,
+ const char *volume, loc_t *loc, int32_t cmd,
+ struct gf_flock *lock, dict_t *xdata);
+
+int
+args_finodelk_store (default_args_t *args,
+ const char *volume, fd_t *fd, int32_t cmd,
+ struct gf_flock *lock, dict_t *xdata);
+
+int
+args_entrylk_store (default_args_t *args,
+ const char *volume, loc_t *loc, const char *name,
+ entrylk_cmd cmd, entrylk_type type, dict_t *xdata);
+
+int
+args_fentrylk_store (default_args_t *args,
+ const char *volume, fd_t *fd, const char *name,
+ entrylk_cmd cmd, entrylk_type type, dict_t *xdata);
+int
+args_readdirp_store (default_args_t *args,
+ fd_t *fd, size_t size, off_t off, dict_t *xdata);
+
+int
+args_readdir_store (default_args_t *args,
+ fd_t *fd, size_t size,
+ off_t off, dict_t *xdata);
+
+int
+args_rchecksum_store (default_args_t *args,
+ fd_t *fd, off_t offset, int32_t len, dict_t *xdata);
+
+int
+args_xattrop_store (default_args_t *args,
+ loc_t *loc, gf_xattrop_flags_t optype,
+ dict_t *xattr, dict_t *xdata);
+
+int
+args_fxattrop_store (default_args_t *args,
+ fd_t *fd, gf_xattrop_flags_t optype,
+ dict_t *xattr, dict_t *xdata);
+
+int
+args_setattr_store (default_args_t *args,
+ loc_t *loc, struct iatt *stbuf,
+ int32_t valid, dict_t *xdata);
+
+int
+args_fsetattr_store (default_args_t *args,
+ fd_t *fd, struct iatt *stbuf,
+ int32_t valid, dict_t *xdata);
+
+int
+args_fallocate_store (default_args_t *args, fd_t *fd,
+ int32_t mode, off_t offset, size_t len, dict_t *xdata);
+
+int
+args_discard_store (default_args_t *args, fd_t *fd,
+ off_t offset, size_t len, dict_t *xdata);
+
+int
+args_zerofill_store (default_args_t *args, fd_t *fd,
+ off_t offset, off_t len, dict_t *xdata);
+
+int
+args_ipc_store (default_args_t *args,
+ int32_t op, dict_t *xdata);
+
+int
+args_seek_store (default_args_t *args, fd_t *fd,
+ off_t offset, gf_seek_what_t what, dict_t *xdata);
+
#endif /* _DEFAULT_ARGS_H */
diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h
index 31df5dd0f6a..16790eb6af6 100644
--- a/libglusterfs/src/defaults.h
+++ b/libglusterfs/src/defaults.h
@@ -45,6 +45,37 @@ typedef struct {
always valid irrespective of this */
} default_args_cbk_t;
+typedef struct {
+ loc_t loc; /* @old in rename(), link() */
+ loc_t loc2; /* @new in rename(), link() */
+ fd_t *fd;
+ off_t offset;
+ int mask;
+ size_t size;
+ mode_t mode;
+ dev_t rdev;
+ mode_t umask;
+ int xflag;
+ int flags;
+ const char *linkname;
+ struct iovec *vector;
+ int count;
+ struct iobref *iobref;
+ int datasync;
+ dict_t *xattr;
+ const char *name;
+ int cmd;
+ struct gf_flock lock;
+ const char *volume;
+ entrylk_cmd entrylkcmd;
+ entrylk_type entrylktype;
+ gf_xattrop_flags_t optype;
+ int valid;
+ struct iatt stat;
+ gf_seek_what_t what;
+ dict_t *xdata;
+} default_args_t;
+
int32_t default_notify (xlator_t *this,
int32_t event,
void *data,