diff mbox

[3/6] libmultipath, alloc_path_with_pathinfo(): Declare third argument const

Message ID 20180301192935.14643-4-bart.vanassche@wdc.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show

Commit Message

Bart Van Assche March 1, 2018, 7:29 p.m. UTC
Since the third argument of this function is not modified inside that
function, declare it const.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
---
 libmultipath/discovery.c | 2 +-
 libmultipath/discovery.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Martin Wilck March 5, 2018, 4:18 p.m. UTC | #1
On Thu, 2018-03-01 at 11:29 -0800, Bart Van Assche wrote:
> Since the third argument of this function is not modified inside that
> function, declare it const.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>

ACK, but this hunk is part of my previously posted patch "libmultipath:
const qualifier for wwid and alias", which includes some more changes
along similar lines and is part of a larger patch set that tries to
improve "const" usage in libmultipath.


> ---
>  libmultipath/discovery.c | 2 +-
>  libmultipath/discovery.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
> index fe50ce5062ea..d84715e15db1 100644
> --- a/libmultipath/discovery.c
> +++ b/libmultipath/discovery.c
> @@ -34,7 +34,7 @@
>  
>  int
>  alloc_path_with_pathinfo (struct config *conf, struct udev_device
> *udevice,
> -			  char *wwid, int flag, struct path
> **pp_ptr)
> +			  const char *wwid, int flag, struct path
> **pp_ptr)
>  {
>  	int err = PATHINFO_FAILED;
>  	struct path * pp;
> diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h
> index b151cc7a39a8..bd5e6678a26d 100644
> --- a/libmultipath/discovery.h
> +++ b/libmultipath/discovery.h
> @@ -38,7 +38,7 @@ int get_state (struct path * pp, struct config *
> conf, int daemon, int state);
>  int get_vpd_sgio (int fd, int pg, char * str, int maxlen);
>  int pathinfo (struct path * pp, struct config * conf, int mask);
>  int alloc_path_with_pathinfo (struct config *conf, struct
> udev_device *udevice,
> -			      char *wwid, int flag, struct path
> **pp_ptr);
> +			      const char *wwid, int flag, struct
> path **pp_ptr);
>  int store_pathinfo (vector pathvec, struct config *conf,
>  		    struct udev_device *udevice, int flag,
>  		    struct path **pp_ptr);
Bart Van Assche March 5, 2018, 4:21 p.m. UTC | #2
On Mon, 2018-03-05 at 17:18 +0100, Martin Wilck wrote:
> On Thu, 2018-03-01 at 11:29 -0800, Bart Van Assche wrote:
> > Since the third argument of this function is not modified inside that
> > function, declare it const.
> > 
> > Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
> 
> ACK, but this hunk is part of my previously posted patch "libmultipath:
> const qualifier for wwid and alias", which includes some more changes
> along similar lines and is part of a larger patch set that tries to
> improve "const" usage in libmultipath.

Hello Martin,

If this patch duplicates some of your work then I'm fine with dropping this
patch.

Bart.



--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox

Patch

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index fe50ce5062ea..d84715e15db1 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -34,7 +34,7 @@ 
 
 int
 alloc_path_with_pathinfo (struct config *conf, struct udev_device *udevice,
-			  char *wwid, int flag, struct path **pp_ptr)
+			  const char *wwid, int flag, struct path **pp_ptr)
 {
 	int err = PATHINFO_FAILED;
 	struct path * pp;
diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h
index b151cc7a39a8..bd5e6678a26d 100644
--- a/libmultipath/discovery.h
+++ b/libmultipath/discovery.h
@@ -38,7 +38,7 @@  int get_state (struct path * pp, struct config * conf, int daemon, int state);
 int get_vpd_sgio (int fd, int pg, char * str, int maxlen);
 int pathinfo (struct path * pp, struct config * conf, int mask);
 int alloc_path_with_pathinfo (struct config *conf, struct udev_device *udevice,
-			      char *wwid, int flag, struct path **pp_ptr);
+			      const char *wwid, int flag, struct path **pp_ptr);
 int store_pathinfo (vector pathvec, struct config *conf,
 		    struct udev_device *udevice, int flag,
 		    struct path **pp_ptr);