[sheepdog] [PATCH] dog: permit two or more depth of subcommands
Liu Yuan
namei.unix at gmail.com
Mon Nov 11 11:58:20 CET 2013
On Mon, Nov 11, 2013 at 07:48:11PM +0900, Hitoshi Mitake wrote:
> Current dog command dies when user invokes "dog node log level set"
> without any arguments because of its subcommand design. This patch
> removes this limitation.
>
> Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> ---
> dog/cluster.c | 4 ++--
> dog/common.c | 5 +++--
> dog/dog.h | 3 ++-
> dog/node.c | 6 +++---
> dog/trace.c | 2 +-
> dog/vdi.c | 2 +-
> 6 files changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/dog/cluster.c b/dog/cluster.c
> index c2f97ad..c508f15 100644
> --- a/dog/cluster.c
> +++ b/dog/cluster.c
> @@ -441,7 +441,7 @@ static struct subcommand cluster_recover_cmd[] = {
>
> static int cluster_recover(int argc, char **argv)
> {
> - return do_generic_subcommand(cluster_recover_cmd, argc, argv);
> + return do_generic_subcommand(cluster_recover_cmd, 0, argc, argv);
> }
>
> /* Subcommand list of snapshot */
> @@ -458,7 +458,7 @@ static struct subcommand cluster_snapshot_cmd[] = {
>
> static int cluster_snapshot(int argc, char **argv)
> {
> - return do_generic_subcommand(cluster_snapshot_cmd, argc, argv);
> + return do_generic_subcommand(cluster_snapshot_cmd, 0, argc, argv);
> }
>
> static int cluster_reweight(int argc, char **argv)
> diff --git a/dog/common.c b/dog/common.c
> index 4480b99..90b43ad 100644
> --- a/dog/common.c
> +++ b/dog/common.c
> @@ -224,7 +224,8 @@ int send_light_req(const struct node_id *nid, struct sd_req *hdr)
> return 0;
> }
>
> -int do_generic_subcommand(struct subcommand *sub, int argc, char **argv)
> +int do_generic_subcommand(struct subcommand *sub, int depth,
> + int argc, char **argv)
I think we'd better define a larger macro for '5' instead of a 'depth' parameter
to achieve the same target.
Thanks
Yuan
More information about the sheepdog
mailing list