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: Kefu Chai <tchaikov@gmail.com>
Change-Id: I8794fcf92090f538743850a28ef4a2a8c357f121
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14082
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Kefu Chai 2022-08-18 00:41:41 +08:00 committed by Tomasz Zawadzki
parent 12807c5bc6
commit 39ecb61ade
2 changed files with 2 additions and 2 deletions

View File

@ -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));
/**

View File

@ -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))
{