Linux Device Mapper development
 help / color / mirror / Atom feed
From: "Benjamin Marzinski" <bmarzins@redhat.com>
To: Martin Wilck <mwilck@suse.com>
Cc: dm-devel@redhat.com
Subject: Re: [RFC PATCH 07/20] libmultipath: use "const" in devmapper code
Date: Wed, 28 Feb 2018 23:39:00 -0600	[thread overview]
Message-ID: <20180301053900.GW14513@octiron.msp.redhat.com> (raw)
In-Reply-To: <20180220132658.22295-8-mwilck@suse.com>

On Tue, Feb 20, 2018 at 02:26:45PM +0100, Martin Wilck wrote:
> Improve use of "const" qualifiers in libmultipath's devmapper code.
> 

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>

> Signed-off-by: Martin Wilck <mwilck@suse.com>
> ---
>  libmultipath/devmapper.c | 32 ++++++++++++++++----------------
>  libmultipath/devmapper.h | 16 ++++++++--------
>  2 files changed, 24 insertions(+), 24 deletions(-)
> 
> diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
> index f112e1cb0e66..f61838cbe369 100644
> --- a/libmultipath/devmapper.c
> +++ b/libmultipath/devmapper.c
> @@ -583,7 +583,7 @@ is_mpath_part(const char *part_name, const char *map_name)
>  	return 0;
>  }
>  
> -int dm_get_status(char *name, char *outstatus)
> +int dm_get_status(const char *name, char *outstatus)
>  {
>  	int r = 1;
>  	struct dm_task *dmt;
> @@ -807,7 +807,7 @@ int _dm_flush_map (const char * mapname, int need_sync, int deferred_remove,
>  	if (need_suspend &&
>  	    !dm_get_map(mapname, &mapsize, params) &&
>  	    strstr(params, "queue_if_no_path")) {
> -		if (!dm_queue_if_no_path((char *)mapname, 0))
> +		if (!dm_queue_if_no_path(mapname, 0))
>  			queue_if_no_path = 1;
>  		else
>  			/* Leave queue_if_no_path alone if unset failed */
> @@ -850,7 +850,7 @@ int _dm_flush_map (const char * mapname, int need_sync, int deferred_remove,
>  	} while (retries-- > 0);
>  
>  	if (queue_if_no_path == 1)
> -		dm_queue_if_no_path((char *)mapname, 1);
> +		dm_queue_if_no_path(mapname, 1);
>  
>  	return 1;
>  }
> @@ -938,7 +938,7 @@ out:
>  }
>  
>  int
> -dm_fail_path(char * mapname, char * path)
> +dm_fail_path(const char * mapname, char * path)
>  {
>  	char message[32];
>  
> @@ -949,7 +949,7 @@ dm_fail_path(char * mapname, char * path)
>  }
>  
>  int
> -dm_reinstate_path(char * mapname, char * path)
> +dm_reinstate_path(const char * mapname, char * path)
>  {
>  	char message[32];
>  
> @@ -960,7 +960,7 @@ dm_reinstate_path(char * mapname, char * path)
>  }
>  
>  int
> -dm_queue_if_no_path(char *mapname, int enable)
> +dm_queue_if_no_path(const char *mapname, int enable)
>  {
>  	char *message;
>  
> @@ -973,7 +973,7 @@ dm_queue_if_no_path(char *mapname, int enable)
>  }
>  
>  static int
> -dm_groupmsg (char * msg, char * mapname, int index)
> +dm_groupmsg (const char * msg, const char * mapname, int index)
>  {
>  	char message[32];
>  
> @@ -984,19 +984,19 @@ dm_groupmsg (char * msg, char * mapname, int index)
>  }
>  
>  int
> -dm_switchgroup(char * mapname, int index)
> +dm_switchgroup(const char * mapname, int index)
>  {
>  	return dm_groupmsg("switch", mapname, index);
>  }
>  
>  int
> -dm_enablegroup(char * mapname, int index)
> +dm_enablegroup(const char * mapname, int index)
>  {
>  	return dm_groupmsg("enable", mapname, index);
>  }
>  
>  int
> -dm_disablegroup(char * mapname, int index)
> +dm_disablegroup(const char * mapname, int index)
>  {
>  	return dm_groupmsg("disable", mapname, index);
>  }
> @@ -1080,7 +1080,7 @@ out:
>  }
>  
>  int
> -dm_geteventnr (char *name)
> +dm_geteventnr (const char *name)
>  {
>  	struct dm_info info;
>  
> @@ -1139,7 +1139,7 @@ dm_mapname(int major, int minor)
>  
>  	map = dm_task_get_name(dmt);
>  	if (map && strlen(map))
> -		response = STRDUP((char *)dm_task_get_name(dmt));
> +		response = STRDUP((const char *)dm_task_get_name(dmt));
>  
>  	dm_task_destroy(dmt);
>  	return response;
> @@ -1264,7 +1264,7 @@ cancel_remove_partmap (const char *name, void *unused)
>  }
>  
>  static int
> -dm_get_deferred_remove (char * mapname)
> +dm_get_deferred_remove (const char * mapname)
>  {
>  	struct dm_info info;
>  
> @@ -1412,10 +1412,10 @@ out:
>  	return r;
>  }
>  
> -void dm_reassign_deps(char *table, char *dep, char *newdep)
> +void dm_reassign_deps(char *table, const char *dep, const char *newdep)
>  {
> -	char *p, *n;
> -	char *newtable;
> +	char *n;
> +	const char *p, *newtable;
>  
>  	newtable = strdup(table);
>  	if (!newtable)
> diff --git a/libmultipath/devmapper.h b/libmultipath/devmapper.h
> index 558e6914074f..8c8ea6c29b27 100644
> --- a/libmultipath/devmapper.h
> +++ b/libmultipath/devmapper.h
> @@ -38,7 +38,7 @@ int dm_addmap_create (struct multipath *mpp, char *params);
>  int dm_addmap_reload (struct multipath *mpp, char *params, int flush);
>  int dm_map_present (const char *);
>  int dm_get_map(const char *, unsigned long long *, char *);
> -int dm_get_status(char *, char *);
> +int dm_get_status(const char *, char *);
>  int dm_type(const char *, char *);
>  int dm_is_mpath(const char *);
>  int _dm_flush_map (const char *, int, int, int, int);
> @@ -49,14 +49,14 @@ int dm_flush_map_nopaths(const char * mapname, int deferred_remove);
>  	_dm_flush_map(mapname, 1, 0, 1, retries)
>  int dm_cancel_deferred_remove(struct multipath *mpp);
>  int dm_flush_maps (int retries);
> -int dm_fail_path(char * mapname, char * path);
> -int dm_reinstate_path(char * mapname, char * path);
> -int dm_queue_if_no_path(char *mapname, int enable);
> -int dm_switchgroup(char * mapname, int index);
> -int dm_enablegroup(char * mapname, int index);
> -int dm_disablegroup(char * mapname, int index);
> +int dm_fail_path(const char * mapname, char * path);
> +int dm_reinstate_path(const char * mapname, char * path);
> +int dm_queue_if_no_path(const char *mapname, int enable);
> +int dm_switchgroup(const char * mapname, int index);
> +int dm_enablegroup(const char * mapname, int index);
> +int dm_disablegroup(const char * mapname, int index);
>  int dm_get_maps (vector mp);
> -int dm_geteventnr (char *name);
> +int dm_geteventnr (const char *name);
>  int dm_is_suspended(const char *name);
>  int dm_get_major_minor (const char *name, int *major, int *minor);
>  char * dm_mapname(int major, int minor);
> -- 
> 2.16.1

  reply	other threads:[~2018-03-01  5:39 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-20 13:26 [RFC PATCH 00/20] "Foreign" NVMe support for multipath-tools Martin Wilck
2018-02-20 13:26 ` [RFC PATCH 01/20] multipath(d)/Makefile: add explicit dependency on libraries Martin Wilck
2018-03-01  5:35   ` Benjamin Marzinski
2018-02-20 13:26 ` [RFC PATCH 02/20] libmultipath: remove unused "stdout helpers" Martin Wilck
2018-03-01  5:36   ` Benjamin Marzinski
2018-02-20 13:26 ` [RFC PATCH 03/20] libmultipath: get rid of selector "hack" in print.c Martin Wilck
2018-03-01  5:36   ` Benjamin Marzinski
2018-02-20 13:26 ` [RFC PATCH 04/20] libmultipath: parser: use call-by-value for "snprint" methods Martin Wilck
2018-03-01  5:37   ` Benjamin Marzinski
2018-02-20 13:26 ` [RFC PATCH 05/20] libmultipath: don't update path groups when printing Martin Wilck
2018-02-28 23:40   ` Benjamin Marzinski
2018-03-02 13:59     ` Martin Wilck
2018-03-02 15:31       ` Benjamin Marzinski
2018-02-20 13:26 ` [RFC PATCH 06/20] libmultipath/print: use "const" where appropriate Martin Wilck
2018-03-01  5:37   ` Benjamin Marzinski
2018-02-20 13:26 ` [RFC PATCH 07/20] libmultipath: use "const" in devmapper code Martin Wilck
2018-03-01  5:39   ` Benjamin Marzinski [this message]
2018-02-20 13:26 ` [RFC PATCH 08/20] libmultipath: fix compiler warnings for -Wcast-qual Martin Wilck
2018-03-01  5:39   ` Benjamin Marzinski
2018-02-20 13:26 ` [RFC PATCH 09/20] multipath-tools: Makefile.inc: use -Werror=cast-qual Martin Wilck
2018-03-01  5:59   ` Benjamin Marzinski
2018-02-20 13:26 ` [RFC PATCH 10/20] libmultipath: add vector_free_const() Martin Wilck
2018-03-01  6:00   ` Benjamin Marzinski
2018-02-20 13:26 ` [RFC PATCH 11/20] libmultipath: add vector_convert() Martin Wilck
2018-03-01  6:02   ` Benjamin Marzinski
2018-02-20 13:26 ` [RFC PATCH 12/20] libmultipath: "generic multipath" interface Martin Wilck
2018-02-28 23:47   ` Benjamin Marzinski
2018-03-01  8:51     ` Martin Wilck
2018-02-20 13:26 ` [RFC PATCH 13/20] libmultipath: print: convert API to generic data type Martin Wilck
2018-02-28 23:55   ` Benjamin Marzinski
2018-02-20 13:26 ` [RFC PATCH 14/20] libmultipath: print: use generic API for get_x_layout() Martin Wilck
2018-03-01  6:03   ` Benjamin Marzinski
2018-02-20 13:26 ` [RFC PATCH 15/20] libmultipath: API for foreign multipath handling Martin Wilck
2018-03-01  3:01   ` Benjamin Marzinski
2018-02-20 13:26 ` [RFC PATCH 16/20] libmultipath/print: add "%G - foreign" wildcard Martin Wilck
2018-03-01  6:04   ` Benjamin Marzinski
2018-02-20 13:26 ` [RFC PATCH 17/20] libmultipath/foreign: nvme foreign library Martin Wilck
2018-03-01  3:14   ` Benjamin Marzinski
2018-03-02 16:04     ` Martin Wilck
2018-03-02 18:30       ` Benjamin Marzinski
2018-02-20 13:26 ` [RFC PATCH 18/20] multipath: use foreign API Martin Wilck
2018-03-01  3:55   ` Benjamin Marzinski
2018-03-02 16:36     ` Martin Wilck
2018-02-20 13:26 ` [RFC PATCH 19/20] multipathd: " Martin Wilck
2018-03-01  5:13   ` Benjamin Marzinski
2018-03-02 17:04     ` Martin Wilck
2018-03-02 18:42       ` Benjamin Marzinski
2018-03-02 19:19     ` Martin Wilck
2018-03-02 20:00       ` Benjamin Marzinski
2018-03-02 21:18         ` [PATCH] multipathd: fix inverted signal blocking logic Martin Wilck
2018-03-02 21:35           ` Bart Van Assche
2018-03-02 22:15             ` Martin Wilck
2018-03-02 22:23               ` Bart Van Assche
2018-03-02 23:16                 ` Martin Wilck
2018-03-02 23:27                   ` Bart Van Assche
2018-03-03  0:31                     ` Martin Wilck
2018-03-05 16:27                       ` Bart Van Assche
2018-03-05 17:28                         ` Martin Wilck
2018-03-06  0:46                           ` Benjamin Marzinski
2018-03-06  8:48                             ` Martin Wilck
2018-03-02 21:00     ` [RFC PATCH 19/20] multipathd: use foreign API Bart Van Assche
2018-02-20 13:26 ` [RFC PATCH 20/20] libmultipath: foreign/nvme: implement path display Martin Wilck
2018-03-01  5:19   ` Benjamin Marzinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180301053900.GW14513@octiron.msp.redhat.com \
    --to=bmarzins@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=mwilck@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox