From: Martin Wilck <mwilck@xxxxxxxx> Use a typedef instead of spelling out the function type everywhere. Reviewed-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx> Signed-off-by: Martin Wilck <mwilck@xxxxxxxx> --- multipathd/cli.c | 6 +++--- multipathd/cli.h | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/multipathd/cli.c b/multipathd/cli.c index bddf172..3582370 100644 --- a/multipathd/cli.c +++ b/multipathd/cli.c @@ -64,7 +64,7 @@ out: } int -add_handler (uint64_t fp, int (*fn)(void *, char **, int *, void *)) +add_handler (uint64_t fp, cli_handler *fn) { struct handler * h; @@ -99,7 +99,7 @@ find_handler (uint64_t fp) } int -set_handler_callback (uint64_t fp, int (*fn)(void *, char **, int *, void *)) +set_handler_callback (uint64_t fp, cli_handler *fn) { struct handler * h = find_handler(fp); @@ -111,7 +111,7 @@ set_handler_callback (uint64_t fp, int (*fn)(void *, char **, int *, void *)) } int -set_unlocked_handler_callback (uint64_t fp,int (*fn)(void *, char **, int *, void *)) +set_unlocked_handler_callback (uint64_t fp, cli_handler *fn) { struct handler * h = find_handler(fp); diff --git a/multipathd/cli.h b/multipathd/cli.h index 6a68107..84b1fbe 100644 --- a/multipathd/cli.h +++ b/multipathd/cli.h @@ -124,16 +124,18 @@ struct key { int has_param; }; +typedef int (cli_handler)(void *keywords, char **reply, int *len, void *data); + struct handler { uint64_t fingerprint; int locked; - int (*fn)(void *, char **, int *, void *); + cli_handler *fn; }; int alloc_handlers (void); -int add_handler (uint64_t fp, int (*fn)(void *, char **, int *, void *)); -int set_handler_callback (uint64_t fp, int (*fn)(void *, char **, int *, void *)); -int set_unlocked_handler_callback (uint64_t fp, int (*fn)(void *, char **, int *, void *)); +int add_handler (uint64_t fp, cli_handler *fn); +int set_handler_callback (uint64_t fp, cli_handler *fn); +int set_unlocked_handler_callback (uint64_t fp, cli_handler *fn); int parse_cmd (char * cmd, char ** reply, int * len, void *, int); int load_keys (void); char * get_keyparam (vector v, uint64_t code); -- 2.33.1 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/dm-devel