Skip to content

multipath-tools: comply with C library reserved names

Martin Wilck dm-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest41 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/41multipath-tools tests: make alias.test succeed with increased verbositytests/alias.c+22 -00 replies
2/41libmpathutil: avoid extra memory allocation in print_strbuf()libmpathutil/strbuf.c tests/strbuf.c+86 -50 replies
3/41libmpathutil: rename strlcat and strlcpylibmpathutil/util.c libmpathutil/util.h+12 -70 replies
4/41libmpathutil.version: remove strlcpy and strlcat, and LIBMULTIPATH sectionlibmpathutil/libmpathutil.version+46 -580 replies
5/41libmpathutil: fix __attribute typo in log_pthread.clibmpathutil/log_pthread.c+1 -10 replies
6/41libmultipath: devmapper.c: rename __DR_UNUSED__, and fix __attribute typolibmultipath/devmapper.c+4 -40 replies
7/41multipathd: fix __attribute typomultipathd/main.c+1 -10 replies
8/41multipath-tools: use common convention for "header file included" macroscreate-config.mk kpartx/byteorder.h kpartx/crc32.h +95 more+282 -2350 replies
9/41libmpathcmd: rename __mpath_connect() to mpath_connect__()libmpathcmd/libmpathcmd.version libmpathcmd/mpath_cmd.c libmpathcmd/mpath_cmd.h +2 more+12 -120 replies
10/41libmpathutil: rename _MAX_CMD_LENlibdmmp/libdmmp.c libmpathutil/uxsock.h multipathd/uxlsnr.c+4 -40 replies
11/41libmpathutil: rename __append_strbuf_str() and __get_strbuf_buf()libmpathutil/libmpathutil.version libmpathutil/parser.c libmpathutil/strbuf.c +5 more+26 -260 replies
12/41libmpathutil: rename _log_bitfield_overflow()libmpathutil/libmpathutil.version libmpathutil/util.c libmpathutil/util.h+4 -40 replies
13/41libmpathutil: rename _install_keyword() to install_keyword__()libmpathutil/libmpathutil.version libmpathutil/parser.c libmpathutil/parser.h+16 -160 replies
14/41libmultipath: rename _NVME_LIB_Clibmultipath/nvme-lib.c libmultipath/nvme-lib.h+2 -20 replies
15/41libmultipath: checkers.h: fix __CHECKER_FIRST_MSG in commentlibmultipath/checkers.h+1 -10 replies
16/41libmultipath: rename identifiers with leading underscores in devmapper.hlibmultipath/devmapper.c libmultipath/devmapper.h+14 -140 replies
17/41libmultipath: rename identifiers with leading underscores in discovery.hlibmultipath/discovery.h+16 -160 replies
18/41libmultipath: rename __snprint_config()libmultipath/libmultipath.version libmultipath/print.c libmultipath/print.h +1 more+7 -110 replies
19/41libmultipath: rename __unlock()libmultipath/lock.c libmultipath/lock.h multipathd/uxlsnr.c+4 -40 replies
20/41libmultipath: rename __sysfs_attr_get_value()libmultipath/sysfs.c tests/sysfs.c+13 -130 replies
21/41libmultipath: rename __snprint_foreign_topology()libmultipath/foreign.c libmultipath/foreign.h+4 -40 replies
22/41libmultipath: rename macros with double underscores in propsel.clibmultipath/propsel.c+5 -50 replies
23/41libmultipath: rename enum values with double underscores in structs.hlibmultipath/dict.c libmultipath/print.c libmultipath/structs.h +2 more+7 -70 replies
24/41libmultipath: rename macros starting with underscorelibmultipath/checkers/directio.c libmultipath/checkers/emc_clariion.c libmultipath/checkers/rdac.c +2 more+42 -420 replies
25/41libmultipath: rename __internal_config variablelibmultipath/config.c+8 -80 replies
26/41libmultipath: rename _dm_flush_map() to dm_flush_map__()libmultipath/devmapper.c libmultipath/devmapper.h libmultipath/libmultipath.version+7 -70 replies
27/41libmultipath: foreign: rename _check() to check__()libmultipath/foreign/nvme.c+2 -20 replies
28/41libmultipath: rename _cleanup_foreign()libmultipath/foreign.c+3 -30 replies
29/41libmultipath: rename _init_config()libmultipath/config.c+4 -40 replies
30/41libmultipath: rename symbols starting with underscore in print.hlibmultipath/foreign.c libmultipath/foreign.h libmultipath/libmultipath.version +2 more+38 -380 replies
31/41libmultipath: remove dead code in pgpolicies.hlibmultipath/pgpolicies.h+0 -60 replies
32/41libmultipath: remove struct and union names in cciss.hlibmultipath/checkers/cciss.h+9 -90 replies
33/41libmpathpersist: rename functions with double leading underscorelibmpathpersist/libmpathpersist.version libmpathpersist/mpath_persist.c libmpathpersist/mpath_persist.h +1 more+35 -380 replies
34/41libdmmp: rename macros starting with _DMMPlibdmmp/libdmmp.c libdmmp/libdmmp_misc.c libdmmp/libdmmp_pg.c +1 more+37 -370 replies
35/41libdmmp: rename enum values and variables starting with _DMMP_libdmmp/libdmmp_path.c libdmmp/libdmmp_pg.c+16 -160 replies
36/41libdmmp: rename non-static functions starting with underscorelibdmmp/libdmmp.c libdmmp/libdmmp_misc.c libdmmp/libdmmp_mp.c +3 more+37 -370 replies
37/41multipathd: rename symbols with double leading underscoremultipathd/cli.c multipathd/cli.h multipathd/dmevents.c +2 more+21 -210 replies
38/41multipath-tools tests: rename functions with double underscorestests/alias.c tests/test-lib.c tests/test-lib.h+31 -310 replies
39/41kpartx: rename macros with leading underscoreskpartx/devmapper.c+10 -100 replies
40/41libmpathutil: rename struct _vector to vector_slibmpathutil/vector.c libmpathutil/vector.h libmultipath/alias.c +27 more+108 -1080 replies
41/41libmultipath: don't define __userlibmultipath/prioritizers/alua_rtpg.c libmultipath/sg_include.h+0 -20 replies

Reviews trailers per patch

None of the 41 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchBenjamin Marzinski
SeriesR-b
1/41
2/41
3/41
4/41
5/41
6/41
7/41
8/41
9/41
10/41
11/41
12/41
13/41
14/41
15/41
16/41
17/41
18/41
19/41
20/41
21/41
22/41
23/41
24/41
25/41
26/41
27/41
28/41
29/41
30/41
31/41
32/41
33/41
34/41
35/41
36/41
37/41
38/41
39/41
40/41
41/41

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/41] 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