summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client/src/client-helpers.c
diff options
context:
space:
mode:
authorSusant Palai <spalai@redhat.com>2016-04-30 18:00:44 +0530
committerNiels de Vos <ndevos@redhat.com>2016-05-01 18:04:31 -0700
commit2cca000fcc2adbffbb3f5258c57ae564b9e2d51f (patch)
tree971db1740040b652d226987baf417a33bb8ab035 /xlators/protocol/client/src/client-helpers.c
parentc823603f5aab0a60eb076ea43b869739745d9f21 (diff)
protocol: add getactivelk () fop
Change-Id: Ie38198db990f133fe163ba160cdf647e34f83f4f BUG: 1326085 Signed-off-by: Susant Palai <spalai@redhat.com> Reviewed-on: http://review.gluster.org/13994 Reviewed-by: Niels de Vos <ndevos@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>
Diffstat (limited to 'xlators/protocol/client/src/client-helpers.c')
-rw-r--r--xlators/protocol/client/src/client-helpers.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/xlators/protocol/client/src/client-helpers.c b/xlators/protocol/client/src/client-helpers.c
index e78242ffe65..c28a7cb4cbd 100644
--- a/xlators/protocol/client/src/client-helpers.c
+++ b/xlators/protocol/client/src/client-helpers.c
@@ -1750,3 +1750,59 @@ compound_request_cleanup (gfs3_compound_req *req)
return;
}
+
+void
+clnt_getactivelk_rsp_cleanup (gfs3_getactivelk_rsp *rsp)
+{
+ gfs3_locklist *trav = NULL;
+ gfs3_locklist *next = NULL;
+
+ trav = rsp->reply;
+
+ while (trav) {
+ next = trav->nextentry;
+ free (trav->client_uid);
+ free (trav);
+ trav = next;
+ }
+}
+
+int
+clnt_unserialize_rsp_locklist (xlator_t *this, struct gfs3_getactivelk_rsp *rsp,
+ lock_migration_info_t *lmi)
+{
+ struct gfs3_locklist *trav = NULL;
+ lock_migration_info_t *temp = NULL;
+ char *buf = NULL;
+ int entry_len = 0;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+
+ trav = rsp->reply;
+
+ conf = this->private;
+ if (!conf)
+ goto out;
+
+ while (trav) {
+ temp = GF_CALLOC (1, sizeof (*lmi), gf_common_mt_lock_mig);
+ if (temp == NULL) {
+ gf_msg (this->name, GF_LOG_ERROR, 0, 0, "No memory");
+ goto out;
+ }
+
+ INIT_LIST_HEAD (&temp->list);
+
+ gf_proto_flock_to_flock (&trav->flock, &temp->flock);
+
+ temp->client_uid = gf_strdup (trav->client_uid);
+
+ list_add_tail (&temp->list, &lmi->list);
+
+ trav = trav->nextentry;
+ }
+
+ ret = 0;
+out:
+ return ret;
+}