Commit c2dc15a0 authored by Dariusz Stojaczyk's avatar Dariusz Stojaczyk Committed by Jim Harris
Browse files

app: allow full-name command line options



The following commands now have the same effect:

```
$ spdk_tgt -w -p 1 -m 3 -s 2048
$ spdk_tgt --wait-for-rpc --master-core 1 --cpumask 3 --mem-size 2048
$ spdk_tgt --wait-for-rpc --master-core=1 --cpumask=3 --mem-size=2048
```

Change-Id: I8540a377abf7e02987e9ecd957d142212e9609c4
Signed-off-by: default avatarDariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/420864


Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 190e580b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ main(int argc, char **argv)
	spdk_app_opts_init(&opts);
	opts.config_file = SPDK_ISCSI_DEFAULT_CONFIG;
	opts.name = "iscsi";
	if ((rc = spdk_app_parse_args(argc, argv, &opts, "b",
	if ((rc = spdk_app_parse_args(argc, argv, &opts, "b", NULL,
				      iscsi_parse_arg, iscsi_usage)) !=
	    SPDK_APP_PARSE_ARGS_SUCCESS) {
		exit(rc);
+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ main(int argc, char **argv)
	opts.name = "nvmf";
	opts.config_file = SPDK_NVMF_DEFAULT_CONFIG;
	opts.max_delay_us = 1000; /* 1 ms */
	if ((rc = spdk_app_parse_args(argc, argv, &opts, "",
	if ((rc = spdk_app_parse_args(argc, argv, &opts, "", NULL,
				      nvmf_parse_arg, nvmf_usage)) !=
	    SPDK_APP_PARSE_ARGS_SUCCESS) {
		exit(rc);
+3 −3
Original line number Diff line number Diff line
@@ -54,9 +54,9 @@ static const char g_spdk_tgt_get_opts_string[] = "f:" SPDK_VHOST_OPTS;
static void
spdk_tgt_usage(void)
{
	printf(" -f pidfile save pid to file under given path\n");
	printf(" -f <file>                 pidfile save pid to file under given path\n");
#ifdef SPDK_CONFIG_VHOST
	printf(" -S dir     directory where to create vhost sockets (default: pwd)\n");
	printf(" -S <path>                 directory where to create vhost sockets (default: pwd)\n");
#endif
}

@@ -113,7 +113,7 @@ main(int argc, char **argv)
	spdk_app_opts_init(&opts);
	opts.name = "spdk_tgt";
	if ((rc = spdk_app_parse_args(argc, argv, &opts, g_spdk_tgt_get_opts_string,
				      spdk_tgt_parse_arg, spdk_tgt_usage)) !=
				      NULL, spdk_tgt_parse_arg, spdk_tgt_usage)) !=
	    SPDK_APP_PARSE_ARGS_SUCCESS) {
		return rc;
	}
+3 −3
Original line number Diff line number Diff line
@@ -56,8 +56,8 @@ vhost_app_opts_init(struct spdk_app_opts *opts)
static void
vhost_usage(void)
{
	printf(" -f pidfile save pid to file under given path\n");
	printf(" -S dir     directory where to create vhost sockets (default: pwd)\n");
	printf(" -f <path>                 save pid to file under given path\n");
	printf(" -S <path>                 directory where to create vhost sockets (default: pwd)\n");
}

static void
@@ -101,7 +101,7 @@ main(int argc, char *argv[])

	vhost_app_opts_init(&opts);

	if ((rc = spdk_app_parse_args(argc, argv, &opts, "f:S:",
	if ((rc = spdk_app_parse_args(argc, argv, &opts, "f:S:", NULL,
				      vhost_parse_arg, vhost_usage)) !=
	    SPDK_APP_PARSE_ARGS_SUCCESS) {
		exit(rc);
+2 −2
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ struct hello_context_t {
static void
hello_bdev_usage(void)
{
	printf(" -b bdev name\n");
	printf(" -b <bdev>                 name of the bdev to use\n");
}

/*
@@ -233,7 +233,7 @@ main(int argc, char **argv)
	 * If none of the parameters are provide the application will use the
	 * default parameters(-c bdev.conf -b Malloc0).
	 */
	if ((rc = spdk_app_parse_args(argc, argv, &opts, "b:", hello_bdev_parse_arg,
	if ((rc = spdk_app_parse_args(argc, argv, &opts, "b:", NULL, hello_bdev_parse_arg,
				      hello_bdev_usage)) != SPDK_APP_PARSE_ARGS_SUCCESS) {
		exit(rc);
	}
Loading