112 lines
3.3 KiB
Diff
112 lines
3.3 KiB
Diff
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: Martin Wilck <mwilck@suse.com>
|
||
|
Date: Wed, 8 Jul 2020 09:23:20 +0200
|
||
|
Subject: [PATCH] libmultipath: util: constify function arguments
|
||
|
|
||
|
Use "const" for function arguments where possible.
|
||
|
|
||
|
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||
|
---
|
||
|
libmultipath/dmparser.c | 2 +-
|
||
|
libmultipath/util.c | 12 ++++++------
|
||
|
libmultipath/util.h | 10 +++++-----
|
||
|
3 files changed, 12 insertions(+), 12 deletions(-)
|
||
|
|
||
|
diff --git a/libmultipath/dmparser.c b/libmultipath/dmparser.c
|
||
|
index b856a07f..27581cde 100644
|
||
|
--- a/libmultipath/dmparser.c
|
||
|
+++ b/libmultipath/dmparser.c
|
||
|
@@ -18,7 +18,7 @@
|
||
|
#define WORD_SIZE 64
|
||
|
|
||
|
static int
|
||
|
-merge_words(char **dst, char *word)
|
||
|
+merge_words(char **dst, const char *word)
|
||
|
{
|
||
|
char * p = *dst;
|
||
|
int len, dstlen;
|
||
|
diff --git a/libmultipath/util.c b/libmultipath/util.c
|
||
|
index 51c38c87..67e7a42f 100644
|
||
|
--- a/libmultipath/util.c
|
||
|
+++ b/libmultipath/util.c
|
||
|
@@ -52,7 +52,7 @@ basenamecpy (const char *src, char *dst, size_t size)
|
||
|
}
|
||
|
|
||
|
int
|
||
|
-filepresent (char * run) {
|
||
|
+filepresent (const char *run) {
|
||
|
struct stat buf;
|
||
|
|
||
|
if(!stat(run, &buf))
|
||
|
@@ -60,7 +60,7 @@ filepresent (char * run) {
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
-char *get_next_string(char **temp, char *split_char)
|
||
|
+char *get_next_string(char **temp, const char *split_char)
|
||
|
{
|
||
|
char *token = NULL;
|
||
|
token = strsep(temp, split_char);
|
||
|
@@ -70,9 +70,9 @@ char *get_next_string(char **temp, char *split_char)
|
||
|
}
|
||
|
|
||
|
int
|
||
|
-get_word (char * sentence, char ** word)
|
||
|
+get_word (const char *sentence, char **word)
|
||
|
{
|
||
|
- char * p;
|
||
|
+ const char *p;
|
||
|
int len;
|
||
|
int skip = 0;
|
||
|
|
||
|
@@ -381,7 +381,7 @@ int get_linux_version_code(void)
|
||
|
return _linux_version_code;
|
||
|
}
|
||
|
|
||
|
-int parse_prkey(char *ptr, uint64_t *prkey)
|
||
|
+int parse_prkey(const char *ptr, uint64_t *prkey)
|
||
|
{
|
||
|
if (!ptr)
|
||
|
return 1;
|
||
|
@@ -398,7 +398,7 @@ int parse_prkey(char *ptr, uint64_t *prkey)
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
-int parse_prkey_flags(char *ptr, uint64_t *prkey, uint8_t *flags)
|
||
|
+int parse_prkey_flags(const char *ptr, uint64_t *prkey, uint8_t *flags)
|
||
|
{
|
||
|
char *flagstr;
|
||
|
|
||
|
diff --git a/libmultipath/util.h b/libmultipath/util.h
|
||
|
index 56bd78c7..c19c5ac3 100644
|
||
|
--- a/libmultipath/util.h
|
||
|
+++ b/libmultipath/util.h
|
||
|
@@ -9,9 +9,9 @@
|
||
|
|
||
|
size_t strchop(char *);
|
||
|
int basenamecpy (const char *src, char *dst, size_t size);
|
||
|
-int filepresent (char * run);
|
||
|
-char *get_next_string(char **temp, char *split_char);
|
||
|
-int get_word (char * sentence, char ** word);
|
||
|
+int filepresent (const char *run);
|
||
|
+char *get_next_string(char **temp, const char *split_char);
|
||
|
+int get_word (const char * sentence, char ** word);
|
||
|
size_t strlcpy(char *dst, const char *src, size_t size);
|
||
|
size_t strlcat(char *dst, const char *src, size_t size);
|
||
|
int devt2devname (char *, int, char *);
|
||
|
@@ -20,8 +20,8 @@ char *convert_dev(char *dev, int is_path_device);
|
||
|
void setup_thread_attr(pthread_attr_t *attr, size_t stacksize, int detached);
|
||
|
int systemd_service_enabled(const char *dev);
|
||
|
int get_linux_version_code(void);
|
||
|
-int parse_prkey(char *ptr, uint64_t *prkey);
|
||
|
-int parse_prkey_flags(char *ptr, uint64_t *prkey, uint8_t *flags);
|
||
|
+int parse_prkey(const char *ptr, uint64_t *prkey);
|
||
|
+int parse_prkey_flags(const char *ptr, uint64_t *prkey, uint8_t *flags);
|
||
|
int safe_write(int fd, const void *buf, size_t count);
|
||
|
void set_max_fds(rlim_t max_fds);
|
||
|
|
||
|
--
|
||
|
2.17.2
|
||
|
|