core: pass parent to device factories when creating devices for connections

We'll use it later for InfiniBand and VLAN.
This commit is contained in:
Dan Williams 2014-09-08 11:36:15 -05:00
parent 560fe126b5
commit 706b9d2056
4 changed files with 9 additions and 3 deletions

View file

@ -124,6 +124,7 @@ nm_device_factory_new_link (NMDeviceFactory *factory,
NMDevice *
nm_device_factory_create_virtual_device_for_connection (NMDeviceFactory *factory,
NMConnection *connection,
NMDevice *parent,
GError **error)
{
NMDeviceFactory *interface;
@ -134,7 +135,7 @@ nm_device_factory_create_virtual_device_for_connection (NMDeviceFactory *factory
interface = NM_DEVICE_FACTORY_GET_INTERFACE (factory);
if (interface->create_virtual_device_for_connection)
return interface->create_virtual_device_for_connection (factory, connection, error);
return interface->create_virtual_device_for_connection (factory, connection, parent, error);
return NULL;
}

View file

@ -118,6 +118,7 @@ struct _NMDeviceFactory {
*/
NMDevice * (*create_virtual_device_for_connection) (NMDeviceFactory *factory,
NMConnection *connection,
NMDevice *parent,
GError **error);
@ -160,6 +161,7 @@ NMDevice * nm_device_factory_new_link (NMDeviceFactory *factory,
NMDevice * nm_device_factory_create_virtual_device_for_connection (NMDeviceFactory *factory,
NMConnection *connection,
NMDevice *parent,
GError **error);
/* For use by implementations */

View file

@ -56,6 +56,7 @@ new_link (NMDeviceFactory *factory, NMPlatformLink *plink, GError **error)
static NMDevice *
create_virtual_device_for_connection (NMDeviceFactory *factory,
NMConnection *connection,
NMDevice *parent,
GError **error)
{
if (nm_connection_is_type (connection, NM_SETTING_TEAM_SETTING_NAME))

View file

@ -1063,8 +1063,10 @@ system_create_virtual_device (NMManager *self, NMConnection *connection)
device = nm_device_infiniband_new_partition (connection, parent);
} else {
for (iter = priv->factories; iter; iter = iter->next) {
device = nm_device_factory_create_virtual_device_for_connection (NM_DEVICE_FACTORY (iter->data), connection, &error);
device = nm_device_factory_create_virtual_device_for_connection (NM_DEVICE_FACTORY (iter->data),
connection,
parent,
&error);
if (device || error) {
if (device)
g_assert_no_error (error);