Commit eb48f76d authored by Krzysztof Karas's avatar Krzysztof Karas Committed by Tomasz Zawadzki
Browse files

hotplug.c: add a second switch to parse_args()



Add another level of option parsing to allow usage
of string values.
Currently all values are converted to long
(or have to be checked before the switch),
which results in errors upon adding a string as a value.

This is going to be used in the next patch in the series.

Change-Id: Ib874d74b015eee825b5135ef3d49b9cb1c72029b
Signed-off-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10471


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent 1b81d438
Loading
Loading
Loading
Loading
+25 −19
Original line number Diff line number Diff line
@@ -444,11 +444,12 @@ parse_args(int argc, char **argv)
			return 1;
		}

		if (op == 'm') {
			g_iova_mode = optarg;
			continue;
		}

		switch (op) {
		case 'c':
		case 'i':
		case 'n':
		case 'r':
		case 't':
			val = spdk_strtol(optarg, 10);
			if (val < 0) {
				fprintf(stderr, "Converting a string to integer failed\n");
@@ -470,6 +471,11 @@ parse_args(int argc, char **argv)
			case 't':
				g_time_in_sec = val;
				break;
			}
			break;
		case 'm':
			g_iova_mode = optarg;
			break;
		default:
			usage(argv[0]);
			return 1;