mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-29 12:20:27 +01:00
platform: expose nm_platform_signal_change_type_to_string()
This commit is contained in:
parent
2f3fd86dc5
commit
d4f828c887
3 changed files with 11 additions and 24 deletions
|
|
@ -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));
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue