[sheepdog] [PATCH v2] dog: permit two or more depth of subcommands
Hitoshi Mitake
mitake.hitoshi at gmail.com
Tue Nov 12 08:33:49 CET 2013
At Mon, 11 Nov 2013 21:24:47 +0800,
Liu Yuan wrote:
>
> On Mon, Nov 11, 2013 at 10:16:57PM +0900, Hitoshi Mitake wrote:
> > From: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> >
> > 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>
> > ---
> >
> > v2: define do_generic_subcommand() as a macro for a common case (depth == 0)
> >
> > dog/common.c | 5 +++--
> > dog/dog.h | 5 ++++-
> > dog/node.c | 3 ++-
> > 3 files changed, 9 insertions(+), 4 deletions(-)
> >
> > 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)
> > {
>
> Why we need 'int depth'? I don't think we need depth since we don't know where
> is the horizon. What I meant in my last reply is just make 5 as a bigger one, like
>
> #define DOG_MAX_PARAMETERS 10
What does the word "horizon" mean in this context? I think we need the
depth variable for detecting the beginning of arguments for
subcommands.
Thanks,
Hitoshi
More information about the sheepdog
mailing list