From adb266baa16f807745102ba925aa8a1028f8580a Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Tue, 13 Feb 2018 09:09:39 +0530 Subject: libglusterfs/syncop: Add syncop_entrylk Change-Id: Idd86b9f0fa144c2316ab6276e2def28b696ae18a BUG: 1543279 Signed-off-by: Raghavendra G --- libglusterfs/src/libglusterfs.sym | 1 + libglusterfs/src/syncop.c | 37 +++++++++++++++++++++++++++++++++++++ libglusterfs/src/syncop.h | 5 +++++ 3 files changed, 43 insertions(+) (limited to 'libglusterfs/src') diff --git a/libglusterfs/src/libglusterfs.sym b/libglusterfs/src/libglusterfs.sym index 41231fc90d1..39f03cbfa44 100644 --- a/libglusterfs/src/libglusterfs.sym +++ b/libglusterfs/src/libglusterfs.sym @@ -938,6 +938,7 @@ syncop_getxattr syncop_gfid_to_path syncop_inode_find syncop_inodelk +syncop_entrylk syncop_ipc syncop_is_subvol_local syncop_link diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c index 202b3aba4ab..5cae4fbb3a0 100644 --- a/libglusterfs/src/syncop.c +++ b/libglusterfs/src/syncop.c @@ -3103,6 +3103,43 @@ syncop_inodelk (xlator_t *subvol, const char *volume, loc_t *loc, int32_t cmd, return args.op_ret; } +int32_t +syncop_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *xdata) +{ + struct syncargs *args = NULL; + + args = cookie; + args->op_ret = op_ret; + args->op_errno = op_errno; + if (xdata) + args->xdata = dict_ref (xdata); + + __wake (args); + return 0; +} + +int +syncop_entrylk (xlator_t *subvol, const char *volume, loc_t *loc, + const char *basename, entrylk_cmd cmd, entrylk_type type, + dict_t *xdata_in, dict_t **xdata_out) +{ + struct syncargs args = {0, }; + + SYNCOP (subvol, (&args), syncop_entrylk_cbk, subvol->fops->entrylk, + volume, loc, basename, cmd, type, xdata_in); + + if (xdata_out) + *xdata_out = args.xdata; + else if (args.xdata) + dict_unref (args.xdata); + + if (args.op_ret < 0) + return -args.op_errno; + + return args.op_ret; +} + int32_t syncop_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, dict_t *dict, diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h index 7d3afa823e3..682191f0243 100644 --- a/libglusterfs/src/syncop.h +++ b/libglusterfs/src/syncop.h @@ -582,4 +582,9 @@ syncop_icreate (xlator_t *subvol, loc_t *loc, mode_t mode, dict_t *xdata_out); int syncop_namelink (xlator_t *subvol, loc_t *loc, dict_t *xdata_out); +int +syncop_entrylk (xlator_t *subvol, const char *volume, loc_t *loc, + const char *basename, entrylk_cmd cmd, entrylk_type type, + dict_t *xdata_in, dict_t **xdata_out); + #endif /* _SYNCOP_H */ -- cgit