summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-04-24 12:28:07 +0200
committerThomas Haller <thaller@redhat.com>2015-05-06 12:33:27 +0200
commit9a92ab3004241db05aed2ebeae0192327871375b (patch)
tree3b40029646644ede82ef931aad3945ab6df616c6
parent12a75d3a5df12277586b93fbb4506776788415a6 (diff)
downloadNetworkManager-9a92ab3004241db05aed2ebeae0192327871375b.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 0e95545eca..f4a457ed09 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -2760,8 +2760,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:
@@ -2779,31 +2779,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 2580c81b3f..4f16aba5df 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -495,6 +495,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 09fd4bed8b..a4d36a0a8a 100644
--- a/src/platform/tests/test-common.c
+++ b/src/platform/tests/test-common.c
@@ -5,7 +5,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
@@ -33,21 +33,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)
{
@@ -124,7 +109,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));