Commit 39ecb61a authored by Kefu Chai's avatar Kefu Chai Committed by Tomasz Zawadzki
Browse files

event: pass "const struct option*" to spdk_app_parse_args()



before this change, we cannot pass a `const struct option*` to
spdk_app_parse_args() even the callee does not mutate the value pointed
by the pointer. in other words, we are not able to write something like:

static const option g_options[] = {...};
// ...
spdk_app_parse_args(argc, argv, &opts, "",
  g_options, app_parse_arg, app_usage);

after this change, the requirement of the type of the `option` argument
is relaxed, so we can pass a `const struct option*` to this function
now.

Signed-off-by: default avatarKefu Chai <tchaikov@gmail.com>
Change-Id: I8794fcf92090f538743850a28ef4a2a8c357f121
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14082


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 12807c5b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -271,7 +271,7 @@ typedef enum spdk_app_parse_args_rvals spdk_app_parse_args_rvals_t;
 */
spdk_app_parse_args_rvals_t spdk_app_parse_args(int argc, char **argv,
		struct spdk_app_opts *opts, const char *getopt_str,
		struct option *app_long_opts, int (*parse)(int ch, char *arg),
		const struct option *app_long_opts, int (*parse)(int ch, char *arg),
		void (*usage)(void));

/**
+1 −1
Original line number Diff line number Diff line
@@ -743,7 +743,7 @@ usage(void (*app_usage)(void))

spdk_app_parse_args_rvals_t
spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
		    const char *app_getopt_str, struct option *app_long_opts,
		    const char *app_getopt_str, const struct option *app_long_opts,
		    int (*app_parse)(int ch, char *arg),
		    void (*app_usage)(void))
{