From: mwilck@suse.com
To: Christophe Varoqui <christophe.varoqui@opensvc.com>,
Benjamin Marzinski <bmarzins@redhat.com>
Cc: dm-devel@redhat.com, Martin Wilck <mwilck@suse.com>
Subject: [PATCH 18/35] libmultipath: uevent: use static linkage where possible
Date: Thu, 9 Jul 2020 12:16:03 +0200 [thread overview]
Message-ID: <20200709101620.6786-19-mwilck@suse.com> (raw)
In-Reply-To: <20200709101620.6786-1-mwilck@suse.com>
From: Martin Wilck <mwilck@suse.com>
Most of the symbols in uevent.c can be converted to static linkage.
alloc_uevent() and uevent_get_wwid() are called in the unit test
and added to the header file.
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/uevent.c | 45 ++++++++++++++++++++-----------------------
libmultipath/uevent.h | 2 ++
tests/uevent.c | 4 ----
3 files changed, 23 insertions(+), 28 deletions(-)
diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
index 6a3f8bd..d74389e 100644
--- a/libmultipath/uevent.c
+++ b/libmultipath/uevent.c
@@ -60,14 +60,14 @@
typedef int (uev_trigger)(struct uevent *, void * trigger_data);
-LIST_HEAD(uevq);
-pthread_mutex_t uevq_lock = PTHREAD_MUTEX_INITIALIZER;
-pthread_mutex_t *uevq_lockp = &uevq_lock;
-pthread_cond_t uev_cond = PTHREAD_COND_INITIALIZER;
-pthread_cond_t *uev_condp = &uev_cond;
-uev_trigger *my_uev_trigger;
-void * my_trigger_data;
-int servicing_uev;
+static LIST_HEAD(uevq);
+static pthread_mutex_t uevq_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t *uevq_lockp = &uevq_lock;
+static pthread_cond_t uev_cond = PTHREAD_COND_INITIALIZER;
+static pthread_cond_t *uev_condp = &uev_cond;
+static uev_trigger *my_uev_trigger;
+static void *my_trigger_data;
+static int servicing_uev;
int is_uevent_busy(void)
{
@@ -91,8 +91,7 @@ struct uevent * alloc_uevent (void)
return uev;
}
-void
-uevq_cleanup(struct list_head *tmpq)
+static void uevq_cleanup(struct list_head *tmpq)
{
struct uevent *uev, *tmp;
@@ -172,8 +171,7 @@ uevent_get_wwid(struct uevent *uev)
uev->wwid = val;
}
-bool
-uevent_need_merge(void)
+static bool uevent_need_merge(void)
{
struct config * conf;
bool need_merge = false;
@@ -186,8 +184,7 @@ uevent_need_merge(void)
return need_merge;
}
-bool
-uevent_can_discard(struct uevent *uev)
+static bool uevent_can_discard(struct uevent *uev)
{
int invalid = 0;
struct config * conf;
@@ -212,7 +209,7 @@ uevent_can_discard(struct uevent *uev)
return false;
}
-bool
+static bool
uevent_can_filter(struct uevent *earlier, struct uevent *later)
{
@@ -246,7 +243,7 @@ uevent_can_filter(struct uevent *earlier, struct uevent *later)
return false;
}
-bool
+static bool
merge_need_stop(struct uevent *earlier, struct uevent *later)
{
/*
@@ -283,7 +280,7 @@ merge_need_stop(struct uevent *earlier, struct uevent *later)
return false;
}
-bool
+static bool
uevent_can_merge(struct uevent *earlier, struct uevent *later)
{
/* merge paths uevents
@@ -302,7 +299,7 @@ uevent_can_merge(struct uevent *earlier, struct uevent *later)
return false;
}
-void
+static void
uevent_prepare(struct list_head *tmpq)
{
struct uevent *uev, *tmp;
@@ -322,7 +319,7 @@ uevent_prepare(struct list_head *tmpq)
}
}
-void
+static void
uevent_filter(struct uevent *later, struct list_head *tmpq)
{
struct uevent *earlier, *tmp;
@@ -345,7 +342,7 @@ uevent_filter(struct uevent *later, struct list_head *tmpq)
}
}
-void
+static void
uevent_merge(struct uevent *later, struct list_head *tmpq)
{
struct uevent *earlier, *tmp;
@@ -366,7 +363,7 @@ uevent_merge(struct uevent *later, struct list_head *tmpq)
}
}
-void
+static void
merge_uevq(struct list_head *tmpq)
{
struct uevent *later;
@@ -379,7 +376,7 @@ merge_uevq(struct list_head *tmpq)
}
}
-void
+static void
service_uevq(struct list_head *tmpq)
{
struct uevent *uev, *tmp;
@@ -450,7 +447,7 @@ int uevent_dispatch(int (*uev_trigger)(struct uevent *, void * trigger_data),
return 0;
}
-struct uevent *uevent_from_udev_device(struct udev_device *dev)
+static struct uevent *uevent_from_udev_device(struct udev_device *dev)
{
struct uevent *uev;
int i = 0;
@@ -512,7 +509,7 @@ struct uevent *uevent_from_udev_device(struct udev_device *dev)
return uev;
}
-bool uevent_burst(struct timeval *start_time, int events)
+static bool uevent_burst(struct timeval *start_time, int events)
{
struct timeval diff_time, end_time;
unsigned long speed;
diff --git a/libmultipath/uevent.h b/libmultipath/uevent.h
index 4956bfc..9a5b213 100644
--- a/libmultipath/uevent.h
+++ b/libmultipath/uevent.h
@@ -24,6 +24,7 @@ struct uevent {
char *envp[HOTPLUG_NUM_ENVP];
};
+struct uevent *alloc_uevent(void);
int is_uevent_busy(void);
int uevent_listen(struct udev *udev);
@@ -36,5 +37,6 @@ char *uevent_get_dm_name(const struct uevent *uev);
char *uevent_get_dm_path(const struct uevent *uev);
char *uevent_get_dm_action(const struct uevent *uev);
bool uevent_is_mpath(const struct uevent *uev);
+void uevent_get_wwid(struct uevent *uev);
#endif /* _UEVENT_H */
diff --git a/tests/uevent.c b/tests/uevent.c
index f4afd9b..9ffcd2d 100644
--- a/tests/uevent.c
+++ b/tests/uevent.c
@@ -27,10 +27,6 @@
#include "globals.c"
-/* Private prototypes missing in uevent.h */
-struct uevent * alloc_uevent(void);
-void uevent_get_wwid(struct uevent *uev);
-
/* Stringify helpers */
#define _str_(x) #x
#define str(x) _str_(x)
--
2.26.2
next prev parent reply other threads:[~2020-07-09 10:16 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-09 10:15 [PATCH 00/35] multipath-tools series part I: minor changes mwilck
2020-07-09 10:15 ` [PATCH 01/35] multipath-tools tests/util: separate group for bitmask tests mwilck
2020-07-09 10:15 ` [PATCH 02/35] multipath-tools tests/directio: fix missing initializers mwilck
2020-07-09 10:15 ` [PATCH 03/35] tests: __wrap_dlog: use check_expected() mwilck
2020-07-09 10:15 ` [PATCH 04/35] multipath tools tests: add strchop() test mwilck
2020-07-09 10:15 ` [PATCH 05/35] libmultipath: improve strchop() mwilck
2020-07-09 10:15 ` [PATCH 06/35] multipath-tools tests: add test for devt2devname mwilck
2020-07-09 10:15 ` [PATCH 07/35] libmultipath: devt2devname(): simplify using libudev mwilck
2020-07-09 10:15 ` [PATCH 08/35] libmultipath: create bitfield abstraction mwilck
2020-07-16 21:17 ` Benjamin Marzinski
2020-08-04 15:04 ` Martin Wilck
2020-08-04 15:18 ` Martin Wilck
2020-08-04 16:26 ` Benjamin Marzinski
2020-08-04 19:35 ` Martin Wilck
2020-08-10 18:05 ` Benjamin Marzinski
2020-08-10 18:59 ` Martin Wilck
2020-07-09 10:15 ` [PATCH 09/35] libmultipath: use bitfields in group_by_match() mwilck
2020-07-09 10:15 ` [PATCH 10/35] libmultipath: util: constify function arguments mwilck
2020-07-09 10:15 ` [PATCH 11/35] multipath-tools tests: add unit tests for strlcat mwilck
2020-07-09 10:15 ` [PATCH 12/35] libmultipath: strlcpy()/strlcat(): use restrict qualifier mwilck
2020-07-16 22:18 ` Benjamin Marzinski
2020-08-04 15:36 ` Martin Wilck
2020-08-04 17:29 ` Benjamin Marzinski
2020-08-04 20:15 ` Martin Wilck
2020-07-09 10:15 ` [PATCH 13/35] libmultipath: constify blacklist code mwilck
2020-07-09 10:15 ` [PATCH 14/35] libmultipath: rlookup_binding(): remove newline in log message mwilck
2020-07-09 10:16 ` [PATCH 15/35] libmultipath: fix missing initializer warning from clang 3.9 mwilck
2020-07-09 10:16 ` [PATCH 16/35] libmultipath: fix gcc -Wstringop-overflow warning mwilck
2020-07-09 10:16 ` [PATCH 17/35] libmultipath: remove uevent listener failback mwilck
2020-07-09 10:16 ` mwilck [this message]
2020-07-09 10:16 ` [PATCH 19/35] libmultipath: uevent: inline trivial functions mwilck
2020-07-09 10:16 ` [PATCH 20/35] libmultipath: decrease log level of "SCSI target" log message mwilck
2020-07-09 10:16 ` [PATCH 21/35] libmultipath: get_udev_uid(): more appropriate error code mwilck
2020-07-09 10:16 ` [PATCH 22/35] libmultipath: get_uid(): improve log message on udev failure mwilck
2020-07-09 10:16 ` [PATCH 23/35] libmultipath: make sysfs_pathinfo() static and use const mwilck
2020-07-09 10:16 ` [PATCH 24/35] libmultipath: pathinfo(): improve a log message mwilck
2020-07-09 10:16 ` [PATCH 25/35] libmultipath: pathinfo(): don't filter emtpy devnode names mwilck
2020-07-09 10:16 ` [PATCH 26/35] libmultipath: io_err_stat_handle_pathfail(): less error conditions mwilck
2020-07-09 10:16 ` [PATCH 27/35] libmultipath: improve libdm logging mwilck
2020-07-09 10:16 ` [PATCH 28/35] libmultipath: snprint_devices(): use udev_enumerate mwilck
2020-07-09 10:16 ` [PATCH 29/35] libmultipath: snprint_devices(): print hidden/foreign status mwilck
2020-07-09 10:16 ` [PATCH 30/35] libmultipath: alloc_path(): initialize pp->initialized mwilck
2020-07-09 10:16 ` [PATCH 31/35] libmultipath: alloc_path_with_pathinfo(): treat devname overflow as error mwilck
2020-07-09 10:16 ` [PATCH 32/35] libmultipath: log table params in addmap() mwilck
2020-07-09 10:16 ` [PATCH 33/35] multipathd: remove set_multipath_wwid() mwilck
2020-07-09 10:16 ` [PATCH 34/35] kpartx: print an error message if removing a partition fails mwilck
2020-07-09 10:16 ` [PATCH 35/35] kpartx: add missing newline mwilck
2020-07-20 21:09 ` [PATCH 00/35] multipath-tools series part I: minor changes Benjamin Marzinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200709101620.6786-19-mwilck@suse.com \
--to=mwilck@suse.com \
--cc=bmarzins@redhat.com \
--cc=christophe.varoqui@opensvc.com \
--cc=dm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.