[dm-devel] [PATCH v2 83/84] libmultipath: alias: static const variable for BINDINGS_FILE_HEADER
mwilck at suse.com
mwilck at suse.com
Wed Aug 12 11:36:00 UTC 2020
From: Martin Wilck <mwilck at suse.com>
... and fixup the header file.
Signed-off-by: Martin Wilck <mwilck at suse.com>
---
libmultipath/alias.c | 17 ++++++++++++++---
libmultipath/alias.h | 12 ++++--------
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/libmultipath/alias.c b/libmultipath/alias.c
index 35f1beb..0759c4e 100644
--- a/libmultipath/alias.c
+++ b/libmultipath/alias.c
@@ -37,6 +37,17 @@
* See the file COPYING included with this distribution for more details.
*/
+#define BINDINGS_FILE_HEADER \
+"# Multipath bindings, Version : 1.0\n" \
+"# NOTE: this file is automatically maintained by the multipath program.\n" \
+"# You should not need to edit this file in normal circumstances.\n" \
+"#\n" \
+"# Format:\n" \
+"# alias wwid\n" \
+"#\n"
+
+static const char bindings_file_header[] = BINDINGS_FILE_HEADER;
+
int
valid_alias(const char *alias)
{
@@ -287,7 +298,7 @@ use_existing_alias (const char *wwid, const char *file, const char *alias_old,
char buff[WWID_SIZE];
FILE *f;
- fd = open_file(file, &can_write, BINDINGS_FILE_HEADER);
+ fd = open_file(file, &can_write, bindings_file_header);
if (fd < 0)
return NULL;
@@ -361,7 +372,7 @@ get_user_friendly_alias(const char *wwid, const char *file, const char *prefix,
return NULL;
}
- fd = open_file(file, &can_write, BINDINGS_FILE_HEADER);
+ fd = open_file(file, &can_write, bindings_file_header);
if (fd < 0)
return NULL;
@@ -406,7 +417,7 @@ get_user_friendly_wwid(const char *alias, char *buff, const char *file)
return -1;
}
- fd = open_file(file, &unused, BINDINGS_FILE_HEADER);
+ fd = open_file(file, &unused, bindings_file_header);
if (fd < 0)
return -1;
diff --git a/libmultipath/alias.h b/libmultipath/alias.h
index 7c4b302..236b3ba 100644
--- a/libmultipath/alias.h
+++ b/libmultipath/alias.h
@@ -1,11 +1,5 @@
-#define BINDINGS_FILE_HEADER \
-"# Multipath bindings, Version : 1.0\n" \
-"# NOTE: this file is automatically maintained by the multipath program.\n" \
-"# You should not need to edit this file in normal circumstances.\n" \
-"#\n" \
-"# Format:\n" \
-"# alias wwid\n" \
-"#\n"
+#ifndef _ALIAS_H
+#define _ALIAS_H
int valid_alias(const char *alias);
char *get_user_friendly_alias(const char *wwid, const char *file,
@@ -15,3 +9,5 @@ int get_user_friendly_wwid(const char *alias, char *buff, const char *file);
char *use_existing_alias (const char *wwid, const char *file,
const char *alias_old,
const char *prefix, int bindings_read_only);
+
+#endif /* _ALIAS_H */
--
2.28.0
More information about the dm-devel
mailing list