summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-04-24 12:28:07 +0200
committerThomas Haller <thaller@redhat.com>2015-06-05 16:52:50 +0200
commitd4f828c887baf7e2dd45825dc53d742a4b07452f (patch)
tree01b02a379af5cd1a23acabd99bd1dd7b4c1a305e
parent2f3fd86dc559a51513ba340a094c4f48710ea68c (diff)
downloadNetworkManager-d4f828c887baf7e2dd45825dc53d742a4b07452f.tar.gz
platform: expose nm_platform_signal_change_type_to_string()
-rw-r--r--src/platform/nm-platform.c14
-rw-r--r--src/platform/nm-platform.h2
-rw-r--r--src/platform/tests/test-common.c19
3 files changed, 11 insertions, 24 deletions
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 6c50144aab..7439b1ef42 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -2885,8 +2885,8 @@ nm_platform_ip_address_cmp_expiry (const NMPlatformIPAddress *a, const NMPlatfor
#undef _CMP_POINTER
-static const char *
-_change_type_to_string (NMPlatformSignalChangeType change_type)
+const char *
+nm_platform_signal_change_type_to_string (NMPlatformSignalChangeType change_type)
{
switch (change_type) {
case NM_PLATFORM_SIGNAL_ADDED:
@@ -2904,31 +2904,31 @@ static void
log_link (NMPlatform *p, int ifindex, NMPlatformLink *device, NMPlatformSignalChangeType change_type, gpointer user_data)
{
- debug ("signal: link %7s: %s", _change_type_to_string (change_type), nm_platform_link_to_string (device));
+ debug ("signal: link %7s: %s", nm_platform_signal_change_type_to_string (change_type), nm_platform_link_to_string (device));
}
static void
log_ip4_address (NMPlatform *p, int ifindex, NMPlatformIP4Address *address, NMPlatformSignalChangeType change_type, gpointer user_data)
{
- debug ("signal: address 4 %7s: %s", _change_type_to_string (change_type), nm_platform_ip4_address_to_string (address));
+ debug ("signal: address 4 %7s: %s", nm_platform_signal_change_type_to_string (change_type), nm_platform_ip4_address_to_string (address));
}
static void
log_ip6_address (NMPlatform *p, int ifindex, NMPlatformIP6Address *address, NMPlatformSignalChangeType change_type, gpointer user_data)
{
- debug ("signal: address 6 %7s: %s", _change_type_to_string (change_type), nm_platform_ip6_address_to_string (address));
+ debug ("signal: address 6 %7s: %s", nm_platform_signal_change_type_to_string (change_type), nm_platform_ip6_address_to_string (address));
}
static void
log_ip4_route (NMPlatform *p, int ifindex, NMPlatformIP4Route *route, NMPlatformSignalChangeType change_type, gpointer user_data)
{
- debug ("signal: route 4 %7s: %s", _change_type_to_string (change_type), nm_platform_ip4_route_to_string (route));
+ debug ("signal: route 4 %7s: %s", nm_platform_signal_change_type_to_string (change_type), nm_platform_ip4_route_to_string (route));
}
static void
log_ip6_route (NMPlatform *p, int ifindex, NMPlatformIP6Route *route, NMPlatformSignalChangeType change_type, gpointer user_data)
{
- debug ("signal: route 6 %7s: %s", _change_type_to_string (change_type), nm_platform_ip6_route_to_string (route));
+ debug ("signal: route 6 %7s: %s", nm_platform_signal_change_type_to_string (change_type), nm_platform_ip6_route_to_string (route));
}
/******************************************************************/
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index f5966233cb..a4482d2458 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -515,6 +515,8 @@ typedef struct {
#define NM_PLATFORM_SIGNAL_IP4_ROUTE_CHANGED "ip4-route-changed"
#define NM_PLATFORM_SIGNAL_IP6_ROUTE_CHANGED "ip6-route-changed"
+const char *nm_platform_signal_change_type_to_string (NMPlatformSignalChangeType change_type);
+
/******************************************************************/
GType nm_platform_get_type (void);
diff --git a/src/platform/tests/test-common.c b/src/platform/tests/test-common.c
index 6170e403eb..8b4eb0465a 100644
--- a/src/platform/tests/test-common.c
+++ b/src/platform/tests/test-common.c
@@ -8,7 +8,7 @@
#include "nm-test-utils.h"
#define SIGNAL_DATA_FMT "'%s-%s' ifindex %d%s%s%s (%d times received)"
-#define SIGNAL_DATA_ARG(data) (data)->name, _change_type_to_string ((data)->change_type), (data)->ifindex, (data)->ifname ? " ifname '" : "", (data)->ifname ? (data)->ifname : "", (data)->ifname ? "'" : "", (data)->received_count
+#define SIGNAL_DATA_ARG(data) (data)->name, nm_platform_signal_change_type_to_string ((data)->change_type), (data)->ifindex, (data)->ifname ? " ifname '" : "", (data)->ifname ? (data)->ifname : "", (data)->ifname ? "'" : "", (data)->received_count
gboolean
@@ -43,21 +43,6 @@ add_signal_full (const char *name, NMPlatformSignalChangeType change_type, GCall
return data;
}
-static const char *
-_change_type_to_string (NMPlatformSignalChangeType change_type)
-{
- switch (change_type) {
- case NM_PLATFORM_SIGNAL_ADDED:
- return "added";
- case NM_PLATFORM_SIGNAL_CHANGED:
- return "changed";
- case NM_PLATFORM_SIGNAL_REMOVED:
- return "removed";
- default:
- g_return_val_if_reached ("UNKNOWN");
- }
-}
-
void
_accept_signal (const char *file, int line, const char *func, SignalData *data)
{
@@ -134,7 +119,7 @@ link_callback (NMPlatform *platform, int ifindex, NMPlatformLink *received, NMPl
}
data->received_count++;
- debug ("Received signal '%s-%s' ifindex %d ifname '%s' %dth time.", data->name, _change_type_to_string (data->change_type), ifindex, received->name, data->received_count);
+ debug ("Received signal '%s-%s' ifindex %d ifname '%s' %dth time.", data->name, nm_platform_signal_change_type_to_string (data->change_type), ifindex, received->name, data->received_count);
if (change_type == NM_PLATFORM_SIGNAL_REMOVED)
g_assert (!nm_platform_link_get_name (NM_PLATFORM_GET, ifindex));