summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorPoornima G <pgurusid@redhat.com>2015-07-09 15:22:43 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-04-29 22:37:39 -0700
commit3c8922d123471de0c5da499420fcac6b10179786 (patch)
tree0f8df8166f53ae77fa9117beb57db55a19ea08e3 /rpc
parent80e3832ec16f69d4184172cfc9afa9e42533e0ef (diff)
Protocol: Add lease fop
Change-Id: I64c361d3e4ae86d57dc18bb887758d044c861237 BUG: 1319992 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/11597 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> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-lib/src/protocol-common.h2
-rw-r--r--rpc/xdr/src/glusterfs3-xdr.x24
-rw-r--r--rpc/xdr/src/glusterfs3.h56
3 files changed, 82 insertions, 0 deletions
diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h
index cf98152..e711f33 100644
--- a/rpc/rpc-lib/src/protocol-common.h
+++ b/rpc/rpc-lib/src/protocol-common.h
@@ -62,6 +62,7 @@ enum gf_fop_procnum {
GFS3_OP_IPC,
GFS3_OP_SEEK,
GFS3_OP_COMPOUND,
+ GFS3_OP_LEASE,
GFS3_OP_MAXVALUE,
} ;
@@ -137,6 +138,7 @@ enum gf_cbk_procnum {
GF_CBK_CACHE_INVALIDATION,
GF_CBK_CHILD_UP,
GF_CBK_CHILD_DOWN,
+ GF_CBK_RECALL_LEASE,
GF_CBK_MAXVALUE,
};
diff --git a/rpc/xdr/src/glusterfs3-xdr.x b/rpc/xdr/src/glusterfs3-xdr.x
index 87194e0..99e88fb 100644
--- a/rpc/xdr/src/glusterfs3-xdr.x
+++ b/rpc/xdr/src/glusterfs3-xdr.x
@@ -26,6 +26,12 @@ struct gf_proto_flock {
opaque lk_owner<>;
} ;
+struct gf_proto_lease {
+ unsigned int cmd;
+ unsigned int lease_type;
+ opaque lease_id[16];
+ unsigned int lease_flags;
+} ;
struct gf_iatt {
opaque ia_gfid[16];
@@ -308,6 +314,24 @@ struct gfs3_lookup_req {
opaque xdata<>; /* Extra data */
} ;
+struct gfs3_lease_req {
+ opaque gfid[16];
+ struct gf_proto_lease lease;
+ opaque xdata<>; /* Extra data */
+} ;
+
+struct gfs3_lease_rsp {
+ int op_ret;
+ int op_errno;
+ struct gf_proto_lease lease;
+ opaque xdata<>; /* Extra data */
+} ;
+
+struct gfs3_recall_lease_req {
+ opaque gfid[16];
+ unsigned int lease_type;
+} ;
+
struct gfs3_inodelk_req {
opaque gfid[16];
unsigned int cmd;
diff --git a/rpc/xdr/src/glusterfs3.h b/rpc/xdr/src/glusterfs3.h
index e50bd9e..b1d43f9 100644
--- a/rpc/xdr/src/glusterfs3.h
+++ b/rpc/xdr/src/glusterfs3.h
@@ -183,6 +183,62 @@ gf_statfs_from_statfs (struct gf_statfs *gf_stat, struct statvfs *stat)
}
static inline void
+gf_proto_lease_to_lease (struct gf_proto_lease *gf_proto_lease, struct gf_lease *gf_lease)
+{
+ if (!gf_lease || !gf_proto_lease)
+ return;
+
+ gf_lease->cmd = gf_proto_lease->cmd;
+ gf_lease->lease_type = gf_proto_lease->lease_type;
+ memcpy (gf_lease->lease_id, gf_proto_lease->lease_id, LEASE_ID_SIZE);
+}
+
+static inline void
+gf_proto_lease_from_lease (struct gf_proto_lease *gf_proto_lease, struct gf_lease *gf_lease)
+{
+ if (!gf_lease || !gf_proto_lease)
+ return;
+
+ gf_proto_lease->cmd = gf_lease->cmd;
+ gf_proto_lease->lease_type = gf_lease->lease_type;
+ memcpy (gf_proto_lease->lease_id, gf_lease->lease_id, LEASE_ID_SIZE);
+}
+
+static inline void
+gf_proto_recall_lease_to_upcall (struct gfs3_recall_lease_req *recall_lease,
+ struct gf_upcall *gf_up_data)
+{
+ struct gf_upcall_recall_lease *tmp = NULL;
+
+ GF_VALIDATE_OR_GOTO(THIS->name, recall_lease, out);
+ GF_VALIDATE_OR_GOTO(THIS->name, gf_up_data, out);
+
+ tmp = (struct gf_upcall_recall_lease *)gf_up_data->data;
+ tmp->lease_type = recall_lease->lease_type;
+ memcpy (gf_up_data->gfid, recall_lease->gfid, 16);
+out:
+ return;
+
+}
+
+static inline void
+gf_proto_recall_lease_from_upcall (struct gfs3_recall_lease_req *recall_lease,
+ struct gf_upcall *gf_up_data)
+{
+ struct gf_upcall_recall_lease *tmp = NULL;
+
+ GF_VALIDATE_OR_GOTO(THIS->name, recall_lease, out);
+ GF_VALIDATE_OR_GOTO(THIS->name, gf_up_data, out);
+
+ tmp = (struct gf_upcall_recall_lease *)gf_up_data->data;
+ recall_lease->lease_type = tmp->lease_type;
+ memcpy (recall_lease->gfid, gf_up_data->gfid, 16);
+out:
+ return;
+
+}
+
+static inline void
gf_proto_flock_to_flock (struct gf_proto_flock *gf_proto_flock, struct gf_flock *gf_flock)
{
if (!gf_flock || !gf_proto_flock)