From 45170bad5d977ed07b9b5f94073fa369187587f8 Mon Sep 17 00:00:00 2001 From: Francesco Giudici Date: Fri, 15 Jun 2018 10:32:07 +0200 Subject: [PATCH] platform: move link_duplex_to_string function to platform Expose it as a regular platform function: change its name to nm_platform_link_duplex_type_to_string(). --- src/devices/nm-device-ethernet.c | 11 +++-------- src/platform/nm-platform.c | 7 +++++++ src/platform/nm-platform.h | 1 + 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c index 6c5e33e4cc..f542be1afc 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -753,13 +753,6 @@ supplicant_interface_init (NMDeviceEthernet *self) return TRUE; } -NM_UTILS_LOOKUP_STR_DEFINE_STATIC (link_duplex_to_string, NMPlatformLinkDuplexType, - NM_UTILS_LOOKUP_DEFAULT_WARN (NULL), - NM_UTILS_LOOKUP_STR_ITEM (NM_PLATFORM_LINK_DUPLEX_UNKNOWN, "unknown"), - NM_UTILS_LOOKUP_STR_ITEM (NM_PLATFORM_LINK_DUPLEX_FULL, "full"), - NM_UTILS_LOOKUP_STR_ITEM (NM_PLATFORM_LINK_DUPLEX_HALF, "half"), -); - static NMPlatformLinkDuplexType link_duplex_to_platform (const char *duplex) { @@ -817,7 +810,9 @@ link_negotiation_set (NMDevice *device) _LOGD (LOGD_DEVICE, "set-link: configure static negotiation (%u Mbit%s - %s duplex%s)", speed ?: link_speed, speed ? "" : "*", - duplex ? link_duplex_to_string (duplex) : link_duplex_to_string (link_duplex), + duplex + ? nm_platform_link_duplex_type_to_string (duplex) + : nm_platform_link_duplex_type_to_string (link_duplex), duplex ? "" : "*"); } diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index b9dcaf27f6..f75019e8ba 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -3005,6 +3005,13 @@ nm_platform_ethtool_get_link_settings (NMPlatform *self, int ifindex, gboolean * return nmp_utils_ethtool_get_link_settings (ifindex, out_autoneg, out_speed, out_duplex); } +NM_UTILS_LOOKUP_STR_DEFINE (nm_platform_link_duplex_type_to_string, NMPlatformLinkDuplexType, + NM_UTILS_LOOKUP_DEFAULT_WARN (NULL), + NM_UTILS_LOOKUP_STR_ITEM (NM_PLATFORM_LINK_DUPLEX_UNKNOWN, "unknown"), + NM_UTILS_LOOKUP_STR_ITEM (NM_PLATFORM_LINK_DUPLEX_FULL, "full"), + NM_UTILS_LOOKUP_STR_ITEM (NM_PLATFORM_LINK_DUPLEX_HALF, "half"), +); + /*****************************************************************************/ const NMDedupMultiHeadEntry * diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index 5d5ce4c869..866df7362e 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -1452,6 +1452,7 @@ int nm_platform_ip_address_cmp_expiry (const NMPlatformIPAddress *a, const NMPla gboolean nm_platform_ethtool_set_wake_on_lan (NMPlatform *self, int ifindex, NMSettingWiredWakeOnLan wol, const char *wol_password); gboolean nm_platform_ethtool_set_link_settings (NMPlatform *self, int ifindex, gboolean autoneg, guint32 speed, NMPlatformLinkDuplexType duplex); gboolean nm_platform_ethtool_get_link_settings (NMPlatform *self, int ifindex, gboolean *out_autoneg, guint32 *out_speed, NMPlatformLinkDuplexType *out_duplex); +const char * nm_platform_link_duplex_type_to_string (NMPlatformLinkDuplexType duplex); void nm_platform_ip4_dev_route_blacklist_set (NMPlatform *self, int ifindex,