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().
This commit is contained in:
Francesco Giudici 2018-06-15 10:32:07 +02:00
parent df58895fb3
commit 45170bad5d
3 changed files with 11 additions and 8 deletions

View file

@ -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 ? "" : "*");
}

View file

@ -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 *

View file

@ -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,