mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 17:00:29 +01:00
platform: rework nm_platform_link_get_udi()
Implement the function directly in nm-platform.c without virtual functions.
This commit is contained in:
parent
639f2e36b0
commit
2f21a52eeb
4 changed files with 3 additions and 38 deletions
|
|
@ -268,7 +268,6 @@ link_add_pre (NMPlatform *platform,
|
|||
g_assert (address_len == 0);
|
||||
|
||||
device->obj = o;
|
||||
device->udi = g_strdup_printf ("fake:%d", ifindex);
|
||||
device->ip6_lladdr = *nmtst_inet6_from_string (ip6_lladdr);
|
||||
|
||||
return device;
|
||||
|
|
@ -420,7 +419,6 @@ link_delete (NMPlatform *platform, int ifindex)
|
|||
return FALSE;
|
||||
|
||||
obj_old = g_steal_pointer (&device->obj);
|
||||
nm_clear_g_free (&device->udi);
|
||||
|
||||
cache_op = nmp_cache_remove (nm_platform_get_cache (platform),
|
||||
obj_old,
|
||||
|
|
@ -633,16 +631,6 @@ link_set_mtu (NMPlatform *platform, int ifindex, guint32 mtu)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const char *
|
||||
link_get_udi (NMPlatform *platform, int ifindex)
|
||||
{
|
||||
NMFakePlatformLink *device = link_get (platform, ifindex);
|
||||
|
||||
if (!device)
|
||||
return NULL;
|
||||
return device->udi;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
link_get_driver_info (NMPlatform *platform,
|
||||
int ifindex,
|
||||
|
|
@ -1345,7 +1333,6 @@ finalize (GObject *object)
|
|||
for (i = 0; i < priv->links->len; i++) {
|
||||
NMFakePlatformLink *device = &g_array_index (priv->links, NMFakePlatformLink, i);
|
||||
|
||||
g_free (device->udi);
|
||||
nm_clear_pointer (&device->obj, nmp_object_unref);
|
||||
}
|
||||
g_array_unref (priv->links);
|
||||
|
|
@ -1371,8 +1358,6 @@ nm_fake_platform_class_init (NMFakePlatformClass *klass)
|
|||
platform_class->link_add = link_add;
|
||||
platform_class->link_delete = link_delete;
|
||||
|
||||
platform_class->link_get_udi = link_get_udi;
|
||||
|
||||
platform_class->link_set_up = link_set_up;
|
||||
platform_class->link_set_down = link_set_down;
|
||||
platform_class->link_set_arp = link_set_arp;
|
||||
|
|
|
|||
|
|
@ -7165,18 +7165,6 @@ link_set_noarp (NMPlatform *platform, int ifindex)
|
|||
return (link_change_flags (platform, ifindex, IFF_NOARP, IFF_NOARP) >= 0);
|
||||
}
|
||||
|
||||
static const char *
|
||||
link_get_udi (NMPlatform *platform, int ifindex)
|
||||
{
|
||||
const NMPObject *obj = nm_platform_link_get_obj (platform, ifindex, TRUE);
|
||||
|
||||
if ( !obj
|
||||
|| !obj->_link.netlink.is_in_netlink
|
||||
|| !obj->_link.udev.device)
|
||||
return NULL;
|
||||
return udev_device_get_syspath (obj->_link.udev.device);
|
||||
}
|
||||
|
||||
static int
|
||||
link_set_user_ipv6ll_enabled (NMPlatform *platform, int ifindex, gboolean enabled)
|
||||
{
|
||||
|
|
@ -9318,8 +9306,6 @@ nm_linux_platform_class_init (NMLinuxPlatformClass *klass)
|
|||
platform_class->link_set_arp = link_set_arp;
|
||||
platform_class->link_set_noarp = link_set_noarp;
|
||||
|
||||
platform_class->link_get_udi = link_get_udi;
|
||||
|
||||
platform_class->link_set_user_ipv6ll_enabled = link_set_user_ipv6ll_enabled;
|
||||
platform_class->link_set_token = link_set_token;
|
||||
|
||||
|
|
|
|||
|
|
@ -1589,13 +1589,10 @@ nm_platform_link_set_ipv6_token (NMPlatform *self, int ifindex, NMUtilsIPv6Iface
|
|||
const char *
|
||||
nm_platform_link_get_udi (NMPlatform *self, int ifindex)
|
||||
{
|
||||
_CHECK_SELF (self, klass, FALSE);
|
||||
struct udev_device *device;
|
||||
|
||||
g_return_val_if_fail (ifindex >= 0, NULL);
|
||||
|
||||
if (klass->link_get_udi)
|
||||
return klass->link_get_udi (self, ifindex);
|
||||
return NULL;
|
||||
device = nm_platform_link_get_udev_device (self, ifindex);
|
||||
return device ? udev_device_get_syspath (device) : NULL;
|
||||
}
|
||||
|
||||
struct udev_device *
|
||||
|
|
|
|||
|
|
@ -1010,9 +1010,6 @@ typedef struct {
|
|||
gboolean (*link_set_arp) (NMPlatform *self, int ifindex);
|
||||
gboolean (*link_set_noarp) (NMPlatform *self, int ifindex);
|
||||
|
||||
const char *(*link_get_udi) (NMPlatform *self, int ifindex);
|
||||
struct udev_device *(*link_get_udev_device) (NMPlatform *self, int ifindex);
|
||||
|
||||
int (*link_set_user_ipv6ll_enabled) (NMPlatform *self, int ifindex, gboolean enabled);
|
||||
gboolean (*link_set_token) (NMPlatform *self, int ifindex, NMUtilsIPv6IfaceId iid);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue