From 3d1fc9ebe2b0292108dd0737cf8f40d6fcb8cf51 Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Wed, 16 Mar 2011 03:35:16 +0000 Subject: TOP: cli, rpc/xdr related changes Signed-off-by: shishir gowda Signed-off-by: Vijay Bellur BUG: 2516 (Implement gluster volume top command) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2516 --- rpc/rpc-lib/src/protocol-common.h | 1 + rpc/xdr/src/cli1-xdr.c | 12 ++++++++++++ rpc/xdr/src/cli1-xdr.h | 19 +++++++++++++++++++ rpc/xdr/src/cli1-xdr.x | 12 ++++++++++++ 4 files changed, 44 insertions(+) (limited to 'rpc') diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h index 30434d0d9..8483fbcf4 100644 --- a/rpc/rpc-lib/src/protocol-common.h +++ b/rpc/rpc-lib/src/protocol-common.h @@ -197,6 +197,7 @@ enum gluster_cli_procnum { GLUSTER_CLI_GSYNC_SET, GLUSTER_CLI_PROFILE_VOLUME, GLUSTER_CLI_QUOTA, + GLUSTER_CLI_TOP_VOLUME, GLUSTER_CLI_MAXVALUE, }; diff --git a/rpc/xdr/src/cli1-xdr.c b/rpc/xdr/src/cli1-xdr.c index c51546a8e..fa24ad90b 100644 --- a/rpc/xdr/src/cli1-xdr.c +++ b/rpc/xdr/src/cli1-xdr.c @@ -107,6 +107,15 @@ xdr_gf1_cli_stats_op (XDR *xdrs, gf1_cli_stats_op *objp) return TRUE; } +bool_t +xdr_gf1_cli_top_op (XDR *xdrs, gf1_cli_top_op *objp) +{ + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + bool_t xdr_gf1_cli_probe_req (XDR *xdrs, gf1_cli_probe_req *objp) { @@ -764,6 +773,9 @@ xdr_gf1_cli_stats_volume_req (XDR *xdrs, gf1_cli_stats_volume_req *objp) return FALSE; if (!xdr_gf1_cli_stats_op (xdrs, &objp->op)) return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->dict_req.dict_req_val, (u_int *) &objp->dict_req.dict_req_len, ~0)) + return FALSE; + return TRUE; } diff --git a/rpc/xdr/src/cli1-xdr.h b/rpc/xdr/src/cli1-xdr.h index 865eb793a..dba583492 100644 --- a/rpc/xdr/src/cli1-xdr.h +++ b/rpc/xdr/src/cli1-xdr.h @@ -100,9 +100,22 @@ enum gf1_cli_stats_op { GF_CLI_STATS_START = 1, GF_CLI_STATS_STOP = 2, GF_CLI_STATS_INFO = 3, + GF_CLI_STATS_TOP = 4, }; typedef enum gf1_cli_stats_op gf1_cli_stats_op; +enum gf1_cli_top_op { + GF_CLI_TOP_NONE = 0, + GF_CLI_TOP_OPEN = 0 + 1, + GF_CLI_TOP_READ = 0 + 2, + GF_CLI_TOP_WRITE = 0 + 3, + GF_CLI_TOP_OPENDIR = 0 + 4, + GF_CLI_TOP_READDIR = 0 + 5, + GF_CLI_TOP_READ_PERF = 0 + 6, + GF_CLI_TOP_WRITE_PERF = 0 + 7, +}; +typedef enum gf1_cli_top_op gf1_cli_top_op; + struct gf1_cli_probe_req { char *hostname; int port; @@ -475,6 +488,10 @@ typedef struct gf1_cli_gsync_set_rsp gf1_cli_gsync_set_rsp; struct gf1_cli_stats_volume_req { char *volname; gf1_cli_stats_op op; + struct { + u_int dict_req_len; + char* dict_req_val; + } dict_req; }; typedef struct gf1_cli_stats_volume_req gf1_cli_stats_volume_req; @@ -499,6 +516,7 @@ extern bool_t xdr_gf1_cli_get_volume (XDR *, gf1_cli_get_volume*); 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_top_op (XDR *, gf1_cli_top_op*); 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*); @@ -558,6 +576,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_gf1_cli_top_op (); extern bool_t xdr_gf_quota_type (); extern bool_t xdr_gf1_cli_probe_req (); extern bool_t xdr_gf1_cli_probe_rsp (); diff --git a/rpc/xdr/src/cli1-xdr.x b/rpc/xdr/src/cli1-xdr.x index f352b6f36..035927f89 100644 --- a/rpc/xdr/src/cli1-xdr.x +++ b/rpc/xdr/src/cli1-xdr.x @@ -58,6 +58,18 @@ enum gf1_cli_stats_op { GF_CLI_STATS_START = 1, GF_CLI_STATS_STOP = 2, GF_CLI_STATS_INFO = 3 + GF_CLI_STATS_TOP = 4 +}; + +enum gf1_cli_top_op { + GF_CLI_TOP_NONE = 0, + GF_CLI_TOP_OPEN, + GF_CLI_TOP_READ, + GF_CLI_TOP_WRITE, + GF_CLI_TOP_OPENDIR, + GF_CLI_TOP_READDIR, + GF_CLI_TOP_READ_PERF, + GF_CLI_TOP_WRITE_PERF }; struct gf1_cli_probe_req { -- cgit