multipath-tools: comply with C library reserved names
cover multipath-tools: comply with C library reserved names
The first 2 patches are minor, independent fixes.
The rest of the set renames identifiers that possibly conflict with reserved names of the C library, and should have no influence on the functionality of the code.
According to the glibc docs, user code must not redefine any type, function, variable, or macro names that are part of the ISO C standard [1]. Moreover, identifiers must not start with "__" (double underscore) or underscore and capital letter, and names starting with underscore are forbidden for globally visible symbols.
This patch series tries to make the multipath-tools code comply with these requirements, at least to some extent. I haven't bothered renaming local or static variables, or variables like "__x" in macro bodies, for example. The starting point for the series was the request not to export strlcat and strlcpy any more [2].
In most cases, I have simply replaced __xyz() or _xyz() by xyz__() (two underscores to make them better visible). In some cases, when xyz() was not defined, I've simply renamed _xyz() to xyz(). There are exceptions to these rules.
The set also fixes some typos where __attribute__ was misspelled.
[1] https://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html
[2] https://github.com/opensvc/multipath-tools/issues/91
Martin Wilck (41):
multipath-tools tests: make alias.test succeed with increased
verbosity
libmpathutil: avoid extra memory allocation in print_strbuf()
libmpathutil: rename strlcat and strlcpy libmpathutil.version: remove strlcpy and strlcat, and LIBMULTIPATH
section
libmpathutil: fix __attribute typo in log_pthread.c
libmultipath: devmapper.c: rename __DR_UNUSED__, and fix __attribute
typo
multipathd: fix __attribute typo
multipath-tools: use common convention for "header file included"
macros
libmpathcmd: rename __mpath_connect() to mpath_connect__()
libmpathutil: rename _MAX_CMD_LEN
libmpathutil: rename __append_strbuf_str() and __get_strbuf_buf()
libmpathutil: rename _log_bitfield_overflow()
libmpathutil: rename _install_keyword() to install_keyword__()
libmultipath: rename _NVME_LIB_C
libmultipath: checkers.h: fix __CHECKER_FIRST_MSG in comment
libmultipath: rename identifiers with leading underscores in
devmapper.h
libmultipath: rename identifiers with leading underscores in
discovery.h
libmultipath: rename __snprint_config()
libmultipath: rename __unlock()
libmultipath: rename __sysfs_attr_get_value()
libmultipath: rename __snprint_foreign_topology()
libmultipath: rename macros with double underscores in propsel.c
libmultipath: rename enum values with double underscores in structs.h
libmultipath: rename macros starting with underscore
libmultipath: rename __internal_config variable
libmultipath: rename _dm_flush_map() to dm_flush_map__()
libmultipath: foreign: rename _check() to check__()
libmultipath: rename _cleanup_foreign()
libmultipath: rename _init_config()
libmultipath: rename symbols starting with underscore in print.h
libmultipath: remove dead code in pgpolicies.h
libmultipath: remove struct and union names in cciss.h
libmpathpersist: rename functions with double leading underscore
libdmmp: rename macros starting with _DMMP
libdmmp: rename enum values and variables starting with _DMMP_
libdmmp: rename non-static functions starting with underscore
multipathd: rename symbols with double leading underscore multipath-tools tests: rename functions with double underscores
kpartx: rename macros with leading underscores
libmpathutil: rename struct _vector to vector_s
libmultipath: don't define __user
create-config.mk | 4 +- kpartx/byteorder.h | 6 +- kpartx/crc32.h | 6 +- kpartx/dasd.h | 6 +- kpartx/devmapper.c | 20 +++--- kpartx/devmapper.h | 6 +- kpartx/dos.h | 2 +- kpartx/efi.h | 6 +- kpartx/gpt.h | 4 +- kpartx/kpartx.h | 6 +- kpartx/lopart.h | 3 + kpartx/mac.h | 4 +- kpartx/xstrncpy.h | 3 + libdmmp/libdmmp.c | 72 +++++++++---------- libdmmp/libdmmp/libdmmp.h | 6 +- libdmmp/libdmmp_misc.c | 10 +-- libdmmp/libdmmp_mp.c | 12 ++-- libdmmp/libdmmp_path.c | 22 +++--- libdmmp/libdmmp_pg.c | 40 +++++------ libdmmp/libdmmp_private.h | 32 ++++----- libmpathcmd/libmpathcmd.version | 4 +- libmpathcmd/mpath_cmd.c | 4 +- libmpathcmd/mpath_cmd.h | 8 +-- libmpathpersist/libmpathpersist.version | 6 +- libmpathpersist/mpath_persist.c | 22 +++--- libmpathpersist/mpath_persist.h | 45 ++++++------ libmpathpersist/mpath_persist_int.h | 6 +- libmpathpersist/mpath_pr_ioctl.h | 5 ++ libmpathpersist/mpathpr.h | 4 +- libmpathutil/debug.h | 6 +- libmpathutil/globals.h | 4 +- libmpathutil/libmpathutil.version | 90 ++++++++++-------------- libmpathutil/log.h | 6 +- libmpathutil/log_pthread.c | 2 +- libmpathutil/log_pthread.h | 6 +- libmpathutil/msort.h | 4 +- libmpathutil/parser.c | 6 +- libmpathutil/parser.h | 32 ++++----- libmpathutil/strbuf.c | 29 +++++--- libmpathutil/strbuf.h | 10 +-- libmpathutil/time-util.h | 6 +- libmpathutil/util.c | 6 +- libmpathutil/util.h | 25 ++++--- libmpathutil/uxsock.h | 7 +- libmpathutil/vector.c | 2 +- libmpathutil/vector.h | 10 +-- libmpathvalid/mpath_valid.h | 6 +- libmultipath/alias.c | 4 +- libmultipath/alias.h | 6 +- libmultipath/blacklist.c | 14 ++-- libmultipath/blacklist.h | 14 ++-- libmultipath/checkers.h | 8 +-- libmultipath/checkers/cciss.h | 22 +++--- libmultipath/checkers/directio.c | 8 +-- libmultipath/checkers/directio.h | 6 +- libmultipath/checkers/emc_clariion.c | 20 +++--- libmultipath/checkers/emc_clariion.h | 6 +- libmultipath/checkers/hp_sw.h | 6 +- libmultipath/checkers/rdac.c | 20 +++--- libmultipath/checkers/rdac.h | 6 +- libmultipath/checkers/readsector0.h | 6 +- libmultipath/checkers/tur.c | 10 +-- libmultipath/checkers/tur.h | 6 +- libmultipath/config.c | 30 ++++---- libmultipath/config.h | 10 +-- libmultipath/configure.c | 2 +- libmultipath/configure.h | 6 +- libmultipath/defaults.h | 7 +- libmultipath/devmapper.c | 28 ++++---- libmultipath/devmapper.h | 27 +++---- libmultipath/dict.c | 4 +- libmultipath/dict.h | 9 +-- libmultipath/discovery.c | 18 ++--- libmultipath/discovery.h | 38 +++++----- libmultipath/dm-generic.c | 8 +-- libmultipath/dm-generic.h | 6 +- libmultipath/dmparser.c | 2 +- libmultipath/dmparser.h | 7 +- libmultipath/file.h | 6 +- libmultipath/foreign.c | 36 +++++----- libmultipath/foreign.h | 19 ++--- libmultipath/foreign/nvme.c | 50 ++++++------- libmultipath/generic.h | 14 ++-- libmultipath/hwtable.h | 6 +- libmultipath/io_err_stat.c | 4 +- libmultipath/io_err_stat.h | 6 +- libmultipath/libmultipath.version | 20 +++--- libmultipath/libsg.h | 6 +- libmultipath/list.h | 6 +- libmultipath/lock.c | 4 +- libmultipath/lock.h | 8 +-- libmultipath/nvme-lib.c | 2 +- libmultipath/nvme-lib.h | 8 +-- libmultipath/nvme/argconfig.h | 4 +- libmultipath/nvme/json.h | 4 +- libmultipath/nvme/linux/nvme.h | 6 +- libmultipath/nvme/linux/nvme_ioctl.h | 6 +- libmultipath/nvme/nvme-ioctl.h | 6 +- libmultipath/nvme/nvme.h | 6 +- libmultipath/nvme/plugin.h | 4 +- libmultipath/pgpolicies.h | 10 +-- libmultipath/print.c | 68 +++++++++--------- libmultipath/print.h | 34 ++++----- libmultipath/prio.h | 6 +- libmultipath/prioritizers/alua.h | 4 +- libmultipath/prioritizers/alua_rtpg.c | 1 - libmultipath/prioritizers/alua_rtpg.h | 6 +- libmultipath/prioritizers/alua_spc3.h | 6 +- libmultipath/prioritizers/weightedpath.h | 4 +- libmultipath/prkey.h | 6 +- libmultipath/propsel.c | 10 +-- libmultipath/propsel.h | 3 + libmultipath/sg_include.h | 4 +- libmultipath/structs.c | 12 ++-- libmultipath/structs.h | 22 +++--- libmultipath/structs_vec.c | 2 +- libmultipath/structs_vec.h | 8 +-- libmultipath/switchgroup.h | 5 ++ libmultipath/sysfs.c | 6 +- libmultipath/sysfs.h | 4 +- libmultipath/uevent.h | 6 +- libmultipath/unaligned.h | 6 +- libmultipath/valid.c | 14 ++-- libmultipath/valid.h | 6 +- libmultipath/version.h | 6 +- libmultipath/wwids.h | 6 +- mpathpersist/main.c | 6 +- mpathpersist/main.h | 4 ++ multipathd/cli.c | 6 +- multipathd/cli.h | 16 ++--- multipathd/cli_handlers.c | 8 +-- multipathd/cli_handlers.h | 4 +- multipathd/dmevents.c | 2 +- multipathd/dmevents.h | 6 +- multipathd/fpin.h | 4 +- multipathd/init_unwinder.h | 4 +- multipathd/main.c | 36 +++++----- multipathd/main.h | 6 +- multipathd/pidfile.h | 4 ++ multipathd/uxclnt.h | 5 ++ multipathd/uxlsnr.c | 6 +- multipathd/uxlsnr.h | 4 +- multipathd/waiter.c | 2 +- multipathd/waiter.h | 6 +- tests/alias.c | 64 +++++++++++------ tests/mpathvalid.c | 2 +- tests/strbuf.c | 80 +++++++++++++++++++-- tests/sysfs.c | 20 +++--- tests/test-lib.c | 4 +- tests/test-lib.h | 20 +++--- tests/test-log.h | 4 +- tests/valid.c | 16 ++--- tests/wrap64.h | 4 +- 153 files changed, 981 insertions(+), 853 deletions(-)
Signature · 1 line
2.46.0
PATCH 1/41 multipath-tools tests: make alias.test succeed with increased verbosity
With MPATHTEST_VERBOSITY > 3, the alias test fails because of an unexpected message at verbosity level 4. Fix it.
--- tests/alias.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
tests/alias.c +22 -0
@@ -1438,6 +1438,7 @@ static void gufa_empty_new_rw(void **state) {mock_bindings_file ("" );mock_unused_alias ("MPATHa" ); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,NOMATCH_WWID_STR ("WWID0" ));mock_allocate_binding ("MPATHa" ,"WWID0" );
@@ -1451,6 +1452,7 @@ static void gufa_empty_new_ro_1(void **state) {mock_bindings_file ("" );mock_unused_alias ("MPATHa" ); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,NOMATCH_WWID_STR ("WWID0" ));mock_allocate_binding_err ("MPATHa" ,"WWID0" , -EROFS ,"Read-only file system" );
@@ -1462,6 +1464,7 @@ static void gufa_empty_new_ro_2(void **state) {char *alias;mock_bindings_file ("" ); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,NOMATCH_WWID_STR ("WWID0" ));mock_unused_alias ("MPATHa" );
@@ -1473,6 +1476,7 @@ static void gufa_match_a_unused(void **state) {char *alias;mock_bindings_file ("MPATHa WWID0" ); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,FOUND_STR ("MPATHa" ,"WWID0" ));mock_unused_alias ("MPATHa" );expect_condlog (3 ,EXISTING_STR ("MPATHa" ,"WWID0" ));
@@ -1486,6 +1490,7 @@ static void gufa_match_a_self(void **state) {char *alias;mock_bindings_file ("MPATHa WWID0" ); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,FOUND_STR ("MPATHa" ,"WWID0" ));mock_self_alias ("MPATHa" ,"WWID0" );expect_condlog (3 ,EXISTING_STR ("MPATHa" ,"WWID0" ));
@@ -1500,6 +1505,7 @@ static void gufa_match_a_used(void **state) {mock_bindings_file ("MPATHa WWID0" ); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,FOUND_STR ("MPATHa" ,"WWID0" ));mock_used_alias ("MPATHa" ,"WWID0" );
@@ -1514,6 +1520,7 @@ static void gufa_nomatch_a_c(void **state) {mock_bindings_file (bindings);mock_unused_alias ("MPATHb" ); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,NOMATCH_WWID_STR ("WWID1" ));mock_allocate_binding_len ("MPATHb" ,"WWID1" ,strlen (bindings));
@@ -1530,6 +1537,7 @@ static void gufa_nomatch_c_a(void **state) {mock_bindings_file (bindings);mock_unused_alias ("MPATHb" ); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,NOMATCH_WWID_STR ("WWID1" ));mock_allocate_binding_len ("MPATHb" ,"WWID1" ,sizeof (bindings) -1 );
@@ -1545,6 +1553,7 @@ static void gufa_nomatch_c_b(void **state) { "MPATHb WWID1\n");mock_bindings_file (bindings); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,NOMATCH_WWID_STR ("WWID0" ));mock_unused_alias ("MPATHa" );
@@ -1561,6 +1570,7 @@ static void gufa_nomatch_c_b_used(void **state) { "MPATHb WWID1\n");mock_bindings_file (bindings); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,NOMATCH_WWID_STR ("WWID4" ));mock_used_alias ("MPATHa" ,"WWID4" );mock_unused_alias ("MPATHd" );
@@ -1579,6 +1589,7 @@ static void gufa_nomatch_b_f_a(void **state) { "MPATHa WWID0\n");mock_bindings_file (bindings); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,NOMATCH_WWID_STR ("WWID7" ));mock_unused_alias ("MPATHc" );
@@ -1595,6 +1606,7 @@ static void gufa_nomatch_b_aa_a(void **state) {fill_bindings (&buf,0 ,26 );mock_bindings_file (get_strbuf_str (&buf)); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,NOMATCH_WWID_STR ("WWID28" ));mock_unused_alias ("MPATHab" );mock_allocate_binding_len ("MPATHab" ,"WWID28" ,get_strbuf_len (&buf));
@@ -1611,6 +1623,7 @@ static void gufa_nomatch_b_f_a_sorted(void **state) { "MPATHa WWID0\n");mock_bindings_file (bindings); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,NOMATCH_WWID_STR ("WWID7" ));mock_unused_alias ("MPATHc" );
@@ -1626,6 +1639,7 @@ static void gufa_old_empty(void **state) {/* rlookup_binding for ALIAS */ mock_bindings_file ("" ); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,NOMATCH_STR ("MPATHz" ));expect_condlog (3 ,NOMATCH_WWID_STR ("WWID0" ));
@@ -1642,6 +1656,7 @@ static void gufa_old_match(void **state) {mock_bindings_file ("MPATHb WWID1\n" "MPATHz WWID0" ); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,FOUND_ALIAS_STR ("MPATHz" ,"WWID0" )); alias =get_user_friendly_alias ("WWID0" ,"MPATHz" ,"MPATH" , false);
@@ -1654,6 +1669,7 @@ static void gufa_old_match_other(void **state) {static const char bindings[] ="MPATHz WWID9\n" ;mock_bindings_file (bindings); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,FOUND_ALIAS_STR ("MPATHz" ,"WWID9" ));expect_condlog (0 ,REUSE_STR ("MPATHz" ,"WWID9" ));expect_condlog (3 ,NOMATCH_WWID_STR ("WWID0" ));
@@ -1671,6 +1687,7 @@ static void gufa_old_match_other_used(void **state) {static const char bindings[] ="MPATHz WWID9\n" ;mock_bindings_file (bindings); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,FOUND_ALIAS_STR ("MPATHz" ,"WWID9" ));expect_condlog (0 ,REUSE_STR ("MPATHz" ,"WWID9" ));expect_condlog (3 ,NOMATCH_WWID_STR ("WWID0" ));
@@ -1689,6 +1706,7 @@ static void gufa_old_match_other_wwidmatch(void **state) { "MPATHc WWID2");mock_bindings_file (bindings); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,FOUND_ALIAS_STR ("MPATHz" ,"WWID9" ));expect_condlog (0 ,REUSE_STR ("MPATHz" ,"WWID9" ));expect_condlog (3 ,FOUND_STR ("MPATHc" ,"WWID2" ));
@@ -1706,6 +1724,7 @@ static void gufa_old_match_other_wwidmatch_used(void **state) { "MPATHc WWID2");mock_bindings_file (bindings); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,FOUND_ALIAS_STR ("MPATHz" ,"WWID9" ));expect_condlog (0 ,REUSE_STR ("MPATHz" ,"WWID9" ));expect_condlog (3 ,FOUND_STR ("MPATHc" ,"WWID2" ));
@@ -1720,6 +1739,7 @@ static void gufa_old_nomatch_wwidmatch(void **state) {static const char bindings[] ="MPATHa WWID0" ;mock_bindings_file (bindings); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,NOMATCH_STR ("MPATHz" ));expect_condlog (3 ,FOUND_STR ("MPATHa" ,"WWID0" ));mock_unused_alias ("MPATHa" );
@@ -1735,6 +1755,7 @@ static void gufa_old_nomatch_wwidmatch_used(void **state) {static const char bindings[] ="MPATHa WWID0" ;mock_bindings_file (bindings); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,NOMATCH_STR ("MPATHz" ));expect_condlog (3 ,FOUND_STR ("MPATHa" ,"WWID0" ));mock_used_alias ("MPATHa" ,"WWID0" );
@@ -1748,6 +1769,7 @@ static void gufa_old_nomatch_nowwidmatch(void **state) {static const char bindings[] ="MPATHb WWID1\n" ;mock_bindings_file (bindings); +expect_condlog (4 ,"_read_bindings_file: bindings are unchanged" );expect_condlog (3 ,NOMATCH_STR ("MPATHz" ));expect_condlog (3 ,NOMATCH_WWID_STR ("WWID0" ));
Signature · 1 line
2.46.0
PATCH 2/41 libmpathutil: avoid extra memory allocation in print_strbuf()
In reply to Martin WilckInstead of allocating a temporary buffer with vasprintf() and copying its contents to the strbuf, try to print directly into the strbuf and use the return value to expand the buffer if necessary. This saves a memory allocation on every invocation of print_strbuf(), and thus reduces the likelihood of failure and at the same time increases efficiency. We need an extra call to vsnprintf() if the buffer must be expanded, but vasprintf() will need to re-process the input internally as well after determining the required buffer size, therefore this probably won't hurt much.
Add some more tests for print_strbuf() to make sure this works as intended.
--- libmpathutil/strbuf.c | 23 +++++++++++---- tests/strbuf.c | 68 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 5 deletions(-)
libmpathutil/strbuf.c +18 -5
@@ -196,17 +196,30 @@ int print_strbuf(struct strbuf *buf, const char *fmt, ...) {va_list ap;int ret; -char *tail; +size_t space = buf->size - buf->offs;va_start (ap, fmt); - ret =vasprintf (&tail, fmt, ap); + ret =vsnprintf (buf->buf + buf->offs, space, fmt, ap);va_end (ap);if (ret <0 ) -return -ENOMEM ; +return ret; +else if ((size_t )ret < space) { + buf->offs += ret; +return ret; + } - ret =__append_strbuf_str (buf, tail, ret); + ret =expand_strbuf (buf, ret); +if (ret <0 ) +return ret; + + space = buf->size - buf->offs; +va_start (ap, fmt); + ret =vsnprintf (buf->buf + buf->offs, space, fmt, ap); +va_end (ap); + +if (ret >=0 ) + buf->offs += ret; -free (tail);return ret; }
tests/strbuf.c +68 -0
80 lines not on this page · raw message
Signature · 1 line
2.46.0
PATCH 3/41 libmpathutil: rename strlcat and strlcpy
In reply to Martin WilckUser programs are forbidden to use names of functions provided by the standard library [1]. Since glibc 2.38, strlcpy() and strlcat() are part of the system library. Rename our own functions to libmp_strlcpy() and libmp_strlcat(), respectively, and only use the short names if the C library doesn't have them.
It turns out that msul libc has always had strlcat() and strlcpy(), so use the system library function with musl, too.
[1] https://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html
--- libmpathutil/util.c | 4 ++-- libmpathutil/util.h | 15 ++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-)
libmpathutil/util.c +2 -2
@@ -121,7 +121,7 @@ get_word (const char *sentence, char **word)return skip + len; } -size_t strlcpy (char * restrict dst,const char * restrict src,size_t size) +size_t libmp_strlcpy (char * restrict dst,const char * restrict src,size_t size) {size_t bytes =0 ;char ch;
@@ -138,7 +138,7 @@ size_t strlcpy(char * restrict dst, const char * restrict src, size_t size)return bytes; } -size_t strlcat (char * restrict dst,const char * restrict src,size_t size) +size_t libmp_strlcat (char * restrict dst,const char * restrict src,size_t size) {size_t bytes =0 ;char ch;
libmpathutil/util.h +10 -5
@@ -12,6 +12,10 @@#include <stdio.h> #include <libudev.h> +#ifndef __GLIBC_PREREQ +#define __GLIBC_PREREQ (x, y) 0 +#endif +size_t strchop (char *);const char *libmp_basename (const char *filename);
@@ -22,8 +26,12 @@ int basenamecpy (const char *src, char *dst, size_t size);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 * restrict dst,const char * restrict src,size_t size); -size_t strlcat (char * restrict dst,const char * restrict src,size_t size); +size_t libmp_strlcpy (char * restrict dst,const char * restrict src,size_t size); +size_t libmp_strlcat (char * restrict dst,const char * restrict src,size_t size); +#if defined(__GLIBC__) && ! (__GLIBC_PREREQ (2 ,38 )) +#define strlcpy (dst, src, size) libmp_strlcpy(dst, src, size) +#define strlcat (dst, src, size) libmp_strlcat(dst, src, size) +#endif dev_t parse_devt (const char *dev_t);char *convert_dev (char *dev,int is_path_device);void setup_thread_attr (pthread_attr_t *attr,size_t stacksize,int detached);
@@ -62,9 +70,6 @@ struct scandir_result { };void free_scandir_result (struct scandir_result *); -#ifndef __GLIBC_PREREQ -#define __GLIBC_PREREQ (x, y) 0 -#endif /* * ffsll() is also available on glibc < 2.27 if _GNU_SOURCE is defined. * But relying on that would require that every program using this header file
Signature · 1 line
2.46.0
PATCH 4/41 libmpathutil.version: remove strlcpy and strlcat, and LIBMULTIPATH section
In reply to Martin WilckWith the removal of strlcpy from the "symbols referenced by multipath and multipathd" section, this part of the ABI (which is actually the part of LIBMULTIPATH_16.0.0 which was moved to libmpathutil and exported to multipath and/or multipathd) has now changed for the first time since the split between libmpathutil and libmultipath.
It makes no sense to further track whether or not any symbols exported by libmpathutil are used by multipath or multipathd. It turns out that both executables were already using some symbols from the sections that were supposedly used by libmultipath only.
Therefore, move all symbols to the new LIBMPATHUTIL_4.0 ABI.
--- libmpathutil/libmpathutil.version | 104 +++++++++++++----------------- 1 file changed, 46 insertions(+), 58 deletions(-)
libmpathutil/libmpathutil.version +46 -58
@@ -43,98 +43,86 @@ LIBMPATHCOMMON_1.0.0 { put_multipath_config; }; -/* symbols referenced by multipath and multipathd */ -LIBMULTIPATH_16.0.0 { +LIBMPATHUTIL_4.0 { global: + alloc_bitfield; alloc_strvec; + __append_strbuf_str; append_strbuf_str; + append_strbuf_quoted; + basenamecpy; cleanup_charp; + cleanup_fclose; + cleanup_fd_ptr; + cleanup_free_ptr; cleanup_mutex; cleanup_ucharp; + cleanup_udev_device; + cleanup_vector; + cleanup_vector_free; convert_dev; dlog; + filepresent; fill_strbuf; + find_keyword; find_slot; + free_keywords; free_scandir_result; free_strvec; + get_linux_version_code; get_monotonic_time; + __get_strbuf_buf; get_next_string; get_strbuf_len; get_strbuf_str; - is_quote; - libmp_verbosity; - log_thread_reset; - log_thread_start; - log_thread_stop; - logsink; - normalize_timespec; - print_strbuf; - pthread_cond_init_mono; - recv_packet; - reset_strbuf; - send_packet; - set_max_fds; - setup_thread_attr; - strchop; - strlcpy; - timespeccmp; - timespecsub; - truncate_strbuf; - ux_socket_listen; - vector_alloc; - vector_alloc_slot; - vector_del_slot; - vector_free; - vector_reset; - vector_set_slot; - -local: - *; -}; - -/* symbols referenced internally by libmultipath */ -LIBMPATHUTIL_2.0 { - alloc_bitfield; - __append_strbuf_str; - append_strbuf_quoted; - basenamecpy; - cleanup_fd_ptr; - cleanup_free_ptr; - cleanup_vector_free; - cleanup_fclose; - filepresent; - find_keyword; - free_keywords; - get_linux_version_code; - __get_strbuf_buf; get_word; _install_keyword; install_sublevel; install_sublevel_end; + is_quote; keyword_alloc; _log_bitfield_overflow; + libmp_basename; + libmp_strlcat; + libmp_strlcpy; + libmp_verbosity; log_safe; + log_thread_reset; + log_thread_start; + log_thread_stop; + logsink; msort; + normalize_timespec; parse_devt; + print_strbuf; process_file; + pthread_cond_init_mono; + recv_packet; + reset_strbuf; safe_write; + send_packet; + set_max_fds; set_value; + setup_thread_attr; + strchop; should_exit; snprint_keyword; steal_strbuf_str; - strlcat; + timespeccmp; + timespecsub; + truncate_strbuf; validate_config_strvec; + ux_socket_listen; + vector_alloc; + vector_alloc_slot; + vector_del_slot; vector_find_or_add_slot; + vector_free; vector_insert_slot; vector_move_up; + vector_reset; + vector_set_slot; vector_sort; -}; - -LIBMPATHUTIL_2.1 { - libmp_basename; -}; - -LIBMPATHUTIL_2.2 { - cleanup_udev_device; - cleanup_vector; +local: + *; };
Signature · 1 line
2.46.0
PATCH 5/41 libmpathutil: fix __attribute typo in log_pthread.c
In reply to Martin Wilck--- libmpathutil/log_pthread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libmpathutil/log_pthread.c +1 -1
@@ -60,7 +60,7 @@ static void flush_logqueue (void) }while (empty ==0 ); } -static void cleanup_log_thread (__attribute((unused))void *arg) +static void cleanup_log_thread (__attribute__((unused))void *arg) {logdbg (stderr,"log thread exiting" );pthread_mutex_lock (&logev_lock);
Signature · 1 line
2.46.0
PATCH 6/41 libmultipath: devmapper.c: rename __DR_UNUSED__, and fix __attribute typo
In reply to Martin Wilck--- libmultipath/devmapper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
libmultipath/devmapper.c +4 -4
@@ -45,9 +45,9 @@ static int dm_conf_verbosity;#ifdef LIBDM_API_DEFERRED static int dm_cancel_remove_partmaps (const char * mapname); -#define __DR_UNUSED__/* empty */ +#define DR_UNUSED__ /* empty */ #else -#define __DR_UNUSED__ __attribute__((unused)) +#define DR_UNUSED__ __attribute__((unused))#endif static int dm_remove_partmaps (const char *mapname,int flags);
@@ -1041,7 +1041,7 @@ int _dm_flush_map (const char *mapname, int flags, int retries) }int -dm_flush_map_nopaths(const char *mapname, int deferred_remove __DR_UNUSED__) +dm_flush_map_nopaths(const char *mapname, int deferred_remove DR_UNUSED__) {int flags =DMFL_NEED_SYNC ;
@@ -1196,7 +1196,7 @@ dm_disablegroup(const char * mapname, int index)static int dm_get_multipath (const char *name,struct multipath **pmpp) { -struct multipath __attribute((cleanup (cleanup_multipath))) *mpp =NULL ; +struct multipath __attribute__((cleanup (cleanup_multipath))) *mpp =NULL ;char uuid[DM_UUID_LEN ];int rc;
Signature · 1 line
2.46.0
PATCH 7/41 multipathd: fix __attribute typo
In reply to Martin Wilck--- multipathd/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
multipathd/main.c +1 -1
@@ -1220,7 +1220,7 @@ int ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map) { struct multipath * mpp; - char *params __attribute((cleanup(cleanup_charp))) = NULL; + char *params __attribute__((cleanup(cleanup_charp))) = NULL;int retries =3 ;int start_waiter =0 ;int ret;
Signature · 1 line
2.46.0
PATCH 8/41 multipath-tools: use common convention for "header file included" macros
In reply to Martin WilckUser code shouldn't define any identifiers starting with 2 underscores, or underscore + capital letter [1]. Adopt this convention for all macros indicating that a certain header file is included. Moreover, use a common convention for constructing these macros: the macro is the base name of the header file, in capital letters, non-alphanumeric characters replaced by underscore, with "_INCLUDED" appended. This convention is well readable and was already used in a few files.
The only exceptions to this rule are:
- the header files under libmultipath/nvme and libmultipath/nvme/linux, where "NVME_" or "LINUX_" is prepended to the base name, respectively;
- the files "byteorder.h" and "devmapper.h" under kpartx/, to avoid ambiguity with the files by the same name under libmultipath;
- "main.h" for mpathpersist, to avoid ambiguity with multipathd's main.h.
This commit also adds "already included" macros where they'd been missing so far.
[1] https://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html
--- create-config.mk | 4 ++-- kpartx/byteorder.h | 6 +++--- kpartx/crc32.h | 6 +++--- kpartx/dasd.h | 6 +++--- kpartx/devmapper.h | 6 +++--- kpartx/dos.h | 2 +- kpartx/efi.h | 6 +++--- kpartx/gpt.h | 4 ++-- kpartx/kpartx.h | 6 +++--- kpartx/lopart.h | 3 +++ kpartx/mac.h | 4 ++-- kpartx/xstrncpy.h | 3 +++ libdmmp/libdmmp/libdmmp.h | 6 +++--- libdmmp/libdmmp_private.h | 6 +++--- libmpathcmd/mpath_cmd.h | 6 +++--- libmpathpersist/mpath_persist.h | 6 +++--- libmpathpersist/mpath_persist_int.h | 6 +++--- libmpathpersist/mpath_pr_ioctl.h | 5 +++++ libmpathpersist/mpathpr.h | 4 ++-- libmpathutil/debug.h | 6 +++--- libmpathutil/globals.h | 4 ++-- libmpathutil/log.h | 6 +++--- libmpathutil/log_pthread.h | 6 +++--- libmpathutil/msort.h | 4 ++-- libmpathutil/parser.h | 4 ++-- libmpathutil/strbuf.h | 4 ++-- libmpathutil/time-util.h | 6 +++--- libmpathutil/util.h | 6 +++--- libmpathutil/uxsock.h | 5 ++++- libmpathutil/vector.h | 4 ++-- libmpathvalid/mpath_valid.h | 6 +++--- libmultipath/alias.h | 6 +++--- libmultipath/blacklist.h | 6 +++--- libmultipath/checkers.h | 6 +++--- libmultipath/checkers/cciss.h | 4 ++-- libmultipath/checkers/directio.h | 6 +++--- libmultipath/checkers/emc_clariion.h | 6 +++--- libmultipath/checkers/hp_sw.h | 6 +++--- libmultipath/checkers/rdac.h | 6 +++--- libmultipath/checkers/readsector0.h | 6 +++--- libmultipath/checkers/tur.h | 6 +++--- libmultipath/config.h | 4 ++-- libmultipath/configure.h | 4 ++++ libmultipath/defaults.h | 7 ++++--- libmultipath/devmapper.h | 7 ++++--- libmultipath/dict.h | 9 +++------ libmultipath/discovery.h | 6 +++--- libmultipath/dm-generic.h | 6 +++--- libmultipath/dmparser.h | 5 +++++ libmultipath/file.h | 6 +++--- libmultipath/foreign.h | 7 ++++--- libmultipath/generic.h | 6 +++--- libmultipath/hwtable.h | 6 +++--- libmultipath/io_err_stat.h | 6 +++--- libmultipath/libsg.h | 6 +++--- libmultipath/list.h | 6 +++--- libmultipath/lock.h | 6 +++--- libmultipath/nvme-lib.h | 6 +++--- libmultipath/nvme/argconfig.h | 4 ++-- libmultipath/nvme/json.h | 4 ++-- libmultipath/nvme/linux/nvme.h | 6 +++--- libmultipath/nvme/linux/nvme_ioctl.h | 6 +++--- libmultipath/nvme/nvme-ioctl.h | 6 +++--- libmultipath/nvme/nvme.h | 6 +++--- libmultipath/nvme/plugin.h | 4 ++-- libmultipath/pgpolicies.h | 4 ++-- libmultipath/print.h | 6 +++--- libmultipath/prio.h | 6 +++--- libmultipath/prioritizers/alua.h | 4 ++-- libmultipath/prioritizers/alua_rtpg.h | 6 +++--- libmultipath/prioritizers/alua_spc3.h | 6 +++--- libmultipath/prioritizers/weightedpath.h | 4 ++-- libmultipath/prkey.h | 6 +++--- libmultipath/propsel.h | 3 +++ libmultipath/sg_include.h | 3 +++ libmultipath/structs.h | 6 +++--- libmultipath/structs_vec.h | 6 +++--- libmultipath/switchgroup.h | 5 +++++ libmultipath/sysfs.h | 4 ++-- libmultipath/uevent.h | 6 +++--- libmultipath/unaligned.h | 6 +++--- libmultipath/valid.h | 6 +++--- libmultipath/version.h | 6 +++--- libmultipath/wwids.h | 6 +++--- mpathpersist/main.h | 4 ++++ multipathd/cli.h | 6 +++--- multipathd/cli_handlers.h | 4 ++-- multipathd/dmevents.h | 6 +++--- multipathd/fpin.h | 4 ++-- multipathd/init_unwinder.h | 4 ++-- multipathd/main.h | 6 +++--- multipathd/pidfile.h | 4 ++++ multipathd/uxclnt.h | 5 +++++ multipathd/uxlsnr.h | 4 ++-- multipathd/waiter.h | 6 +++--- tests/test-lib.h | 4 ++-- tests/test-log.h | 4 ++-- tests/wrap64.h | 4 ++-- 98 files changed, 282 insertions(+), 235 deletions(-)
create-config.mk +2 -2
@@ -163,8 +163,8 @@ all: $(TOPDIR)/config.mk $(multipathdir)/autoconfig.h: @echo creating $@ - @echo '#ifndef _AUTOCONFIG_H' >$@ - @echo '#define _AUTOCONFIG_H' >>$@ + @echo '#ifndef AUTOCONFIG_H_INCLUDED' >$@ + @echo '#define AUTOCONFIG_H_INCLUDED' >>$@ @for x in $(DEFINES); do echo "#define $$x" >>$@; done @echo '#endif' >>$@
kpartx/byteorder.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef BYTEORDER_H_INCLUDED -#define BYTEORDER_H_INCLUDED +#ifndef KPARTX_BYTEORDER_H_INCLUDED +#define KPARTX_BYTEORDER_H_INCLUDED #ifdef __linux__# include <endian.h>
@@ -26,4 +26,4 @@# error unsupported#endif -#endif /* BYTEORDER_H_INCLUDED */ +#endif /* KPARTX_BYTEORDER_H_INCLUDED */
kpartx/crc32.h +3 -3
@@ -1,8 +1,8 @@/* * crc32.h */ -#ifndef _CRC32_H -#define _CRC32_H +#ifndef CRC32_H_INCLUDED +#define CRC32_H_INCLUDED #include <inttypes.h> #include <stdlib.h>
@@ -16,4 +16,4 @@ extern uint32_t crc32_be(uint32_t crc, unsigned char const *p, size_t len);#define ether_crc_le (length, data) crc32_le(~0, data, length)#define ether_crc (length, data) crc32_be(~0, data, length) -#endif /* _CRC32_H */ +#endif /* CRC32_H_INCLUDED */
kpartx/dasd.h +3 -3
@@ -22,8 +22,8 @@* along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef _DASD_H -#define _DASD_H +#ifndef DASD_H_INCLUDED +#define DASD_H_INCLUDED typedef struct ttr {
@@ -289,4 +289,4 @@ cchhb2blk (cchhb_t *ptr, struct hd_geometry *geo) ptr->b; } -#endif /* _DASD_H */ +#endif /* DASD_H_INCLUDED */
kpartx/devmapper.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _KPARTX_DEVMAPPER_H -#define _KPARTX_DEVMAPPER_H +#ifndef KPARTX_DEVMAPPER_H_INCLUDED +#define KPARTX_DEVMAPPER_H_INCLUDED #ifdef DM_SUBSYSTEM_UDEV_FLAG0 #define MPATH_UDEV_RELOAD_FLAG DM_SUBSYSTEM_UDEV_FLAG0
@@ -36,4 +36,4 @@ int dm_find_part(const char *parent, const char *delim, int part,char *nondm_create_uuid (dev_t devt);int nondm_parse_uuid (const char *uuid,unsigned int *major,unsigned int *minor); -#endif /* _KPARTX_DEVMAPPER_H */ +#endif /* KPARTX_DEVMAPPER_H_INCLUDED */
kpartx/dos.h +1 -1
@@ -10,4 +10,4 @@ struct partition {unsigned int nr_sects; } __attribute__((packed)); -#endif /* DOS_H_INCLUDED */ +#endif /* DOS_H_INCLUDED */
kpartx/efi.h +3 -3
@@ -17,8 +17,8 @@along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef EFI_H -#define EFI_H +#ifndef EFI_H_INCLUDED +#define EFI_H_INCLUDED /* * Extensible Firmware Interface
@@ -54,4 +54,4 @@ efi_guidcmp(efi_guid_t left, efi_guid_t right)typedef uint16_t efi_char16_t ;/* UNICODE character */ -#endif /* EFI_H */ +#endif /* EFI_H_INCLUDED */
kpartx/gpt.h +2 -2
@@ -21,8 +21,8 @@along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef _GPT_H -#define _GPT_H +#ifndef GPT_H_INCLUDED +#define GPT_H_INCLUDED #include <inttypes.h>
kpartx/kpartx.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _KPARTX_H -#define _KPARTX_H +#ifndef KPARTX_H_INCLUDED +#define KPARTX_H_INCLUDED #include <stddef.h> #include <stdint.h>
@@ -70,4 +70,4 @@ four2int(unsigned char *p) { return p[0] + (p[1]<<8) + (p[2]<<16) + (p[3]<<24); } -#endif /* _KPARTX_H */ +#endif /* KPARTX_H_INCLUDED */
kpartx/lopart.h +3 -0
@@ -1,4 +1,7 @@ +#ifndef LOPART_H_INCLUDED +#define LOPART_H_INCLUDED extern int verbose;extern int set_loop (char **,const char *,int ,int *);extern int del_loop (const char *);extern char *find_loop_by_file (const char *); +#endif
kpartx/mac.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef MAC_H -#define MAC_H +#ifndef MAC_H_INCLUDED +#define MAC_H_INCLUDED #include <stdint.h>
kpartx/xstrncpy.h +3 -0
@@ -1 +1,4 @@ +#ifndef XSTRNCPY_H_INCLUDED +#define XSTRNCPY_H_INCLUDED extern void xstrncpy (char *dest,const char *src,size_t n); +#endif
libdmmp/libdmmp/libdmmp.h +3 -3
@@ -19,8 +19,8 @@*/ -#ifndef _LIB_DMMP_H_ -#define _LIB_DMMP_H_ +#ifndef LIBDMMP_H_INCLUDED +#define LIBDMMP_H_INCLUDED #include <stdint.h> #include <stdarg.h>
@@ -732,4 +732,4 @@ DMMP_DLL_EXPORT const char *dmmp_last_error_msg(struct dmmp_context *ctx); } /* End of extern "C" */#endif -#endif /* End of _LIB_DMMP_H_ */ +#endif /* End of LIBDMMP_H_INCLUDED */
libdmmp/libdmmp_private.h +3 -3
@@ -18,8 +18,8 @@* Todd Gill <[email protected]> */ -#ifndef _LIB_DMMP_PRIVATE_H_ -#define _LIB_DMMP_PRIVATE_H_ +#ifndef LIBDMMP_PRIVATE_H_INCLUDED +#define LIBDMMP_PRIVATE_H_INCLUDED /* * Notes:
@@ -209,4 +209,4 @@ DMMP_DLL_LOCAL void _dmmp_log_stderr(struct dmmp_context *ctx, int priority, } /* End of extern "C" */#endif -#endif /* End of _LIB_DMMP_PRIVATE_H_ */ +#endif /* End of LIBDMMP_PRIVATE_H_INCLUDED */
libmpathcmd/mpath_cmd.h +3 -3
@@ -17,8 +17,8 @@* along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef LIB_MPATH_CMD_H -#define LIB_MPATH_CMD_H +#ifndef MPATH_CMD_H_INCLUDED +#define MPATH_CMD_H_INCLUDED /* * This should be sufficient for json output for >10000 maps,
@@ -141,4 +141,4 @@ int mpath_recv_reply_data(int fd, char *reply, size_t len,#ifdef __cplusplus }#endif -#endif /* LIB_MPATH_CMD_H */ +#endif /* MPATH_CMD_H_INCLUDED */
libmpathpersist/mpath_persist.h +3 -3
@@ -1,7 +1,7 @@/* version - 1.0 */ -#ifndef MPATH_PERSIST_LIB_H -#define MPATH_PERSIST_LIB_H +#ifndef MPATH_PERSIST_H_INCLUDED +#define MPATH_PERSIST_H_INCLUDED #ifdef __cplusplus
@@ -326,4 +326,4 @@ void mpath_persistent_reserve_free_vecs(void); }#endif -#endif /*MPATH_PERSIST_LIB_H*/ +#endif /* MPATH_PERSIST_H_INCLUDED */
libmpathpersist/mpath_persist_int.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _MPATH_PERSIST_INT_H -#define _MPATH_PERSIST_INT_H +#ifndef MPATH_PERSIST_INT_H_INCLUDED +#define MPATH_PERSIST_INT_H_INCLUDED /* * This header file contains symbols that are used by multipath-tools
@@ -22,4 +22,4 @@ int prout_do_scsi_ioctl( char * dev, int rq_servact, int rq_scope,void dumpHex (const char * ,int len,int no_ascii);int update_map_pr (struct multipath *mpp); -#endif /* _MPATH_PERSIST_INT_H */ +#endif /* MPATH_PERSIST_INT_H_INCLUDED */
libmpathpersist/mpath_pr_ioctl.h +5 -0
@@ -1,3 +1,6 @@ +#ifndef MPATH_PR_IOCTL_H_INCLUDED +#define MPATH_PR_IOCTL_H_INCLUDED +#define MPATH_XFER_HOST_DEV 0/*data transfer from initiator to target */ #define MPATH_XFER_DEV_HOST 1/*data transfer from target to initiator */ #define MPATH_XFER_NONE 2/*no data transfer */
@@ -107,3 +110,5 @@ typedef struct SenseData/* Driver status */ #define DRIVER_OK 0x00 + +#endif
libmpathpersist/mpathpr.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef MPATHPR_H -#define MPATHPR_H +#ifndef MPATHPR_H_INCLUDED +#define MPATHPR_H_INCLUDED /* * This header file contains symbols that are only used by
libmpathutil/debug.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _DEBUG_H -#define _DEBUG_H +#ifndef DEBUG_H_INCLUDED +#define DEBUG_H_INCLUDED void dlog (int prio,const char *fmt, ...) __attribute__((format (printf,2 ,3 )));
@@ -29,4 +29,4 @@ enum { if (__p <= MAX_VERBOSITY && __p <= libmp_verbosity) \ dlog(__p, fmt "\n", ##args); \ } while (0) -#endif /* _DEBUG_H */ +#endif /* DEBUG_H_INCLUDED */
libmpathutil/globals.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef _GLOBALS_H -#define _GLOBALS_H +#ifndef GLOBALS_H_INCLUDED +#define GLOBALS_H_INCLUDED struct config ;
libmpathutil/log.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef LOG_H -#define LOG_H +#ifndef LOG_H_INCLUDED +#define LOG_H_INCLUDED #define DEFAULT_AREA_SIZE 16384#define MAX_MSG_SIZE 256
@@ -40,4 +40,4 @@ int log_dequeue (void *);void log_syslog (void *);void dump_logmsg (void *); -#endif /* LOG_H */ +#endif /* LOG_H_INCLUDED */
libmpathutil/log_pthread.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _LOG_PTHREAD_H -#define _LOG_PTHREAD_H +#ifndef LOG_PTHREAD_H_INCLUDED +#define LOG_PTHREAD_H_INCLUDED #include <pthread.h>
@@ -9,4 +9,4 @@ void log_thread_start(pthread_attr_t *attr);void log_thread_reset (void );void log_thread_stop (void ); -#endif /* _LOG_PTHREAD_H */ +#endif /* LOG_PTHREAD_H_INCLUDED */
libmpathutil/msort.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef __MSORT_H -#define __MSORT_H +#ifndef MSORT_H_INCLUDED +#define MSORT_H_INCLUDED typedef int (*__compar_fn_t )(const void *,const void *);void msort (void *b,size_t n,size_t s,__compar_fn_t cmp);
libmpathutil/parser.h +2 -2
@@ -20,8 +20,8 @@* 2 of the License, or (at your option) any later version. */ -#ifndef _PARSER_H -#define _PARSER_H +#ifndef PARSER_H_INCLUDED +#define PARSER_H_INCLUDED /* system includes */ #include <stdlib.h>
libmpathutil/strbuf.h +2 -2
@@ -2,8 +2,8 @@* Copyright (c) 2021 SUSE LLC * SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef _STRBUF_H -#define _STRBUF_H +#ifndef STRBUF_H_INCLUDED +#define STRBUF_H_INCLUDED #include <errno.h> #include <string.h>
libmpathutil/time-util.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _TIME_UTIL_H_ -#define _TIME_UTIL_H_ +#ifndef TIME_UTIL_H_INCLUDED +#define TIME_UTIL_H_INCLUDED #include <pthread.h>
@@ -12,4 +12,4 @@ void timespecsub(const struct timespec *a, const struct timespec *b, struct timespec *res);int timespeccmp (const struct timespec *a,const struct timespec *b); -#endif /* _TIME_UTIL_H_ */ +#endif /* TIME_UTIL_H_INCLUDED */
libmpathutil/util.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _UTIL_H -#define _UTIL_H +#ifndef UTIL_H_INCLUDED +#define UTIL_H_INCLUDED #include <stdlib.h> #include <string.h>
@@ -147,4 +147,4 @@ void cleanup_charp(char **p);void cleanup_ucharp (unsigned char **p);void cleanup_udev_device (struct udev_device **udd); -#endif /* _UTIL_H */ +#endif /* UTIL_H_INCLUDED */
libmpathutil/uxsock.h +4 -1
@@ -1,7 +1,10 @@/* some prototypes */ +#ifndef UXSOCK_H_INCLUDED +#define UXSOCK_H_INCLUDED +int ux_socket_listen (const char *name);int send_packet (int fd,const char *buf);int recv_packet (int fd,char **buf,unsigned int timeout);#define _MAX_CMD_LEN 512 - +#endif
libmpathutil/vector.h +2 -2
@@ -20,8 +20,8 @@* 2 of the License, or (at your option) any later version. */ -#ifndef _VECTOR_H -#define _VECTOR_H +#ifndef VECTOR_H_INCLUDED +#define VECTOR_H_INCLUDED #include <stdbool.h>
libmpathvalid/mpath_valid.h +3 -3
@@ -17,8 +17,8 @@* along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef LIB_MPATH_VALID_H -#define LIB_MPATH_VALID_H +#ifndef MPATH_VALID_H_INCLUDED +#define MPATH_VALID_H_INCLUDED #ifdef __cplusplus extern "C" {
@@ -152,4 +152,4 @@ int mpathvalid_is_path(const char *name, unsigned int mode, char **wwid,#ifdef __cplusplus }#endif -#endif /* LIB_PATH_VALID_H */ +#endif /* MPATH_VALID_H_INCLUDED */
libmultipath/alias.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _ALIAS_H -#define _ALIAS_H +#ifndef ALIAS_H_INCLUDED +#define ALIAS_H_INCLUDED int valid_alias (const char *alias);int get_user_friendly_wwid (const char *alias,char *buff);
@@ -11,4 +11,4 @@ int check_alias_settings(const struct config *);void cleanup_bindings (void );struct inotify_event ;void handle_bindings_file_inotify (const struct inotify_event *event); -#endif /* _ALIAS_H */ +#endif /* ALIAS_H_INCLUDED */
libmultipath/blacklist.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _BLACKLIST_H -#define _BLACKLIST_H +#ifndef BLACKLIST_H_INCLUDED +#define BLACKLIST_H_INCLUDED #include <libudev.h> #include <regex.h>
@@ -54,4 +54,4 @@ void free_blacklist_device (vector);void merge_blacklist (vector );void merge_blacklist_device (vector ); -#endif /* _BLACKLIST_H */ +#endif /* BLACKLIST_H_INCLUDED */
libmultipath/checkers.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _CHECKERS_H -#define _CHECKERS_H +#ifndef CHECKERS_H_INCLUDED +#define CHECKERS_H_INCLUDED #include <pthread.h> #include "list.h"
@@ -199,4 +199,4 @@ void *libcheck_thread(struct checker_context *ctx);*/ extern const char *libcheck_msgtable[]; -#endif /* _CHECKERS_H */ +#endif /* CHECKERS_H_INCLUDED */
libmultipath/checkers/cciss.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef CCISS_H -#define CCISS_H +#ifndef CCISS_H_INCLUDED +#define CCISS_H_INCLUDED #include <linux/types.h> #include <linux/ioctl.h>
libmultipath/checkers/directio.h +3 -3
@@ -1,8 +1,8 @@ -#ifndef _DIRECTIO_H -#define _DIRECTIO_H +#ifndef DIRECTIO_H_INCLUDED +#define DIRECTIO_H_INCLUDED int directio (struct checker *);int directio_init (struct checker *);void directio_free (struct checker *); -#endif /* _DIRECTIO_H */ +#endif /* DIRECTIO_H_INCLUDED */
libmultipath/checkers/emc_clariion.h +3 -3
@@ -1,8 +1,8 @@ -#ifndef _EMC_CLARIION_H -#define _EMC_CLARIION_H +#ifndef EMC_CLARIION_H_INCLUDED +#define EMC_CLARIION_H_INCLUDED int emc_clariion (struct checker *);int emc_clariion_init (struct checker *);void emc_clariion_free (struct checker *); -#endif /* _EMC_CLARIION_H */ +#endif /* EMC_CLARIION_H_INCLUDED */
libmultipath/checkers/hp_sw.h +3 -3
@@ -1,8 +1,8 @@ -#ifndef _HP_SW_H -#define _HP_SW_H +#ifndef HP_SW_H_INCLUDED +#define HP_SW_H_INCLUDED int hp_sw (struct checker *);int hp_sw_init (struct checker *);void hp_sw_free (struct checker *); -#endif /* _HP_SW_H */ +#endif /* HP_SW_H_INCLUDED */
libmultipath/checkers/rdac.h +3 -3
@@ -1,8 +1,8 @@ -#ifndef _RDAC_H -#define _RDAC_H +#ifndef RDAC_H_INCLUDED +#define RDAC_H_INCLUDED int rdac (struct checker *);int rdac_init (struct checker *);void rdac_free (struct checker *); -#endif /* _RDAC_H */ +#endif /* RDAC_H_INCLUDED */
libmultipath/checkers/readsector0.h +3 -3
@@ -1,8 +1,8 @@ -#ifndef _READSECTOR0_H -#define _READSECTOR0_H +#ifndef READSECTOR0_H_INCLUDED +#define READSECTOR0_H_INCLUDED int readsector0 (struct checker *);int readsector0_init (struct checker *);void readsector0_free (struct checker *); -#endif /* _READSECTOR0_H */ +#endif /* READSECTOR0_H_INCLUDED */
libmultipath/checkers/tur.h +3 -3
@@ -1,8 +1,8 @@ -#ifndef _TUR_H -#define _TUR_H +#ifndef TUR_H_INCLUDED +#define TUR_H_INCLUDED int tur (struct checker *);int tur_init (struct checker *);void tur_free (struct checker *); -#endif /* _TUR_H */ +#endif /* TUR_H_INCLUDED */
libmultipath/config.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef _CONFIG_H -#define _CONFIG_H +#ifndef CONFIG_H_INCLUDED +#define CONFIG_H_INCLUDED #include <sys/types.h> #include <stdint.h>
libmultipath/configure.h +4 -0
@@ -1,3 +1,6 @@ +#ifndef CONFIGURE_H_INCLUDED +#define CONFIGURE_H_INCLUDED +/* * configurator actions */
@@ -63,3 +66,4 @@ void trigger_paths_udev_change(struct multipath *mpp, bool is_mpath);void trigger_partitions_udev_change (struct udev_device *dev,const char *action,int len);int check_daemon (void ); +#endif
libmultipath/defaults.h +4 -3
@@ -1,5 +1,6 @@ -#ifndef _DEFAULTS_H -#define _DEFAULTS_H +#ifndef DEFAULTS_H_INCLUDED +#define DEFAULTS_H_INCLUDED +#include <limits.h> #include <string.h>
@@ -78,4 +79,4 @@ static inline char *set_default(char *str) return strdup(str); }extern const char *const default_partition_delim; -#endif /* _DEFAULTS_H */ +#endif /* DEFAULTS_H_INCLUDED */
libmultipath/devmapper.h +4 -3
@@ -1,5 +1,6 @@ -#ifndef _DEVMAPPER_H -#define _DEVMAPPER_H +#ifndef DEVMAPPER_H_INCLUDED +#define DEVMAPPER_H_INCLUDED +#include <sys/sysmacros.h> #include <linux/dm-ioctl.h> #include "autoconfig.h"
@@ -210,4 +211,4 @@ int libmp_dm_task_run(struct dm_task *dmt);condlog (lvl,"%s: libdm task=%d error: %s" , __func__, \ cmd, strerror(dm_task_get_errno(dmt))) \ -#endif /* _DEVMAPPER_H */ +#endif /* DEVMAPPER_H_INCLUDED */
libmultipath/dict.h +3 -6
@@ -1,10 +1,7 @@ -#ifndef _DICT_H -#define _DICT_H +#ifndef DICT_H_INCLUDED +#define DICT_H_INCLUDED -#ifndef _VECTOR_H#include "vector.h" -#endif -#include "byteorder.h" struct strbuf ;
@@ -19,4 +16,4 @@ int print_dev_loss(struct strbuf *buff, unsigned long v);int print_off_int_undef (struct strbuf *buff,long v);int print_auto_resize (struct strbuf *buff,long v);int print_flush_on_last_del (struct strbuf *buff,long v); -#endif /* _DICT_H */ +#endif /* DICT_H_INCLUDED */
libmultipath/discovery.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef DISCOVERY_H -#define DISCOVERY_H +#ifndef DISCOVERY_H_INCLUDED +#define DISCOVERY_H_INCLUDED #define SYSFS_PATH_SIZE 255#define INQUIRY_CMDLEN 6
@@ -84,4 +84,4 @@ enum discovery_mode {#define DI_ALL (DI_SYSFS | DI_SERIAL | DI_CHECKER | DI_PRIO | \ DI_WWID) -#endif /* DISCOVERY_H */ +#endif /* DISCOVERY_H_INCLUDED */
libmultipath/dm-generic.h +3 -3
@@ -14,8 +14,8 @@You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -#ifndef _DM_GENERIC_H -#define _DM_GENERIC_H +#ifndef DM_GENERIC_H_INCLUDED +#define DM_GENERIC_H_INCLUDED #include "generic.h" #include "list.h" /* for container_of */ #include "structs.h"
@@ -36,4 +36,4 @@ extern const struct gen_multipath_ops dm_gen_multipath_ops;extern const struct gen_pathgroup_ops dm_gen_pathgroup_ops;extern const struct gen_path_ops dm_gen_path_ops; -#endif /* _DM_GENERIC_H */ +#endif /* DM_GENERIC_H_INCLUDED */
libmultipath/dmparser.h +5 -0
@@ -1,3 +1,8 @@ +#ifndef DMPARSER_H_INCLUDED +#define DMPARSER_H_INCLUDED +int assemble_map (struct multipath *,char **);int disassemble_map (const struct _vector *,const char *,struct multipath *);int disassemble_status (const char *,struct multipath *); + +#endif
libmultipath/file.h +3 -3
@@ -2,8 +2,8 @@* Copyright (c) 2010 Benjamin Marzinski, Redhat */ -#ifndef _FILE_H -#define _FILE_H +#ifndef FILE_H_INCLUDED +#define FILE_H_INCLUDED #include <sys/stat.h>
@@ -11,4 +11,4 @@int ensure_directories_exist (const char *str,mode_t dir_mode);int open_file (const char *file,int *can_write,const char *header); -#endif /* _FILE_H */ +#endif /* FILE_H_INCLUDED */
libmultipath/foreign.h +4 -3
@@ -14,8 +14,9 @@You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -#ifndef _FOREIGN_H -#define _FOREIGN_H +#ifndef FOREIGN_H_INCLUDED +#define FOREIGN_H_INCLUDED +#include <stdbool.h> #include <libudev.h> #define LIBMP_FOREIGN_API ((1 << 8) | 2)
@@ -320,4 +321,4 @@ is_claimed_by_foreign(struct udev_device *ud) return (rc == FOREIGN_CLAIMED || rc == FOREIGN_OK); } -#endif /* _FOREIGN_H */ +#endif /* FOREIGN_H_INCLUDED */
libmultipath/generic.h +3 -3
@@ -14,8 +14,8 @@You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -#ifndef _GENERIC_H -#define _GENERIC_H +#ifndef GENERIC_H_INCLUDED +#define GENERIC_H_INCLUDED #include "vector.h" /*
@@ -138,4 +138,4 @@ struct gen_path {int generic_style (const struct gen_multipath *,struct strbuf *buf,int verbosity); -#endif /* _GENERIC_H */ +#endif /* GENERIC_H_INCLUDED */
libmultipath/hwtable.h +3 -3
@@ -1,6 +1,6 @@ -#ifndef _HWTABLE_H -#define _HWTABLE_H +#ifndef HWTABLE_H_INCLUDED +#define HWTABLE_H_INCLUDED int setup_default_hwtable (vector hw); -#endif /* _HWTABLE_H */ +#endif /* HWTABLE_H_INCLUDED */
libmultipath/io_err_stat.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _IO_ERR_STAT_H -#define _IO_ERR_STAT_H +#ifndef IO_ERR_STAT_H_INCLUDED +#define IO_ERR_STAT_H_INCLUDED #include "vector.h" #include "lock.h"
@@ -12,4 +12,4 @@ void stop_io_err_stat_thread(void);int io_err_stat_handle_pathfail (struct path *path);int need_io_err_check (struct path *pp); -#endif /* _IO_ERR_STAT_H */ +#endif /* IO_ERR_STAT_H_INCLUDED */
libmultipath/libsg.h +3 -3
@@ -1,9 +1,9 @@ -#ifndef _LIBSG_H -#define _LIBSG_H +#ifndef LIBSG_H_INCLUDED +#define LIBSG_H_INCLUDED #define SENSE_BUFF_LEN 32int sg_read (int sg_fd,unsigned char * buff,int buff_len,unsigned char * sense,int sense_len,unsigned int timeout); -#endif /* _LIBSG_H */ +#endif /* LIBSG_H_INCLUDED */
libmultipath/list.h +3 -3
@@ -5,8 +5,8 @@* */ -#ifndef _LIST_H -#define _LIST_H +#ifndef LIST_H_INCLUDED +#define LIST_H_INCLUDED #include <stddef.h>
@@ -415,4 +415,4 @@ static inline struct list_head *list_pop(struct list_head *head) &pos->member != (to); \ pos = n, n = list_entry(n->member.prev, typeof(*n), member)) -#endif /* _LIST_H */ +#endif /* LIST_H_INCLUDED */
libmultipath/lock.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _LOCK_H -#define _LOCK_H +#ifndef LOCK_H_INCLUDED +#define LOCK_H_INCLUDED #include <pthread.h> #include <urcu/uatomic.h>
@@ -65,4 +65,4 @@ static inline bool lock_has_waiters(struct mutex_lock *a)void cleanup_lock (void * data);void set_wakeup_fn (struct mutex_lock *lock,wakeup_fn *fn); -#endif /* _LOCK_H */ +#endif /* LOCK_H_INCLUDED */
libmultipath/nvme-lib.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef NVME_LIB_H -#define NVME_LIB_H +#ifndef NVME_LIB_H_INCLUDED +#define NVME_LIB_H_INCLUDED #include "nvme.h"
@@ -36,4 +36,4 @@ int nvme_id_ctrl_ana(int fd, struct nvme_id_ctrl *ctrl);#undef le64_to_cpu#endif -#endif /* NVME_LIB_H */ +#endif /* NVME_LIB_H_INCLUDED */
libmultipath/nvme/argconfig.h +2 -2
@@ -30,8 +30,8 @@// //////////////////////////////////////////////////////////////////////// -#ifndef argconfig_H -#define argconfig_H +#ifndef NVME_ARGCONFIG_H_INCLUDED +#define NVME_ARGCONFIG_H_INCLUDED #include <string.h> #include <getopt.h>
libmultipath/nvme/json.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef __JSON__H -#define __JSON__H +#ifndef NVME_JSON_H_INCLUDED +#define NVME_JSON_H_INCLUDED struct json_object ;struct json_array ;
libmultipath/nvme/linux/nvme.h +3 -3
@@ -12,8 +12,8 @@* more details. */ -#ifndef _LINUX_NVME_H -#define _LINUX_NVME_H +#ifndef LINUX_NVME_H_INCLUDED +#define LINUX_NVME_H_INCLUDED #include <linux/types.h> #include <linux/uuid.h>
@@ -1525,4 +1525,4 @@ struct nvme_completion {#define NVME_MINOR (ver) (((ver) >> 8) & 0xff)#define NVME_TERTIARY (ver) ((ver) & 0xff) -#endif /* _LINUX_NVME_H */ +#endif /* LINUX_NVME_H_INCLUDED */
libmultipath/nvme/linux/nvme_ioctl.h +3 -3
@@ -12,8 +12,8 @@* more details. */ -#ifndef _UAPI_LINUX_NVME_IOCTL_H -#define _UAPI_LINUX_NVME_IOCTL_H +#ifndef LINUX_NVME_IOCTL_H_INCLUDED +#define LINUX_NVME_IOCTL_H_INCLUDED #include <linux/types.h> #include <sys/ioctl.h>
@@ -64,4 +64,4 @@ struct nvme_passthru_cmd {#define NVME_IOCTL_SUBSYS_RESET _IO('N', 0x45)#define NVME_IOCTL_RESCAN _IO('N', 0x46) -#endif /* _UAPI_LINUX_NVME_IOCTL_H */ +#endif /* LINUX_NVME_IOCTL_H_INCLUDED */
libmultipath/nvme/nvme-ioctl.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _NVME_LIB_H -#define _NVME_LIB_H +#ifndef NVME_NVME_IOCTL_H_INCLUDED +#define NVME_NVME_IOCTL_H_INCLUDED #include <linux/types.h> #include <stdbool.h>
@@ -155,4 +155,4 @@ int nvme_sanitize(int fd, __u8 sanact, __u8 ause, __u8 owpass, __u8 oipbp,int nvme_self_test_start (int fd,__u32 nsid,__u32 cdw10);int nvme_self_test_log (int fd,struct nvme_self_test_log *self_test_log);int nvme_virtual_mgmt (int fd,__u32 cdw10,__u32 cdw11,__u32 *result); -#endif /* _NVME_LIB_H */ +#endif /* NVME_NVME_IOCTL_H_INCLUDED */
libmultipath/nvme/nvme.h +3 -3
@@ -12,8 +12,8 @@* more details. */ -#ifndef _NVME_H -#define _NVME_H +#ifndef NVME_NVME_H_INCLUDED +#define NVME_NVME_H_INCLUDED #include <stdbool.h> #include <stdint.h>
@@ -237,4 +237,4 @@ static inline bool is_64bit_reg(__u32 offset) return false; } -#endif /* _NVME_H */ +#endif /* NVME_NVME_H_INCLUDED */
libmultipath/nvme/plugin.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef PLUGIN_H -#define PLUGIN_H +#ifndef NVME_PLUGIN_H_INCLUDED +#define NVME_PLUGIN_H_INCLUDED #include <stdbool.h>
libmultipath/pgpolicies.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef _PGPOLICIES_H -#define _PGPOLICIES_H +#ifndef PGPOLICIES_H_INCLUDED +#define PGPOLICIES_H_INCLUDED #if 0 #ifndef _MAIN_H
libmultipath/print.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _PRINT_H -#define _PRINT_H +#ifndef PRINT_H_INCLUDED +#define PRINT_H_INCLUDED #include "dm-generic.h" #define PRINT_PATH_CHECKER "%i %d %D %p %t %T %o %C"
@@ -73,4 +73,4 @@ int snprint_multipath_attr(const struct gen_multipath* gm, struct strbuf *buf, char wildcard);int snprint_multipath_style (const struct gen_multipath *gmp,struct strbuf *style,int verbosity); -#endif /* _PRINT_H */ +#endif /* PRINT_H_INCLUDED */
libmultipath/prio.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _PRIO_H -#define _PRIO_H +#ifndef PRIO_H_INCLUDED +#define PRIO_H_INCLUDED /* * knowing about path struct gives flexibility to prioritizers
@@ -67,4 +67,4 @@ int prio_set_args (struct prio *, const char *);/* The only function exported by prioritizer dynamic libraries (.so) */ int getprio (struct path *,char *); -#endif /* _PRIO_H */ +#endif /* PRIO_H_INCLUDED */
libmultipath/prioritizers/alua.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef _ALUA_H -#define _ALUA_H +#ifndef ALUA_H_INCLUDED +#define ALUA_H_INCLUDED #include "alua_rtpg.h"
libmultipath/prioritizers/alua_rtpg.h +3 -3
@@ -12,8 +12,8 @@* * This file is released under the GPL. */ -#ifndef __RTPG_H__ -#define __RTPG_H__ +#ifndef ALUA_RTPG_H_INCLUDED +#define ALUA_RTPG_H_INCLUDED #include "alua_spc3.h" #define RTPG_SUCCESS 0
@@ -26,4 +26,4 @@ int get_target_port_group_support(const struct path *pp);int get_target_port_group (const struct path *pp);int get_asymmetric_access_state (const struct path *pp,unsigned int tpg); -#endif /* __RTPG_H__ */ +#endif /* ALUA_RTPG_H_INCLUDED */
libmultipath/prioritizers/alua_spc3.h +3 -3
@@ -12,8 +12,8 @@* * This file is released under the GPL. */ -#ifndef __SPC3_H__ -#define __SPC3_H__ +#ifndef ALUA_SPC3_H_INCLUDED +#define ALUA_SPC3_H_INCLUDED #include "../unaligned.h" /*=============================================================================
@@ -323,4 +323,4 @@ struct rtpg_data { ) \ ) -#endif /* __SPC3_H__ */ +#endif /* ALUA_SPC3_H_INCLUDED */
libmultipath/prioritizers/weightedpath.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef _WEIGHTED_PATH_H -#define _WEIGHTED_PATH_H +#ifndef WEIGHTEDPATH_H_INCLUDED +#define WEIGHTEDPATH_H_INCLUDED #define PRIO_WEIGHTED_PATH "weightedpath"#define HBTL "hbtl"
libmultipath/prkey.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _PRKEY_H -#define _PRKEY_H +#ifndef PRKEY_H_INCLUDED +#define PRKEY_H_INCLUDED #include "structs.h" #include <inttypes.h>
@@ -20,4 +20,4 @@ int set_prkey(struct config *conf, struct multipath *mpp, uint64_t prkey, uint8_t sa_flags);int get_prkey (struct multipath *mpp,uint64_t *prkey,uint8_t *sa_flags); -#endif /* _PRKEY_H */ +#endif /* PRKEY_H_INCLUDED */
libmultipath/propsel.h +3 -0
@@ -1,3 +1,5 @@ +#ifndef PROPSEL_H_INCLUDED +#define PROPSEL_H_INCLUDED int select_rr_weight (struct config *conf,struct multipath * mp);int select_pgfailback (struct config *conf,struct multipath * mp);int select_detect_pgpolicy (struct config *conf,struct multipath * mp);
@@ -42,3 +44,4 @@ void reconcile_features_with_options(const char *id, char **features, int *retain_hwhandler);int select_all_tg_pt (struct config *conf,struct multipath * mp);int select_vpd_vendor_id (struct path *pp); +#endif
libmultipath/sg_include.h +3 -0
@@ -1,3 +1,5 @@ +#ifndef SG_INCLUDE_H_INCLUDED +#define SG_INCLUDE_H_INCLUDED #define __user#include <scsi/sg.h>
@@ -23,3 +25,4 @@* retry or fail IO */ #define DID_TRANSPORT_FAILFAST 0x0f/* Transport class fastfailed the io */ #endif +#endif
libmultipath/structs.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _STRUCTS_H -#define _STRUCTS_H +#ifndef STRUCTS_H_INCLUDED +#define STRUCTS_H_INCLUDED #include <sys/types.h> #include <inttypes.h>
@@ -584,4 +584,4 @@ int pathcmp (const struct pathgroup *, const struct pathgroup *);int add_feature (char **,const char *);int remove_feature (char **,const char *); -#endif /* _STRUCTS_H */ +#endif /* STRUCTS_H_INCLUDED */
libmultipath/structs_vec.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _STRUCTS_VEC_H -#define _STRUCTS_VEC_H +#ifndef STRUCTS_VEC_H_INCLUDED +#define STRUCTS_VEC_H_INCLUDED #include "vector.h" #include "config.h"
@@ -39,4 +39,4 @@ int update_multipath_table (struct multipath *mpp, vector pathvec, int flags);int update_multipath_status (struct multipath *mpp);vector get_used_hwes (const struct _vector *pathvec); -#endif /* _STRUCTS_VEC_H */ +#endif /* STRUCTS_VEC_H_INCLUDED */
libmultipath/switchgroup.h +5 -0
@@ -1,2 +1,7 @@ +#ifndef SWITCHGROUP_H_INCLUDED +#define SWITCHGROUP_H_INCLUDED +void path_group_prio_update (struct pathgroup * pgp);int select_path_group (struct multipath * mpp); + +#endif
libmultipath/sysfs.h +2 -2
@@ -2,8 +2,8 @@* sysfs.h */ -#ifndef _LIBMULTIPATH_SYSFS_H -#define _LIBMULTIPATH_SYSFS_H +#ifndef SYSFS_H_INCLUDED +#define SYSFS_H_INCLUDED #include <stdbool.h> #include "strbuf.h"
libmultipath/uevent.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _UEVENT_H -#define _UEVENT_H +#ifndef UEVENT_H_INCLUDED +#define UEVENT_H_INCLUDED /* * buffer for environment variables, the kernel's size in
@@ -69,4 +69,4 @@ static inline char *uevent_get_dm_action(const struct uevent *uev) return uevent_get_dm_str(uev, "DM_ACTION"); } -#endif /* _UEVENT_H */ +#endif /* UEVENT_H_INCLUDED */
libmultipath/unaligned.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _UNALIGNED_H_ -#define _UNALIGNED_H_ +#ifndef UNALIGNED_H_INCLUDED +#define UNALIGNED_H_INCLUDED #include <stdint.h>
@@ -51,4 +51,4 @@ static inline void put_unaligned_be64(uint64_t val, void *ptr) put_unaligned_be32(val, p + 4); } -#endif /* _UNALIGNED_H_ */ +#endif /* UNALIGNED_H_INCLUDED */
libmultipath/valid.h +3 -3
@@ -14,8 +14,8 @@You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -#ifndef _VALID_H -#define _VALID_H +#ifndef VALID_H_INCLUDED +#define VALID_H_INCLUDED /* * PATH_IS_VALID_NO_CHECK is returned when multipath should claim
@@ -39,4 +39,4 @@ enum is_path_valid_result {int is_path_valid (const char *name,struct config *conf,struct path *pp,bool check_multipathd); -#endif /* _VALID_D */ +#endif /* VALID_H_INCLUDED */
libmultipath/version.h +3 -3
@@ -17,8 +17,8 @@* * Copyright (c) 2006 Christophe Varoqui */ -#ifndef _VERSION_H -#define _VERSION_H +#ifndef VERSION_H_INCLUDED +#define VERSION_H_INCLUDED #define VERSION_CODE 0x000909/* MMDDYY, in hex */
@@ -35,4 +35,4 @@MULTIPATH_VERSION (VERSION_CODE ), \ MULTIPATH_VERSION(DATE_CODE) -#endif /* _VERSION_H */ +#endif /* VERSION_H_INCLUDED */
libmultipath/wwids.h +3 -3
@@ -2,8 +2,8 @@* Copyright (c) 2010 Benjamin Marzinski, Redhat */ -#ifndef _WWIDS_H -#define _WWIDS_H +#ifndef WWIDS_H_INCLUDED +#define WWIDS_H_INCLUDED #define WWIDS_FILE_HEADER \ "# Multipath wwids, Version : 1.0\n" \
@@ -29,4 +29,4 @@ enum {int is_failed_wwid (const char *wwid);int mark_failed_wwid (const char *wwid);int unmark_failed_wwid (const char *wwid); -#endif /* _WWIDS_H */ +#endif /* WWIDS_H_INCLUDED */
mpathpersist/main.h +4 -0
@@ -1,3 +1,6 @@ +#ifndef MPATHPERSIST_MAIN_H_INCLUDED +#define MPATHPERSIST_MAIN_H_INCLUDED +static struct option long_options[] = { {"verbose" ,1 ,NULL ,'v' }, {"clear", 0, NULL, 'C'},
@@ -28,3 +31,4 @@ static struct option long_options[] = { };static void usage (void ); +#endif
multipathd/cli.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _CLI_H_ -#define _CLI_H_ +#ifndef CLI_H_INCLUDED +#define CLI_H_INCLUDED #include <stdint.h>
@@ -157,4 +157,4 @@ vector get_keys(void);vector get_handlers (void );struct key *find_key (const char * str); -#endif /* _CLI_H_ */ +#endif /* CLI_H_INCLUDED */
multipathd/cli_handlers.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef _CLI_HANDLERS_H -#define _CLI_HANDLERS_H +#ifndef CLI_HANDLERS_H_INCLUDED +#define CLI_HANDLERS_H_INCLUDED void init_handler_callbacks (void );
multipathd/dmevents.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _DMEVENTS_H -#define _DMEVENTS_H +#ifndef DMEVENTS_H_INCLUDED +#define DMEVENTS_H_INCLUDED #include "structs_vec.h"
@@ -10,4 +10,4 @@ int watch_dmevents(char *name);void unwatch_all_dmevents (void );void *wait_dmevents (void *unused); -#endif /* _DMEVENTS_H */ +#endif /* DMEVENTS_H_INCLUDED */
multipathd/fpin.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef __FPIN_H__ -#define __FPIN_H__ +#ifndef FPIN_H_INCLUDED +#define FPIN_H_INCLUDED #include "autoconfig.h" #ifdef FPIN_EVENT_HANDLER
multipathd/init_unwinder.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef _INIT_UNWINDER_H -#define _INIT_UNWINDER_H 1 +#ifndef INIT_UNWINDER_H_INCLUDED +#define INIT_UNWINDER_H_INCLUDED /* * init_unwinder(): make sure unwinder symbols are loaded
multipathd/main.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef MAIN_H -#define MAIN_H +#ifndef MAIN_H_INCLUDED +#define MAIN_H_INCLUDED #define MAPGCINT 5
@@ -52,4 +52,4 @@ bool check_path_wwid_change(struct path *pp);int finish_path_init (struct path *pp,struct vectors * vecs);int resize_map (struct multipath *mpp,unsigned long long size,struct vectors *vecs); -#endif /* MAIN_H */ +#endif /* MAIN_H_INCLUDED */
multipathd/pidfile.h +4 -0
@@ -1 +1,5 @@ +#ifndef PIDFILE_H_INCLUDED +#define PIDFILE_H_INCLUDED int pidfile_create (const char *pidFile,pid_t pid); +#endif +
multipathd/uxclnt.h +5 -0
@@ -1 +1,6 @@ +#ifndef UXCLNT_H_INCLUDED +#define UXCLNT_H_INCLUDED +int uxclnt (char * inbuf,unsigned int timeout); + +#endif
multipathd/uxlsnr.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef _UXLSNR_H -#define _UXLSNR_H +#ifndef UXLSNR_H_INCLUDED +#define UXLSNR_H_INCLUDED #include <stdbool.h>
multipathd/waiter.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _WAITER_H -#define _WAITER_H +#ifndef WAITER_H_INCLUDED +#define WAITER_H_INCLUDED extern pthread_attr_t waiter_attr;
@@ -14,4 +14,4 @@ struct event_thread {void stop_waiter_thread (struct multipath *mpp);int start_waiter_thread (struct multipath *mpp,struct vectors *vecs); -#endif /* _WAITER_H */ +#endif /* WAITER_H_INCLUDED */
tests/test-lib.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef __LIB_H -#define __LIB_H +#ifndef TEST_LIB_H_INCLUDED +#define TEST_LIB_H_INCLUDED extern const int default_mask;extern const char default_devnode[];
tests/test-log.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef _TEST_LOG_H -#define _TEST_LOG_H +#ifndef TEST_LOG_H_INCLUDED +#define TEST_LOG_H_INCLUDED __attribute__((format (printf,2 ,0 )))void __wrap_dlog (int prio,const char * fmt, ...);
tests/wrap64.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef _WRAP64_H -#define _WRAP64_H 1 +#ifndef WRAP64_H_INCLUDED +#define WRAP64_H_INCLUDED #include <syscall.h> #include <linux/types.h> /* The following include is required for LIBAIO_REDIRECT */
Signature · 1 line
2.46.0
PATCH 9/41 libmpathcmd: rename __mpath_connect() to mpath_connect__()
In reply to Martin WilckIdentifiers starting with double underscore are forbidden, see
https://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html
--- libmpathcmd/libmpathcmd.version | 4 ++-- libmpathcmd/mpath_cmd.c | 4 ++-- libmpathcmd/mpath_cmd.h | 2 +- libmultipath/valid.c | 2 +- tests/valid.c | 12 ++++++------ 5 files changed, 12 insertions(+), 12 deletions(-)
libmpathcmd/libmpathcmd.version +2 -2
@@ -10,10 +10,10 @@ * * See libmultipath.version for general policy about version numbers. */ -LIBMPATHCMD_1.0.0 { +LIBMPATHCMD_2.0.0 { global: - __mpath_connect; mpath_connect; + mpath_connect__; mpath_disconnect; mpath_process_cmd; mpath_recv_reply;
libmpathcmd/mpath_cmd.c +2 -2
@@ -94,7 +94,7 @@ static size_t write_all(int fd, const void *buf, size_t len)/* * connect to a unix domain socket */ -int __mpath_connect (int nonblocking) +int mpath_connect__ (int nonblocking) {int fd;size_t len;
@@ -138,7 +138,7 @@ int __mpath_connect(int nonblocking)*/ int mpath_connect (void ) { -return __mpath_connect (0 ); +return mpath_connect__ (0 ); }int mpath_disconnect (int fd)
libmpathcmd/mpath_cmd.h +1 -1
@@ -47,7 +47,7 @@ extern "C" {* RETURNS: * A file descriptor on success. -1 on failure (with errno set). */ -int __mpath_connect (int nonblocking); +int mpath_connect__ (int nonblocking);/* * DESCRIPTION:
libmultipath/valid.c +1 -1
@@ -315,7 +315,7 @@ is_path_valid(const char *name, struct config *conf, struct path *pp, }if (check_multipathd) { - fd =__mpath_connect (1 ); + fd =mpath_connect__ (1 );if (fd <0 ) {if (errno !=EAGAIN ) {condlog (3 ,"multipathd not running" );
tests/valid.c +6 -6
@@ -52,7 +52,7 @@ bool __wrap_sysfs_is_multipathed(struct path *pp, bool set_wwid)return is_multipathed; } -int __wrap___mpath_connect (int nonblocking) +int __wrap_mpath_connect__ (int nonblocking) {bool connected =mock_type (bool);assert_int_equal (nonblocking,1 );
@@ -223,10 +223,10 @@ static void setup_passing(char *name, char *wwid, unsigned int check_multipathd,if (stage ==STAGE_IS_MULTIPATHED )return ;if (check_multipathd ==CHECK_MPATHD_RUNNING ) -will_return (__wrap___mpath_connect, true); +will_return (__wrap_mpath_connect__, true);else if (check_multipathd ==CHECK_MPATHD_EAGAIN ) { -will_return (__wrap___mpath_connect, false); -will_return (__wrap___mpath_connect,EAGAIN ); +will_return (__wrap_mpath_connect__, false); +will_return (__wrap_mpath_connect__,EAGAIN ); }/* nothing for CHECK_MPATHD_SKIP */
@@ -332,8 +332,8 @@ static void test_check_multipathd(void **state) conf.find_multipaths =FIND_MULTIPATHS_STRICT ;/* test failed check to see if multipathd is active */ will_return (__wrap_sysfs_is_multipathed, false); -will_return (__wrap___mpath_connect, false); -will_return (__wrap___mpath_connect,ECONNREFUSED ); +will_return (__wrap_mpath_connect__, false); +will_return (__wrap_mpath_connect__,ECONNREFUSED );assert_int_equal (is_path_valid (name, &conf, &pp, true),PATH_IS_NOT_VALID );
Signature · 1 line
2.46.0
PATCH 10/41 libmpathutil: rename _MAX_CMD_LEN
In reply to Martin Wilck--- libdmmp/libdmmp.c | 2 +- libmpathutil/uxsock.h | 2 +- multipathd/uxlsnr.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
libdmmp/libdmmp.c +1 -1
@@ -46,7 +46,7 @@#define _DMMP_JSON_MAPS_KEY "maps"#define _ERRNO_STR_BUFF_SIZE 256#define _IPC_MAX_CMD_LEN 512 -/* ^ Was _MAX_CMD_LEN in ./libmultipath/uxsock.h */ +/* ^ Was MAX_CMD_LEN in ./libmultipath/uxsock.h */ #define _LAST_ERR_MSG_BUFF_SIZE 1024struct dmmp_context {
libmpathutil/uxsock.h +1 -1
@@ -6,5 +6,5 @@ int ux_socket_listen(const char *name);int send_packet (int fd,const char *buf);int recv_packet (int fd,char **buf,unsigned int timeout); -#define _MAX_CMD_LEN 512 +#define MAX_CMD_LEN 512#endif
multipathd/uxlsnr.c +2 -2
@@ -59,7 +59,7 @@ struct client {int fd;vector cmdvec;/* NUL byte at end */ -char cmd[_MAX_CMD_LEN +1 ]; +char cmd[MAX_CMD_LEN +1 ];struct strbuf reply;struct handler *handler;size_t cmd_len, len;
@@ -477,7 +477,7 @@ static int client_state_machine(struct client *c, struct vectors *vecs,condlog (1 ,"%s: cli[%d]: failed to receive reply len: %zd" , __func__, c->fd, n); c->error = -ECONNRESET ; - }else if (len <=0 || len > _MAX_CMD_LEN) { + }else if (len <=0 || len >MAX_CMD_LEN ) {condlog (1 ,"%s: cli[%d]: invalid command length (%zu bytes)" , __func__, c->fd, len); c->error = -ECONNRESET ;
Signature · 1 line
2.46.0
PATCH 11/41 libmpathutil: rename __append_strbuf_str() and __get_strbuf_buf()
In reply to Martin Wilck--- libmpathutil/libmpathutil.version | 4 ++-- libmpathutil/parser.c | 4 ++-- libmpathutil/strbuf.c | 6 +++--- libmpathutil/strbuf.h | 6 +++--- libmultipath/alias.c | 2 +- libmultipath/discovery.c | 8 ++++---- libmultipath/print.c | 10 +++++----- tests/strbuf.c | 12 ++++++------ 8 files changed, 26 insertions(+), 26 deletions(-)
libmpathutil/libmpathutil.version +2 -2
@@ -47,8 +47,8 @@ LIBMPATHUTIL_4.0 { global: alloc_bitfield; alloc_strvec; - __append_strbuf_str; append_strbuf_str; + append_strbuf_str__; append_strbuf_quoted; basenamecpy; cleanup_charp;
@@ -71,7 +71,7 @@ global: free_strvec; get_linux_version_code; get_monotonic_time; - __get_strbuf_buf; + get_strbuf_buf__; get_next_string; get_strbuf_len; get_strbuf_str;
libmpathutil/parser.c +2 -2
@@ -167,7 +167,7 @@ snprint_keyword(struct strbuf *buff, const char *fmt, struct keyword *kw, goto out; }if (f != fmt && - (r =__append_strbuf_str (&sbuf, fmt, f - fmt)) <0 ) + (r =append_strbuf_str__ (&sbuf, fmt, f - fmt)) <0 ) goto out; fmt = f +1 ;switch (*fmt) {
@@ -191,7 +191,7 @@ snprint_keyword(struct strbuf *buff, const char *fmt, struct keyword *kw, }while (*fmt++); out:if (r >=0 ) - r =__append_strbuf_str (buff,get_strbuf_str (&sbuf), + r =append_strbuf_str__ (buff,get_strbuf_str (&sbuf),get_strbuf_len (&sbuf));return r; }
libmpathutil/strbuf.c +3 -3
@@ -15,7 +15,7 @@static const char empty_str[] ="" ; -char *__get_strbuf_buf (struct strbuf *buf) +char *get_strbuf_buf__ (struct strbuf *buf) {return buf->buf; }
@@ -110,7 +110,7 @@ static int expand_strbuf(struct strbuf *buf, int addsz)return 0 ; } -int __append_strbuf_str (struct strbuf *buf,const char *str,int slen) +int append_strbuf_str__ (struct strbuf *buf,const char *str,int slen) {int ret;
@@ -135,7 +135,7 @@ int append_strbuf_str(struct strbuf *buf, const char *str)if (slen >INT_MAX )return -ERANGE ; -return __append_strbuf_str (buf, str, slen); +return append_strbuf_str__ (buf, str, slen); }int fill_strbuf (struct strbuf *buf,char c,int slen)
libmpathutil/strbuf.h +3 -3
@@ -66,7 +66,7 @@ struct strbuf *new_strbuf(void);* If @strbuf was never written to, the function returns NULL. * The return value of this function must not be free()d. */ -char *__get_strbuf_buf (struct strbuf *buf); +char *get_strbuf_buf__ (struct strbuf *buf);/** * get_strbuf_str(): retrieve string from strbuf
@@ -112,7 +112,7 @@ size_t get_strbuf_len(const struct strbuf *buf);int truncate_strbuf (struct strbuf *buf,size_t offs);/** -* __append_strbuf_str(): append string of known length +* append_strbuf_str__(): append string of known length * @param buf: the struct strbuf to write to * @param str: the string to append, not necessarily 0-terminated * @param slen: max number of characters to append, must be non-negative
@@ -123,7 +123,7 @@ int truncate_strbuf(struct strbuf *buf, size_t offs);* 0-bytes possibly contained in the first @slen characters are copied into * the output. If the function returns an error, @strbuf is unchanged. */ -int __append_strbuf_str (struct strbuf *buf,const char *str,int slen); +int append_strbuf_str__ (struct strbuf *buf,const char *str,int slen);/** * append_strbuf_str(): append string
libmultipath/alias.c +1 -1
@@ -242,7 +242,7 @@ static int write_bindings_file(const Bindings *bindings, int fd,int i;size_t len; -if (__append_strbuf_str (&content,BINDINGS_FILE_HEADER , +if (append_strbuf_str__ (&content,BINDINGS_FILE_HEADER ,sizeof (BINDINGS_FILE_HEADER ) -1 ) ==-1 )return -1 ;
libmultipath/discovery.c +4 -4
@@ -1336,14 +1336,14 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len, vpd +=4 ; len = vpd_len -4 ; -if ((err =__append_strbuf_str (&buf, (const char *)vpd, len)) <0 ) +if ((err =append_strbuf_str__ (&buf, (const char *)vpd, len)) <0 )return err;/* The input is 0-padded, make sure the length is correct */ truncate_strbuf (&buf,strlen (get_strbuf_str (&buf))); len =get_strbuf_len (&buf);if (type !='8' ) { -char *buffer =__get_strbuf_buf (&buf); +char *buffer =get_strbuf_buf__ (&buf);for (i =0 ; i < len; ++i) buffer[i] =tolower (buffer[i]);
@@ -1357,7 +1357,7 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,return err;while (vpd && (p =memchr (vpd,' ' , vpd_len))) { p_len = p - vpd; -if ((err =__append_strbuf_str (&buf, (const char *)vpd, +if ((err =append_strbuf_str__ (&buf, (const char *)vpd, p_len)) <0 )return err; vpd = p;
@@ -1370,7 +1370,7 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,return err; }if (vpd_len >0 ) { -if ((err =__append_strbuf_str (&buf, (const char *)vpd, +if ((err =append_strbuf_str__ (&buf, (const char *)vpd, vpd_len)) <0 )return err; }
libmultipath/print.c +5 -5
@@ -1090,7 +1090,7 @@ int snprint_multipath_header(struct strbuf *line, const char *format,for (f =strchr (format,'%' ); f; f =strchr (++format,'%' )) {int iwc; -if ((rc =__append_strbuf_str (line, format, f - format)) <0 ) +if ((rc =append_strbuf_str__ (line, format, f - format)) <0 )return rc; format = f +1 ;
@@ -1121,7 +1121,7 @@ int _snprint_multipath(const struct gen_multipath *gmp,for (f =strchr (format,'%' ); f; f =strchr (++format,'%' )) {int iwc; -if ((rc =__append_strbuf_str (line, format, f - format)) <0 ) +if ((rc =append_strbuf_str__ (line, format, f - format)) <0 )return rc; format = f +1 ;
@@ -1151,7 +1151,7 @@ int snprint_path_header(struct strbuf *line, const char *format,for (f =strchr (format,'%' ); f; f =strchr (++format,'%' )) {int iwc; -if ((rc =__append_strbuf_str (line, format, f - format)) <0 ) +if ((rc =append_strbuf_str__ (line, format, f - format)) <0 )return rc; format = f +1 ;
@@ -1181,7 +1181,7 @@ int _snprint_path(const struct gen_path *gp, struct strbuf *line,for (f =strchr (format,'%' ); f; f =strchr (++format,'%' )) {int iwc; -if ((rc =__append_strbuf_str (line, format, f - format)) <0 ) +if ((rc =append_strbuf_str__ (line, format, f - format)) <0 )return rc; format = f +1 ;
@@ -1208,7 +1208,7 @@ int _snprint_pathgroup(const struct gen_pathgroup *ggp, struct strbuf *line,int rc;for (f =strchr (format,'%' ); f; f =strchr (++format,'%' )) { -if ((rc =__append_strbuf_str (line, format, f - format)) <0 ) +if ((rc =append_strbuf_str__ (line, format, f - format)) <0 )return rc; format = f +1 ;
tests/strbuf.c +6 -6
@@ -78,7 +78,7 @@ static void test_strbuf_00(void **state)assert_string_equal (p,"" );free (p); -assert_int_equal (__append_strbuf_str (&buf,"x" ,0 ),0 ); +assert_int_equal (append_strbuf_str__ (&buf,"x" ,0 ),0 );/* appending a 0-length string allocates memory */ assert_in_range (buf.size,1 ,SIZE_MAX );assert_int_equal (buf.offs,0 );
@@ -181,9 +181,9 @@ static void test_strbuf_nul(void **state)STRBUF_ON_STACK (buf);char greet[] ="hello, sir!" ; -assert_int_equal (__append_strbuf_str (&buf, greet,6 ),6 ); +assert_int_equal (append_strbuf_str__ (&buf, greet,6 ),6 );assert_string_equal (get_strbuf_str (&buf),"hello," ); -assert_int_equal (__append_strbuf_str (&buf, greet,6 ),6 ); +assert_int_equal (append_strbuf_str__ (&buf, greet,6 ),6 );assert_string_equal (get_strbuf_str (&buf),"hello,hello," );/* overwrite comma with NUL; append_strbuf_str() stops at NUL byte */
@@ -196,14 +196,14 @@ static void test_strbuf_nul(void **state)assert_int_equal (get_strbuf_len (&buf),10 );assert_string_equal (get_strbuf_str (&buf),"hellohello" ); -/* __append_strbuf_str() appends full memory, including NUL bytes */ +/* append_strbuf_str__() appends full memory, including NUL bytes */ reset_strbuf (&buf); -assert_int_equal (__append_strbuf_str (&buf, greet,sizeof (greet) -1 ), +assert_int_equal (append_strbuf_str__ (&buf, greet,sizeof (greet) -1 ),sizeof (greet) -1 );assert_int_equal (get_strbuf_len (&buf),sizeof (greet) -1 );assert_string_equal (get_strbuf_str (&buf),"hello" );assert_string_equal (get_strbuf_str (&buf) +get_strbuf_len (&buf) -5 ," sir!" ); -assert_int_equal (__append_strbuf_str (&buf, greet,sizeof (greet) -1 ), +assert_int_equal (append_strbuf_str__ (&buf, greet,sizeof (greet) -1 ),sizeof (greet) -1 );assert_string_equal (get_strbuf_str (&buf),"hello" );assert_int_equal (get_strbuf_len (&buf),2 * (sizeof (greet) -1 ));
Signature · 1 line
2.46.0
PATCH 12/41 libmpathutil: rename _log_bitfield_overflow()
In reply to Martin Wilck--- libmpathutil/libmpathutil.version | 2 +- libmpathutil/util.c | 2 +- libmpathutil/util.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
libmpathutil/libmpathutil.version +1 -1
@@ -81,7 +81,7 @@ global: install_sublevel_end; is_quote; keyword_alloc; - _log_bitfield_overflow; + log_bitfield_overflow__; libmp_basename; libmp_strlcat; libmp_strlcpy;
libmpathutil/util.c +1 -1
@@ -354,7 +354,7 @@ struct bitfield *alloc_bitfield(unsigned int maxbit)return bf; } -void _log_bitfield_overflow (const char *f,unsigned int bit,unsigned int len) +void log_bitfield_overflow__ (const char *f,unsigned int bit,unsigned int len) {condlog (0 ,"%s: bitfield overflow: %u >= %u" , f, bit, len); }
libmpathutil/util.h +2 -2
@@ -103,9 +103,9 @@ struct bitfield {struct bitfield *alloc_bitfield (unsigned int maxbit); -void _log_bitfield_overflow (const char *f,unsigned int bit,unsigned int len); +void log_bitfield_overflow__ (const char *f,unsigned int bit,unsigned int len);#define log_bitfield_overflow (bit, len) \ - _log_bitfield_overflow(__func__, bit, len) + log_bitfield_overflow__(__func__, bit, len)static inline bool is_bit_set_in_bitfield (unsigned int bit,const struct bitfield *bf)
Signature · 1 line
2.46.0
PATCH 13/41 libmpathutil: rename _install_keyword() to install_keyword__()
In reply to Martin WilckAlso, remove some superfluous extern declarations in parser.h.
--- libmpathutil/libmpathutil.version | 2 +- libmpathutil/parser.c | 2 +- libmpathutil/parser.h | 28 ++++++++++++++-------------- 3 files changed, 16 insertions(+), 16 deletions(-)
libmpathutil/libmpathutil.version +1 -1
@@ -76,7 +76,7 @@ global: get_strbuf_len; get_strbuf_str; get_word; - _install_keyword; + install_keyword__; install_sublevel; install_sublevel_end; is_quote;
libmpathutil/parser.c +1 -1
@@ -70,7 +70,7 @@ install_sublevel_end(void) }int -_install_keyword (vector keywords,char *string, +install_keyword__ (vector keywords,char *string,handler_fn *handler,print_fn *print,int unique)
libmpathutil/parser.h +14 -14
@@ -63,22 +63,22 @@ struct keyword {for (i =0 ; i < (k)->sub->allocated && ((p) = (k)->sub->slot[i]); i++)/* Prototypes */ -extern int keyword_alloc(vector keywords, char *string, handler_fn *handler, -print_fn *print,int unique); +int keyword_alloc(vector keywords, char *string, handler_fn *handler, + print_fn *print, int unique);#define install_keyword_root (str, h) keyword_alloc(keywords, str, h, NULL, 1) -extern void install_sublevel (void ); -extern void install_sublevel_end (void ); +void install_sublevel (void ); +void install_sublevel_end (void ); -extern int _install_keyword (vector keywords,char *string,handler_fn *handler, -print_fn *print,int unique); -#define install_keyword (str, vec, pri) _install_keyword(keywords, str, vec, pri, 1) -#define install_keyword_multi (str, vec, pri) _install_keyword(keywords, str, vec, pri, 0) -extern void dump_keywords (vector keydump,int level); -extern void free_keywords (vector keywords); -extern vector alloc_strvec (char *string); -extern void *set_value (vector strvec); -extern int process_file (struct config *conf,const char *conf_file); -extern struct keyword *find_keyword (vector keywords,vector v,char * name); +int install_keyword__ (vector keywords,char *string,handler_fn *handler, +print_fn *print,int unique); +#define install_keyword (str, vec, pri) install_keyword__(keywords, str, vec, pri, 1) +#define install_keyword_multi (str, vec, pri) install_keyword__(keywords, str, vec, pri, 0) +void dump_keywords (vector keydump,int level); +void free_keywords (vector keywords); +vector alloc_strvec (char *string); +void *set_value (vector strvec); +int process_file (struct config *conf,const char *conf_file); +struct keyword *find_keyword (vector keywords,vector v,char * name);int snprint_keyword (struct strbuf *buff,const char *fmt,struct keyword *kw,const void *data);bool is_quote (const char * token);
Signature · 1 line
2.46.0
PATCH 14/41 libmultipath: rename _NVME_LIB_C
In reply to Martin Wilck--- libmultipath/nvme-lib.c | 2 +- libmultipath/nvme-lib.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
libmultipath/nvme-lib.c +1 -1
@@ -1,6 +1,6 @@#include <sys/types.h> /* avoid inclusion of standard API */ -#define _NVME_LIB_C 1 +#define NVME_LIB_C 1#include "nvme-lib.h" #include "nvme-ioctl.c" #include "debug.h"
libmultipath/nvme-lib.h +1 -1
@@ -16,7 +16,7 @@ int libmp_nvme_ana_log(int fd, void *ana_log, size_t ana_log_len, int rgo);*/ int nvme_id_ctrl_ana (int fd,struct nvme_id_ctrl *ctrl); -#ifndef _NVME_LIB_C +#ifndef NVME_LIB_C /* * In all files except nvme-lib.c, the nvme functions can be called * by their usual name.
Signature · 1 line
2.46.0
PATCH 15/41 libmultipath: checkers.h: fix __CHECKER_FIRST_MSG in comment
In reply to Martin Wilck--- libmultipath/checkers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libmultipath/checkers.h +1 -1
@@ -194,7 +194,7 @@ void *libcheck_thread(struct checker_context *ctx);* message IDs. * Message IDs available to checkers start at CHECKER_FIRST_MSG. * The msgtable array is 0-based, i.e. msgtable[0] is the message -* for msgid == __CHECKER_FIRST_MSG. +* for msgid == CHECKER_FIRST_MSG. * The table ends with a NULL element. */ extern const char *libcheck_msgtable[];
Signature · 1 line
2.46.0
PATCH 16/41 libmultipath: rename identifiers with leading underscores in devmapper.h
In reply to Martin Wilck--- libmultipath/devmapper.c | 16 ++++++++-------- libmultipath/devmapper.h | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-)
libmultipath/devmapper.c +8 -8
@@ -86,10 +86,10 @@ const char *dmp_errstr(int rc) [DMP_OK] = "success", [DMP_NOT_FOUND] = "not found", [DMP_NO_MATCH] = "target type mismatch", - [__DMP_LAST__] = "**invalid**", + [DMP_LAST__] = "**invalid**", }; -if (rc <0 || rc > __DMP_LAST__) - rc = __DMP_LAST__; +if (rc <0 || rc >DMP_LAST__ ) + rc =DMP_LAST__ ;return str[rc]; }
@@ -624,7 +624,7 @@ has_dm_info(const struct multipath *mpp)static int libmp_set_map_identifier (int flags,mapid_t id,struct dm_task *dmt) { -switch (flags & __DM_MAP_BY_MASK) { +switch (flags &DM_MAP_BY_MASK__ ) {case DM_MAP_BY_UUID :if (!id.str || !(*id.str))return 0 ;
@@ -682,7 +682,7 @@ static int libmp_mapinfo__(int flags, mapid_t id, mapinfo_t info, const char *ma*/ if (info.target && !info.status) ioctl_nr =DM_DEVICE_TABLE ; -else if (info.status || info.size || flags & __MAPINFO_TGT_TYPE) +else if (info.status || info.size || flags &MAPINFO_TGT_TYPE__ ) ioctl_nr =DM_DEVICE_STATUS ;else ioctl_nr =DM_DEVICE_INFO ;
@@ -715,7 +715,7 @@ static int libmp_mapinfo__(int flags, mapid_t id, mapinfo_t info, const char *mareturn DMP_NOT_FOUND ; } -if (info.target || info.status || info.size || flags & __MAPINFO_TGT_TYPE) { +if (info.target || info.status || info.size || flags &MAPINFO_TGT_TYPE__ ) {if (dm_get_next_target (dmt,NULL , &start, &length, &target_type, ¶ms) !=NULL ) {condlog (2 ,"%s: map %s has multiple targets" , fname__, map_id);
@@ -725,7 +725,7 @@ static int libmp_mapinfo__(int flags, mapid_t id, mapinfo_t info, const char *macondlog (2 ,"%s: map %s has no targets" , fname__, map_id);return DMP_NOT_FOUND ; } -if (flags & __MAPINFO_TGT_TYPE) { +if (flags &MAPINFO_TGT_TYPE__ ) {const char *tgt_type = flags &MAPINFO_MPATH_ONLY ?TGT_MPATH :TGT_PART ;if (strcmp (target_type, tgt_type)) {
@@ -797,7 +797,7 @@ static int libmp_mapinfo__(int flags, mapid_t id, mapinfo_t info, const char *ma/* Helper: format a string describing the map for log messages */ static const char *libmp_map_identifier (int flags,mapid_t id,char buf[BLK_DEV_SIZE ]) { -switch (flags & __DM_MAP_BY_MASK) { +switch (flags &DM_MAP_BY_MASK__ ) {case DM_MAP_BY_NAME :case DM_MAP_BY_UUID :return id.str;
libmultipath/devmapper.h +6 -6
@@ -35,15 +35,15 @@ enum {DMP_OK ,DMP_NOT_FOUND ,DMP_NO_MATCH , - __DMP_LAST__, + DMP_LAST__, };const char *dmp_errstr (int rc);/** -* enum mapinfo_flags: input flags for libmp_mapinfo() +* input flags for libmp_mapinfo() */ -enum __mapinfo_flags { +enum {/** DM_MAP_BY_NAME: identify map by device-mapper name from @name */ DM_MAP_BY_NAME =0 , /** DM_MAP_BY_UUID: identify map by device-mapper UUID from @uuid */
@@ -52,12 +52,12 @@ enum __mapinfo_flags {DM_MAP_BY_DEV ,/** DM_MAP_BY_DEVT: identify map by a dev_t */ DM_MAP_BY_DEVT , - __DM_MAP_BY_MASK = (1 <<8 ) -1 , +DM_MAP_BY_MASK__ = (1 <<8 ) -1 ,/* Fail if target type is not multipath */ MAPINFO_MPATH_ONLY = (1 <<8 ),/* Fail if target type is not "partition" (linear) */ MAPINFO_PART_ONLY = (1 <<9 ), - __MAPINFO_TGT_TYPE = (MAPINFO_MPATH_ONLY |MAPINFO_PART_ONLY ), +MAPINFO_TGT_TYPE__ = (MAPINFO_MPATH_ONLY |MAPINFO_PART_ONLY ),/* Fail if the UUID doesn't match the multipath UUID format */ MAPINFO_CHECK_UUID = (1 << 10), };
@@ -92,7 +92,7 @@ typedef struct libmp_map_info {/** * libmp_mapinfo(): obtain information about a map from the kernel -* @param flags: see __mapinfo_flags above. +* @param flags: see enum values above. * Exactly one of DM_MAP_BY_NAME, DM_MAP_BY_UUID, and DM_MAP_BY_DEV must be set. * @param id: string or major/minor to identify the map to query * @param info: output parameters, see above. Non-NULL elements will be filled in.
Signature · 1 line
2.46.0
PATCH 17/41 libmultipath: rename identifiers with leading underscores in discovery.h
In reply to Martin Wilck--- libmultipath/discovery.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
libmultipath/discovery.h +16 -16
@@ -62,24 +62,24 @@ bool is_vpd_page_supported(int fd, int pg);* discovery bitmask */ enum discovery_mode { - __DI_SYSFS, - __DI_SERIAL, - __DI_CHECKER, - __DI_PRIO, - __DI_WWID, - __DI_BLACKLIST, - __DI_NOIO, - __DI_NOFALLBACK, +DI_SYSFS__ , +DI_SERIAL__ , +DI_CHECKER__ , +DI_PRIO__ , +DI_WWID__ , +DI_BLACKLIST__ , +DI_NOIO__ , +DI_NOFALLBACK__ , }; -#define DI_SYSFS (1 << __DI_SYSFS) -#define DI_SERIAL (1 << __DI_SERIAL) -#define DI_CHECKER (1 << __DI_CHECKER) -#define DI_PRIO (1 << __DI_PRIO) -#define DI_WWID (1 << __DI_WWID) -#define DI_BLACKLIST (1 << __DI_BLACKLIST) -#define DI_NOIO (1 << __DI_NOIO)/* Avoid IO on the device */ -#define DI_NOFALLBACK (1 << __DI_NOFALLBACK)/* do not allow wwid fallback */ +#define DI_SYSFS (1 << DI_SYSFS__) +#define DI_SERIAL (1 << DI_SERIAL__) +#define DI_CHECKER (1 << DI_CHECKER__) +#define DI_PRIO (1 << DI_PRIO__) +#define DI_WWID (1 << DI_WWID__) +#define DI_BLACKLIST (1 << DI_BLACKLIST__) +#define DI_NOIO (1 << DI_NOIO__)/* Avoid IO on the device */ +#define DI_NOFALLBACK (1 << DI_NOFALLBACK__)/* do not allow wwid fallback */ #define DI_ALL (DI_SYSFS | DI_SERIAL | DI_CHECKER | DI_PRIO | \ DI_WWID)
Signature · 1 line
2.46.0
PATCH 18/41 libmultipath: rename __snprint_config()
In reply to Martin Wilck--- libmultipath/libmultipath.version | 10 +++------- libmultipath/print.c | 4 ++-- libmultipath/print.h | 2 +- multipathd/cli_handlers.c | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-)
libmultipath/libmultipath.version +3 -7
@@ -43,7 +43,7 @@ LIBMPATHCOMMON_1.0.0 { put_multipath_config; }; -LIBMULTIPATH_25.0.0 { +LIBMULTIPATH_26.0.0 { global: /* symbols referenced by multipath and multipathd */ add_foreign;
@@ -74,6 +74,7 @@ global: dm_cancel_deferred_remove; dm_enablegroup; dm_fail_path; + dm_find_map_by_wwid; _dm_flush_map; dm_flush_map_nopaths; dm_flush_maps;
@@ -172,7 +173,7 @@ global: should_multipath; skip_libmp_dm_init; snprint_blacklist_report; - __snprint_config; + snprint_config__; snprint_config; snprint_devices; snprint_foreign_multipaths;
@@ -241,8 +242,3 @@ global: local: *; }; - -LIBMULTIPATH_25.1.0 { -global: - dm_find_map_by_wwid; -} LIBMULTIPATH_25.0.0;
libmultipath/print.c +2 -2
@@ -1908,7 +1908,7 @@ static int snprint_blacklist_except(const struct config *conf,return get_strbuf_len (buff) - initial_len; } -int __snprint_config (const struct config *conf,struct strbuf *buff, +int snprint_config__ (const struct config *conf,struct strbuf *buff,const struct _vector *hwtable,const struct _vector *mpvec) {int rc;
@@ -1934,7 +1934,7 @@ char *snprint_config(const struct config *conf, int *len, {STRBUF_ON_STACK (buff);char *reply; -int rc =__snprint_config (conf, &buff, hwtable, mpvec); +int rc =snprint_config__ (conf, &buff, hwtable, mpvec);if (rc <0 )return NULL ;
libmultipath/print.h +1 -1
@@ -40,7 +40,7 @@ int _snprint_multipath_topology (const struct gen_multipath *, struct strbuf *,#define snprint_multipath_topology (buf, mpp, v, w) \ _snprint_multipath_topology (dm_multipath_to_gen(mpp), buf, v, w)int snprint_multipath_topology_json (struct strbuf *,const struct vectors *vecs); -int __snprint_config (const struct config *conf,struct strbuf *buff, +int snprint_config__ (const struct config *conf,struct strbuf *buff,const struct _vector *hwtable,const struct _vector *mpvec); char *snprint_config(const struct config *conf, int *len, const struct _vector *hwtable,
multipathd/cli_handlers.c +1 -1
@@ -165,7 +165,7 @@ show_config (struct strbuf *reply, const struct _vector *hwtable, conf =get_multipath_config ();pthread_cleanup_push (put_multipath_config, conf); - rc =__snprint_config (conf, reply, hwtable, mpvec); + rc =snprint_config__ (conf, reply, hwtable, mpvec);pthread_cleanup_pop (1 );if (rc <0 )return 1 ;
Signature · 1 line
2.46.0
PATCH 19/41 libmultipath: rename __unlock()
In reply to Martin Wilck--- libmultipath/lock.c | 4 ++-- libmultipath/lock.h | 2 +- multipathd/uxlsnr.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
libmultipath/lock.c +2 -2
@@ -5,7 +5,7 @@ void cleanup_lock (void * data)struct mutex_lock *lock = data;wakeup_fn *fn = lock->wakeup; -__unlock (lock); +unlock__ (lock);if (fn)fn (); }
@@ -14,5 +14,5 @@ void set_wakeup_fn(struct mutex_lock *lck, wakeup_fn *fn) {lock (lck); lck->wakeup = fn; -__unlock (lck); +unlock__ (lck); }
libmultipath/lock.h +1 -1
@@ -50,7 +50,7 @@ static inline int timedlock(struct mutex_lock *a, struct timespec *tmo)return pthread_mutex_timedlock (&a->mutex, tmo); } -static inline void __unlock (struct mutex_lock *a) +static inline void unlock__ (struct mutex_lock *a) {pthread_mutex_unlock (&a->mutex); }
multipathd/uxlsnr.c +1 -1
@@ -527,7 +527,7 @@ static int client_state_machine(struct client *c, struct vectors *vecs,case CLT_LOCKED_WORK :if (trylock (&vecs->lock) ==0 ) {/* don't use cleanup_lock(), lest we wakeup ourselves */ -pthread_cleanup_push_cast (__unlock, &vecs->lock); +pthread_cleanup_push_cast (unlock__, &vecs->lock); c->error =execute_handler (c, vecs);check_for_locked_work (c);pthread_cleanup_pop (1 );
Signature · 1 line
2.46.0
PATCH 20/41 libmultipath: rename __sysfs_attr_get_value()
In reply to Martin Wilck--- libmultipath/sysfs.c | 6 +++--- tests/sysfs.c | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-)
libmultipath/sysfs.c +3 -3
@@ -45,7 +45,7 @@* as libudev lacks the capability to update an attribute value. * So for modified attributes we need to implement our own function. */ -static ssize_t __sysfs_attr_get_value (struct udev_device *dev,const char *attr_name, +static ssize_t sysfs_attr_get_value__ (struct udev_device *dev,const char *attr_name,char *value,size_t value_len,bool binary) {const char *syspath;
@@ -100,13 +100,13 @@ static ssize_t __sysfs_attr_get_value(struct udev_device *dev, const char *attr_ssize_t sysfs_attr_get_value (struct udev_device *dev,const char *attr_name,char *value,size_t value_len) { -return __sysfs_attr_get_value (dev, attr_name, value, value_len, false); +return sysfs_attr_get_value__ (dev, attr_name, value, value_len, false); }ssize_t sysfs_bin_attr_get_value (struct udev_device *dev,const char *attr_name,unsigned char *value,size_t value_len) { -return __sysfs_attr_get_value (dev, attr_name, (char *)value, +return sysfs_attr_get_value__ (dev, attr_name, (char *)value, value_len, true); }
tests/sysfs.c +10 -10
@@ -90,7 +90,7 @@ static int teardown(void **state)static void expect_sagv_invalid (void ) { -expect_condlog (1 ,"__sysfs_attr_get_value: invalid parameters" ); +expect_condlog (1 ,"sysfs_attr_get_value__: invalid parameters" ); }static void test_sagv_invalid (void **state)
@@ -132,12 +132,12 @@ static void test_sagv_invalid(void **state)static void test_sagv_bad_udev (void **state) {will_return (__wrap_udev_device_get_syspath,NULL ); -expect_condlog (3 ,"__sysfs_attr_get_value: invalid udevice" ); +expect_condlog (3 ,"sysfs_attr_get_value__: invalid udevice" );assert_int_equal (sysfs_attr_get_value ((void *)state, (void *)state, (void *)state,1 ), -EINVAL );will_return (__wrap_udev_device_get_syspath,NULL ); -expect_condlog (3 ,"__sysfs_attr_get_value: invalid udevice" ); +expect_condlog (3 ,"sysfs_attr_get_value__: invalid udevice" );assert_int_equal (sysfs_bin_attr_get_value ((void *)state, (void *)state, (void *)state,1 ), -EINVAL ); }
@@ -151,11 +151,11 @@ static void test_sagv_bad_snprintf(void **state) longstr[sizeof (longstr) -1 ] ='\0' ;will_return (__wrap_udev_device_get_syspath,"/foo" ); -expect_condlog (3 ,"__sysfs_attr_get_value: devpath overflow" ); +expect_condlog (3 ,"sysfs_attr_get_value__: devpath overflow" );assert_int_equal (sysfs_attr_get_value ((void *)state, longstr, buf,sizeof (buf)), -EOVERFLOW );will_return (__wrap_udev_device_get_syspath,"/foo" ); -expect_condlog (3 ,"__sysfs_attr_get_value: devpath overflow" ); +expect_condlog (3 ,"sysfs_attr_get_value__: devpath overflow" );assert_int_equal (sysfs_bin_attr_get_value ((void *)state, longstr, (unsigned char *)buf,sizeof (buf)), -EOVERFLOW );
@@ -171,7 +171,7 @@ static void test_sagv_open_fail(void **state)expect_value (WRAP_OPEN , flags,O_RDONLY ); errno =ENOENT ;wrap_will_return (WRAP_OPEN ,-1 ); -expect_condlog (3 ,"__sysfs_attr_get_value: attribute '/foo/bar' cannot be opened" ); +expect_condlog (3 ,"sysfs_attr_get_value__: attribute '/foo/bar' cannot be opened" );assert_int_equal (sysfs_attr_get_value ((void *)state,"bar" , buf,sizeof (buf)), -ENOENT ); }
@@ -190,7 +190,7 @@ static void test_sagv_read_fail(void **state) errno =EISDIR ;will_return (__wrap_read,-1 );will_return (__wrap_read,NULL ); -expect_condlog (3 ,"__sysfs_attr_get_value: read from /foo/bar failed:" ); +expect_condlog (3 ,"sysfs_attr_get_value__: read from /foo/bar failed:" );will_return (__wrap_close,0 );assert_int_equal (sysfs_attr_get_value ((void *)state,"bar" , buf,sizeof (buf)), -EISDIR );
@@ -205,7 +205,7 @@ static void test_sagv_read_fail(void **state) errno =EPERM ;will_return (__wrap_read,-1 );will_return (__wrap_read,NULL ); -expect_condlog (3 ,"__sysfs_attr_get_value: read from /foo/baz failed:" ); +expect_condlog (3 ,"sysfs_attr_get_value__: read from /foo/baz failed:" );will_return (__wrap_close,0 ); assert_int_equal(sysfs_bin_attr_get_value((void *)state, "baz", (unsigned char *)buf, sizeof(buf)),
@@ -235,7 +235,7 @@ static void _test_sagv_read(void **state, unsigned int bufsz)if (bufsz <=sizeof (input) -1 ) { n = bufsz; trunc =1 ; -expect_condlog (3 ,"__sysfs_attr_get_value: overflow reading from /foo/bar" ); +expect_condlog (3 ,"sysfs_attr_get_value__: overflow reading from /foo/bar" ); }else { n =sizeof (input) -1 ; trunc =0 ;
@@ -311,7 +311,7 @@ static void _test_sagv_read_zeroes(void **state, unsigned int bufsz)if (bufsz <=sizeof (input) -1 ) { n = bufsz; -expect_condlog (3 ,"__sysfs_attr_get_value: overflow reading from /foo/bar" ); +expect_condlog (3 ,"sysfs_attr_get_value__: overflow reading from /foo/bar" ); }else n =0 ;
Signature · 1 line
2.46.0
PATCH 21/41 libmultipath: rename __snprint_foreign_topology()
In reply to Martin Wilck... and __LAST_FOREIGN_RETCODE.
--- libmultipath/foreign.c | 6 +++--- libmultipath/foreign.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
libmultipath/foreign.c +3 -3
@@ -499,7 +499,7 @@ void foreign_multipath_layout(fieldwidth_t *width)pthread_cleanup_pop (1 ); } -static int __snprint_foreign_topology (struct strbuf *buf,int verbosity, +static int snprint_foreign_topology__ (struct strbuf *buf,int verbosity,const fieldwidth_t *width) {struct foreign *fgn;
@@ -540,7 +540,7 @@ int snprint_foreign_topology(struct strbuf *buf, int verbosity,return 0 ; }pthread_cleanup_push (unlock_foreigns,NULL ); - rc =__snprint_foreign_topology (buf, verbosity, width); + rc =snprint_foreign_topology__ (buf, verbosity, width);pthread_cleanup_pop (1 );return rc; }
@@ -570,7 +570,7 @@ void print_foreign_topology(int verbosity) fgn->release_paths (fgn->context, vec);pthread_cleanup_pop (1 ); } -__snprint_foreign_topology (&buf, verbosity, width); +snprint_foreign_topology__ (&buf, verbosity, width);pthread_cleanup_pop (1 );printf ("%s" ,get_strbuf_str (&buf)); }
libmultipath/foreign.h +1 -1
@@ -32,7 +32,7 @@ enum foreign_retcode {FOREIGN_UNCLAIMED ,FOREIGN_NODEV ,FOREIGN_ERR , - __LAST_FOREIGN_RETCODE, + LAST_FOREIGN_RETCODE__, };/**
Signature · 1 line
2.46.0
PATCH 22/41 libmultipath: rename macros with double underscores in propsel.c
In reply to Martin Wilck--- libmultipath/propsel.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
libmultipath/propsel.c +5 -5
@@ -48,7 +48,7 @@ do { \ } \ } while(0) -#define __do_set_from_vec (type, var, src, dest) \ +#define do_set_from_vec__ (type, var, src, dest) \ ({ \ type *_p; \ bool _found = false; \
@@ -64,11 +64,11 @@ do { \ _found; \ }) -#define __do_set_from_hwe (var, src, dest) \ - __do_set_from_vec(struct hwentry, var, (src)->hwe, dest) +#define do_set_from_hwe__ (var, src, dest) \ + do_set_from_vec__(struct hwentry, var, (src)->hwe, dest)#define do_set_from_hwe (var, src, dest, msg) \ - if (src->hwe && __do_set_from_hwe(var, src, dest)) { \ + if (src->hwe && do_set_from_hwe__(var, src, dest)) { \ origin = msg; \ goto out; \ }
@@ -660,7 +660,7 @@ check_rdac(struct path * pp)if (pp->bus !=SYSFS_BUS_SCSI )return 0 ;/* Avoid checking 0xc9 if this is likely not an RDAC array */ -if (!__do_set_from_hwe (checker_name, pp, checker_name) && +if (!do_set_from_hwe__ (checker_name, pp, checker_name) && !is_vpd_page_supported (pp->fd,0xC9 ))return 0 ;if (checker_name &&strcmp (checker_name,RDAC ))
Signature · 1 line
2.46.0
PATCH 23/41 libmultipath: rename enum values with double underscores in structs.h
In reply to Martin Wilck--- libmultipath/dict.c | 4 ++-- libmultipath/print.c | 2 +- libmultipath/structs.h | 4 ++-- libmultipath/valid.c | 2 +- tests/mpathvalid.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-)
libmultipath/dict.c +2 -2
@@ -568,7 +568,7 @@ def_find_multipaths_handler(struct config *conf, vector strvec,if (!buff)return 1 ; -for (i =FIND_MULTIPATHS_OFF ; i < __FIND_MULTIPATHS_LAST; i++) { +for (i =FIND_MULTIPATHS_OFF ; i <FIND_MULTIPATHS_LAST__ ; i++) {if (find_multipaths_optvals[i] !=NULL && !strcmp (buff, find_multipaths_optvals[i])) { conf->find_multipaths = i;
@@ -576,7 +576,7 @@ def_find_multipaths_handler(struct config *conf, vector strvec, } } -if (i >= __FIND_MULTIPATHS_LAST) { +if (i >=FIND_MULTIPATHS_LAST__ ) {if (strcmp (buff,"no" ) ==0 ||strcmp (buff,"0" ) ==0 ) conf->find_multipaths =FIND_MULTIPATHS_OFF ;else if (strcmp (buff,"yes" ) ==0 ||strcmp (buff,"1" ) ==0 )
libmultipath/print.c +1 -1
@@ -575,7 +575,7 @@ static int snprint_initialized(struct strbuf *buff, const struct path * pp) };const char *str; -if (pp->initialized <INIT_NEW || pp->initialized >= __INIT_LAST) +if (pp->initialized <INIT_NEW || pp->initialized >=INIT_LAST__ ) str ="undef" ;else str = init_state_name[pp->initialized];
libmultipath/structs.h +2 -2
@@ -99,7 +99,7 @@ enum find_multipaths_states {FIND_MULTIPATHS_GREEDY ,FIND_MULTIPATHS_SMART ,FIND_MULTIPATHS_STRICT , - __FIND_MULTIPATHS_LAST, + FIND_MULTIPATHS_LAST__, }; enum marginal_pathgroups_mode {
@@ -258,7 +258,7 @@ enum initialized_states {* change uevent is received. */ INIT_PARTIAL , - __INIT_LAST, + INIT_LAST__, }; enum prkey_sources {
libmultipath/valid.c +1 -1
@@ -302,7 +302,7 @@ is_path_valid(const char *name, struct config *conf, struct path *pp,return PATH_IS_ERROR ;if (conf->find_multipaths <=FIND_MULTIPATHS_UNDEF || - conf->find_multipaths >= __FIND_MULTIPATHS_LAST) + conf->find_multipaths >=FIND_MULTIPATHS_LAST__ )return PATH_IS_ERROR ;if (safe_sprintf (pp->dev,"%s" , name))
tests/mpathvalid.c +1 -1
@@ -130,7 +130,7 @@ void make_config_file(int findmp)char buf[64 ];assert_true (findmp >FIND_MULTIPATHS_UNDEF && - findmp < __FIND_MULTIPATHS_LAST); + findmp <FIND_MULTIPATHS_LAST__ ); r =snprintf (buf,sizeof (buf),"defaults {\nfind_multipaths %s\n}\n" , find_multipaths_optvals[findmp]);
Signature · 1 line
2.46.0
PATCH 24/41 libmultipath: rename macros starting with underscore
In reply to Martin Wilck--- libmultipath/checkers/directio.c | 8 ++++---- libmultipath/checkers/emc_clariion.c | 20 ++++++++++---------- libmultipath/checkers/rdac.c | 20 ++++++++++---------- libmultipath/checkers/tur.c | 10 +++++----- libmultipath/foreign/nvme.c | 26 +++++++++++++------------- 5 files changed, 42 insertions(+), 42 deletions(-)
libmultipath/checkers/directio.c +4 -4
@@ -49,11 +49,11 @@ enum { MSG_DIRECTIO_BLOCKSIZE, }; -#define _IDX (x) (MSG_DIRECTIO_##x - CHECKER_FIRST_MSGID) +#define IDX_ (x) (MSG_DIRECTIO_##x - CHECKER_FIRST_MSGID)const char *libcheck_msgtable[] = { - [_IDX (UNKNOWN )] =" is not available" , - [_IDX (PENDING )] =" is waiting on aio" , - [_IDX (BLOCKSIZE )] =" cannot get blocksize, set default" , + [IDX_ (UNKNOWN )] =" is not available" , + [IDX_ (PENDING )] =" is waiting on aio" , + [IDX_ (BLOCKSIZE )] =" cannot get blocksize, set default" ,NULL , };
libmultipath/checkers/emc_clariion.c +10 -10
@@ -57,20 +57,20 @@ enum { MSG_CLARIION_PASSIVE_GOOD, }; -#define _IDX (x) (MSG_CLARIION_ ## x - CHECKER_FIRST_MSGID) +#define IDX_ (x) (MSG_CLARIION_ ## x - CHECKER_FIRST_MSGID)const char *libcheck_msgtable[] = { - [_IDX (QUERY_FAILED )] =": sending query command failed" , - [_IDX (QUERY_ERROR )] =": query command indicates error" , - [_IDX (PATH_CONFIG )] = + [IDX_ (QUERY_FAILED )] =": sending query command failed" , + [IDX_ (QUERY_ERROR )] =": query command indicates error" , + [IDX_ (PATH_CONFIG )] =": Path not correctly configured for failover" , - [_IDX (UNIT_REPORT )] = + [IDX_ (UNIT_REPORT )] =": Path unit report page in unknown format" , - [_IDX (PATH_NOT_AVAIL )] = + [IDX_ (PATH_NOT_AVAIL )] =": Path not available for normal operations" , - [_IDX (LUN_UNBOUND )] =": Logical Unit is unbound or LUNZ" , - [_IDX (WWN_CHANGED )] =": Logical Unit WWN has changed" , - [_IDX (READ_ERROR )] =": Read error" , - [_IDX (PASSIVE_GOOD )] =": Active path is healthy" , + [IDX_ (LUN_UNBOUND )] =": Logical Unit is unbound or LUNZ" , + [IDX_ (WWN_CHANGED )] =": Logical Unit WWN has changed" , + [IDX_ (READ_ERROR )] =": Read error" , + [IDX_ (PASSIVE_GOOD )] =": Active path is healthy" ,NULL , };
libmultipath/checkers/rdac.c +10 -10
@@ -234,19 +234,19 @@ enum { RDAC_MSGID_INQUIRY_FAILED, }; -#define _IDX (x) (RDAC_MSGID_##x - CHECKER_FIRST_MSGID) +#define IDX_ (x) (RDAC_MSGID_##x - CHECKER_FIRST_MSGID)const char *libcheck_msgtable[] = { - [_IDX (NOT_CONN )] =MSG_RDAC_DOWN_TYPE ("lun not connected" ), - [_IDX (IN_STARTUP )] =MSG_RDAC_DOWN_TYPE ("ctlr is in startup sequence" ), - [_IDX (NON_RESPONSIVE )] = + [IDX_ (NOT_CONN )] =MSG_RDAC_DOWN_TYPE ("lun not connected" ), + [IDX_ (IN_STARTUP )] =MSG_RDAC_DOWN_TYPE ("ctlr is in startup sequence" ), + [IDX_ (NON_RESPONSIVE )] =MSG_RDAC_DOWN_TYPE ("non-responsive to queries" ), - [_IDX (IN_RESET )] =MSG_RDAC_DOWN_TYPE ("ctlr held in reset" ), - [_IDX (FW_DOWNLOADING )] = + [IDX_ (IN_RESET )] =MSG_RDAC_DOWN_TYPE ("ctlr held in reset" ), + [IDX_ (FW_DOWNLOADING )] =MSG_RDAC_DOWN_TYPE ("ctlr firmware downloading" ), - [_IDX (QUIESCED )] =MSG_RDAC_DOWN_TYPE ("ctlr quiesced by admin request" ), - [_IDX (SERVICE_MODE )] =MSG_RDAC_DOWN_TYPE ("ctlr is in service mode" ), - [_IDX (UNAVAILABLE )] =MSG_RDAC_DOWN_TYPE ("ctlr is unavailable" ), - [_IDX (INQUIRY_FAILED )] =MSG_RDAC_DOWN_TYPE ("inquiry failed" ), + [IDX_ (QUIESCED )] =MSG_RDAC_DOWN_TYPE ("ctlr quiesced by admin request" ), + [IDX_ (SERVICE_MODE )] =MSG_RDAC_DOWN_TYPE ("ctlr is in service mode" ), + [IDX_ (UNAVAILABLE )] =MSG_RDAC_DOWN_TYPE ("ctlr is unavailable" ), + [IDX_ (INQUIRY_FAILED )] =MSG_RDAC_DOWN_TYPE ("inquiry failed" ),NULL , };
libmultipath/checkers/tur.c +5 -5
@@ -35,12 +35,12 @@ enum { MSG_TUR_TRANSITIONING, }; -#define _IDX (x) (MSG_ ## x - CHECKER_FIRST_MSGID) +#define IDX_ (x) (MSG_ ## x - CHECKER_FIRST_MSGID)const char *libcheck_msgtable[] = { - [_IDX (TUR_RUNNING )] =" still running" , - [_IDX (TUR_TIMEOUT )] =" timed out" , - [_IDX (TUR_FAILED )] =" failed to initialize" , - [_IDX (TUR_TRANSITIONING )] =" reports path is transitioning" , + [IDX_ (TUR_RUNNING )] =" still running" , + [IDX_ (TUR_TIMEOUT )] =" timed out" , + [IDX_ (TUR_FAILED )] =" failed to initialize" , + [IDX_ (TUR_TRANSITIONING )] =" reports path is transitioning" ,NULL , };
libmultipath/foreign/nvme.c +13 -13
@@ -955,18 +955,18 @@ void release_paths(__attribute__((unused)) const struct context *ctx, }/* compile-time check whether all methods are present and correctly typed */ -#define _METHOD_INIT (x) .x = x +#define METHOD_INIT (x) .x = x static struct foreign __methods __attribute__((unused)) = { -_METHOD_INIT (init), -_METHOD_INIT (cleanup ), -_METHOD_INIT (change ), -_METHOD_INIT (delete ), -_METHOD_INIT (delete_all ), -_METHOD_INIT (check ), -_METHOD_INIT (lock ), -_METHOD_INIT (unlock ), -_METHOD_INIT (get_multipaths ), -_METHOD_INIT (release_multipaths ), -_METHOD_INIT (get_paths ), - _METHOD_INIT(release_paths), +METHOD_INIT (init), +METHOD_INIT (cleanup ), +METHOD_INIT (change ), +METHOD_INIT (delete ), +METHOD_INIT (delete_all ), +METHOD_INIT (check ), +METHOD_INIT (lock ), +METHOD_INIT (unlock ), +METHOD_INIT (get_multipaths ), +METHOD_INIT (release_multipaths ), +METHOD_INIT (get_paths ), + METHOD_INIT(release_paths), };
Signature · 1 line
2.46.0
PATCH 25/41 libmultipath: rename __internal_config variable
In reply to Martin Wilck--- libmultipath/config.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
libmultipath/config.c +8 -8
@@ -72,13 +72,13 @@ void libmultipath_exit(void)pthread_once (&_exit_once, _libmultipath_exit); } -static struct config __internal_config; +static struct config internal_config;struct config *libmp_get_multipath_config (void ) { -if (!__internal_config.hwtable) +if (!internal_config.hwtable)/* not initialized */ return NULL ; -return &__internal_config; +return &internal_config; }struct config *get_multipath_config (void )
@@ -734,7 +734,7 @@ static void _uninit_config(struct config *conf)int i;if (!conf) - conf = &__internal_config; + conf = &internal_config;if (conf->selector)free (conf->selector);
@@ -791,14 +791,14 @@ static void _uninit_config(struct config *conf)void uninit_config (void ) { -_uninit_config (&__internal_config); +_uninit_config (&internal_config); }void free_config (struct config *conf) {if (!conf)return ; -else if (conf == &__internal_config) { +else if (conf == &internal_config) {condlog (0 ,"ERROR: %s called for internal config. Use uninit_config() instead" , __func__);return ;
@@ -883,7 +883,7 @@ static int _init_config (const char *file, struct config *conf);int init_config (const char *file) { -return _init_config (file, &__internal_config); +return _init_config (file, &internal_config); }struct config *load_config (const char *file)
@@ -901,7 +901,7 @@ int _init_config (const char *file, struct config *conf) {if (!conf) - conf = &__internal_config; + conf = &internal_config;/* * Processing the config file will overwrite conf->verbosity if set
Signature · 1 line
2.46.0
PATCH 26/41 libmultipath: rename _dm_flush_map() to dm_flush_map__()
In reply to Martin Wilck--- libmultipath/devmapper.c | 4 ++-- libmultipath/devmapper.h | 8 ++++---- libmultipath/libmultipath.version | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
libmultipath/devmapper.c +2 -2
@@ -965,7 +965,7 @@ int mpath_in_use(const char *name)return 0 ; } -int _dm_flush_map (const char *mapname,int flags,int retries) +int dm_flush_map__ (const char *mapname,int flags,int retries) {int r;int queue_if_no_path =0 ;
@@ -1050,7 +1050,7 @@ dm_flush_map_nopaths(const char *mapname, int deferred_remove DR_UNUSED__) deferred_remove == DEFERRED_REMOVE_IN_PROGRESS) ? DMFL_DEFERRED : 0);#endif -return _dm_flush_map (mapname, flags,0 ); +return dm_flush_map__ (mapname, flags,0 ); }int dm_flush_maps (int retries)
libmultipath/devmapper.h +4 -4
@@ -161,11 +161,11 @@ enum { DMFL_NO_FLUSH = 1 << 3, }; -int _dm_flush_map (const char *mapname,int flags,int retries); -#define dm_flush_map (mapname) _dm_flush_map(mapname, DMFL_NEED_SYNC, 0) -#define dm_flush_map_nosync (mapname) _dm_flush_map(mapname, DMFL_NONE, 0) +int dm_flush_map__ (const char *mapname,int flags,int retries); +#define dm_flush_map (mapname) dm_flush_map__(mapname, DMFL_NEED_SYNC, 0) +#define dm_flush_map_nosync (mapname) dm_flush_map__(mapname, DMFL_NONE, 0)#define dm_suspend_and_flush_map (mapname, retries) \ - _dm_flush_map(mapname, DMFL_NEED_SYNC|DMFL_SUSPEND, retries) + dm_flush_map__(mapname, DMFL_NEED_SYNC|DMFL_SUSPEND, retries)int dm_flush_map_nopaths (const char * mapname,int deferred_remove);int dm_cancel_deferred_remove (struct multipath *mpp);int dm_flush_maps (int retries);
libmultipath/libmultipath.version +1 -1
@@ -75,7 +75,7 @@ global: dm_enablegroup; dm_fail_path; dm_find_map_by_wwid; - _dm_flush_map; + dm_flush_map__; dm_flush_map_nopaths; dm_flush_maps; dm_geteventnr;
Signature · 1 line
2.46.0
PATCH 27/41 libmultipath: foreign: rename _check() to check__()
In reply to Martin Wilck--- libmultipath/foreign/nvme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
libmultipath/foreign/nvme.c +2 -2
@@ -891,7 +891,7 @@ int delete(struct context *ctx, struct udev_device *ud)return rc; } -void _check (struct context *ctx) +void check__ (struct context *ctx) {struct gen_multipath *gm;int i;
@@ -908,7 +908,7 @@ void check(struct context *ctx)condlog (4 ,"%s called for \"%s\"" , __func__,THIS );lock (ctx);pthread_cleanup_push (unlock, ctx); -_check (ctx); +check__ (ctx);pthread_cleanup_pop (1 );return ; }
Signature · 1 line
2.46.0
PATCH 28/41 libmultipath: rename _cleanup_foreign()
In reply to Martin Wilck--- libmultipath/foreign.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
libmultipath/foreign.c +3 -3
@@ -84,7 +84,7 @@ static void free_foreign(struct foreign *fgn)free (fgn); } -void _cleanup_foreign (void ) +void cleanup_foreign__ (void ) {struct foreign *fgn;int i;
@@ -103,7 +103,7 @@ void _cleanup_foreign(void)void cleanup_foreign (void ) {wrlock_foreigns (); -_cleanup_foreign (); +cleanup_foreign__ ();unlock_foreigns (NULL ); }
@@ -164,7 +164,7 @@ static int _init_foreign(const char *enable) r = -errno;condlog (1 ,"%s: error scanning foreign multipath libraries: %m" , __func__); -_cleanup_foreign (); +cleanup_foreign__ (); goto out_free_pre; }
Signature · 1 line
2.46.0
PATCH 29/41 libmultipath: rename _init_config()
In reply to Martin Wilck--- libmultipath/config.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
libmultipath/config.c +4 -4
@@ -879,25 +879,25 @@ static void set_max_checkint_from_watchdog(struct config *conf) }#endif -static int _init_config (const char *file,struct config *conf); +static int init_config__ (const char *file,struct config *conf);int init_config (const char *file) { -return _init_config (file, &internal_config); +return init_config__ (file, &internal_config); }struct config *load_config (const char *file) {struct config *conf =alloc_config (); -if (conf && !_init_config (file, conf)) +if (conf && !init_config__ (file, conf))return conf;free (conf);return NULL ; } -int _init_config (const char *file,struct config *conf) +int init_config__ (const char *file,struct config *conf) {if (!conf)
Signature · 1 line
2.46.0
PATCH 30/41 libmultipath: rename symbols starting with underscore in print.h
In reply to Martin Wilck--- libmultipath/foreign.c | 12 +++++------ libmultipath/foreign.h | 2 +- libmultipath/libmultipath.version | 8 ++++---- libmultipath/print.c | 34 +++++++++++++++---------------- libmultipath/print.h | 20 +++++++++--------- 5 files changed, 38 insertions(+), 38 deletions(-)
libmultipath/foreign.c +6 -6
@@ -458,7 +458,7 @@ void foreign_path_layout(fieldwidth_t *width) vec = fgn->get_paths (fgn->context);if (vec !=NULL ) { -_get_path_layout (vec,LAYOUT_RESET_NOT , width); +get_path_layout__ (vec,LAYOUT_RESET_NOT , width); } fgn->release_paths (fgn->context, vec);
@@ -489,7 +489,7 @@ void foreign_multipath_layout(fieldwidth_t *width) vec = fgn->get_multipaths (fgn->context);if (vec !=NULL ) { -_get_multipath_layout (vec,LAYOUT_RESET_NOT , width); +get_multipath_layout__ (vec,LAYOUT_RESET_NOT , width); } fgn->release_multipaths (fgn->context, vec);
@@ -517,7 +517,7 @@ static int snprint_foreign_topology__(struct strbuf *buf, int verbosity, vec = fgn->get_multipaths (fgn->context);if (vec !=NULL ) { vector_foreach_slot(vec, gm, j) { -if (_snprint_multipath_topology ( +if (snprint_multipath_topology__ ( gm, buf, verbosity, width) <0 )break ; }
@@ -566,7 +566,7 @@ void print_foreign_topology(int verbosity) fgn->lock (fgn->context);pthread_cleanup_push (fgn->unlock, fgn->context); vec = fgn->get_paths (fgn->context); -_get_multipath_layout (vec,LAYOUT_RESET_NOT , width); +get_multipath_layout__ (vec,LAYOUT_RESET_NOT , width); fgn->release_paths (fgn->context, vec);pthread_cleanup_pop (1 ); }
@@ -600,7 +600,7 @@ int snprint_foreign_paths(struct strbuf *buf, const char *style, vec = fgn->get_paths (fgn->context);if (vec !=NULL ) { vector_foreach_slot(vec, gp, j) { - ret =_snprint_path (gp, buf, style, width); + ret =snprint_path__ (gp, buf, style, width);if (ret <0 )break ; }
@@ -640,7 +640,7 @@ int snprint_foreign_multipaths(struct strbuf *buf, const char *style, vec = fgn->get_multipaths (fgn->context);if (vec !=NULL ) { vector_foreach_slot(vec, gm, j) { - ret =_snprint_multipath (gm, buf, + ret =snprint_multipath__ (gm, buf, style, width);if (ret <0 )break ;
libmultipath/foreign.h +1 -1
@@ -271,7 +271,7 @@ void foreign_multipath_layout(fieldwidth_t *width);* '\0' - terminated. * @param buf: output buffer * @param verbosity: verbosity level -* @param width: an array of field widths, initialized by _get_path_layout() +* @param width: an array of field widths, initialized by get_path_layout__() * @returns: number of printed characters excluding trailing '\0'. */ int snprint_foreign_topology(struct strbuf *buf, int verbosity,
libmultipath/libmultipath.version +4 -4
@@ -149,7 +149,7 @@ global: path_offline; print_all_paths; print_foreign_topology; - _print_multipath_topology; + print_multipath_topology__; reinstate_paths; remember_wwid; remove_feature;
@@ -179,12 +179,12 @@ global: snprint_foreign_multipaths; snprint_foreign_paths; snprint_foreign_topology; - _snprint_multipath; + snprint_multipath__; snprint_multipath_header; snprint_multipath_map_json; - _snprint_multipath_topology; + snprint_multipath_topology__; snprint_multipath_topology_json; - _snprint_path; + snprint_path__; snprint_path_header; snprint_status; snprint_wildcards;
libmultipath/print.c +17 -17
@@ -924,7 +924,7 @@ void get_path_layout(vector pathvec, int header, fieldwidth_t *width) { vector gpvec = vector_convert(NULL, pathvec, struct path, dm_path_to_gen); -_get_path_layout (gpvec, +get_path_layout__ (gpvec, header ?LAYOUT_RESET_HEADER :LAYOUT_RESET_ZERO , width);vector_free (gpvec);
@@ -946,7 +946,7 @@ reset_width(fieldwidth_t *width, enum layout_reset reset, const char *header) } } -void _get_path_layout (const struct _vector *gpvec,enum layout_reset reset, +void get_path_layout__ (const struct _vector *gpvec,enum layout_reset reset,fieldwidth_t *width) {unsigned int i, j;
@@ -980,14 +980,14 @@ fieldwidth_t *alloc_multipath_layout(void) {void get_multipath_layout (vector mpvec,int header,fieldwidth_t *width) { vector gmvec = vector_convert(NULL, mpvec, struct multipath, dm_multipath_to_gen); -_get_multipath_layout (gmvec, +get_multipath_layout__ (gmvec, header ?LAYOUT_RESET_HEADER :LAYOUT_RESET_ZERO , width);vector_free (gmvec); }void -_get_multipath_layout (const struct _vector *gmvec,enum layout_reset reset, +get_multipath_layout__ (const struct _vector *gmvec,enum layout_reset reset,fieldwidth_t *width) {unsigned int i, j;
@@ -1110,7 +1110,7 @@ int snprint_multipath_header(struct strbuf *line, const char *format,return get_strbuf_len (line) - initial_len; } -int _snprint_multipath (const struct gen_multipath *gmp, +int snprint_multipath__ (const struct gen_multipath *gmp,struct strbuf *line,const char *format,const fieldwidth_t *width) {
@@ -1171,7 +1171,7 @@ int snprint_path_header(struct strbuf *line, const char *format,return get_strbuf_len (line) - initial_len; } -int _snprint_path (const struct gen_path *gp,struct strbuf *line, +int snprint_path__ (const struct gen_path *gp,struct strbuf *line,const char *format,const fieldwidth_t *width) {int initial_len =get_strbuf_len (line);
@@ -1200,7 +1200,7 @@ int _snprint_path(const struct gen_path *gp, struct strbuf *line,return get_strbuf_len (line) - initial_len; } -int _snprint_pathgroup (const struct gen_pathgroup *ggp,struct strbuf *line, +int snprint_pathgroup__ (const struct gen_pathgroup *ggp,struct strbuf *line,const char *format) {int initial_len =get_strbuf_len (line);
@@ -1223,9 +1223,9 @@ int _snprint_pathgroup(const struct gen_pathgroup *ggp, struct strbuf *line, }#define snprint_pathgroup (line, fmt, pgp) \ - _snprint_pathgroup(dm_pathgroup_to_gen(pgp), line, fmt) + snprint_pathgroup__(dm_pathgroup_to_gen(pgp), line, fmt) -void _print_multipath_topology (const struct gen_multipath *gmp,int verbosity) +void print_multipath_topology__ (const struct gen_multipath *gmp,int verbosity) {STRBUF_ON_STACK (buff); fieldwidth_t *p_width __attribute__((cleanup(cleanup_ucharp))) = NULL;
@@ -1241,13 +1241,13 @@ void _print_multipath_topology(const struct gen_multipath *gmp, int verbosity) pathvec = gpg->ops->get_paths (gpg);if (pathvec ==NULL )continue ; -_get_path_layout (pathvec,LAYOUT_RESET_NOT , p_width); +get_path_layout__ (pathvec,LAYOUT_RESET_NOT , p_width); gpg->ops->rel_paths (gpg, pathvec); } gmp->ops->rel_pathgroups (gmp, pgvec); } -_snprint_multipath_topology (gmp, &buff, verbosity, p_width); +snprint_multipath_topology__ (gmp, &buff, verbosity, p_width);printf ("%s" ,get_strbuf_str (&buff)); }
@@ -1266,7 +1266,7 @@ int snprint_multipath_style(const struct gen_multipath *gmp, need_wwid ? " (%w)" : "", " %d %s"); } -int _snprint_multipath_topology (const struct gen_multipath *gmp, +int snprint_multipath_topology__ (const struct gen_multipath *gmp,struct strbuf *buff,int verbosity,const fieldwidth_t *p_width) {
@@ -1284,7 +1284,7 @@ int _snprint_multipath_topology(const struct gen_multipath *gmp,return -ENOMEM ;if (verbosity ==1 ) -return _snprint_multipath (gmp, buff,"%n" , width); +return snprint_multipath__ (gmp, buff,"%n" , width);if (isatty (1 ) && (rc =print_strbuf (&style,"%c[%dm" ,0x1B ,1 )) <0 )/* bold on */
@@ -1295,8 +1295,8 @@ int _snprint_multipath_topology(const struct gen_multipath *gmp, (rc = print_strbuf(&style, "%c[%dm", 0x1B, 0)) < 0) /* bold off */return rc; -if ((rc =_snprint_multipath (gmp, buff,get_strbuf_str (&style), width)) <0 - || (rc =_snprint_multipath (gmp, buff,PRINT_MAP_PROPS , width)) <0 ) +if ((rc =snprint_multipath__ (gmp, buff,get_strbuf_str (&style), width)) <0 + || (rc =snprint_multipath__ (gmp, buff,PRINT_MAP_PROPS , width)) <0 )return rc; pgvec = gmp->ops->get_pathgroups (gmp);
@@ -1310,7 +1310,7 @@ int _snprint_multipath_topology(const struct gen_multipath *gmp,if ((rc =print_strbuf (buff,"%c-+- " , last_group ?'`' :'|' )) <0 || - (rc =_snprint_pathgroup (gpg, buff,PRINT_PG_INDENT )) <0 ) + (rc =snprint_pathgroup__ (gpg, buff,PRINT_PG_INDENT )) <0 )return rc; pathvec = gpg->ops->get_paths (gpg);
@@ -1322,7 +1322,7 @@ int _snprint_multipath_topology(const struct gen_multipath *gmp, last_group ? ' ' : '|', i + 1 == VECTOR_SIZE(pathvec) ? '`': '|')) < 0 || - (rc = _snprint_path(gp, buff, + (rc = snprint_path__(gp, buff, PRINT_PATH_INDENT, p_width)) < 0)return rc; }
libmultipath/print.h +10 -10
@@ -17,28 +17,28 @@ enum layout_reset {/* fieldwidth_t is defined in generic.h */ fieldwidth_t *alloc_path_layout (void ); -void _get_path_layout (const struct _vector *gpvec,enum layout_reset , +void get_path_layout__ (const struct _vector *gpvec,enum layout_reset ,fieldwidth_t *width);void get_path_layout (vector pathvec,int header,fieldwidth_t *width);fieldwidth_t *alloc_multipath_layout (void ); -void _get_multipath_layout (const struct _vector *gmvec,enum layout_reset , +void get_multipath_layout__ (const struct _vector *gmvec,enum layout_reset ,fieldwidth_t *width);void get_multipath_layout (vector mpvec,int header,fieldwidth_t *width);int snprint_path_header (struct strbuf *,const char *,const fieldwidth_t *);int snprint_multipath_header (struct strbuf *,const char *,const fieldwidth_t *); -int _snprint_path (const struct gen_path *,struct strbuf *,const char *, +int snprint_path__ (const struct gen_path *,struct strbuf *,const char *,const fieldwidth_t *);#define snprint_path (buf, fmt, pp, w) \ - _snprint_path(dm_path_to_gen(pp), buf, fmt, w) -int _snprint_multipath (const struct gen_multipath *,struct strbuf *, + snprint_path__(dm_path_to_gen(pp), buf, fmt, w) +int snprint_multipath__ (const struct gen_multipath *,struct strbuf *,const char *,const fieldwidth_t *);#define snprint_multipath (buf, fmt, mp, w) \ - _snprint_multipath(dm_multipath_to_gen(mp), buf, fmt, w) -int _snprint_multipath_topology (const struct gen_multipath *,struct strbuf *, + snprint_multipath__(dm_multipath_to_gen(mp), buf, fmt, w) +int snprint_multipath_topology__ (const struct gen_multipath *,struct strbuf *,int verbosity,const fieldwidth_t *);#define snprint_multipath_topology (buf, mpp, v, w) \ - _snprint_multipath_topology (dm_multipath_to_gen(mpp), buf, v, w) + snprint_multipath_topology__ (dm_multipath_to_gen(mpp), buf, v, w)int snprint_multipath_topology_json (struct strbuf *,const struct vectors *vecs);int snprint_config__ (const struct config *conf,struct strbuf *buff,const struct _vector *hwtable,const struct _vector *mpvec);
@@ -58,10 +58,10 @@ int snprint_tgt_wwpn(struct strbuf *, const struct path *);#define PROTOCOL_BUF_SIZE sizeof("scsi:unspec")int snprint_path_protocol (struct strbuf *,const struct path *); -void _print_multipath_topology (const struct gen_multipath * gmp, +void print_multipath_topology__ (const struct gen_multipath * gmp,int verbosity);#define print_multipath_topology (mpp, v) \ - _print_multipath_topology(dm_multipath_to_gen(mpp), v) + print_multipath_topology__(dm_multipath_to_gen(mpp), v)void print_all_paths (vector pathvec,int banner);
Signature · 1 line
2.46.0
PATCH 31/41 libmultipath: remove dead code in pgpolicies.h
In reply to Martin Wilck--- libmultipath/pgpolicies.h | 6 ------ 1 file changed, 6 deletions(-)
libmultipath/pgpolicies.h +0 -6
@@ -1,12 +1,6 @@#ifndef PGPOLICIES_H_INCLUDED #define PGPOLICIES_H_INCLUDED -#if 0 -#ifndef _MAIN_H -#include "main.h" -#endif -#endif -#define POLICY_NAME_SIZE 32/* Storage controllers capabilities */
Signature · 1 line
2.46.0
PATCH 32/41 libmultipath: remove struct and union names in cciss.h
In reply to Martin WilckOnly the typedef names are used in the rest of the code, so we don't need these struct names.
--- libmultipath/checkers/cciss.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
libmultipath/checkers/cciss.h +9 -9
@@ -42,7 +42,7 @@#pragma pack(1)//Command List Structure -typedef union _SCSI3Addr_struct { +typedef union { struct { BYTE Dev; BYTE Bus:6;
@@ -61,27 +61,27 @@ typedef union _SCSI3Addr_struct { } LogUnit; } SCSI3Addr_struct; -typedef struct _PhysDevAddr_struct { +typedef struct {DWORD TargetId:24 ;DWORD Bus:6 ;DWORD Mode:2 ;SCSI3Addr_struct Target[2 ];//2 level target device addr }PhysDevAddr_struct ; -typedef struct _LogDevAddr_struct { +typedef struct {DWORD VolId:30 ;DWORD Mode:2 ;BYTE reserved[4 ]; }LogDevAddr_struct ; -typedef union _LUNAddr_struct { +typedef union {BYTE LunAddrBytes[8 ];SCSI3Addr_struct SCSI3Lun[4 ];PhysDevAddr_struct PhysDev;LogDevAddr_struct LogDev; }LUNAddr_struct ; -typedef struct _RequestBlock_struct { +typedef struct { BYTE CDBLen; struct { BYTE Type:3;
@@ -92,7 +92,7 @@ typedef struct _RequestBlock_struct {BYTE CDB [16 ]; } RequestBlock_struct; -typedef union _MoreErrInfo_struct{ +typedef union { struct { BYTE Reserved[3]; BYTE Type;
@@ -106,7 +106,7 @@ typedef union _MoreErrInfo_struct{ } Invalid_Cmd; } MoreErrInfo_struct; -typedef struct _ErrorInfo_struct { +typedef struct { BYTE ScsiStatus; BYTE SenseLen; HWORD CommandStatus;
@@ -117,7 +117,7 @@ typedef struct _ErrorInfo_struct {#pragma pack() -typedef struct _IOCTL_Command_struct { +typedef struct { LUNAddr_struct LUN_info; RequestBlock_struct Request; ErrorInfo_struct error_info;
@@ -125,7 +125,7 @@ typedef struct _IOCTL_Command_struct {BYTE *buf; } IOCTL_Command_struct; -typedef struct _LogvolInfo_struct{ +typedef struct { __u32 LunID; int num_opens; /* number of opens on the logical volume */ int num_parts; /* number of partitions configured on logvol */
Signature · 1 line
2.46.0
PATCH 33/41 libmpathpersist: rename functions with double leading underscore
In reply to Martin WilckAlso remove some superfluous "extern" qualifiers in mpath_persist.h.
--- libmpathpersist/libmpathpersist.version | 6 ++-- libmpathpersist/mpath_persist.c | 22 +++++++------- libmpathpersist/mpath_persist.h | 39 ++++++++++++------------- mpathpersist/main.c | 6 ++-- 4 files changed, 35 insertions(+), 38 deletions(-)
libmpathpersist/libmpathpersist.version +3 -3
@@ -10,7 +10,7 @@ * * See libmultipath.version for general policy about version numbers. */ -LIBMPATHPERSIST_2.1.0 { +LIBMPATHPERSIST_3.0.0 { global: /* public API as defined in mpath_persist.h */ libmpathpersist_exit;
@@ -19,10 +19,10 @@ global: mpath_lib_init; mpath_mx_alloc_len; mpath_persistent_reserve_free_vecs; - __mpath_persistent_reserve_in; + mpath_persistent_reserve_in__; mpath_persistent_reserve_in; mpath_persistent_reserve_init_vecs; - __mpath_persistent_reserve_out; + mpath_persistent_reserve_out__; mpath_persistent_reserve_out; local: *; };
libmpathpersist/mpath_persist.c +11 -11
@@ -74,7 +74,7 @@ int libmpathpersist_exit(void)static vector curmp;static vector pathvec; -static void __mpath_persistent_reserve_free_vecs (vector curmp,vector pathvec) +static void mpath_persistent_reserve_free_vecs__ (vector curmp,vector pathvec) {free_multipathvec (curmp,KEEP_PATHS );free_pathvec (pathvec,FREE_PATHS );
@@ -82,11 +82,11 @@ static void __mpath_persistent_reserve_free_vecs(vector curmp, vector pathvec)void mpath_persistent_reserve_free_vecs (void ) { -__mpath_persistent_reserve_free_vecs (curmp, pathvec); +mpath_persistent_reserve_free_vecs__ (curmp, pathvec); curmp = pathvec =NULL ; } -static int __mpath_persistent_reserve_init_vecs (vector *curmp_p, +static int mpath_persistent_reserve_init_vecs__ (vector *curmp_p,vector *pathvec_p,int verbose) { libmp_verbosity = verbose;
@@ -110,17 +110,17 @@ static int __mpath_persistent_reserve_init_vecs(vector *curmp_p,return MPATH_PR_SUCCESS ; err: -__mpath_persistent_reserve_free_vecs (*curmp_p, *pathvec_p); +mpath_persistent_reserve_free_vecs__ (*curmp_p, *pathvec_p); *curmp_p = *pathvec_p =NULL ;return MPATH_PR_DMMP_ERROR ; }int mpath_persistent_reserve_init_vecs (int verbose) { -return __mpath_persistent_reserve_init_vecs (&curmp, &pathvec, verbose); +return mpath_persistent_reserve_init_vecs__ (&curmp, &pathvec, verbose); } -int __mpath_persistent_reserve_in (int fd,int rq_servact, +int mpath_persistent_reserve_in__ (int fd,int rq_servact,struct prin_resp *resp,int noisy) { return do_mpath_persistent_reserve_in(curmp, pathvec, fd, rq_servact,
@@ -128,7 +128,7 @@ int __mpath_persistent_reserve_in (int fd, int rq_servact, } -int __mpath_persistent_reserve_out (int fd,int rq_servact,int rq_scope, +int mpath_persistent_reserve_out__ (int fd,int rq_servact,int rq_scope,unsigned int rq_type,struct prout_param_descriptor *paramp,int noisy) { return do_mpath_persistent_reserve_out(curmp, pathvec, fd, rq_servact,
@@ -140,14 +140,14 @@ int mpath_persistent_reserve_in (int fd, int rq_servact, struct prin_resp *resp, int noisy, int verbose) { vector curmp = NULL, pathvec; -int ret =__mpath_persistent_reserve_init_vecs (&curmp, &pathvec, +int ret =mpath_persistent_reserve_init_vecs__ (&curmp, &pathvec, verbose);if (ret !=MPATH_PR_SUCCESS )return ret; ret =do_mpath_persistent_reserve_in (curmp, pathvec, fd, rq_servact, resp, noisy); -__mpath_persistent_reserve_free_vecs (curmp, pathvec); +mpath_persistent_reserve_free_vecs__ (curmp, pathvec);return ret; }
@@ -155,13 +155,13 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope, unsigned int rq_type, struct prout_param_descriptor *paramp, int noisy, int verbose) { vector curmp = NULL, pathvec; -int ret =__mpath_persistent_reserve_init_vecs (&curmp, &pathvec, +int ret =mpath_persistent_reserve_init_vecs__ (&curmp, &pathvec, verbose);if (ret !=MPATH_PR_SUCCESS )return ret; ret =do_mpath_persistent_reserve_out (curmp, pathvec, fd, rq_servact, rq_scope, rq_type, paramp, noisy); -__mpath_persistent_reserve_free_vecs (curmp, pathvec); +mpath_persistent_reserve_free_vecs__ (curmp, pathvec);return ret; }
libmpathpersist/mpath_persist.h +18 -21
@@ -3,7 +3,6 @@ #ifndef MPATH_PERSIST_H_INCLUDED #define MPATH_PERSIST_H_INCLUDED - #ifdef __cplusplus extern "C" { #endif
@@ -81,12 +80,8 @@ extern "C" {#define MPATH_WWUI_DEVICE_NAME 0x00/* World wide unique initiator device name */ #define MPATH_WWUI_PORT_IDENTIFIER 0x40/* World wide unique initiator port identifier */ - -extern unsigned int mpath_mx_alloc_len; - -struct prin_readdescr {uint32_t prgeneration;
@@ -183,7 +178,7 @@ struct prout_param_descriptor { /* PROUT parameter descriptor */* * RETURNS: 0->Success, 1->Failed. */ -extern int libmpathpersist_init (void ); +int libmpathpersist_init (void );/* * DESCRIPTION :
@@ -197,7 +192,7 @@ extern int libmpathpersist_init (void);* * RETURNS: struct config ->Success, NULL->Failed. */ -extern struct config *mpath_lib_init (void ); +struct config *mpath_lib_init (void );/*
@@ -209,7 +204,7 @@ extern struct config * mpath_lib_init (void);* * RETURNS: 0->Success, 1->Failed. */ -extern int mpath_lib_exit (struct config *conf); +int mpath_lib_exit (struct config *conf);/* * DESCRIPTION :
@@ -221,7 +216,7 @@ extern int mpath_lib_exit (struct config *conf);* * RETURNS: 0->Success, 1->Failed. */ -extern int libmpathpersist_exit (void ); +int libmpathpersist_exit (void );/*
@@ -241,8 +236,8 @@ extern int libmpathpersist_exit (void);* above in RETURN_STATUS. * */ -extern int mpath_persistent_reserve_in (int fd,int rq_servact,struct prin_resp *resp, -int noisy,int verbose); +int mpath_persistent_reserve_in (int fd,int rq_servact,struct prin_resp *resp, +int noisy,int verbose);/* * DESCRIPTION :
@@ -254,8 +249,8 @@ extern int mpath_persistent_reserve_in (int fd, int rq_servact, struct prin_resp* RESTRICTIONS: * This function uses static internal variables, and is not thread-safe. */ -extern int __mpath_persistent_reserve_in (int fd,int rq_servact, -struct prin_resp *resp,int noisy); +int mpath_persistent_reserve_in__ (int fd,int rq_servact, +struct prin_resp *resp,int noisy);/* * DESCRIPTION :
@@ -279,9 +274,10 @@ extern int __mpath_persistent_reserve_in(int fd, int rq_servact,* RETURNS: MPATH_PR_SUCCESS if PR command successful else returns any of the status specified * above in RETURN_STATUS. */ -extern int mpath_persistent_reserve_out (int fd,int rq_servact,int rq_scope, -unsigned int rq_type,struct prout_param_descriptor *paramp,int noisy, -int verbose); +int mpath_persistent_reserve_out (int fd,int rq_servact,int rq_scope, +unsigned int rq_type, +struct prout_param_descriptor *paramp, +int noisy,int verbose);/* * DESCRIPTION : * This function is like mpath_persistent_reserve_out(), except that it
@@ -292,15 +288,16 @@ extern int mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,* RESTRICTIONS: * This function uses static internal variables, and is not thread-safe. */ -extern int __mpath_persistent_reserve_out (int fd,int rq_servact,int rq_scope, -unsigned int rq_type,struct prout_param_descriptor *paramp, -int noisy); +int mpath_persistent_reserve_out__ (int fd,int rq_servact,int rq_scope, +unsigned int rq_type, +struct prout_param_descriptor *paramp, +int noisy);/* * DESCRIPTION : * This function allocates data structures and performs basic initialization and -* device discovery for later calls of __mpath_persistent_reserve_in() or -* __mpath_persistent_reserve_out(). +* device discovery for later calls of mpath_persistent_reserve_in__() or +* mpath_persistent_reserve_out__(). * @verbose: Set verbosity level. Input argument. value:0 to 3. 0->disabled, 3->Max verbose * * RESTRICTIONS:
mpathpersist/main.c +3 -3
@@ -505,7 +505,7 @@ static int handle_args(int argc, char * argv[], int nline) goto out_fd; } - ret =__mpath_persistent_reserve_in (fd, prin_sa, resp, noisy); + ret =mpath_persistent_reserve_in__ (fd, prin_sa, resp, noisy);if (ret !=MPATH_PR_SUCCESS ) {fprintf (stderr,"Persistent Reserve IN command failed\n" );
@@ -575,8 +575,8 @@ static int handle_args(int argc, char * argv[], int nline) }/* PROUT commands other than 'register and move' */ - ret =__mpath_persistent_reserve_out (fd, prout_sa,0 , prout_type, - paramp, noisy); + ret =mpath_persistent_reserve_out__ (fd, prout_sa,0 , prout_type, + paramp, noisy);free_prout_param_descriptor (paramp); }
Signature · 1 line
2.46.0
PATCH 34/41 libdmmp: rename macros starting with _DMMP
In reply to Martin Wilck--- libdmmp/libdmmp.c | 60 +++++++++++++++++++-------------------- libdmmp/libdmmp_misc.c | 6 ++-- libdmmp/libdmmp_pg.c | 6 ++-- libdmmp/libdmmp_private.h | 2 +- 4 files changed, 37 insertions(+), 37 deletions(-)
libdmmp/libdmmp.c +30 -30
@@ -35,19 +35,19 @@#include "libdmmp/libdmmp.h" #include "libdmmp_private.h" -#define _DEFAULT_UXSOCK_TIMEOUT 60000 +#define DEFAULT_UXSOCK_TIMEOUT 60000/* ^ 60 seconds. On system with 10k sdX, dmmp_mpath_array_get() * only take 3.5 seconds, so this default value should be OK for most users. */ -#define _DMMP_IPC_SHOW_JSON_CMD "show maps json" -#define _DMMP_JSON_MAJOR_KEY "major_version" -#define _DMMP_JSON_MAJOR_VERSION 0 -#define _DMMP_JSON_MAPS_KEY "maps" -#define _ERRNO_STR_BUFF_SIZE 256 -#define _IPC_MAX_CMD_LEN 512 +#define DMMP_IPC_SHOW_JSON_CMD "show maps json" +#define DMMP_JSON_MAJOR_KEY "major_version" +#define DMMP_JSON_MAJOR_VERSION 0 +#define DMMP_JSON_MAPS_KEY "maps" +#define ERRNO_STR_BUFF_SIZE 256 +#define IPC_MAX_CMD_LEN 512/* ^ Was MAX_CMD_LEN in ./libmultipath/uxsock.h */ -#define _LAST_ERR_MSG_BUFF_SIZE 1024 +#define LAST_ERR_MSG_BUFF_SIZE 1024struct dmmp_context { void (*log_func)(struct dmmp_context *ctx, int priority,
@@ -56,7 +56,7 @@ struct dmmp_context {int log_priority;void *userdata;unsigned int tmo; -char last_err_msg[_LAST_ERR_MSG_BUFF_SIZE]; +char last_err_msg[LAST_ERR_MSG_BUFF_SIZE ]; };/*
@@ -99,7 +99,7 @@ void _dmmp_log(struct dmmp_context *ctx, int priority, const char *file,va_start (args, format); ctx->log_func (ctx, priority, file, line, func_name, format, args);if (priority ==DMMP_LOG_PRIORITY_ERROR ) -vsnprintf (ctx->last_err_msg, _LAST_ERR_MSG_BUFF_SIZE, +vsnprintf (ctx->last_err_msg,LAST_ERR_MSG_BUFF_SIZE , format, args);va_end (args); }
@@ -116,8 +116,8 @@ struct dmmp_context *dmmp_context_new(void) ctx->log_func = _dmmp_log_stderr; ctx->log_priority =DMMP_LOG_PRIORITY_DEFAULT ; ctx->userdata =NULL ; - ctx->tmo = _DEFAULT_UXSOCK_TIMEOUT; -memset (ctx->last_err_msg,0 , _LAST_ERR_MSG_BUFF_SIZE); + ctx->tmo =DEFAULT_UXSOCK_TIMEOUT ; +memset (ctx->last_err_msg,0 ,LAST_ERR_MSG_BUFF_SIZE );return ctx; }
@@ -180,7 +180,7 @@ int dmmp_mpath_array_get(struct dmmp_context *ctx,_good (_ipc_connect (ctx, &ipc_fd), rc, out); -_good (_process_cmd (ctx, ipc_fd, _DMMP_IPC_SHOW_JSON_CMD, &j_str), +_good (_process_cmd (ctx, ipc_fd,DMMP_IPC_SHOW_JSON_CMD , &j_str), rc, out);_debug (ctx,"Got json output from multipathd: '%s'" , j_str);
@@ -202,20 +202,20 @@ int dmmp_mpath_array_get(struct dmmp_context *ctx, }_json_obj_get_value (ctx, j_obj, cur_json_major_version, - _DMMP_JSON_MAJOR_KEY, json_type_int, +DMMP_JSON_MAJOR_KEY , json_type_int, json_object_get_int, rc, out); -if (cur_json_major_version != _DMMP_JSON_MAJOR_VERSION) { +if (cur_json_major_version !=DMMP_JSON_MAJOR_VERSION ) { rc =DMMP_ERR_INCOMPATIBLE ;_error (ctx,"Incompatible multipathd JSON major version %d, " "should be %d" , cur_json_major_version, - _DMMP_JSON_MAJOR_VERSION); +DMMP_JSON_MAJOR_VERSION ); goto out; }_debug (ctx,"multipathd JSON major version(%d) check pass" , - _DMMP_JSON_MAJOR_VERSION); +DMMP_JSON_MAJOR_VERSION ); -_json_obj_get_value (ctx, j_obj, ar_maps, _DMMP_JSON_MAPS_KEY, +_json_obj_get_value (ctx, j_obj, ar_maps,DMMP_JSON_MAPS_KEY , json_type_array, json_object_get_array, rc, out);if (ar_maps ==NULL ) {
@@ -279,7 +279,7 @@ static int _process_cmd(struct dmmp_context *ctx, int fd, const char *cmd, {int errno_save =0 ;int rc =DMMP_OK ; -char errno_str_buff[_ERRNO_STR_BUFF_SIZE]; +char errno_str_buff[ERRNO_STR_BUFF_SIZE ];struct timespec start_ts;struct timespec cur_ts;unsigned int ipc_tmo =0 ;
@@ -300,7 +300,7 @@ static int _process_cmd(struct dmmp_context *ctx, int fd, const char *cmd, ipc_tmo = ctx->tmo;if (ctx->tmo ==0 ) - ipc_tmo = _DEFAULT_UXSOCK_TIMEOUT; + ipc_tmo =DEFAULT_UXSOCK_TIMEOUT ; invoke: _debug(ctx, "Invoking IPC command '%s' with IPC tmo %u milliseconds",
@@ -308,8 +308,8 @@ invoke: flag_check_tmo = false;if (mpath_process_cmd (fd, cmd, output, ipc_tmo) !=0 ) { errno_save = errno; -memset (errno_str_buff,0 , _ERRNO_STR_BUFF_SIZE); -strerror_r (errno_save, errno_str_buff, _ERRNO_STR_BUFF_SIZE); +memset (errno_str_buff,0 ,ERRNO_STR_BUFF_SIZE ); +strerror_r (errno_save, errno_str_buff,ERRNO_STR_BUFF_SIZE );if (errno_save ==ETIMEDOUT ) { flag_check_tmo = true; }else {
@@ -397,7 +397,7 @@ static int _ipc_connect(struct dmmp_context *ctx, int *fd) {int rc =DMMP_OK ;int errno_save =0 ; -char errno_str_buff[_ERRNO_STR_BUFF_SIZE]; +char errno_str_buff[ERRNO_STR_BUFF_SIZE ];assert (ctx !=NULL );assert (fd !=NULL );
@@ -407,8 +407,8 @@ static int _ipc_connect(struct dmmp_context *ctx, int *fd) *fd =mpath_connect ();if (*fd ==-1 ) { errno_save = errno; -memset (errno_str_buff,0 , _ERRNO_STR_BUFF_SIZE); -strerror_r (errno_save, errno_str_buff, _ERRNO_STR_BUFF_SIZE); +memset (errno_str_buff,0 ,ERRNO_STR_BUFF_SIZE ); +strerror_r (errno_save, errno_str_buff,ERRNO_STR_BUFF_SIZE );if (errno_save ==ECONNREFUSED ) { rc =DMMP_ERR_NO_DAEMON ; _error(ctx, "Socket connection refuse. "
@@ -426,14 +426,14 @@ int dmmp_flush_mpath(struct dmmp_context *ctx, const char *mpath_name) {int rc =DMMP_OK ;int ipc_fd =-1 ; -char cmd[_IPC_MAX_CMD_LEN]; +char cmd[IPC_MAX_CMD_LEN ];char *output =NULL ;assert (ctx !=NULL );assert (mpath_name !=NULL ); -snprintf (cmd, _IPC_MAX_CMD_LEN,"del map %s" , mpath_name); -if (strlen (cmd) == _IPC_MAX_CMD_LEN -1 ) { +snprintf (cmd,IPC_MAX_CMD_LEN ,"del map %s" , mpath_name); +if (strlen (cmd) ==IPC_MAX_CMD_LEN -1 ) { rc =DMMP_ERR_INVALID_ARGUMENT ;_error (ctx,"Invalid mpath name %s" , mpath_name); goto out;
@@ -461,9 +461,9 @@ int dmmp_reconfig(struct dmmp_context *ctx)int rc =DMMP_OK ;int ipc_fd =-1 ;char *output =NULL ; -char cmd[_IPC_MAX_CMD_LEN]; +char cmd[IPC_MAX_CMD_LEN ]; -snprintf (cmd, _IPC_MAX_CMD_LEN,"%s" ,"reconfigure" ); +snprintf (cmd,IPC_MAX_CMD_LEN ,"%s" ,"reconfigure" );_good (_ipc_connect (ctx, &ipc_fd), rc, out);_good (_process_cmd (ctx, ipc_fd, cmd, &output), rc, out);
libdmmp/libdmmp_misc.c +3 -3
@@ -30,7 +30,7 @@#include "libdmmp/libdmmp.h" #include "libdmmp_private.h" -#define _DMMP_LOG_STRERR_ALIGN_WIDTH 80 +#define DMMP_LOG_STRERR_ALIGN_WIDTH 80/* ^ Only used in _dmmp_log_stderr() for pretty log output. * When provided log message is less than 80 bytes, fill it with space, then * print code file name, function name, line after the 80th bytes.
@@ -81,9 +81,9 @@ void _dmmp_log_stderr(struct dmmp_context *ctx, int priority,* bypass clang static analyzer about unused ctx argument warning */ -if (printed_bytes < _DMMP_LOG_STRERR_ALIGN_WIDTH) { +if (printed_bytes <DMMP_LOG_STRERR_ALIGN_WIDTH ) {fprintf (stderr,"%*s # %s:%s():%d\n" , - _DMMP_LOG_STRERR_ALIGN_WIDTH - printed_bytes,"" , file, +DMMP_LOG_STRERR_ALIGN_WIDTH - printed_bytes,"" , file, func_name, line); }else {fprintf (stderr," # %s:%s():%d\n" , file, func_name, line);
libdmmp/libdmmp_pg.c +3 -3
@@ -78,7 +78,7 @@ struct dmmp_path_group *_dmmp_path_group_new(void)malloc (sizeof (struct dmmp_path_group ));if (dmmp_pg !=NULL ) { - dmmp_pg->id = _DMMP_PATH_GROUP_ID_UNKNOWN; + dmmp_pg->id =DMMP_PATH_GROUP_ID_UNKNOWN ; dmmp_pg->status =DMMP_PATH_GROUP_STATUS_UNKNOWN ; dmmp_pg->priority =0 ; dmmp_pg->selector =NULL ;
@@ -127,10 +127,10 @@ int _dmmp_path_group_update(struct dmmp_context *ctx, dmmp_pg->id = id; -if (dmmp_pg->id == _DMMP_PATH_GROUP_ID_UNKNOWN) { +if (dmmp_pg->id ==DMMP_PATH_GROUP_ID_UNKNOWN ) { rc =DMMP_ERR_BUG ;_error (ctx,"BUG: Got unknown(%d) path group ID" , - _DMMP_PATH_GROUP_ID_UNKNOWN); +DMMP_PATH_GROUP_ID_UNKNOWN ); goto out; }
libdmmp/libdmmp_private.h +1 -1
@@ -46,7 +46,7 @@ extern "C" { goto out; \ } while(0) -#define _DMMP_PATH_GROUP_ID_UNKNOWN 0 +#define DMMP_PATH_GROUP_ID_UNKNOWN 0struct DMMP_DLL_LOCAL _num_str_conv;struct _num_str_conv {
Signature · 1 line
2.46.0
PATCH 35/41 libdmmp: rename enum values and variables starting with _DMMP_
In reply to Martin Wilck--- libdmmp/libdmmp_path.c | 14 +++++++------- libdmmp/libdmmp_pg.c | 18 +++++++++--------- 2 files changed, 16 insertions(+), 16 deletions(-)
libdmmp/libdmmp_path.c +7 -7
@@ -27,17 +27,17 @@#include "libdmmp/libdmmp.h" #include "libdmmp_private.h" -#define _DMMP_SHOW_PS_INDEX_BLK_NAME 0 -#define _DMMP_SHOW_PS_INDEX_STATUS 1 -#define _DMMP_SHOW_PS_INDEX_WWID 2 -#define _DMMP_SHOW_PS_INDEX_PGID 3 +#define DMMP_SHOW_PS_INDEX_BLK_NAME 0 +#define DMMP_SHOW_PS_INDEX_STATUS 1 +#define DMMP_SHOW_PS_INDEX_WWID 2 +#define DMMP_SHOW_PS_INDEX_PGID 3struct dmmp_path {char *blk_name;uint32_t status; }; -static const struct _num_str_conv _DMMP_PATH_STATUS_CONV[] = { +static const struct _num_str_conv DMMP_PATH_STATUS_CONV [] = { {DMMP_PATH_STATUS_UNKNOWN ,"undef" }, {DMMP_PATH_STATUS_UP ,"ready" }, {DMMP_PATH_STATUS_DOWN ,"faulty" },
@@ -49,10 +49,10 @@ static const struct _num_str_conv _DMMP_PATH_STATUS_CONV[] = { };_dmmp_str_func_gen (dmmp_path_status_str, uint32_t, path_status, - _DMMP_PATH_STATUS_CONV); +DMMP_PATH_STATUS_CONV );_dmmp_str_conv_func_gen (_dmmp_path_status_str_conv, ctx, path_status_str, uint32_t,DMMP_PATH_STATUS_UNKNOWN , - _DMMP_PATH_STATUS_CONV); +DMMP_PATH_STATUS_CONV ); _dmmp_getter_func_gen(dmmp_path_blk_name_get, struct dmmp_path, dmmp_p, blk_name, const char *);
libdmmp/libdmmp_pg.c +9 -9
@@ -28,12 +28,12 @@#include "libdmmp/libdmmp.h" #include "libdmmp_private.h" -#define _DMMP_SHOW_PGS_CMD "show groups raw format %w|%g|%p|%t|%s" -#define _DMMP_SHOW_PG_INDEX_WWID 0 -#define _DMMP_SHOW_PG_INDEX_PG_ID 1 -#define _DMMP_SHOW_PG_INDEX_PRI 2 -#define _DMMP_SHOW_PG_INDEX_STATUS 3 -#define _DMMP_SHOW_PG_INDEX_SELECTOR 4 +#define DMMP_SHOW_PGS_CMD "show groups raw format %w|%g|%p|%t|%s" +#define DMMP_SHOW_PG_INDEX_WWID 0 +#define DMMP_SHOW_PG_INDEX_PG_ID 1 +#define DMMP_SHOW_PG_INDEX_PRI 2 +#define DMMP_SHOW_PG_INDEX_STATUS 3 +#define DMMP_SHOW_PG_INDEX_SELECTOR 4struct dmmp_path_group {uint32_t id;
@@ -45,7 +45,7 @@ struct dmmp_path_group {struct dmmp_path **dmmp_ps; }; -static const struct _num_str_conv _DMMP_PATH_GROUP_STATUS_CONV[] = { +static const struct _num_str_conv DMMP_PATH_GROUP_STATUS_CONV [] = { {DMMP_PATH_GROUP_STATUS_UNKNOWN ,"undef" }, {DMMP_PATH_GROUP_STATUS_ACTIVE ,"active" }, {DMMP_PATH_GROUP_STATUS_DISABLED ,"disabled" },
@@ -53,10 +53,10 @@ static const struct _num_str_conv _DMMP_PATH_GROUP_STATUS_CONV[] = { };_dmmp_str_func_gen (dmmp_path_group_status_str, uint32_t, pg_status, - _DMMP_PATH_GROUP_STATUS_CONV); +DMMP_PATH_GROUP_STATUS_CONV );_dmmp_str_conv_func_gen (_dmmp_path_group_status_str_conv, ctx, pg_status_str, uint32_t,DMMP_PATH_GROUP_STATUS_UNKNOWN , - _DMMP_PATH_GROUP_STATUS_CONV); +DMMP_PATH_GROUP_STATUS_CONV ); _dmmp_getter_func_gen(dmmp_path_group_id_get, struct dmmp_path_group, dmmp_pg, id, uint32_t);
Signature · 1 line
2.46.0
PATCH 36/41 libdmmp: rename non-static functions starting with underscore
In reply to Martin Wilck--- libdmmp/libdmmp.c | 10 +++++----- libdmmp/libdmmp_misc.c | 4 ++-- libdmmp/libdmmp_mp.c | 12 ++++++------ libdmmp/libdmmp_path.c | 8 ++++---- libdmmp/libdmmp_pg.c | 16 ++++++++-------- libdmmp/libdmmp_private.h | 24 ++++++++++++------------ 6 files changed, 37 insertions(+), 37 deletions(-)
libdmmp/libdmmp.c +5 -5
@@ -86,9 +86,9 @@ _dmmp_getter_func_gen(dmmp_last_error_msg, struct dmmp_context, ctx, last_err_msg, const char *); _dmmp_array_free_func_gen(dmmp_mpath_array_free, struct dmmp_mpath, - _dmmp_mpath_free); + dmmp_mpath_free); -void _dmmp_log (struct dmmp_context *ctx,int priority,const char *file, +void dmmp_log (struct dmmp_context *ctx,int priority,const char *file,int line,const char *func_name,const char *format, ...) {va_list args;
@@ -113,7 +113,7 @@ struct dmmp_context *dmmp_context_new(void)if (ctx ==NULL )return NULL ; - ctx->log_func = _dmmp_log_stderr; + ctx->log_func = dmmp_log_stderr; ctx->log_priority =DMMP_LOG_PRIORITY_DEFAULT ; ctx->userdata =NULL ; ctx->tmo =DEFAULT_UXSOCK_TIMEOUT ;
@@ -250,10 +250,10 @@ int dmmp_mpath_array_get(struct dmmp_context *ctx, goto out; } - dmmp_mp =_dmmp_mpath_new (); + dmmp_mp =dmmp_mpath_new ();_dmmp_alloc_null_check (ctx, dmmp_mp, rc, out); (*dmmp_mps)[i] = dmmp_mp; -_good (_dmmp_mpath_update (ctx, dmmp_mp, j_obj_map), rc, out); +_good (dmmp_mpath_update (ctx, dmmp_mp, j_obj_map), rc, out); } out:
libdmmp/libdmmp_misc.c +2 -2
@@ -31,7 +31,7 @@#include "libdmmp_private.h" #define DMMP_LOG_STRERR_ALIGN_WIDTH 80 -/* ^ Only used in _dmmp_log_stderr() for pretty log output. +/* ^ Only used in dmmp_log_stderr() for pretty log output. * When provided log message is less than 80 bytes, fill it with space, then * print code file name, function name, line after the 80th bytes. */
@@ -62,7 +62,7 @@ static const struct _num_str_conv _DMMP_PRI_CONV[] = { };_dmmp_str_func_gen (dmmp_log_priority_str, int, priority, _DMMP_PRI_CONV); -void _dmmp_log_stderr (struct dmmp_context *ctx,int priority, +void dmmp_log_stderr (struct dmmp_context *ctx,int priority,const char *file,int line,const char *func_name,const char *format,va_list args) {
libdmmp/libdmmp_mp.c +6 -6
@@ -44,7 +44,7 @@ _dmmp_getter_func_gen(dmmp_mpath_wwid_get, struct dmmp_mpath, dmmp_mp, _dmmp_getter_func_gen(dmmp_mpath_kdev_name_get, struct dmmp_mpath, dmmp_mp, kdev_name, const char *); -struct dmmp_mpath *_dmmp_mpath_new (void ) +struct dmmp_mpath *dmmp_mpath_new (void ) {struct dmmp_mpath *dmmp_mp =NULL ;
@@ -59,7 +59,7 @@ struct dmmp_mpath *_dmmp_mpath_new(void)return dmmp_mp; } -int _dmmp_mpath_update (struct dmmp_context *ctx,struct dmmp_mpath *dmmp_mp, +int dmmp_mpath_update (struct dmmp_context *ctx,struct dmmp_mpath *dmmp_mp,json_object *j_obj_map) {int rc =DMMP_OK ;
@@ -113,10 +113,10 @@ int _dmmp_mpath_update(struct dmmp_context *ctx, struct dmmp_mpath *dmmp_mp, dmmp_mp->dmmp_pgs[i] =NULL ;for (i =0 ; i < dmmp_mp->dmmp_pg_count; ++i) { - dmmp_pg =_dmmp_path_group_new (); + dmmp_pg =dmmp_path_group_new ();_dmmp_alloc_null_check (ctx, dmmp_pg, rc, out); dmmp_mp->dmmp_pgs[i] = dmmp_pg; -_good (_dmmp_path_group_update (ctx, dmmp_pg, +_good (dmmp_path_group_update (ctx, dmmp_pg,array_list_get_idx (ar_pgs, i)), rc, out); }
@@ -126,11 +126,11 @@ int _dmmp_mpath_update(struct dmmp_context *ctx, struct dmmp_mpath *dmmp_mp, out:if (rc !=DMMP_OK ) -_dmmp_mpath_free (dmmp_mp); +dmmp_mpath_free (dmmp_mp);return rc; } -void _dmmp_mpath_free (struct dmmp_mpath *dmmp_mp) +void dmmp_mpath_free (struct dmmp_mpath *dmmp_mp) {if (dmmp_mp ==NULL )return ;
libdmmp/libdmmp_path.c +4 -4
@@ -59,7 +59,7 @@ _dmmp_getter_func_gen(dmmp_path_blk_name_get, struct dmmp_path, dmmp_p, _dmmp_getter_func_gen(dmmp_path_status_get, struct dmmp_path, dmmp_p, status, uint32_t); -struct dmmp_path *_dmmp_path_new (void ) +struct dmmp_path *dmmp_path_new (void ) {struct dmmp_path *dmmp_p =NULL ;
@@ -72,7 +72,7 @@ struct dmmp_path *_dmmp_path_new(void)return dmmp_p; } -int _dmmp_path_update (struct dmmp_context *ctx,struct dmmp_path *dmmp_p, +int dmmp_path_update (struct dmmp_context *ctx,struct dmmp_path *dmmp_p,json_object *j_obj_p) {int rc =DMMP_OK ;
@@ -102,11 +102,11 @@ int _dmmp_path_update(struct dmmp_context *ctx, struct dmmp_path *dmmp_p, out:if (rc !=DMMP_OK ) -_dmmp_path_free (dmmp_p); +dmmp_path_free (dmmp_p);return rc; } -void _dmmp_path_free (struct dmmp_path *dmmp_p) +void dmmp_path_free (struct dmmp_path *dmmp_p) {if (dmmp_p ==NULL )return ;
libdmmp/libdmmp_pg.c +8 -8
@@ -67,10 +67,10 @@ _dmmp_getter_func_gen(dmmp_path_group_priority_get, struct dmmp_path_group, _dmmp_getter_func_gen(dmmp_path_group_selector_get, struct dmmp_path_group, dmmp_pg, selector, const char *); _dmmp_array_free_func_gen(_dmmp_path_group_array_free, struct dmmp_path_group, - _dmmp_path_group_free); + dmmp_path_group_free); -struct dmmp_path_group *_dmmp_path_group_new (void ) +struct dmmp_path_group *dmmp_path_group_new (void ) {struct dmmp_path_group *dmmp_pg =NULL ;
@@ -87,7 +87,7 @@ struct dmmp_path_group *_dmmp_path_group_new(void) }return dmmp_pg; } -int _dmmp_path_group_update (struct dmmp_context *ctx, +int dmmp_path_group_update (struct dmmp_context *ctx,struct dmmp_path_group *dmmp_pg,json_object *j_obj_pg) {
@@ -157,10 +157,10 @@ int _dmmp_path_group_update(struct dmmp_context *ctx, dmmp_pg->dmmp_ps[i] =NULL ;for (i =0 ; i < dmmp_pg->dmmp_p_count; ++i) { - dmmp_p =_dmmp_path_new (); + dmmp_p =dmmp_path_new ();_dmmp_alloc_null_check (ctx, dmmp_p, rc, out); dmmp_pg->dmmp_ps[i] = dmmp_p; -_good (_dmmp_path_update (ctx, dmmp_p, +_good (dmmp_path_update (ctx, dmmp_p,array_list_get_idx (ar_ps, i)), rc, out); }
@@ -173,11 +173,11 @@ int _dmmp_path_group_update(struct dmmp_context *ctx, out:if (rc !=DMMP_OK ) -_dmmp_path_group_free (dmmp_pg); +dmmp_path_group_free (dmmp_pg);return rc; } -void _dmmp_path_group_free (struct dmmp_path_group *dmmp_pg) +void dmmp_path_group_free (struct dmmp_path_group *dmmp_pg) {uint32_t i =0 ;
@@ -188,7 +188,7 @@ void _dmmp_path_group_free(struct dmmp_path_group *dmmp_pg)if (dmmp_pg->dmmp_ps !=NULL ) {for (i =0 ; i < dmmp_pg->dmmp_p_count; ++i) { -_dmmp_path_free (dmmp_pg->dmmp_ps[i]); +dmmp_path_free (dmmp_pg->dmmp_ps[i]); }free (dmmp_pg->dmmp_ps); }
libdmmp/libdmmp_private.h +12 -12
@@ -110,33 +110,33 @@ do { \ DMMP_DLL_LOCAL int _dmmp_ipc_exec(struct dmmp_context *ctx, const char *cmd,char **output); -DMMP_DLL_LOCAL struct dmmp_mpath *_dmmp_mpath_new(void); -DMMP_DLL_LOCAL struct dmmp_path_group *_dmmp_path_group_new(void); -DMMP_DLL_LOCAL struct dmmp_path *_dmmp_path_new(void); +DMMP_DLL_LOCAL struct dmmp_mpath *dmmp_mpath_new(void); +DMMP_DLL_LOCAL struct dmmp_path_group *dmmp_path_group_new(void); +DMMP_DLL_LOCAL struct dmmp_path *dmmp_path_new(void); -DMMP_DLL_LOCAL int _dmmp_mpath_update(struct dmmp_context *ctx, +DMMP_DLL_LOCAL int dmmp_mpath_update(struct dmmp_context *ctx,struct dmmp_mpath *dmmp_mp,json_object *j_obj_map); -DMMP_DLL_LOCAL int _dmmp_path_group_update(struct dmmp_context *ctx, +DMMP_DLL_LOCAL int dmmp_path_group_update(struct dmmp_context *ctx,struct dmmp_path_group *dmmp_pg,json_object *j_obj_pg); -DMMP_DLL_LOCAL int _dmmp_path_update(struct dmmp_context *ctx, +DMMP_DLL_LOCAL int dmmp_path_update(struct dmmp_context *ctx,struct dmmp_path *dmmp_p,json_object *j_obj_p); -DMMP_DLL_LOCAL void _dmmp_mpath_free(struct dmmp_mpath *dmmp_mp); -DMMP_DLL_LOCAL void _dmmp_path_group_free(struct dmmp_path_group *dmmp_pg); +DMMP_DLL_LOCAL void dmmp_mpath_free(struct dmmp_mpath *dmmp_mp); +DMMP_DLL_LOCAL void dmmp_path_group_free(struct dmmp_path_group *dmmp_pg); DMMP_DLL_LOCAL void _dmmp_path_group_array_free (struct dmmp_path_group **dmmp_pgs,uint32_t dmmp_pg_count); -DMMP_DLL_LOCAL void _dmmp_path_free(struct dmmp_path *dmmp_p); -DMMP_DLL_LOCAL void _dmmp_log(struct dmmp_context *ctx, int priority, +DMMP_DLL_LOCAL void dmmp_path_free(struct dmmp_path *dmmp_p); +DMMP_DLL_LOCAL void dmmp_log(struct dmmp_context *ctx, int priority,const char *file,int line,const char *func_name,const char *format, ...) __attribute__((format (printf,6 ,7 ))); DMMP_DLL_LOCAL void _dmmp_log_err_str(struct dmmp_context *ctx, int rc); -DMMP_DLL_LOCAL void _dmmp_log_stderr(struct dmmp_context *ctx, int priority, +DMMP_DLL_LOCAL void dmmp_log_stderr(struct dmmp_context *ctx, int priority,const char *file,int line,const char *func_name,const char *format,va_list args)
@@ -146,7 +146,7 @@ DMMP_DLL_LOCAL void _dmmp_log_stderr(struct dmmp_context *ctx, int priority, #define _dmmp_log_cond(ctx, prio, arg...) \ do { \ if (dmmp_context_log_priority_get(ctx) >= prio) \ - _dmmp_log(ctx, prio, __FILE__, __LINE__, __FUNCTION__, \ + dmmp_log(ctx, prio, __FILE__, __LINE__, __FUNCTION__, \ ## arg); \ } while (0)
Signature · 1 line
2.46.0
PATCH 37/41 multipathd: rename symbols with double leading underscore
In reply to Martin WilckAlso remove last mentions of __setup_multipath(), which has been removed in e5debe0 ("multipathd: don't modify the multipath device on show commands").
--- multipathd/cli.c | 2 +- multipathd/cli.h | 6 +++--- multipathd/dmevents.c | 2 +- multipathd/main.c | 30 +++++++++++++++--------------- multipathd/waiter.c | 2 +- 5 files changed, 21 insertions(+), 21 deletions(-)
multipathd/cli.c +1 -1
@@ -114,7 +114,7 @@ find_handler (uint32_t fp) }int -__set_handler_callback (uint32_t fp,cli_handler *fn,bool locked) +set_handler_callback__ (uint32_t fp,cli_handler *fn,bool locked) {struct handler *h;
multipathd/cli.h +3 -3
@@ -137,9 +137,9 @@ struct handler { };int alloc_handlers (void ); -int __set_handler_callback (uint32_t fp,cli_handler *fn,bool locked); -#define set_handler_callback (fp, fn) __set_handler_callback(fp, fn, true) -#define set_unlocked_handler_callback (fp, fn) __set_handler_callback(fp, fn, false) +int set_handler_callback__ (uint32_t fp,cli_handler *fn,bool locked); +#define set_handler_callback (fp, fn) set_handler_callback__(fp, fn, true) +#define set_unlocked_handler_callback (fp, fn) set_handler_callback__(fp, fn, false)int get_cmdvec (char *cmd,vector *v,bool allow_incomplete);struct handler *find_handler_for_cmdvec (const struct _vector *v);
multipathd/dmevents.c +1 -1
@@ -202,7 +202,7 @@ fail:return -1 ; } -/* You must call __setup_multipath() after calling this function, to +/* You must call setup_multipath() after calling this function, to * deal with any events that came in before the device was added */ int watch_dmevents (char *name) {
multipathd/main.c +15 -15
@@ -131,7 +131,7 @@ static int poll_dmevents = 1;/* Don't access this variable without holding config_lock */ static enum daemon_status running_state =DAEMON_INIT ;/* Don't access this variable without holding config_lock */ -static bool __delayed_reconfig; +static bool delayed_reconfig;/* Don't access this variable without holding config_lock */ static enum force_reload_types reconfigure_pending =FORCE_RELOAD_NONE ;pid_t daemon_pid;
@@ -243,7 +243,7 @@ static void config_cleanup(__attribute__((unused)) void *arg)pthread_mutex_unlock (&config_lock); } -#define __wait_for_state_change (condition, ms) \ +#define wait_for_state_change__ (condition, ms) \ ({ \ struct timespec tmo; \ int rc = 0; \
@@ -275,14 +275,14 @@ enum daemon_status wait_for_state_change_if(enum daemon_status oldstate,pthread_mutex_lock (&config_lock);pthread_cleanup_push (config_cleanup,NULL ); -__wait_for_state_change (running_state == oldstate, ms); +wait_for_state_change__ (running_state == oldstate, ms); st = running_state;pthread_cleanup_pop (1 );return st; }/* must be called with config_lock held */ -static void __post_config_state (enum daemon_status state) +static void post_config_state__ (enum daemon_status state) {if (state != running_state && running_state !=DAEMON_SHUTDOWN ) {enum daemon_status old_state = running_state;
@@ -299,7 +299,7 @@ void post_config_state(enum daemon_status state) {pthread_mutex_lock (&config_lock);pthread_cleanup_push (config_cleanup,NULL ); -__post_config_state (state); +post_config_state__ (state);pthread_cleanup_pop (1 ); }
@@ -308,15 +308,15 @@ static bool unblock_reconfigure(void)bool was_delayed;pthread_mutex_lock (&config_lock); - was_delayed = __delayed_reconfig; + was_delayed = delayed_reconfig;if (was_delayed) { - __delayed_reconfig = false; + delayed_reconfig = false;/* * In IDLE state, make sure child() is woken up * Otherwise it will wake up when state switches to IDLE */ if (running_state ==DAEMON_IDLE ) -__post_config_state (DAEMON_CONFIGURE ); +post_config_state__ (DAEMON_CONFIGURE ); }pthread_mutex_unlock (&config_lock);if (was_delayed)
@@ -350,7 +350,7 @@ void schedule_reconfigure(enum force_reload_types requested_type)break ;case DAEMON_IDLE : reconfigure_pending = type; -__post_config_state (DAEMON_CONFIGURE ); +post_config_state__ (DAEMON_CONFIGURE );break ;case DAEMON_CONFIGURE :case DAEMON_RUNNING :
@@ -378,7 +378,7 @@ static enum daemon_status set_config_state(enum daemon_status state) }if (rc ==0 && running_state ==DAEMON_IDLE && state !=DAEMON_IDLE ) -__post_config_state (state); +post_config_state__ (state); st = running_state;pthread_cleanup_pop (1 );
@@ -3749,17 +3749,17 @@ child (__attribute__((unused)) void *param)/* * Check if another reconfigure request was scheduled * while we last ran reconfigure(). -* We have to test __delayed_reconfig here +* We have to test delayed_reconfig here * to avoid a busy loop */ (reconfigure_pending == FORCE_RELOAD_NONE - || __delayed_reconfig)) + || delayed_reconfig))pthread_cond_wait (&config_cond, &config_lock);if (running_state !=DAEMON_CONFIGURE && running_state !=DAEMON_SHUTDOWN )/* This sets running_state to DAEMON_CONFIGURE */ -__post_config_state (DAEMON_CONFIGURE ); +post_config_state__ (DAEMON_CONFIGURE ); state = running_state;pthread_cleanup_pop (1 );if (state ==DAEMON_SHUTDOWN )
@@ -3776,13 +3776,13 @@ child (__attribute__((unused)) void *param) reload_type = reconfigure_pending ==FORCE_RELOAD_YES ?FORCE_RELOAD_YES :FORCE_RELOAD_WEAK ; reconfigure_pending =FORCE_RELOAD_NONE ; - __delayed_reconfig = false; + delayed_reconfig = false;pthread_mutex_unlock (&config_lock); rc =reconfigure (vecs, reload_type); }else {pthread_mutex_lock (&config_lock); - __delayed_reconfig = true; + delayed_reconfig = true;pthread_mutex_unlock (&config_lock);condlog (3 ,"delaying reconfigure()" ); }
multipathd/waiter.c +1 -1
@@ -56,7 +56,7 @@ void stop_waiter_thread (struct multipath *mpp) mpp->alias);return ; } -/* Don't cancel yourself. __setup_multipath is called by +/* Don't cancel yourself. setup_multipath is called by by the waiter thread, and may remove a multipath device */ if (pthread_equal (mpp->waiter,pthread_self ()))return ;
Signature · 1 line
2.46.0
PATCH 38/41 multipath-tools tests: rename functions with double underscores
In reply to Martin Wilck--- tests/alias.c | 42 +++++++++++++++++++++--------------------- tests/test-lib.c | 4 ++-- tests/test-lib.h | 16 ++++++++-------- 3 files changed, 31 insertions(+), 31 deletions(-)
tests/alias.c +21 -21
@@ -25,7 +25,7 @@#define MPATH_ID_INT_MAX_p1 "fxshrxx"#endif -static int __set_errno (int err) +static int set_errno__ (int err) {if (err >=0 ) { errno =0 ;
@@ -63,12 +63,12 @@ ssize_t __wrap_write(int fd, const void *buf, size_t count) start =strstr (start, binding);check_expected (count);assert_ptr_not_equal (start,NULL ); -return __set_errno (mock_type (int)); +return set_errno__ (mock_type (int)); }int __wrap_rename (const char *old,const char *new) { -return __set_errno (mock_type (int)); +return set_errno__ (mock_type (int)); }int WRAP_FUNC (mkstemp )(char *template)
@@ -134,7 +134,7 @@ int __wrap_pthread_mutex_unlock(pthread_mutex_t *mutex)#define TEST_FPTR ((FILE *) 0xaffe)/* strbuf wrapper for the old format_devname() */ -static int __format_devname (char *name,int id,size_t len,const char *prefix) +static int format_devname__ (char *name,int id,size_t len,const char *prefix) {STRBUF_ON_STACK (buf);
@@ -151,7 +151,7 @@ static void fd_mpatha(void **state)char buf[32 ];int rc; - rc =__format_devname (buf,1 ,sizeof (buf),"FOO" ); + rc =format_devname__ (buf,1 ,sizeof (buf),"FOO" );assert_int_equal (rc,4 );assert_string_equal (buf,"FOOa" ); }
@@ -162,7 +162,7 @@ static void fd_mpathz(void **state)char buf[5 ];int rc; - rc =__format_devname (buf,26 ,sizeof (buf),"FOO" ); + rc =format_devname__ (buf,26 ,sizeof (buf),"FOO" );assert_int_equal (rc,4 );assert_string_equal (buf,"FOOz" ); }
@@ -172,7 +172,7 @@ static void fd_mpathaa(void **state)char buf[32 ];int rc; - rc =__format_devname (buf,26 +1 ,sizeof (buf),"FOO" ); + rc =format_devname__ (buf,26 +1 ,sizeof (buf),"FOO" );assert_int_equal (rc,5 );assert_string_equal (buf,"FOOaa" ); }
@@ -182,7 +182,7 @@ static void fd_mpathzz(void **state)char buf[32 ];int rc; - rc =__format_devname (buf,26 *26 +26 ,sizeof (buf),"FOO" ); + rc =format_devname__ (buf,26 *26 +26 ,sizeof (buf),"FOO" );assert_int_equal (rc,5 );assert_string_equal (buf,"FOOzz" ); }
@@ -192,7 +192,7 @@ static void fd_mpathaaa(void **state)char buf[32 ];int rc; - rc =__format_devname (buf,26 *26 +27 ,sizeof (buf),"FOO" ); + rc =format_devname__ (buf,26 *26 +27 ,sizeof (buf),"FOO" );assert_int_equal (rc,6 );assert_string_equal (buf,"FOOaaa" ); }
@@ -202,7 +202,7 @@ static void fd_mpathzzz(void **state)char buf[32 ];int rc; - rc =__format_devname (buf,26 *26 *26 +26 *26 +26 ,sizeof (buf),"FOO" ); + rc =format_devname__ (buf,26 *26 *26 +26 *26 +26 ,sizeof (buf),"FOO" );assert_int_equal (rc,6 );assert_string_equal (buf,"FOOzzz" ); }
@@ -212,7 +212,7 @@ static void fd_mpathaaaa(void **state)char buf[32 ];int rc; - rc =__format_devname (buf,26 *26 *26 +26 *26 +27 ,sizeof (buf),"FOO" ); + rc =format_devname__ (buf,26 *26 *26 +26 *26 +27 ,sizeof (buf),"FOO" );assert_int_equal (rc,7 );assert_string_equal (buf,"FOOaaaa" ); }
@@ -222,7 +222,7 @@ static void fd_mpathzzzz(void **state)char buf[32 ];int rc; - rc =__format_devname (buf,26 *26 *26 *26 +26 *26 *26 +26 *26 +26 , + rc =format_devname__ (buf,26 *26 *26 *26 +26 *26 *26 +26 *26 +26 ,sizeof (buf),"FOO" );assert_int_equal (rc,7 );assert_string_equal (buf,"FOOzzzz" );
@@ -234,7 +234,7 @@ static void fd_mpath_max(void **state)char buf[32 ];int rc; - rc =__format_devname (buf,INT_MAX ,sizeof (buf),"" ); + rc =format_devname__ (buf,INT_MAX ,sizeof (buf),"" );assert_int_equal (rc,strlen (MPATH_ID_INT_MAX ));assert_string_equal (buf,MPATH_ID_INT_MAX ); }
@@ -245,7 +245,7 @@ static void fd_mpath_max1(void **state)char buf[32 ];int rc; - rc =__format_devname (buf,INT_MIN ,sizeof (buf),"" ); + rc =format_devname__ (buf,INT_MIN ,sizeof (buf),"" );assert_int_equal (rc,-1 ); }
@@ -254,7 +254,7 @@ static void fd_mpath_short(void **state)char buf[4 ];int rc; - rc =__format_devname (buf,1 ,sizeof (buf),"FOO" ); + rc =format_devname__ (buf,1 ,sizeof (buf),"FOO" );assert_int_equal (rc,-1 ); }
@@ -263,7 +263,7 @@ static void fd_mpath_short1(void **state)char buf[5 ];int rc; - rc =__format_devname (buf,27 ,sizeof (buf),"FOO" ); + rc =format_devname__ (buf,27 ,sizeof (buf),"FOO" );assert_int_equal (rc,-1 ); }
@@ -388,7 +388,7 @@ static void sd_fd_many(void **state)int rc, i;for (i =1 ; i <5000 ; i++) { - rc =__format_devname (buf, i,sizeof (buf),"MPATH" ); + rc =format_devname__ (buf, i,sizeof (buf),"MPATH" );assert_in_range (rc,6 ,8 ); rc =scan_devname (buf,"MPATH" );assert_int_equal (rc, i);
@@ -403,7 +403,7 @@ static void sd_fd_random(void **state)srandom (1 );for (i =1 ; i <1000 ; i++) { n =random () &0xffff ; - rc =__format_devname (buf, n,sizeof (buf),"MPATH" ); + rc =format_devname__ (buf, n,sizeof (buf),"MPATH" );assert_in_range (rc,6 ,9 ); rc =scan_devname (buf,"MPATH" );assert_int_equal (rc, n);
@@ -483,7 +483,7 @@ static void mock_self_alias(const char *alias, const char *wwid)expect_condlog (3 ,USED_STR (alias, wwid)); \ }while (0 ) -static void __mock_bindings_file(const char *content, bool conflict_ok) +static void mock_bindings_file__(const char *content, bool conflict_ok) { char *cnt __attribute__((cleanup(cleanup_charp))) = NULL;char *token, *savep =NULL ;
@@ -509,7 +509,7 @@ static void __mock_bindings_file(const char *content, bool conflict_ok) }static void mock_bindings_file (const char *content) { -return __mock_bindings_file (content, false); +return mock_bindings_file__ (content, false); }static int teardown_bindings (void **state)
@@ -1918,7 +1918,7 @@ static void order_test(int n, const struct random_aliases ra[], bool conflict_okfor (j =0 ; j < n; j++)fill_bindings_random (&buf, ra[j].start, ra[j].end, ra[j].prefix); -__mock_bindings_file (get_strbuf_str (&buf), conflict_ok); +mock_bindings_file__ (get_strbuf_str (&buf), conflict_ok);for (j =0 ; j < n; j++) { bdg =VECTOR_SLOT (bindings,0 );
tests/test-lib.c +2 -2
@@ -367,7 +367,7 @@ void mock_store_pathinfo(int mask, const struct mocked_path *mp)mock_pathinfo (mask, mp); } -struct path *__mock_path(vector pathvec, +struct path *mock_path__(vector pathvec, const char *vnd, const char *prd, const char *rev, const char *wwid, const char *dev,
@@ -395,7 +395,7 @@ struct path *__mock_path(vector pathvec, } -struct multipath *__mock_multipath (struct vectors *vecs,struct path *pp) +struct multipath *mock_multipath__ (struct vectors *vecs,struct path *pp) {struct multipath *mp;struct config *conf;
tests/test-lib.h +8 -8
@@ -40,29 +40,29 @@ struct mocked_path *mocked_path_from_path(struct mocked_path *mp,void mock_pathinfo (int mask,const struct mocked_path *mp);void mock_store_pathinfo (int mask,const struct mocked_path *mp); -struct path *__mock_path (vector pathvec, +struct path *mock_path__ (vector pathvec,const char *vnd,const char *prd,const char *rev,const char *wwid,const char *dev,unsigned int flags,int mask);#define mock_path (v, p) \ - __mock_path(hwt->vecs->pathvec, (v), (p), "0", NULL, NULL, \ + mock_path__(hwt->vecs->pathvec, (v), (p), "0", NULL, NULL, \ 0, default_mask)#define mock_path_flags (v, p, f) \ - __mock_path(hwt->vecs->pathvec, (v), (p), "0", NULL, NULL, \ + mock_path__(hwt->vecs->pathvec, (v), (p), "0", NULL, NULL, \ (f), default_mask)#define mock_path_blacklisted (v, p) \ - __mock_path(hwt->vecs->pathvec, (v), (p), "0", NULL, NULL, \ + mock_path__(hwt->vecs->pathvec, (v), (p), "0", NULL, NULL, \ BL_BY_DEVICE, default_mask)#define mock_path_wwid (v, p, w) \ - __mock_path(hwt->vecs->pathvec, (v), (p), "0", (w), NULL, \ + mock_path__(hwt->vecs->pathvec, (v), (p), "0", (w), NULL, \ 0, default_mask)#define mock_path_wwid_flags (v, p, w, f) \ - __mock_path(hwt->vecs->pathvec, (v), (p), "0", (w), \ + mock_path__(hwt->vecs->pathvec, (v), (p), "0", (w), \ NULL, (f), default_mask) -struct multipath *__mock_multipath (struct vectors *vecs,struct path *pp); -#define mock_multipath (pp) __mock_multipath(hwt->vecs, (pp)) +struct multipath *mock_multipath__ (struct vectors *vecs,struct path *pp); +#define mock_multipath (pp) mock_multipath__(hwt->vecs, (pp))#endif
Signature · 1 line
2.46.0
PATCH 39/41 kpartx: rename macros with leading underscores
In reply to Martin Wilck--- kpartx/devmapper.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
kpartx/devmapper.c +10 -10
@@ -13,16 +13,16 @@#include "devmapper.h" #include "kpartx.h" -#define _UUID_PREFIX "part" -#define UUID_PREFIX _UUID_PREFIX "%d-" -#define _UUID_PREFIX_LEN (sizeof(_UUID_PREFIX) - 1) -#define MAX_PREFIX_LEN (_UUID_PREFIX_LEN + 4) +#define UUID_PREFIX_ "part" +#define UUID_PREFIX UUID_PREFIX_ "%d-" +#define UUID_PREFIX_LEN (sizeof(UUID_PREFIX_) - 1) +#define MAX_PREFIX_LEN (UUID_PREFIX_LEN + 4)#define PARAMS_SIZE 1024#ifdef LIBDM_API_COOKIE -# define __DM_API_COOKIE_UNUSED__/* empty */ +# define DM_API_COOKIE_UNUSED__ /* empty */ #else -# define __DM_API_COOKIE_UNUSED__ __attribute__((unused)) +# define DM_API_COOKIE_UNUSED__ __attribute__((unused))#endif int dm_prereq (char * str,uint32_t x,uint32_t y,uint32_t z)
@@ -60,7 +60,7 @@ out:return r; } -int dm_simplecmd(int task, const char *name, int no_flush, __DM_API_COOKIE_UNUSED__ uint16_t udev_flags) +int dm_simplecmd(int task, const char *name, int no_flush, DM_API_COOKIE_UNUSED__ uint16_t udev_flags) {int r =0 ;#ifdef LIBDM_API_COOKIE
@@ -496,12 +496,12 @@ dm_compare_uuid(const char *mapuuid, const char *partname)if (!partuuid)return 1 ; -if (!strncmp (partuuid, _UUID_PREFIX, _UUID_PREFIX_LEN)) { -char *p = partuuid + _UUID_PREFIX_LEN; +if (!strncmp (partuuid,UUID_PREFIX_ ,UUID_PREFIX_LEN )) { +char *p = partuuid +UUID_PREFIX_LEN ;/* skip partition number */ while (isdigit (*p)) p++; -if (p != partuuid + _UUID_PREFIX_LEN && *p =='-' && +if (p != partuuid +UUID_PREFIX_LEN && *p =='-' && !strcmp (mapuuid, p +1 )) r =0 ; }
Signature · 1 line
2.46.0
PATCH 40/41 libmpathutil: rename struct _vector to vector_s
In reply to Martin WilckThis isn't strictly required by glibc, but "struct _vector" is now the only public identifier starting with underscore, so let's replace it, too.
--- libmpathutil/vector.c | 2 +- libmpathutil/vector.h | 6 +++--- libmultipath/alias.c | 2 +- libmultipath/blacklist.c | 14 +++++++------- libmultipath/blacklist.h | 8 ++++---- libmultipath/config.c | 8 ++++---- libmultipath/config.h | 6 +++--- libmultipath/configure.c | 2 +- libmultipath/configure.h | 2 +- libmultipath/discovery.c | 10 +++++----- libmultipath/dm-generic.c | 8 ++++---- libmultipath/dmparser.c | 2 +- libmultipath/dmparser.h | 2 +- libmultipath/foreign.c | 12 ++++++------ libmultipath/foreign.h | 8 ++++---- libmultipath/foreign/nvme.c | 20 ++++++++++---------- libmultipath/generic.h | 8 ++++---- libmultipath/io_err_stat.c | 4 ++-- libmultipath/print.c | 22 +++++++++++----------- libmultipath/print.h | 10 +++++----- libmultipath/structs.c | 12 ++++++------ libmultipath/structs.h | 12 ++++++------ libmultipath/structs_vec.c | 2 +- libmultipath/structs_vec.h | 2 +- libmultipath/valid.c | 10 +++++----- multipathd/cli.c | 4 ++-- multipathd/cli.h | 4 ++-- multipathd/cli_handlers.c | 6 +++--- multipathd/main.c | 4 ++-- tests/valid.c | 4 ++-- 30 files changed, 108 insertions(+), 108 deletions(-)
libmpathutil/vector.c +1 -1
@@ -30,7 +30,7 @@vector vector_alloc (void ) { -vector v = (vector )calloc (1 ,sizeof (struct _vector )); +vector v = (vector )calloc (1 ,sizeof (struct vector_s ));return v; }
libmpathutil/vector.h +3 -3
@@ -26,11 +26,11 @@#include <stdbool.h> /* vector definition */ -struct _vector { +struct vector_s {int allocated;void **slot; }; -typedef struct _vector *vector ; +typedef struct vector_s *vector ;#define VECTOR_DEFAULT_SIZE 1#define VECTOR_SIZE (V ) ((V) ? ((V)->allocated) / VECTOR_DEFAULT_SIZE : 0)
@@ -53,7 +53,7 @@ typedef struct _vector *vector;*/ #define vector_convert (new, vec, type, conv) \ ({ \ - const struct _vector *__v = (vec); \ + const struct vector_s *__v = (vec); \ vector __t = (new); \ type *__j; \ int __i; \
libmultipath/alias.c +1 -1
@@ -70,7 +70,7 @@ struct binding {* Perhaps one day we'll implement this more efficiently, thus use * an abstract type. */ -typedef struct _vector Bindings ; +typedef struct vector_s Bindings ;/* Protect global_bindings */ static pthread_mutex_t bindings_mutex =PTHREAD_MUTEX_INITIALIZER ;
libmultipath/blacklist.c +7 -7
@@ -141,7 +141,7 @@ out: }static int -match_reglist (const struct _vector *blist,const char *str) +match_reglist (const struct vector_s *blist,const char *str) {int i;struct blentry * ble;
@@ -154,7 +154,7 @@ match_reglist (const struct _vector *blist, const char *str) }static int -match_reglist_device (const struct _vector *blist,const char *vendor, +match_reglist_device (const struct vector_s *blist,const char *vendor,const char * product) {int i;
@@ -175,7 +175,7 @@ match_reglist_device (const struct _vector *blist, const char *vendor, }static int -find_blacklist_device (const struct _vector *blist,const char *vendor, +find_blacklist_device (const struct vector_s *blist,const char *vendor,const char *product) {int i;
@@ -316,7 +316,7 @@ log_filter (const char *dev, const char *vendor, const char *product, }int -filter_device (const struct _vector *blist,const struct _vector *elist, +filter_device (const struct vector_s *blist,const struct vector_s *elist,const char *vendor,const char * product,const char *dev) {int r =MATCH_NOTHING ;
@@ -333,7 +333,7 @@ filter_device (const struct _vector *blist, const struct _vector *elist, }int -filter_devnode (const struct _vector *blist,const struct _vector *elist, +filter_devnode (const struct vector_s *blist,const struct vector_s *elist,const char *dev) {int r =MATCH_NOTHING ;
@@ -350,7 +350,7 @@ filter_devnode (const struct _vector *blist, const struct _vector *elist, }int -filter_wwid (const struct _vector *blist,const struct _vector *elist, +filter_wwid (const struct vector_s *blist,const struct vector_s *elist,const char *wwid,const char *dev) {int r =MATCH_NOTHING ;
@@ -367,7 +367,7 @@ filter_wwid (const struct _vector *blist, const struct _vector *elist, }int -filter_protocol (const struct _vector *blist,const struct _vector *elist, +filter_protocol (const struct vector_s *blist,const struct vector_s *elist,const struct path *pp) {STRBUF_ON_STACK (buf);
libmultipath/blacklist.h +4 -4
@@ -36,16 +36,16 @@ struct blentry_device {int setup_default_blist (struct config *);int alloc_ble_device (vector ); -int filter_devnode (const struct _vector *,const struct _vector *, +int filter_devnode (const struct vector_s *,const struct vector_s *,const char *); -int filter_wwid (const struct _vector *,const struct _vector *, +int filter_wwid (const struct vector_s *,const struct vector_s *,const char *,const char *); -int filter_device (const struct _vector *,const struct _vector *, +int filter_device (const struct vector_s *,const struct vector_s *,const char *,const char *,const char *);int filter_path (const struct config *,const struct path *);int filter_property (const struct config *,struct udev_device *,int ,const char *); -int filter_protocol (const struct _vector *,const struct _vector *, +int filter_protocol (const struct vector_s *,const struct vector_s *,const struct path *);int store_ble (vector ,const char *,int );int set_ble_device (vector ,const char *,const char *,int );
libmultipath/config.c +4 -4
@@ -114,7 +114,7 @@ hwe_strmatch (const struct hwentry *hwe1, const struct hwentry *hwe2) }static struct hwentry * -find_hwe_strmatch (const struct _vector *hwtable,const struct hwentry *hwe) +find_hwe_strmatch (const struct vector_s *hwtable,const struct hwentry *hwe) {int i;struct hwentry *tmp, *ret =NULL ;
@@ -179,7 +179,7 @@ static void _log_match(const char *fn, const struct hwentry *h,#define log_match (h, v, p, r) _log_match(__func__, (h), (v), (p), (r))int -find_hwe (const struct _vector *hwtable, +find_hwe (const struct vector_s *hwtable,const char * vendor,const char * product,const char * revision,vector result) {
@@ -222,7 +222,7 @@ struct mpentry *find_mpe(vector mptable, char *wwid)return NULL ; } -const char *get_mpe_wwid (const struct _vector *mptable,const char *alias) +const char *get_mpe_wwid (const struct vector_s *mptable,const char *alias) {int i;struct mpentry * mpe;
@@ -1089,7 +1089,7 @@ out:const char *get_uid_attribute_by_attrs (const struct config *conf,const char *path_dev) { -const struct _vector *uid_attrs = &conf->uid_attrs; +const struct vector_s *uid_attrs = &conf->uid_attrs;int j;char *att, *col;
libmultipath/config.h +3 -3
@@ -206,7 +206,7 @@ struct config {int auto_resize;char * selector; -struct _vector uid_attrs; +struct vector_s uid_attrs;char * uid_attribute;char * features;char * hwhandler;
@@ -286,11 +286,11 @@ int libmultipath_init(void);*/ void libmultipath_exit (void ); -int find_hwe (const struct _vector *hwtable, +int find_hwe (const struct vector_s *hwtable,const char * vendor,const char * product,const char *revision,vector result);struct mpentry *find_mpe (vector mptable,char * wwid); -const char *get_mpe_wwid (const struct _vector *mptable,const char *alias); +const char *get_mpe_wwid (const struct vector_s *mptable,const char *alias);struct hwentry *alloc_hwe (void );struct mpentry *alloc_mpe (void );
libmultipath/configure.c +1 -1
@@ -630,7 +630,7 @@ select_reload_action(struct multipath *mpp, const char *reason)condlog (3 ,"%s: set ACT_RELOAD (%s)" , mpp->alias, reason); } -void select_action (struct multipath *mpp,const struct _vector *curmp, +void select_action (struct multipath *mpp,const struct vector_s *curmp,int force_reload) {struct multipath * cmpp;
libmultipath/configure.h +1 -1
@@ -53,7 +53,7 @@ enum {struct vectors ;int setup_map (struct multipath * mpp,char **params,struct vectors *vecs); -void select_action (struct multipath *mpp,const struct _vector *curmp, +void select_action (struct multipath *mpp,const struct vector_s *curmp,int force_reload);int domap (struct multipath * mpp,char * params,int is_daemon);int reinstate_paths (struct multipath *mpp);
libmultipath/discovery.c +5 -5
@@ -1523,7 +1523,7 @@ get_vpd_sgio (int fd, int pg, int vend_id, char * str, int maxlen) }static int -scsi_sysfs_pathinfo (struct path *pp,const struct _vector *hwtable) +scsi_sysfs_pathinfo (struct path *pp,const struct vector_s *hwtable) {struct udev_device *parent;const char *attr_path =NULL ;
@@ -1594,7 +1594,7 @@ scsi_sysfs_pathinfo (struct path *pp, const struct _vector *hwtable) }static int -nvme_sysfs_pathinfo (struct path *pp,const struct _vector *hwtable) +nvme_sysfs_pathinfo (struct path *pp,const struct vector_s *hwtable) {struct udev_device *parent;const char *attr_path =NULL ;
@@ -1653,7 +1653,7 @@ nvme_sysfs_pathinfo (struct path *pp, const struct _vector *hwtable) }static int -ccw_sysfs_pathinfo (struct path *pp,const struct _vector *hwtable) +ccw_sysfs_pathinfo (struct path *pp,const struct vector_s *hwtable) {struct udev_device *parent;char attr_buff[NAME_SIZE ];
@@ -1714,7 +1714,7 @@ ccw_sysfs_pathinfo (struct path *pp, const struct _vector *hwtable) }static int -cciss_sysfs_pathinfo (struct path *pp,const struct _vector *hwtable) +cciss_sysfs_pathinfo (struct path *pp,const struct vector_s *hwtable) {const char * attr_path =NULL ;struct udev_device *parent;
@@ -1872,7 +1872,7 @@ path_offline (struct path * pp) }static int -sysfs_pathinfo (struct path *pp,const struct _vector *hwtable) +sysfs_pathinfo (struct path *pp,const struct vector_s *hwtable) {int r =common_sysfs_pathinfo (pp);
libmultipath/dm-generic.c +4 -4
@@ -24,7 +24,7 @@#include "config.h" #include "print.h" -static const struct _vector * +static const struct vector_s *dm_mp_get_pgs (const struct gen_multipath *gmp) { return vector_convert(NULL, gen_multipath_to_dm(gmp)->pg,
@@ -33,12 +33,12 @@ dm_mp_get_pgs(const struct gen_multipath *gmp)static void dm_mp_rel_pgs (__attribute__((unused))const struct gen_multipath *gmp, -const struct _vector * v) +const struct vector_s * v) {vector_free_const (v); } -static const struct _vector * +static const struct vector_s *dm_pg_get_paths (const struct gen_pathgroup *gpg) { return vector_convert(NULL, gen_pathgroup_to_dm(gpg)->paths,
@@ -47,7 +47,7 @@ dm_pg_get_paths(const struct gen_pathgroup *gpg)static void dm_mp_rel_paths (__attribute__((unused))const struct gen_pathgroup *gpg, -const struct _vector * v) +const struct vector_s * v) {vector_free_const (v); }
libmultipath/dmparser.c +1 -1
@@ -117,7 +117,7 @@ err:* Call update_pathvec_from_dm() after this function to make sure * all data structures are in a sane state. */ -int disassemble_map (const struct _vector *pathvec, +int disassemble_map (const struct vector_s *pathvec,const char *params,struct multipath *mpp) {char * word;
libmultipath/dmparser.h +1 -1
@@ -2,7 +2,7 @@#define DMPARSER_H_INCLUDED int assemble_map (struct multipath *,char **); -int disassemble_map (const struct _vector *,const char *,struct multipath *); +int disassemble_map (const struct vector_s *,const char *,struct multipath *);int disassemble_status (const char *,struct multipath *);#endif
libmultipath/foreign.c +6 -6
@@ -451,7 +451,7 @@ void foreign_path_layout(fieldwidth_t *width)pthread_cleanup_push (unlock_foreigns,NULL ); vector_foreach_slot(foreigns, fgn, i) { -const struct _vector *vec; +const struct vector_s *vec; fgn->lock (fgn->context);pthread_cleanup_push (fgn->unlock, fgn->context);
@@ -482,7 +482,7 @@ void foreign_multipath_layout(fieldwidth_t *width)pthread_cleanup_push (unlock_foreigns,NULL ); vector_foreach_slot(foreigns, fgn, i) { -const struct _vector *vec; +const struct vector_s *vec; fgn->lock (fgn->context);pthread_cleanup_push (fgn->unlock, fgn->context);
@@ -507,7 +507,7 @@ static int snprint_foreign_topology__(struct strbuf *buf, int verbosity,size_t initial_len =get_strbuf_len (buf); vector_foreach_slot(foreigns, fgn, i) { -const struct _vector *vec; +const struct vector_s *vec;const struct gen_multipath *gm;int j;
@@ -561,7 +561,7 @@ void print_foreign_topology(int verbosity) }pthread_cleanup_push (unlock_foreigns,NULL ); vector_foreach_slot(foreigns, fgn, i) { -const struct _vector *vec; +const struct vector_s *vec; fgn->lock (fgn->context);pthread_cleanup_push (fgn->unlock, fgn->context);
@@ -590,7 +590,7 @@ int snprint_foreign_paths(struct strbuf *buf, const char *style,pthread_cleanup_push (unlock_foreigns,NULL ); vector_foreach_slot(foreigns, fgn, i) { -const struct _vector *vec; +const struct vector_s *vec;const struct gen_path *gp;int j, ret =0 ;
@@ -630,7 +630,7 @@ int snprint_foreign_multipaths(struct strbuf *buf, const char *style,pthread_cleanup_push (unlock_foreigns,NULL ); vector_foreach_slot(foreigns, fgn, i) { -const struct _vector *vec; +const struct vector_s *vec;const struct gen_multipath *gm;int j, ret =0 ;
libmultipath/foreign.h +4 -4
@@ -155,7 +155,7 @@ struct foreign {* @returns a vector of "struct gen_multipath*" with the map devices * belonging to this library (see generic.h). */ -const struct _vector * (*get_multipaths)(const struct context *); +const struct vector_s * (*get_multipaths)(const struct context *);/** * method: release_multipaths(context, mpvec)
@@ -165,7 +165,7 @@ struct foreign {* @param[in] mpvec the vector allocated with get_multipaths() */ void (*release_multipaths)(const struct context *ctx, -const struct _vector * mpvec); +const struct vector_s * mpvec);/** * method: get_paths
@@ -176,7 +176,7 @@ struct foreign {* @returns a vector of "struct gen_path*" with the path devices * belonging to this library (see generic.h) */ -const struct _vector * (*get_paths)(const struct context *); +const struct vector_s * (*get_paths)(const struct context *);/** * release data structures obtained with get_multipaths (if any)
@@ -185,7 +185,7 @@ struct foreign {* @param[in] ppvec the vector allocated with get_paths() */ void (*release_paths)(const struct context *ctx, -const struct _vector * ppvec); +const struct vector_s * ppvec);void *handle;struct context *context;
libmultipath/foreign/nvme.c +10 -10
@@ -45,7 +45,7 @@ const char *THIS;struct nvme_map ;struct nvme_pathgroup {struct gen_pathgroup gen; -struct _vector pathvec; +struct vector_s pathvec; };struct nvme_path {
@@ -66,7 +66,7 @@ struct nvme_map {struct udev_device *udev;struct udev_device *subsys;dev_t devt; -struct _vector pgvec; +struct vector_s pgvec;int nr_live;int ana_supported; };
@@ -114,7 +114,7 @@ static void cleanup_nvme_map(struct nvme_map *map)free (map); } -static const struct _vector * +static const struct vector_s *nvme_mp_get_pgs (const struct gen_multipath *gmp) {const struct nvme_map *nvme =const_gen_mp_to_nvme (gmp);
@@ -124,7 +124,7 @@ nvme_mp_get_pgs(const struct gen_multipath *gmp) {static void nvme_mp_rel_pgs (__attribute__((unused))const struct gen_multipath *gmp, - __attribute__((unused))const struct _vector *v) + __attribute__((unused))const struct vector_s *v) {/* empty */ }
@@ -201,7 +201,7 @@ static int snprint_nvme_map(const struct gen_multipath *gmp,return append_strbuf_str (buff,N_A ); } -static const struct _vector * +static const struct vector_s *nvme_pg_get_paths (const struct gen_pathgroup *gpg) {const struct nvme_pathgroup *gp =const_gen_pg_to_nvme (gpg);
@@ -211,7 +211,7 @@ nvme_pg_get_paths(const struct gen_pathgroup *gpg) {static void nvme_pg_rel_paths (__attribute__((unused))const struct gen_pathgroup *gpg, - __attribute__((unused))const struct _vector *v) + __attribute__((unused))const struct vector_s *v) {/* empty */ }
@@ -916,14 +916,14 @@ void check(struct context *ctx)/* * It's safe to pass our internal pointer, this is only used under the lock. */ -const struct _vector *get_multipaths (const struct context *ctx) +const struct vector_s *get_multipaths (const struct context *ctx) {condlog (5 ,"%s called for \"%s\"" , __func__,THIS );return ctx->mpvec; }void release_multipaths (__attribute__((unused))const struct context *ctx, - __attribute__((unused))const struct _vector *mpvec) + __attribute__((unused))const struct vector_s *mpvec) {condlog (5 ,"%s called for \"%s\"" , __func__,THIS );/* NOP */
@@ -932,7 +932,7 @@ void release_multipaths(__attribute__((unused)) const struct context *ctx,/* * It's safe to pass our internal pointer, this is only used under the lock. */ -const struct _vector *get_paths (const struct context *ctx) +const struct vector_s *get_paths (const struct context *ctx) {vector paths =NULL ;const struct gen_multipath *gm;
@@ -948,7 +948,7 @@ const struct _vector * get_paths(const struct context *ctx) }void release_paths (__attribute__((unused))const struct context *ctx, -const struct _vector *mpvec) +const struct vector_s *mpvec) {condlog (5 ,"%s called for \"%s\"" , __func__,THIS );vector_free_const (mpvec);
libmultipath/generic.h +4 -4
@@ -43,7 +43,7 @@ struct gen_multipath_ops {* @param gmp: generic multipath object to act on * @returns a vector of const struct gen_pathgroup* */ -const struct _vector * (*get_pathgroups)(const struct gen_multipath *); +const struct vector_s * (*get_pathgroups)(const struct gen_multipath *);/** * method: rel_pathgroups(gmp, v) * free data allocated by get_pathgroups(), if any
@@ -51,7 +51,7 @@ struct gen_multipath_ops {* @param v the value returned by get_pathgroups() */ void (*rel_pathgroups)(const struct gen_multipath *, -const struct _vector *); +const struct vector_s *);/** * method: snprint(gmp, buf, len, wildcard) * prints the property of the multipath map matching
@@ -89,14 +89,14 @@ struct gen_pathgroup_ops {* @param gpg: generic pathgroup object to act on * @returns a vector of const struct gen_path* */ -const struct _vector * (*get_paths)(const struct gen_pathgroup *); +const struct vector_s * (*get_paths)(const struct gen_pathgroup *);/** * method: rel_paths(gpg, v) * free data allocated by get_paths(), if any * @param gmp: generic pathgroup object to act on * @param v the value returned by get_paths() */ -void (*rel_paths)(const struct gen_pathgroup *,const struct _vector *); +void (*rel_paths)(const struct gen_pathgroup *,const struct vector_s *);/** * Method snprint() * see gen_multipath_ops->snprint() above
libmultipath/io_err_stat.c +2 -2
@@ -619,9 +619,9 @@ static void process_async_ios_event(int timeout_nsecs, char *dev)static void service_paths (void ) { -struct _vector _pathvec = { .allocated =0 }; +struct vector_s _pathvec = { .allocated =0 };/* avoid gcc warnings that &_pathvec will never be NULL in vector ops */ -struct _vector *const tmp_pathvec = &_pathvec; +struct vector_s *const tmp_pathvec = &_pathvec;struct io_err_stat_path *pp;int i;
libmultipath/print.c +11 -11
@@ -946,7 +946,7 @@ reset_width(fieldwidth_t *width, enum layout_reset reset, const char *header) } } -void get_path_layout__ (const struct _vector *gpvec,enum layout_reset reset, +void get_path_layout__ (const struct vector_s *gpvec,enum layout_reset reset,fieldwidth_t *width) {unsigned int i, j;
@@ -987,7 +987,7 @@ void get_multipath_layout (vector mpvec, int header, fieldwidth_t *width) { }void -get_multipath_layout__ (const struct _vector *gmvec,enum layout_reset reset, +get_multipath_layout__ (const struct vector_s *gmvec,enum layout_reset reset,fieldwidth_t *width) {unsigned int i, j;
@@ -1230,7 +1230,7 @@ void print_multipath_topology__(const struct gen_multipath *gmp, int verbosity)STRBUF_ON_STACK (buff); fieldwidth_t *p_width __attribute__((cleanup(cleanup_ucharp))) = NULL;const struct gen_pathgroup *gpg; -const struct _vector *pgvec, *pathvec; +const struct vector_s *pgvec, *pathvec;int j; p_width =alloc_path_layout ();
@@ -1271,7 +1271,7 @@ int snprint_multipath_topology__(const struct gen_multipath *gmp, const fieldwidth_t *p_width) {int j, i, rc; -const struct _vector *pgvec; +const struct vector_s *pgvec;const struct gen_pathgroup *gpg;STRBUF_ON_STACK (style);size_t initial_len =get_strbuf_len (buff);
@@ -1304,7 +1304,7 @@ int snprint_multipath_topology__(const struct gen_multipath *gmp, goto out; vector_foreach_slot (pgvec, gpg, j) { -const struct _vector *pathvec; +const struct vector_s *pathvec;struct gen_path *gp;bool last_group = j +1 ==VECTOR_SIZE (pgvec);
@@ -1482,7 +1482,7 @@ snprint_pcentry (const struct config *conf, struct strbuf *buff,static int snprint_pctable (const struct config *conf,struct strbuf *buff, -const struct _vector *pctable) +const struct vector_s *pctable) {int i, rc;struct pcentry *pce;
@@ -1526,7 +1526,7 @@ snprint_hwentry (const struct config *conf, }static int snprint_hwtable (const struct config *conf,struct strbuf *buff, -const struct _vector *hwtable) +const struct vector_s *hwtable) {int i, rc;struct hwentry * hwe;
@@ -1552,7 +1552,7 @@ static int snprint_hwtable(const struct config *conf, struct strbuf *buff,static int snprint_mpentry (const struct config *conf,struct strbuf *buff, -const struct mpentry * mpe,const struct _vector *mpvec) +const struct mpentry * mpe,const struct vector_s *mpvec) {int i, rc;struct keyword * kw;
@@ -1587,7 +1587,7 @@ snprint_mpentry (const struct config *conf, struct strbuf *buff, }static int snprint_mptable (const struct config *conf,struct strbuf *buff, -const struct _vector *mpvec) +const struct vector_s *mpvec) {int i, rc;struct mpentry * mpe;
@@ -1909,7 +1909,7 @@ static int snprint_blacklist_except(const struct config *conf, }int snprint_config__ (const struct config *conf,struct strbuf *buff, -const struct _vector *hwtable,const struct _vector *mpvec) +const struct vector_s *hwtable,const struct vector_s *mpvec) {int rc;
@@ -1930,7 +1930,7 @@ int snprint_config__(const struct config *conf, struct strbuf *buff, }char *snprint_config (const struct config *conf,int *len, -const struct _vector *hwtable,const struct _vector *mpvec) +const struct vector_s *hwtable,const struct vector_s *mpvec) {STRBUF_ON_STACK (buff);char *reply;
libmultipath/print.h +5 -5
@@ -17,11 +17,11 @@ enum layout_reset {/* fieldwidth_t is defined in generic.h */ fieldwidth_t *alloc_path_layout (void ); -void get_path_layout__ (const struct _vector *gpvec,enum layout_reset , +void get_path_layout__ (const struct vector_s *gpvec,enum layout_reset ,fieldwidth_t *width);void get_path_layout (vector pathvec,int header,fieldwidth_t *width);fieldwidth_t *alloc_multipath_layout (void ); -void get_multipath_layout__ (const struct _vector *gmvec,enum layout_reset , +void get_multipath_layout__ (const struct vector_s *gmvec,enum layout_reset ,fieldwidth_t *width);void get_multipath_layout (vector mpvec,int header,fieldwidth_t *width);int snprint_path_header (struct strbuf *,const char *,const fieldwidth_t *);
@@ -41,10 +41,10 @@ int snprint_multipath_topology__ (const struct gen_multipath *, struct strbuf *, snprint_multipath_topology__ (dm_multipath_to_gen(mpp), buf, v, w)int snprint_multipath_topology_json (struct strbuf *,const struct vectors *vecs);int snprint_config__ (const struct config *conf,struct strbuf *buff, -const struct _vector *hwtable,const struct _vector *mpvec); +const struct vector_s *hwtable,const struct vector_s *mpvec);char *snprint_config (const struct config *conf,int *len, -const struct _vector *hwtable, -const struct _vector *mpvec); +const struct vector_s *hwtable, +const struct vector_s *mpvec);int snprint_multipath_map_json (struct strbuf *,const struct multipath *mpp);int snprint_blacklist_report (struct config *,struct strbuf *);int snprint_wildcards (struct strbuf *);
libmultipath/structs.c +6 -6
@@ -433,7 +433,7 @@ store_adaptergroup(vector adapters, struct adapter_group * agp) }struct multipath * -find_mp_by_minor (const struct _vector *mpvec,unsigned int minor) +find_mp_by_minor (const struct vector_s *mpvec,unsigned int minor) {int i;struct multipath * mpp;
@@ -452,7 +452,7 @@ find_mp_by_minor (const struct _vector *mpvec, unsigned int minor) }struct multipath * -find_mp_by_wwid (const struct _vector *mpvec,const char * wwid) +find_mp_by_wwid (const struct vector_s *mpvec,const char * wwid) {int i;struct multipath * mpp;
@@ -468,7 +468,7 @@ find_mp_by_wwid (const struct _vector *mpvec, const char * wwid) }struct multipath * -find_mp_by_alias (const struct _vector *mpvec,const char * alias) +find_mp_by_alias (const struct vector_s *mpvec,const char * alias) {int i;size_t len;
@@ -491,7 +491,7 @@ find_mp_by_alias (const struct _vector *mpvec, const char * alias) }struct multipath * -find_mp_by_str (const struct _vector *mpvec,const char * str) +find_mp_by_str (const struct vector_s *mpvec,const char * str) {int minor;char dummy;
@@ -510,7 +510,7 @@ find_mp_by_str (const struct _vector *mpvec, const char * str) }struct path * -find_path_by_dev (const struct _vector *pathvec,const char *dev) +find_path_by_dev (const struct vector_s *pathvec,const char *dev) {int i;struct path * pp;
@@ -527,7 +527,7 @@ find_path_by_dev (const struct _vector *pathvec, const char *dev) }struct path * -find_path_by_devt (const struct _vector *pathvec,const char * dev_t) +find_path_by_devt (const struct vector_s *pathvec,const char * dev_t) {int i;struct path * pp;
libmultipath/structs.h +6 -6
@@ -564,14 +564,14 @@ int store_hostgroup(vector hostgroupvec, struct host_group *hgp);int store_path (vector pathvec,struct path * pp);int add_pathgroup (struct multipath *,struct pathgroup *); -struct multipath *find_mp_by_alias (const struct _vector *mp,const char *alias); -struct multipath *find_mp_by_wwid (const struct _vector *mp,const char *wwid); -struct multipath *find_mp_by_str (const struct _vector *mp,const char *wwid); -struct multipath *find_mp_by_minor (const struct _vector *mp, +struct multipath *find_mp_by_alias (const struct vector_s *mp,const char *alias); +struct multipath *find_mp_by_wwid (const struct vector_s *mp,const char *wwid); +struct multipath *find_mp_by_str (const struct vector_s *mp,const char *wwid); +struct multipath *find_mp_by_minor (const struct vector_s *mp,unsigned int minor); -struct path *find_path_by_devt (const struct _vector *pathvec,const char *devt); -struct path *find_path_by_dev (const struct _vector *pathvec,const char *dev); +struct path *find_path_by_devt (const struct vector_s *pathvec,const char *devt); +struct path *find_path_by_dev (const struct vector_s *pathvec,const char *dev);struct path *first_path (const struct multipath *mpp);struct path *mp_find_path_by_devt (const struct multipath *mpp,const char *devt);
libmultipath/structs_vec.c +1 -1
@@ -891,7 +891,7 @@ void update_queue_mode_add_path(struct multipath *mpp)condlog (2 ,"%s: remaining active paths: %d" , mpp->alias, active); } -vector get_used_hwes (const struct _vector *pathvec) +vector get_used_hwes (const struct vector_s *pathvec) {int i, j;struct path *pp;
libmultipath/structs_vec.h +1 -1
@@ -37,6 +37,6 @@ int update_multipath_table__ (struct multipath *mpp, vector pathvec, int flags, const char *params, const char *status);int update_multipath_table (struct multipath *mpp,vector pathvec,int flags);int update_multipath_status (struct multipath *mpp); -vector get_used_hwes (const struct _vector *pathvec); +vector get_used_hwes (const struct vector_s *pathvec);#endif /* STRUCTS_VEC_H_INCLUDED */
libmultipath/valid.c +5 -5
@@ -120,7 +120,7 @@ static int check_holders(const char *syspath)return sr.n; } -static int check_all_holders (const struct _vector *parts) +static int check_all_holders (const struct vector_s *parts) {char syspath[PATH_MAX ];const char *sysname;
@@ -168,7 +168,7 @@ static void cleanup_cache(void *arg)* check if any of the partitions in the vector is referenced in the table. * Note that mnt_table_find_srcpath() also resolves mounts by symlinks. */ -static int check_mnt_table (const struct _vector *parts, +static int check_mnt_table (const struct vector_s *parts,struct libmnt_table *tbl,const char *table_name) {
@@ -188,7 +188,7 @@ static int check_mnt_table(const struct _vector *parts,return 0 ; } -static int check_mountinfo (const struct _vector *parts) +static int check_mountinfo (const struct vector_s *parts) {static const char mountinfo[] ="/proc/self/mountinfo" ;struct libmnt_table *tbl;
@@ -223,7 +223,7 @@ static int check_mountinfo(const struct _vector *parts) }#ifdef LIBMOUNT_SUPPORTS_SWAP -static int check_swaps (const struct _vector *parts) +static int check_swaps (const struct vector_s *parts) {struct libmnt_table *tbl;struct libmnt_cache *cache;
@@ -248,7 +248,7 @@ static int check_swaps(const struct _vector *parts) return used; }#else -static int check_swaps (const struct _vector *parts __attribute__((unused))) +static int check_swaps (const struct vector_s *parts __attribute__((unused))) {return 0 ; }
multipathd/cli.c +2 -2
@@ -335,7 +335,7 @@ int get_cmdvec (char *cmd, vector *v, bool allow_incomplete)return r; } -uint32_t fingerprint (const struct _vector *vec) +uint32_t fingerprint (const struct vector_s *vec) {int i;uint32_t fp =0 ;
@@ -352,7 +352,7 @@ uint32_t fingerprint(const struct _vector *vec)return fp; } -struct handler *find_handler_for_cmdvec (const struct _vector *v) +struct handler *find_handler_for_cmdvec (const struct vector_s *v) {return find_handler (fingerprint (v)); }
multipathd/cli.h +2 -2
@@ -142,7 +142,7 @@ int set_handler_callback__ (uint32_t fp, cli_handler *fn, bool locked);#define set_unlocked_handler_callback (fp, fn) set_handler_callback__(fp, fn, false)int get_cmdvec (char *cmd,vector *v,bool allow_incomplete); -struct handler *find_handler_for_cmdvec (const struct _vector *v); +struct handler *find_handler_for_cmdvec (const struct vector_s *v);void genhelp_handler (const char *cmd,int error,struct strbuf *reply);int load_keys (void );
@@ -152,7 +152,7 @@ void free_keys (vector vec);void free_handlers (void );int cli_init (void );void cli_exit (void ); -uint32_t fingerprint (const struct _vector *vec); +uint32_t fingerprint (const struct vector_s *vec);vector get_keys (void );vector get_handlers (void );struct key *find_key (const char * str);
multipathd/cli_handlers.c +3 -3
@@ -33,7 +33,7 @@#include "cli_handlers.h" static struct path * -find_path_by_str (const struct _vector *pathvec,const char *str, +find_path_by_str (const struct vector_s *pathvec,const char *str,const char *action_str) {struct path *pp;
@@ -157,8 +157,8 @@ show_map_json (struct strbuf *reply, struct multipath * mpp, }static int -show_config (struct strbuf *reply,const struct _vector *hwtable, -const struct _vector *mpvec) +show_config (struct strbuf *reply,const struct vector_s *hwtable, +const struct vector_s *mpvec) {struct config *conf;int rc;
multipathd/main.c +2 -2
@@ -3140,8 +3140,8 @@ void rcu_free_config(struct rcu_head *head)free_config (conf); } -static bool reconfigure_check_uid_attrs (const struct _vector *old_attrs, -const struct _vector *new_attrs) +static bool reconfigure_check_uid_attrs (const struct vector_s *old_attrs, +const struct vector_s *new_attrs) {int i;char *old;
tests/valid.c +2 -2
@@ -106,14 +106,14 @@ const char *__wrap_udev_device_get_sysname(struct udev_device *udev_device) }/* called from pathinfo() */ -int __wrap_filter_devnode (struct config *conf,const struct _vector *elist, +int __wrap_filter_devnode (struct config *conf,const struct vector_s *elist,const char *vendor,const char * product,const char *dev) {return mock_type (int); }/* called from pathinfo() */ -int __wrap_filter_device (const struct _vector *blist,const struct _vector *elist, +int __wrap_filter_device (const struct vector_s *blist,const struct vector_s *elist,const char *vendor,const char * product,const char *dev) {return mock_type (int);
Signature · 1 line
2.46.0
PATCH 41/41 libmultipath: don't define __user
In reply to Martin WilckThis may have been necessary in the old days, but it isn't necessary any more now.
--- libmultipath/prioritizers/alua_rtpg.c | 1 - libmultipath/sg_include.h | 1 - 2 files changed, 2 deletions(-)
libmultipath/prioritizers/alua_rtpg.c +0 -1
@@ -21,7 +21,6 @@#include <libudev.h> #include <errno.h> -#define __user#include <scsi/sg.h> #include "../structs.h"
libmultipath/sg_include.h +0 -1
@@ -1,6 +1,5 @@#ifndef SG_INCLUDE_H_INCLUDED #define SG_INCLUDE_H_INCLUDED -#define __user#include <scsi/sg.h> #ifndef DID_OK
Signature · 1 line
2.46.0
Quoted 18 lines · Martin Wilck
The first 2 patches are minor, independent fixes.
The rest of the set renames identifiers that possibly conflict with reserved names of the C library, and should have no influence on the functionality of the code.
According to the glibc docs, user code must not redefine any type, function, variable, or macro names that are part of the ISO C standard [1]. Moreover, identifiers must not start with "__" (double underscore) or underscore and capital letter, and names starting with underscore are forbidden for globally visible symbols.
This patch series tries to make the multipath-tools code comply with these requirements, at least to some extent. I haven't bothered renaming local or static variables, or variables like "
__x" in macro bodies, for example. The starting point for the series was the request not to export strlcat and strlcpy any more [2].
Quoted 4 lines
In most cases, I have simply replaced
__xyz()or_xyz()byxyz__()(two underscores to make them better visible). In some cases, whenxyz()was not defined, I've simply renamed_xyz()toxyz(). There are exceptions to these rules.
Despite some small misgivings about renaming symbols (which quite possibly aren't being used by anyone) in our user-facing libraries, libpmathpersist and libmpathcmd, for the set:
Quoted 211 lines
The set also fixes some typos where
__attribute__was misspelled.[1] https://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html
[2] https://github.com/opensvc/multipath-tools/issues/91Martin Wilck (41):
multipath-tools tests: make alias.test succeed with increased
verbosity
libmpathutil: avoid extra memory allocation inprint_strbuf()
libmpathutil: rename strlcat and strlcpy libmpathutil.version: remove strlcpy and strlcat, and LIBMULTIPATH
section
libmpathutil: fix__attributetypo inlog_pthread.c
libmultipath:devmapper.c: rename__DR_UNUSED__, and fix__attribute
typo
multipathd: fix__attributetypo
multipath-tools: use common convention for "header file included"
macros
libmpathcmd: rename__mpath_connect()tompath_connect__()
libmpathutil: rename_MAX_CMD_LEN
libmpathutil: rename__append_strbuf_str()and__get_strbuf_buf()
libmpathutil: rename_log_bitfield_overflow()
libmpathutil: rename_install_keyword()toinstall_keyword__()
libmultipath: rename_NVME_LIB_C
libmultipath:checkers.h: fix__CHECKER_FIRST_MSGin comment
libmultipath: rename identifiers with leading underscores in
devmapper.h
libmultipath: rename identifiers with leading underscores in
discovery.h
libmultipath: rename__snprint_config()
libmultipath: rename__unlock()
libmultipath: rename__sysfs_attr_get_value()
libmultipath: rename__snprint_foreign_topology()
libmultipath: rename macros with double underscores inpropsel.c
libmultipath: rename enum values with double underscores instructs.h
libmultipath: rename macros starting with underscore
libmultipath: rename__internal_configvariable
libmultipath: rename_dm_flush_map()todm_flush_map__()
libmultipath: foreign: rename_check()tocheck__()
libmultipath: rename_cleanup_foreign()
libmultipath: rename_init_config()
libmultipath: rename symbols starting with underscore inprint.h
libmultipath: remove dead code inpgpolicies.h
libmultipath: remove struct and union names incciss.h
libmpathpersist: rename functions with double leading underscore
libdmmp: rename macros starting with_DMMP
libdmmp: rename enum values and variables starting with _DMMP_
libdmmp: rename non-static functions starting with underscore
multipathd: rename symbols with double leading underscore multipath-tools tests: rename functions with double underscores
kpartx: rename macros with leading underscores
libmpathutil: rename struct_vectortovector_s
libmultipath: don't define__usercreate-config.mk | 4 +- kpartx/byteorder.h | 6 +- kpartx/crc32.h | 6 +- kpartx/dasd.h | 6 +- kpartx/devmapper.c | 20 +++--- kpartx/devmapper.h | 6 +- kpartx/dos.h | 2 +- kpartx/efi.h | 6 +- kpartx/gpt.h | 4 +- kpartx/kpartx.h | 6 +- kpartx/lopart.h | 3 + kpartx/mac.h | 4 +- kpartx/xstrncpy.h | 3 + libdmmp/libdmmp.c | 72 +++++++++---------- libdmmp/libdmmp/libdmmp.h | 6 +- libdmmp/libdmmp_misc.c | 10 +-- libdmmp/libdmmp_mp.c | 12 ++-- libdmmp/libdmmp_path.c | 22 +++--- libdmmp/libdmmp_pg.c | 40 +++++------ libdmmp/libdmmp_private.h | 32 ++++----- libmpathcmd/libmpathcmd.version | 4 +- libmpathcmd/mpath_cmd.c | 4 +- libmpathcmd/mpath_cmd.h | 8 +-- libmpathpersist/libmpathpersist.version | 6 +- libmpathpersist/mpath_persist.c | 22 +++--- libmpathpersist/mpath_persist.h | 45 ++++++------ libmpathpersist/mpath_persist_int.h | 6 +- libmpathpersist/mpath_pr_ioctl.h | 5 ++ libmpathpersist/mpathpr.h | 4 +- libmpathutil/debug.h | 6 +- libmpathutil/globals.h | 4 +- libmpathutil/libmpathutil.version | 90 ++++++++++-------------- libmpathutil/log.h | 6 +- libmpathutil/log_pthread.c | 2 +- libmpathutil/log_pthread.h | 6 +- libmpathutil/msort.h | 4 +- libmpathutil/parser.c | 6 +- libmpathutil/parser.h | 32 ++++----- libmpathutil/strbuf.c | 29 +++++--- libmpathutil/strbuf.h | 10 +-- libmpathutil/time-util.h | 6 +- libmpathutil/util.c | 6 +- libmpathutil/util.h | 25 ++++--- libmpathutil/uxsock.h | 7 +- libmpathutil/vector.c | 2 +- libmpathutil/vector.h | 10 +-- libmpathvalid/mpath_valid.h | 6 +- libmultipath/alias.c | 4 +- libmultipath/alias.h | 6 +- libmultipath/blacklist.c | 14 ++-- libmultipath/blacklist.h | 14 ++-- libmultipath/checkers.h | 8 +-- libmultipath/checkers/cciss.h | 22 +++--- libmultipath/checkers/directio.c | 8 +-- libmultipath/checkers/directio.h | 6 +- libmultipath/checkers/emc_clariion.c | 20 +++--- libmultipath/checkers/emc_clariion.h | 6 +- libmultipath/checkers/hp_sw.h | 6 +- libmultipath/checkers/rdac.c | 20 +++--- libmultipath/checkers/rdac.h | 6 +- libmultipath/checkers/readsector0.h | 6 +- libmultipath/checkers/tur.c | 10 +-- libmultipath/checkers/tur.h | 6 +- libmultipath/config.c | 30 ++++---- libmultipath/config.h | 10 +-- libmultipath/configure.c | 2 +- libmultipath/configure.h | 6 +- libmultipath/defaults.h | 7 +- libmultipath/devmapper.c | 28 ++++---- libmultipath/devmapper.h | 27 +++---- libmultipath/dict.c | 4 +- libmultipath/dict.h | 9 +-- libmultipath/discovery.c | 18 ++--- libmultipath/discovery.h | 38 +++++----- libmultipath/dm-generic.c | 8 +-- libmultipath/dm-generic.h | 6 +- libmultipath/dmparser.c | 2 +- libmultipath/dmparser.h | 7 +- libmultipath/file.h | 6 +- libmultipath/foreign.c | 36 +++++----- libmultipath/foreign.h | 19 ++--- libmultipath/foreign/nvme.c | 50 ++++++------- libmultipath/generic.h | 14 ++-- libmultipath/hwtable.h | 6 +- libmultipath/io_err_stat.c | 4 +- libmultipath/io_err_stat.h | 6 +- libmultipath/libmultipath.version | 20 +++--- libmultipath/libsg.h | 6 +- libmultipath/list.h | 6 +- libmultipath/lock.c | 4 +- libmultipath/lock.h | 8 +-- libmultipath/nvme-lib.c | 2 +- libmultipath/nvme-lib.h | 8 +-- libmultipath/nvme/argconfig.h | 4 +- libmultipath/nvme/json.h | 4 +- libmultipath/nvme/linux/nvme.h | 6 +- libmultipath/nvme/linux/nvme_ioctl.h | 6 +- libmultipath/nvme/nvme-ioctl.h | 6 +- libmultipath/nvme/nvme.h | 6 +- libmultipath/nvme/plugin.h | 4 +- libmultipath/pgpolicies.h | 10 +-- libmultipath/print.c | 68 +++++++++--------- libmultipath/print.h | 34 ++++----- libmultipath/prio.h | 6 +- libmultipath/prioritizers/alua.h | 4 +- libmultipath/prioritizers/alua_rtpg.c | 1 - libmultipath/prioritizers/alua_rtpg.h | 6 +- libmultipath/prioritizers/alua_spc3.h | 6 +- libmultipath/prioritizers/weightedpath.h | 4 +- libmultipath/prkey.h | 6 +- libmultipath/propsel.c | 10 +-- libmultipath/propsel.h | 3 + libmultipath/sg_include.h | 4 +- libmultipath/structs.c | 12 ++-- libmultipath/structs.h | 22 +++--- libmultipath/structs_vec.c | 2 +- libmultipath/structs_vec.h | 8 +-- libmultipath/switchgroup.h | 5 ++ libmultipath/sysfs.c | 6 +- libmultipath/sysfs.h | 4 +- libmultipath/uevent.h | 6 +- libmultipath/unaligned.h | 6 +- libmultipath/valid.c | 14 ++-- libmultipath/valid.h | 6 +- libmultipath/version.h | 6 +- libmultipath/wwids.h | 6 +- mpathpersist/main.c | 6 +- mpathpersist/main.h | 4 ++ multipathd/cli.c | 6 +- multipathd/cli.h | 16 ++--- multipathd/cli_handlers.c | 8 +-- multipathd/cli_handlers.h | 4 +- multipathd/dmevents.c | 2 +- multipathd/dmevents.h | 6 +- multipathd/fpin.h | 4 +- multipathd/init_unwinder.h | 4 +- multipathd/main.c | 36 +++++----- multipathd/main.h | 6 +- multipathd/pidfile.h | 4 ++ multipathd/uxclnt.h | 5 ++ multipathd/uxlsnr.c | 6 +- multipathd/uxlsnr.h | 4 +- multipathd/waiter.c | 2 +- multipathd/waiter.h | 6 +- tests/alias.c | 64 +++++++++++------ tests/mpathvalid.c | 2 +- tests/strbuf.c | 80 +++++++++++++++++++-- tests/sysfs.c | 20 +++--- tests/test-lib.c | 4 +- tests/test-lib.h | 20 +++--- tests/test-log.h | 4 +- tests/valid.c | 16 ++--- tests/wrap64.h | 4 +- 153 files changed, 981 insertions(+), 853 deletions(-)Signature · 1 line
2.46.0
Quoted 4 lines · Benjamin Marzinski
Despite some small misgivings about renaming symbols (which quite possibly aren't being used by anyone) in our user-facing libraries, libpmathpersist and libmpathcmd, for the set:
As the functions are only renamed, we could use (weak) aliases here to still provide the old function names if some caller requires them. Would you prefer that?
We'd still be violating the glibc standards somewhat, but the probability for an actual symbol name clash is very low, so I guess it would be acceptable to do this in the name of backward compatibility.
Martin
Benjamin Marzinski
maintainerQuoted 6 lines · Martin Wilck
Quoted 4 lines · Benjamin Marzinski
Despite some small misgivings about renaming symbols (which quite possibly aren't being used by anyone) in our user-facing libraries, libpmathpersist and libmpathcmd, for the set:
Quoted 7 lines
As the functions are only renamed, we could use (weak) aliases here to still provide the old function names if some caller requires them. Would you prefer that?
We'd still be violating the glibc standards somewhat, but the probability for an actual symbol name clash is very low, so I guess it would be acceptable to do this in the name of backward compatibility.
While it's not that big of a deal, I do think we should prioritize backwards compatibility over this level of standards compliance.
-Ben
Quoted 2 lines
Martin
Quoted 13 lines · Benjamin Marzinski
Quoted 12 lines · Martin Wilck
Quoted 5 lines · Benjamin Marzinski
Despite some small misgivings about renaming symbols (which quite possibly aren't being used by anyone) in our user-facing libraries,
libpmathpersist and libmpathcmd, for the set:As the functions are only renamed, we could use (weak) aliases here to
still provide the old function names if some caller requires them. Would you prefer that?
Quoted 8 lines
Quoted 5 lines
We'd still be violating the glibc standards somewhat, but the probability for an actual symbol name clash is very low, so I guess it
would be acceptable to do this in the name of backward compatibility.While it's not that big of a deal, I do think we should prioritize backwards compatibility over this level of standards compliance.
Ok. Sending patches right now. I've given them quick tests with qemu- pr-helper and some trivial test program that use the "old" ABI, but I'd be grateful if you could double-check.
Martin