diff options
| author | Mohammed Junaid Ahmed <junaid@gluster.com> | 2011-03-15 05:36:33 +0000 | 
|---|---|---|
| committer | Vijay Bellur <vijay@dev.gluster.com> | 2011-03-16 00:04:44 -0700 | 
| commit | 8221c3cae1ce5c2f7d897e5637591c5437aeea69 (patch) | |
| tree | ace43c4a317db448560410e4c252d78c72ea61db /rpc | |
| parent | 7d61416a443b1786158c6236f182b6c11b3619f7 (diff) | |
rpc: QUOTA rpc related changes.
Signed-off-by: Junaid <junaid@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 2473 (Support for volume and directory level quota)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2473
Diffstat (limited to 'rpc')
| -rw-r--r-- | rpc/rpc-lib/src/protocol-common.h | 1 | ||||
| -rw-r--r-- | rpc/xdr/src/cli1-xdr.c | 40 | ||||
| -rw-r--r-- | rpc/xdr/src/cli1-xdr.h | 40 | ||||
| -rw-r--r-- | rpc/xdr/src/cli1-xdr.x | 24 | ||||
| -rw-r--r-- | rpc/xdr/src/cli1.c | 30 | ||||
| -rw-r--r-- | rpc/xdr/src/cli1.h | 12 | 
6 files changed, 143 insertions, 4 deletions
diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h index 1c3d73d19..30434d0d9 100644 --- a/rpc/rpc-lib/src/protocol-common.h +++ b/rpc/rpc-lib/src/protocol-common.h @@ -196,6 +196,7 @@ enum gluster_cli_procnum {          GLUSTER_CLI_FSM_LOG,          GLUSTER_CLI_GSYNC_SET,          GLUSTER_CLI_PROFILE_VOLUME, +        GLUSTER_CLI_QUOTA,          GLUSTER_CLI_MAXVALUE,  }; diff --git a/rpc/xdr/src/cli1-xdr.c b/rpc/xdr/src/cli1-xdr.c index ba58992d8..c51546a8e 100644 --- a/rpc/xdr/src/cli1-xdr.c +++ b/rpc/xdr/src/cli1-xdr.c @@ -45,6 +45,15 @@ xdr_gf1_cli_replace_op (XDR *xdrs, gf1_cli_replace_op *objp)  }  bool_t +xdr_gf_quota_type (XDR *xdrs, gf_quota_type *objp) +{ + +	 if (!xdr_enum (xdrs, (enum_t *) objp)) +		 return FALSE; +	return TRUE; +} + +bool_t  xdr_gf1_cli_friends_list (XDR *xdrs, gf1_cli_friends_list *objp)  { @@ -114,7 +123,6 @@ xdr_gf1_cli_probe_rsp (XDR *xdrs, gf1_cli_probe_rsp *objp)  {  	register int32_t *buf; -  	if (xdrs->x_op == XDR_ENCODE) {  		buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT);  		if (buf == NULL) { @@ -530,6 +538,36 @@ xdr_gf1_cli_reset_vol_rsp (XDR *xdrs, gf1_cli_reset_vol_rsp *objp)  }  bool_t +xdr_gf1_cli_quota_req (XDR *xdrs, gf1_cli_quota_req *objp) +{ + +	 if (!xdr_string (xdrs, &objp->volname, ~0)) +		 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_gf1_cli_quota_rsp (XDR *xdrs, gf1_cli_quota_rsp *objp) +{ + +	 if (!xdr_int (xdrs, &objp->op_ret)) +		 return FALSE; +	 if (!xdr_int (xdrs, &objp->op_errno)) +		 return FALSE; +	 if (!xdr_string (xdrs, &objp->volname, ~0)) +		 return FALSE; +	 if (!xdr_string (xdrs, &objp->op_errstr, ~0)) +		 return FALSE; +	 if (!xdr_string (xdrs, &objp->limit_list, ~0)) +		 return FALSE; +	 if (!xdr_gf_quota_type (xdrs, &objp->type)) +		 return FALSE; +	return TRUE; +} + +bool_t  xdr_gf1_cli_set_vol_req (XDR *xdrs, gf1_cli_set_vol_req *objp)  { diff --git a/rpc/xdr/src/cli1-xdr.h b/rpc/xdr/src/cli1-xdr.h index fc84e48dd..865eb793a 100644 --- a/rpc/xdr/src/cli1-xdr.h +++ b/rpc/xdr/src/cli1-xdr.h @@ -16,8 +16,6 @@    along with this program.  If not, see    <http://www.gnu.org/licenses/>.  */ - -  /*   * Please do not edit this file.   * It was generated using rpcgen. @@ -27,7 +25,7 @@  #define _CLI1_XDR_H_RPCGEN  #include <rpc/rpc.h> -#include "xdr-common.h" +  #ifdef __cplusplus  extern "C" { @@ -52,6 +50,17 @@ enum gf1_cli_replace_op {  };  typedef enum gf1_cli_replace_op gf1_cli_replace_op; +enum gf_quota_type { +	GF_QUOTA_OPTION_TYPE_NONE = 0, +	GF_QUOTA_OPTION_TYPE_ENABLE = 0 + 1, +	GF_QUOTA_OPTION_TYPE_DISABLE = 0 + 2, +	GF_QUOTA_OPTION_TYPE_LIMIT_USAGE = 0 + 3, +	GF_QUOTA_OPTION_TYPE_REMOVE = 0 + 4, +	GF_QUOTA_OPTION_TYPE_LIST = 0 + 5, +	GF_QUOTA_OPTION_TYPE_VERSION = 0 + 6, +}; +typedef enum gf_quota_type gf_quota_type; +  enum gf1_cli_friends_list {  	GF_CLI_LIST_ALL = 1,  }; @@ -331,6 +340,25 @@ struct gf1_cli_reset_vol_rsp {  };  typedef struct gf1_cli_reset_vol_rsp gf1_cli_reset_vol_rsp; +struct gf1_cli_quota_req { +	char *volname; +	struct { +		u_int dict_len; +		char *dict_val; +	} dict; +}; +typedef struct gf1_cli_quota_req gf1_cli_quota_req; + +struct gf1_cli_quota_rsp { +	int op_ret; +	int op_errno; +	char *volname; +	char *op_errstr; +	char *limit_list; +	gf_quota_type type; +}; +typedef struct gf1_cli_quota_rsp gf1_cli_quota_rsp; +  struct gf1_cli_set_vol_req {  	char *volname;  	struct { @@ -472,6 +500,7 @@ extern  bool_t xdr_gf1_cli_sync_volume (XDR *, gf1_cli_sync_volume*);  extern  bool_t xdr_gf1_cli_op_flags (XDR *, gf1_cli_op_flags*);  extern  bool_t xdr_gf1_cli_gsync_set (XDR *, gf1_cli_gsync_set*);  extern  bool_t xdr_gf1_cli_stats_op (XDR *, gf1_cli_stats_op*); +extern  bool_t xdr_gf_quota_type (XDR *, gf_quota_type*);  extern  bool_t xdr_gf1_cli_probe_req (XDR *, gf1_cli_probe_req*);  extern  bool_t xdr_gf1_cli_probe_rsp (XDR *, gf1_cli_probe_rsp*);  extern  bool_t xdr_gf1_cli_deprobe_req (XDR *, gf1_cli_deprobe_req*); @@ -501,6 +530,8 @@ extern  bool_t xdr_gf1_cli_replace_brick_req (XDR *, gf1_cli_replace_brick_req*)  extern  bool_t xdr_gf1_cli_replace_brick_rsp (XDR *, gf1_cli_replace_brick_rsp*);  extern  bool_t xdr_gf1_cli_reset_vol_req (XDR *, gf1_cli_reset_vol_req*);  extern  bool_t xdr_gf1_cli_reset_vol_rsp (XDR *, gf1_cli_reset_vol_rsp*); +extern  bool_t xdr_gf1_cli_quota_req (XDR *, gf1_cli_quota_req*); +extern  bool_t xdr_gf1_cli_quota_rsp (XDR *, gf1_cli_quota_rsp*);  extern  bool_t xdr_gf1_cli_set_vol_req (XDR *, gf1_cli_set_vol_req*);  extern  bool_t xdr_gf1_cli_set_vol_rsp (XDR *, gf1_cli_set_vol_rsp*);  extern  bool_t xdr_gf1_cli_log_filename_req (XDR *, gf1_cli_log_filename_req*); @@ -527,6 +558,7 @@ extern bool_t xdr_gf1_cli_sync_volume ();  extern bool_t xdr_gf1_cli_op_flags ();  extern bool_t xdr_gf1_cli_gsync_set ();  extern bool_t xdr_gf1_cli_stats_op (); +extern bool_t xdr_gf_quota_type ();  extern bool_t xdr_gf1_cli_probe_req ();  extern bool_t xdr_gf1_cli_probe_rsp ();  extern bool_t xdr_gf1_cli_deprobe_req (); @@ -556,6 +588,8 @@ extern bool_t xdr_gf1_cli_replace_brick_req ();  extern bool_t xdr_gf1_cli_replace_brick_rsp ();  extern bool_t xdr_gf1_cli_reset_vol_req ();  extern bool_t xdr_gf1_cli_reset_vol_rsp (); +extern bool_t xdr_gf1_cli_quota_req (); +extern bool_t xdr_gf1_cli_quota_rsp ();  extern bool_t xdr_gf1_cli_set_vol_req ();  extern bool_t xdr_gf1_cli_set_vol_rsp ();  extern bool_t xdr_gf1_cli_log_filename_req (); diff --git a/rpc/xdr/src/cli1-xdr.x b/rpc/xdr/src/cli1-xdr.x index f47d18d88..f352b6f36 100644 --- a/rpc/xdr/src/cli1-xdr.x +++ b/rpc/xdr/src/cli1-xdr.x @@ -14,6 +14,16 @@          GF_REPLACE_OP_COMMIT_FORCE  } ; +enum gf_quota_type { +        GF_QUOTA_OPTION_TYPE_NONE = 0, +        GF_QUOTA_OPTION_TYPE_ENABLE, +        GF_QUOTA_OPTION_TYPE_DISABLE, +        GF_QUOTA_OPTION_TYPE_LIMIT_USAGE, +        GF_QUOTA_OPTION_TYPE_REMOVE, +        GF_QUOTA_OPTION_TYPE_LIST, +        GF_QUOTA_OPTION_TYPE_VERSION +}; +  enum gf1_cli_friends_list {          GF_CLI_LIST_ALL = 1  } ; @@ -338,3 +348,17 @@ struct gf1_cli_stats_volume_rsp {          string op_errstr<>;          opaque stats_info<>;  }; + +struct gf1_cli_quota_req { +        string volname<>; +        opaque dict<>; +} ; + +struct gf1_cli_quota_rsp { +        int     op_ret; +        int     op_errno; +        string  volname<>; +        string  op_errstr<>; +        string  limit_list<>; +        gf_quota_type type; +}; diff --git a/rpc/xdr/src/cli1.c b/rpc/xdr/src/cli1.c index df77c6f7a..bd3cbf0c7 100644 --- a/rpc/xdr/src/cli1.c +++ b/rpc/xdr/src/cli1.c @@ -483,6 +483,36 @@ gf_xdr_from_cli_gsync_set_req (struct iovec outmsg, void *req)  }  ssize_t +gf_xdr_serialize_cli_quota_rsp (struct iovec outmsg, void *rsp) +{ +        return xdr_serialize_generic (outmsg, (void *)rsp, +                                      (xdrproc_t)xdr_gf1_cli_quota_rsp); + +} + +ssize_t +gf_xdr_to_cli_quota_req (struct iovec inmsg, void *args) +{ +        return xdr_to_generic (inmsg, (void *)args, +                               (xdrproc_t)xdr_gf1_cli_quota_req); +} + +ssize_t +gf_xdr_to_cli_quota_rsp (struct iovec inmsg, void *args) +{ +        return xdr_to_generic (inmsg, (void *)args, +                               (xdrproc_t)xdr_gf1_cli_quota_rsp); +} + + +ssize_t +gf_xdr_from_cli_quota_req (struct iovec outmsg, void *req) +{ +        return xdr_serialize_generic (outmsg, (void *)req, +                                      (xdrproc_t)xdr_gf1_cli_quota_req); +} + +ssize_t  gf_xdr_serialize_cli_set_vol_rsp (struct iovec outmsg, void *rsp)  {          return xdr_serialize_generic (outmsg, (void *)rsp, diff --git a/rpc/xdr/src/cli1.h b/rpc/xdr/src/cli1.h index c22c38749..9bc3a196a 100644 --- a/rpc/xdr/src/cli1.h +++ b/rpc/xdr/src/cli1.h @@ -208,6 +208,18 @@ ssize_t  gf_xdr_from_cli_gsync_set_req (struct iovec outmsg, void *req);  ssize_t +gf_xdr_serialize_cli_quota_rsp (struct iovec outmsg, void *rsp); + +ssize_t +gf_xdr_to_cli_quota_req (struct iovec inmsg, void *args); + +ssize_t +gf_xdr_to_cli_quota_rsp (struct iovec inmsg, void *args); + +ssize_t +gf_xdr_from_cli_quota_req (struct iovec outmsg, void *req); + +ssize_t  gf_xdr_serialize_cli_set_vol_rsp (struct iovec outmsg, void *rsp);  ssize_t  | 
