summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-02-17 16:09:42 +0100
committerThomas Haller <thaller@redhat.com>2016-02-17 18:43:45 +0100
commitf31954c07132092e30981b5fff557000a312e0a8 (patch)
tree495038dd371b2aef89a465088fbfd9742de60631
parentca0dbefb0247caa8ead1f04639958c743dfb0800 (diff)
downloadNetworkManager-f31954c07132092e30981b5fff557000a312e0a8.tar.gz
device: don't overwrite get_connection_iface() by default
Factories that overwrite this function are not supposed to chain up the parent implementation. Thus there is no reason to have a default implementation and it's clearer to inline it.
-rw-r--r--src/devices/nm-device-factory.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/src/devices/nm-device-factory.c b/src/devices/nm-device-factory.c
index ddf798dfc1..1af07d406d 100644
--- a/src/devices/nm-device-factory.c
+++ b/src/devices/nm-device-factory.c
@@ -157,37 +157,26 @@ nm_device_factory_get_connection_parent (NMDeviceFactory *factory,
return NULL;
}
-static char *
-get_connection_iface (NMDeviceFactory *factory,
- NMConnection *connection,
- const char *parent_iface)
-{
- /* Default to just using NMSettingConnection:interface-name */
- return g_strdup (nm_connection_get_interface_name (connection));
-}
-
char *
nm_device_factory_get_connection_iface (NMDeviceFactory *factory,
NMConnection *connection,
const char *parent_iface,
GError **error)
{
+ NMDeviceFactoryInterface *klass;
char *ifname;
g_return_val_if_fail (factory != NULL, NULL);
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (!error || !*error, NULL);
- if (!NM_DEVICE_FACTORY_GET_INTERFACE (factory)->get_connection_iface) {
- g_set_error (error,
- NM_MANAGER_ERROR,
- NM_MANAGER_ERROR_FAILED,
- "failed to determine interface name: cannot determine name for %s",
- nm_connection_get_connection_type (connection));
- return NULL;
- }
+ klass = NM_DEVICE_FACTORY_GET_INTERFACE (factory);
+
+ if (klass->get_connection_iface)
+ ifname = klass->get_connection_iface (factory, connection, parent_iface);
+ else
+ ifname = g_strdup (nm_connection_get_interface_name (connection));
- ifname = NM_DEVICE_FACTORY_GET_INTERFACE (factory)->get_connection_iface (factory, connection, parent_iface);
if (!ifname) {
g_set_error (error,
NM_MANAGER_ERROR,
@@ -215,8 +204,6 @@ nm_device_factory_get_connection_iface (NMDeviceFactory *factory,
static void
nm_device_factory_default_init (NMDeviceFactoryInterface *factory_iface)
{
- factory_iface->get_connection_iface = get_connection_iface;
-
/* Signals */
signals[DEVICE_ADDED] = g_signal_new (NM_DEVICE_FACTORY_DEVICE_ADDED,
NM_TYPE_DEVICE_FACTORY,