From b31226532d9e5b5ac5960ce2f0b65a60e92d428f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 28 Sep 2017 15:06:28 +0200 Subject: [PATCH] device: refactor function nm_device_get_priority() / _get_route_metric_default() The name nm_device_get_priority() is misleading. Nowadays it's only used for the default route metric, and nothing else. Rename it, and make it static. --- src/devices/nm-device.c | 17 ++++------------- src/devices/nm-device.h | 2 -- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index eefe62ea20..51d1f72a3f 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -1586,23 +1586,14 @@ nm_device_get_metered (NMDevice *self) return NM_DEVICE_GET_PRIVATE (self)->metered; } -/** - * nm_device_get_priority(): - * @self: the #NMDevice - * - * Returns: the device's routing priority. Lower numbers means a "better" - * device, eg higher priority. - */ -int -nm_device_get_priority (NMDevice *self) +static guint32 +_get_route_metric_default (NMDevice *self) { - g_return_val_if_fail (NM_IS_DEVICE (self), 1000); - /* Device 'priority' is used for the default route-metric and is based on * the device type. The settings ipv4.route-metric and ipv6.route-metric * can overwrite this default. * - * Currently for both IPv4 and IPv6 we use the same default values. + * For both IPv4 and IPv6 we use the same default values. * * The route-metric is used for the metric of the routes of device. * This also applies to the default route. Therefore it affects also @@ -1729,7 +1720,7 @@ nm_device_get_route_metric (NMDevice *self, if (route_metric >= 0) goto out; } - route_metric = nm_device_get_priority (self); + route_metric = _get_route_metric_default (self); out: return nm_utils_ip_route_metric_normalize (addr_family, route_metric); } diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index e1c47d3ff5..b02b8d923b 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -447,8 +447,6 @@ NMDeviceType nm_device_get_device_type (NMDevice *dev); NMLinkType nm_device_get_link_type (NMDevice *dev); NMMetered nm_device_get_metered (NMDevice *dev); -int nm_device_get_priority (NMDevice *dev); - guint32 nm_device_get_route_metric (NMDevice *dev, int addr_family); const char * nm_device_get_hw_address (NMDevice *dev);