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
This commit is contained in:
Mohammed Junaid Ahmed 2011-03-15 05:36:33 +00:00 committed by Vijay Bellur
parent 7d61416a44
commit 8221c3cae1
6 changed files with 143 additions and 4 deletions

View File

@ -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,
};

View File

@ -44,6 +44,15 @@ xdr_gf1_cli_replace_op (XDR *xdrs, gf1_cli_replace_op *objp)
return TRUE;
}
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) {
@ -529,6 +537,36 @@ xdr_gf1_cli_reset_vol_rsp (XDR *xdrs, gf1_cli_reset_vol_rsp *objp)
return TRUE;
}
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)
{

View File

@ -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 ();

View File

@ -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;
};

View File

@ -482,6 +482,36 @@ gf_xdr_from_cli_gsync_set_req (struct iovec outmsg, void *req)
(xdrproc_t)xdr_gf1_cli_gsync_set_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)
{

View File

@ -207,6 +207,18 @@ gf_xdr_to_cli_gsync_set_rsp (struct iovec inmsg, void *args);
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);