On Fri, Sep 10, 2021 at 01:40:55PM +0200, [email protected] wrote:
> From: Martin Wilck <[email protected]>
> 
> Use a typedef instead of spelling out the function type everywhere.
> 
Reviewed-by: Benjamin Marzinski <[email protected]>
> Signed-off-by: Martin Wilck <[email protected]>
> ---
>  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 4d6c37c..5213813 100644
> --- a/multipathd/cli.c
> +++ b/multipathd/cli.c
> @@ -65,7 +65,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;
>  
> @@ -100,7 +100,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);
>  
> @@ -112,7 +112,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 1e8948a..3dac1b4 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.0

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

Reply via email to