100 lines
3.1 KiB
Diff
100 lines
3.1 KiB
Diff
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: Martin Wilck <mwilck@suse.com>
|
||
|
Date: Thu, 24 Sep 2020 15:37:07 +0200
|
||
|
Subject: [PATCH] libmultipath: constify file argument in config parser
|
||
|
|
||
|
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||
|
Signed-off-by: Martin Wilck <mwilck@suse.com>
|
||
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||
|
---
|
||
|
libmultipath/config.c | 3 +--
|
||
|
libmultipath/config.h | 2 +-
|
||
|
libmultipath/parser.c | 9 +++++----
|
||
|
libmultipath/parser.h | 2 +-
|
||
|
4 files changed, 8 insertions(+), 8 deletions(-)
|
||
|
|
||
|
diff --git a/libmultipath/config.c b/libmultipath/config.c
|
||
|
index a253a936..1818f8b9 100644
|
||
|
--- a/libmultipath/config.c
|
||
|
+++ b/libmultipath/config.c
|
||
|
@@ -718,8 +718,7 @@ static void set_max_checkint_from_watchdog(struct config *conf)
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
-struct config *
|
||
|
-load_config (char * file)
|
||
|
+struct config *load_config(const char *file)
|
||
|
{
|
||
|
struct config *conf = alloc_config();
|
||
|
|
||
|
diff --git a/libmultipath/config.h b/libmultipath/config.h
|
||
|
index c7a73fba..78375f2f 100644
|
||
|
--- a/libmultipath/config.h
|
||
|
+++ b/libmultipath/config.h
|
||
|
@@ -253,7 +253,7 @@ void free_mptable (vector mptable);
|
||
|
|
||
|
int store_hwe (vector hwtable, struct hwentry *);
|
||
|
|
||
|
-struct config *load_config (char * file);
|
||
|
+struct config *load_config (const char *file);
|
||
|
struct config * alloc_config (void);
|
||
|
void free_config (struct config * conf);
|
||
|
extern struct config *get_multipath_config(void);
|
||
|
diff --git a/libmultipath/parser.c b/libmultipath/parser.c
|
||
|
index a7285a35..d150e7b2 100644
|
||
|
--- a/libmultipath/parser.c
|
||
|
+++ b/libmultipath/parser.c
|
||
|
@@ -400,7 +400,7 @@ set_regex_value(vector strvec)
|
||
|
/* non-recursive configuration stream handler */
|
||
|
static int kw_level = 0;
|
||
|
|
||
|
-int warn_on_duplicates(vector uniques, char *str, char *file)
|
||
|
+int warn_on_duplicates(vector uniques, char *str, const char *file)
|
||
|
{
|
||
|
char *tmp;
|
||
|
int i;
|
||
|
@@ -444,7 +444,7 @@ is_sublevel_keyword(char *str)
|
||
|
}
|
||
|
|
||
|
int
|
||
|
-validate_config_strvec(vector strvec, char *file)
|
||
|
+validate_config_strvec(vector strvec, const char *file)
|
||
|
{
|
||
|
char *str;
|
||
|
int i;
|
||
|
@@ -507,7 +507,8 @@ validate_config_strvec(vector strvec, char *file)
|
||
|
}
|
||
|
|
||
|
static int
|
||
|
-process_stream(struct config *conf, FILE *stream, vector keywords, char *file)
|
||
|
+process_stream(struct config *conf, FILE *stream, vector keywords,
|
||
|
+ const char *file)
|
||
|
{
|
||
|
int i;
|
||
|
int r = 0, t;
|
||
|
@@ -592,7 +593,7 @@ out:
|
||
|
|
||
|
/* Data initialization */
|
||
|
int
|
||
|
-process_file(struct config *conf, char *file)
|
||
|
+process_file(struct config *conf, const char *file)
|
||
|
{
|
||
|
int r;
|
||
|
FILE *stream;
|
||
|
diff --git a/libmultipath/parser.h b/libmultipath/parser.h
|
||
|
index b7917052..b385fb9e 100644
|
||
|
--- a/libmultipath/parser.h
|
||
|
+++ b/libmultipath/parser.h
|
||
|
@@ -78,7 +78,7 @@ extern void free_keywords(vector keywords);
|
||
|
extern vector alloc_strvec(char *string);
|
||
|
extern void *set_value(vector strvec);
|
||
|
extern void *set_regex_value(vector strvec);
|
||
|
-extern int process_file(struct config *conf, char *conf_file);
|
||
|
+extern int process_file(struct config *conf, const char *conf_file);
|
||
|
extern struct keyword * find_keyword(vector keywords, vector v, char * name);
|
||
|
int snprint_keyword(char *buff, int len, char *fmt, struct keyword *kw,
|
||
|
const void *data);
|
||
|
--
|
||
|
2.17.2
|
||
|
|