[sheepdog] [PATCH 4/6] use sd_getopt instead of getopt_long
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Tue Nov 6 08:52:53 CET 2012
At Tue, 06 Nov 2012 15:39:31 +0800,
Liu Yuan wrote:
>
> On 11/06/2012 03:30 PM, MORITA Kazutaka wrote:
> > I'm not sure whether I understand your suggestion correctly, but IIUC,
> > it means that we create sd_opt_param (including a user-defined handler
> > to parse a key-value string) for each prefix (not <prefix,key> pair).
> > Is it correct? Then, we cannot auto-generate a help message of
> > key-value pairs, no?
> >
>
> > Or you mean that the user should define sd_opt_param for each
> > <prefix,key> pair, and define the handler outside of sd_opt_param for
> > each prefix?
>
> Ah, I wasn't noticing the structure is <prefix, key> pair.
>
> maybe handler for each <prefix, key> is okay? like following:
>
> static struct sd_opt_param write_cache_options[] = {
> {"object", "size", "<size>",
> "specify a cache size for object cache", A},
> {"object", "directio", "<on|off>",
> "avoid using gateway page cache", B},
> ....
> };
>
> Then sd-opt user is freed to use the same handler for handler A and B or
> use dedicated handlers for A and B. In either case, users don't need to
> write prefix parser.
Thanks, I got it, it makes sense. I'll address it in the next
version.
Kazutaka
More information about the sheepdog
mailing list