From 8f2eba00fd315b42aeaa01d683b765fbd2ee111b Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Tue, 24 Apr 2012 10:27:18 +0530 Subject: rebalance: handshake_event_notify to make fsd talk to glusterd Event_notify can be used by others to communicate with glusterd. A cbk event is also added for future use. req has a op, and dict. rsp has op_ret, op_errno, and dict. With this, rebalance process can update the status before exiting. Signed-off-by: shishir gowda Change-Id: If5c0ec00514eb3a109a790b2ea273317611e4562 BUG: 807126 Reviewed-on: http://review.gluster.com/3013 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Vijay Bellur --- rpc/rpc-lib/src/protocol-common.h | 10 +++++++++- rpc/xdr/src/glusterfs3-xdr.c | 28 ++++++++++++++++++++++++++++ rpc/xdr/src/glusterfs3-xdr.h | 23 +++++++++++++++++++++++ rpc/xdr/src/glusterfs3-xdr.x | 11 +++++++++++ 4 files changed, 71 insertions(+), 1 deletion(-) (limited to 'rpc') diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h index cccd1e7f898..ceb87955c7f 100644 --- a/rpc/rpc-lib/src/protocol-common.h +++ b/rpc/rpc-lib/src/protocol-common.h @@ -74,6 +74,7 @@ enum gf_handshake_procnum { GF_HNDSK_GETSPEC, GF_HNDSK_PING, GF_HNDSK_SET_LK_VER, + GF_HNDSK_EVENT_NOTIFY, GF_HNDSK_MAXVALUE, }; @@ -118,6 +119,7 @@ enum gf_cbk_procnum { GF_CBK_NULL = 0, GF_CBK_FETCHSPEC, GF_CBK_INO_FLUSH, + GF_CBK_EVENT_NOTIFY, GF_CBK_MAXVALUE, }; @@ -200,8 +202,14 @@ typedef enum { GF_AFR_OP_HEAL_FAILED_FILES, GF_AFR_OP_SPLIT_BRAIN_FILES } gf_xl_afr_op_t ; + +enum gf_hdsk_event_notify_op { + GF_EN_DEFRAG_STATUS, + GF_EN_MAX, +}; + #define GLUSTER_HNDSK_PROGRAM 14398633 /* Completely random */ -#define GLUSTER_HNDSK_VERSION 1 /* 0.0.1 */ +#define GLUSTER_HNDSK_VERSION 2 /* 0.0.1 */ #define GLUSTER_PMAP_PROGRAM 34123456 #define GLUSTER_PMAP_VERSION 1 diff --git a/rpc/xdr/src/glusterfs3-xdr.c b/rpc/xdr/src/glusterfs3-xdr.c index 5dffda3e070..dd8281ee223 100644 --- a/rpc/xdr/src/glusterfs3-xdr.c +++ b/rpc/xdr/src/glusterfs3-xdr.c @@ -1892,3 +1892,31 @@ xdr_gf_set_lk_ver_req (XDR *xdrs, gf_set_lk_ver_req *objp) return FALSE; return TRUE; } + +bool_t +xdr_gf_event_notify_req (XDR *xdrs, gf_event_notify_req *objp) +{ + register int32_t *buf; + buf = NULL; + + if (!xdr_int (xdrs, &objp->op)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gf_event_notify_rsp (XDR *xdrs, gf_event_notify_rsp *objp) +{ + register int32_t *buf; + buf = NULL; + + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) + return FALSE; + return TRUE; +} diff --git a/rpc/xdr/src/glusterfs3-xdr.h b/rpc/xdr/src/glusterfs3-xdr.h index 124b21e2266..ed29deea271 100644 --- a/rpc/xdr/src/glusterfs3-xdr.h +++ b/rpc/xdr/src/glusterfs3-xdr.h @@ -1081,6 +1081,25 @@ struct gf_set_lk_ver_req { }; typedef struct gf_set_lk_ver_req gf_set_lk_ver_req; +struct gf_event_notify_req { + int op; + struct { + u_int dict_len; + char *dict_val; + } dict; +}; +typedef struct gf_event_notify_req gf_event_notify_req; + +struct gf_event_notify_rsp { + int op_ret; + int op_errno; + struct { + u_int dict_len; + char *dict_val; + } dict; +}; +typedef struct gf_event_notify_rsp gf_event_notify_rsp; + /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) @@ -1172,6 +1191,8 @@ extern bool_t xdr_gfs3_dirplist (XDR *, gfs3_dirplist*); extern bool_t xdr_gfs3_readdirp_rsp (XDR *, gfs3_readdirp_rsp*); extern bool_t xdr_gf_set_lk_ver_rsp (XDR *, gf_set_lk_ver_rsp*); extern bool_t xdr_gf_set_lk_ver_req (XDR *, gf_set_lk_ver_req*); +extern bool_t xdr_gf_event_notify_req (XDR *, gf_event_notify_req*); +extern bool_t xdr_gf_event_notify_rsp (XDR *, gf_event_notify_rsp*); #else /* K&R C */ extern bool_t xdr_gf_statfs (); @@ -1262,6 +1283,8 @@ extern bool_t xdr_gfs3_dirplist (); extern bool_t xdr_gfs3_readdirp_rsp (); extern bool_t xdr_gf_set_lk_ver_rsp (); extern bool_t xdr_gf_set_lk_ver_req (); +extern bool_t xdr_gf_event_notify_req (); +extern bool_t xdr_gf_event_notify_rsp (); #endif /* K&R C */ diff --git a/rpc/xdr/src/glusterfs3-xdr.x b/rpc/xdr/src/glusterfs3-xdr.x index 64c2d206113..ad261423d2e 100644 --- a/rpc/xdr/src/glusterfs3-xdr.x +++ b/rpc/xdr/src/glusterfs3-xdr.x @@ -683,3 +683,14 @@ struct gf_set_lk_ver_req { string uid<>; int lk_ver; }; + +struct gf_event_notify_req { + int op; + opaque dict<>; +}; + +struct gf_event_notify_rsp { + int op_ret; + int op_errno; + opaque dict<>; +}; -- cgit