diff options
author | Thomas Haller <thaller@redhat.com> | 2017-04-18 12:09:02 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-04-18 15:53:11 +0200 |
commit | 7b91e8b6dbc54eb73e987a8830d97e4a89f5239d (patch) | |
tree | e9958739905f8a6d23d095c8bdfc1eb156aa5a39 /src/devices/nm-device-macvlan.c | |
parent | 8a6eef6aa70148d618dce1f04e1c0891256260e6 (diff) | |
download | NetworkManager-7b91e8b6dbc54eb73e987a8830d97e4a89f5239d.tar.gz |
device: don't use platform singleton getter in device subclasses
Reduce the use of NM_PLATFORM_GET / nm_platform_get() to get
the platform singleton instance.
For one, this is a step towards supporting namespaces, where we need
to use different NMNetns/NMPlatform instances depending on in which
namespace the device lives.
Also, we should reduce our use of singletons. They are difficult to
coordinate on shutdown. Instead there should be a clear order of
dependencies, expressed by owning a reference to those singelton
instances. We already own a reference to the platform singelton,
so use it and avoid NM_PLATFORM_GET.
(cherry picked from commit 94d9ee129d85ff926a10de78fedcc6b57cdcdb19)
Diffstat (limited to 'src/devices/nm-device-macvlan.c')
-rw-r--r-- | src/devices/nm-device-macvlan.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/devices/nm-device-macvlan.c b/src/devices/nm-device-macvlan.c index 77adf28ec7..cea2b984fc 100644 --- a/src/devices/nm-device-macvlan.c +++ b/src/devices/nm-device-macvlan.c @@ -185,9 +185,9 @@ update_properties (NMDevice *device) const NMPlatformLink *plink; if (priv->props.tap) - props = nm_platform_link_get_lnk_macvtap (NM_PLATFORM_GET, nm_device_get_ifindex (device), &plink); + props = nm_platform_link_get_lnk_macvtap (nm_device_get_platform (device), nm_device_get_ifindex (device), &plink); else - props = nm_platform_link_get_lnk_macvlan (NM_PLATFORM_GET, nm_device_get_ifindex (device), &plink); + props = nm_platform_link_get_lnk_macvlan (nm_device_get_platform (device), nm_device_get_ifindex (device), &plink); if (!props) { _LOGW (LOGD_PLATFORM, "could not get %s properties", priv->props.tap ? "macvtap" : "macvlan"); @@ -251,7 +251,7 @@ create_and_realize (NMDevice *device, lnk.no_promisc = !nm_setting_macvlan_get_promiscuous (s_macvlan); lnk.tap = nm_setting_macvlan_get_tap (s_macvlan); - plerr = nm_platform_link_macvlan_add (NM_PLATFORM_GET, iface, parent_ifindex, &lnk, out_plink); + plerr = nm_platform_link_macvlan_add (nm_device_get_platform (device), iface, parent_ifindex, &lnk, out_plink); if (plerr != NM_PLATFORM_ERROR_SUCCESS) { g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, "Failed to create %s interface '%s' for '%s': %s", @@ -399,7 +399,7 @@ complete_connection (NMDevice *device, { NMSettingMacvlan *s_macvlan; - nm_utils_complete_generic (NM_PLATFORM_GET, + nm_utils_complete_generic (nm_device_get_platform (device), connection, NM_SETTING_MACVLAN_SETTING_NAME, existing_connections, |