platform: add NMPlatformLink.parent, sort link_get_all() output

Add a "parent" field to NMPlatformLink, giving the parent device
ifindex for devices that have a parent.

Make nm_platform_link_get_all() sort the links before returning them,
so that masters appear after all of their slaves, and parent devices
appear before their children.

Remove the second call to nm_platform_query_devices() from NMManager
since it is now guaranteed that an NMDeviceVLAN's parent NMDevice will
have been created before the NMDeviceVLAN.
This commit is contained in:
Dan Winship
2013-06-03 11:49:55 -03:00
parent 2fe8019a79
commit 05216f67d6
6 changed files with 42 additions and 12 deletions

View File

@@ -543,6 +543,7 @@ link_init (NMPlatform *platform, NMPlatformLink *info, struct rtnl_link *rtnllin
info->connected = !!(rtnl_link_get_flags (rtnllink) & IFF_LOWER_UP);
info->arp = !(rtnl_link_get_flags (rtnllink) & IFF_NOARP);
info->master = rtnl_link_get_master (rtnllink);
info->parent = rtnl_link_get_link (rtnllink);
info->mtu = rtnl_link_get_mtu (rtnllink);
udev_device = g_hash_table_lookup (priv->udev_devices, GINT_TO_POINTER (info->ifindex));