[sheepdog] [PATCH 4/6] use sd_getopt instead of getopt_long

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Tue Nov 6 06:48:49 CET 2012


At Tue, 06 Nov 2012 13:04:07 +0800,
Liu Yuan wrote:
> 
> On 11/05/2012 06:52 PM, morita.kazutaka at gmail.com wrote:
> > +static struct sd_opt_param cluster_options[] = {
> > +	{"local", "shmfile", "<filename>",
> > +	 "specify a file to be used for shared memory"},
> > +	{"zookeeper", "server", "<host[:port]>[,...]",
> > +	 "specify ZooKeeper servers with comma separated host:port pairs"},
> > +	{"accord", "server", "<server>",
> > +	 "specify one of Accord servers"},
> > +	{NULL, NULL, NULL, NULL},
> > +};
> > +
> > +static struct sd_opt_param write_cache_options[] = {
> > +	{"object", "size", "<size>",
> > +	 "specify a cache size for object cache"},
> > +	{"object", "directio", "<on|off>",
> > +	 "avoid using gateway page cache"},
> > +	{NULL, NULL, NULL, NULL},
> > +};
> > +
> 
> 
> > +struct sd_opt_param {
> > +	const char *arg;
> > +	const char *key;
> > +	const char *usage;
> > +	const char *desc;
> > +
> > +	struct sd_opt_value value;
> > +};
> 
> I am wondering if we can built-in a callback in struct_sd_opt_param.
> Then users of sd_opt will only write body handler, which interpret the
> key-value string.

Do you mean to create a callback for each <prefix, key> pair?

Thanks,

Kazutaka



More information about the sheepdog mailing list