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

Liu Yuan namei.unix at gmail.com
Tue Nov 6 06:04:07 CET 2012


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.

Thanks,
Yuan



More information about the sheepdog mailing list