mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-31 06:40:11 +01:00
core: move device factory type function into factory object
In preparation for internal device types exposing factories too, it's easier to have the device type that the factory creates be returned by the factory object instead of the plugin, because internal device types don't have plugins. This requires that we create the factory objects earlier, which further requires that any operations that trigger signals must be moved out of each factory's construction path to a separate start() function.
This commit is contained in:
parent
beb18050b5
commit
00fe31f5cd
15 changed files with 128 additions and 140 deletions
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
global:
|
||||
nm_device_factory_create;
|
||||
nm_device_factory_get_device_type;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@
|
|||
typedef struct {
|
||||
GUdevClient *client;
|
||||
GSList *devices;
|
||||
guint start_id;
|
||||
} NMAtmManagerPrivate;
|
||||
|
||||
#define NM_ATM_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_ATM_MANAGER, NMAtmManagerPrivate))
|
||||
|
|
@ -46,20 +45,12 @@ G_DEFINE_TYPE_EXTENDED (NMAtmManager, nm_atm_manager, G_TYPE_OBJECT, 0,
|
|||
|
||||
/**************************************************************************/
|
||||
|
||||
#define PLUGIN_TYPE NM_DEVICE_TYPE_ADSL
|
||||
|
||||
G_MODULE_EXPORT NMDeviceFactory *
|
||||
nm_device_factory_create (GError **error)
|
||||
{
|
||||
return (NMDeviceFactory *) g_object_new (NM_TYPE_ATM_MANAGER, NULL);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT NMDeviceType
|
||||
nm_device_factory_get_device_type (void)
|
||||
{
|
||||
return PLUGIN_TYPE;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
static gboolean
|
||||
|
|
@ -163,9 +154,10 @@ adsl_remove (NMAtmManager *self, GUdevDevice *udev_device)
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
query_devices (NMAtmManager *self)
|
||||
static void
|
||||
start (NMDeviceFactory *factory)
|
||||
{
|
||||
NMAtmManager *self = NM_ATM_MANAGER (factory);
|
||||
NMAtmManagerPrivate *priv = NM_ATM_MANAGER_GET_PRIVATE (self);
|
||||
GUdevEnumerator *enumerator;
|
||||
GList *devices, *iter;
|
||||
|
|
@ -180,8 +172,6 @@ query_devices (NMAtmManager *self)
|
|||
}
|
||||
g_list_free (devices);
|
||||
g_object_unref (enumerator);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -212,6 +202,12 @@ handle_uevent (GUdevClient *client,
|
|||
adsl_remove (self, device);
|
||||
}
|
||||
|
||||
static NMDeviceType
|
||||
get_device_type (NMDeviceFactory *factory)
|
||||
{
|
||||
return NM_DEVICE_TYPE_ADSL;
|
||||
}
|
||||
|
||||
/*********************************************************************/
|
||||
|
||||
static void
|
||||
|
|
@ -222,13 +218,13 @@ nm_atm_manager_init (NMAtmManager *self)
|
|||
|
||||
priv->client = g_udev_client_new (subsys);
|
||||
g_signal_connect (priv->client, "uevent", G_CALLBACK (handle_uevent), self);
|
||||
|
||||
priv->start_id = g_idle_add ((GSourceFunc) query_devices, self);
|
||||
}
|
||||
|
||||
static void
|
||||
device_factory_interface_init (NMDeviceFactory *factory_iface)
|
||||
{
|
||||
factory_iface->get_device_type = get_device_type;
|
||||
factory_iface->start = start;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -242,11 +238,6 @@ dispose (GObject *object)
|
|||
g_signal_handlers_disconnect_by_func (priv->client, handle_uevent, self);
|
||||
g_clear_object (&priv->client);
|
||||
|
||||
if (priv->start_id) {
|
||||
g_source_remove (priv->start_id);
|
||||
priv->start_id = 0;
|
||||
}
|
||||
|
||||
for (iter = priv->devices; iter; iter = iter->next)
|
||||
g_object_weak_unref (G_OBJECT (iter->data), device_destroyed, self);
|
||||
g_clear_pointer (&priv->devices, g_slist_free);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
global:
|
||||
nm_device_factory_create;
|
||||
nm_device_factory_get_device_type;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -62,20 +62,12 @@ static void check_bluez_and_try_setup (NMBluezManager *self);
|
|||
|
||||
/**************************************************************************/
|
||||
|
||||
#define PLUGIN_TYPE NM_DEVICE_TYPE_BT
|
||||
|
||||
G_MODULE_EXPORT NMDeviceFactory *
|
||||
nm_device_factory_create (GError **error)
|
||||
{
|
||||
return (NMDeviceFactory *) g_object_new (NM_TYPE_BLUEZ_MANAGER, NULL);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT NMDeviceType
|
||||
nm_device_factory_get_device_type (void)
|
||||
{
|
||||
return PLUGIN_TYPE;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
struct AsyncData {
|
||||
|
|
@ -368,6 +360,18 @@ check_bluez_and_try_setup (NMBluezManager *self)
|
|||
async_data_pack (self));
|
||||
}
|
||||
|
||||
static void
|
||||
start (NMDeviceFactory *factory)
|
||||
{
|
||||
check_bluez_and_try_setup (NM_BLUEZ_MANAGER (factory));
|
||||
}
|
||||
|
||||
static NMDeviceType
|
||||
get_device_type (NMDeviceFactory *factory)
|
||||
{
|
||||
return NM_DEVICE_TYPE_BT;
|
||||
}
|
||||
|
||||
/*********************************************************************/
|
||||
|
||||
static void
|
||||
|
|
@ -390,16 +394,6 @@ dispose (GObject *object)
|
|||
priv->bluez_version = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
NMBluezManager *self = NM_BLUEZ_MANAGER (object);
|
||||
|
||||
G_OBJECT_CLASS (nm_bluez_manager_parent_class)->constructed (object);
|
||||
|
||||
check_bluez_and_try_setup (self);
|
||||
}
|
||||
|
||||
static void
|
||||
nm_bluez_manager_init (NMBluezManager *self)
|
||||
{
|
||||
|
|
@ -412,6 +406,8 @@ nm_bluez_manager_init (NMBluezManager *self)
|
|||
static void
|
||||
device_factory_interface_init (NMDeviceFactory *factory_iface)
|
||||
{
|
||||
factory_iface->get_device_type = get_device_type;
|
||||
factory_iface->start = start;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -423,6 +419,5 @@ nm_bluez_manager_class_init (NMBluezManagerClass *klass)
|
|||
|
||||
/* virtual methods */
|
||||
object_class->dispose = dispose;
|
||||
object_class->constructed = constructed;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,6 +91,23 @@ nm_device_factory_get_type (void)
|
|||
return device_factory_type;
|
||||
}
|
||||
|
||||
NMDeviceType
|
||||
nm_device_factory_get_device_type (NMDeviceFactory *factory)
|
||||
{
|
||||
g_return_val_if_fail (factory != NULL, NM_DEVICE_TYPE_UNKNOWN);
|
||||
|
||||
return NM_DEVICE_FACTORY_GET_INTERFACE (factory)->get_device_type (factory);
|
||||
}
|
||||
|
||||
void
|
||||
nm_device_factory_start (NMDeviceFactory *factory)
|
||||
{
|
||||
g_return_if_fail (factory != NULL);
|
||||
|
||||
if (NM_DEVICE_FACTORY_GET_INTERFACE (factory)->start)
|
||||
NM_DEVICE_FACTORY_GET_INTERFACE (factory)->start (factory);
|
||||
}
|
||||
|
||||
NMDevice *
|
||||
nm_device_factory_new_link (NMDeviceFactory *factory,
|
||||
NMPlatformLink *plink,
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ typedef struct _NMDeviceFactory NMDeviceFactory;
|
|||
* Creates a #GObject that implements the #NMDeviceFactory interface. This
|
||||
* function must not emit any signals or perform any actions that would cause
|
||||
* devices or components to be created immediately. Instead these should be
|
||||
* deferred to an idle handler.
|
||||
* deferred to the "start" interface method.
|
||||
*
|
||||
* Returns: the #GObject implementing #NMDeviceFactory or %NULL
|
||||
*/
|
||||
|
|
@ -51,16 +51,6 @@ NMDeviceFactory *nm_device_factory_create (GError **error);
|
|||
/* Should match nm_device_factory_create() */
|
||||
typedef NMDeviceFactory * (*NMDeviceFactoryCreateFunc) (GError **error);
|
||||
|
||||
/**
|
||||
* nm_device_factory_get_device_type:
|
||||
*
|
||||
* Returns: the #NMDeviceType that this plugin creates
|
||||
*/
|
||||
NMDeviceType nm_device_factory_get_device_type (void);
|
||||
|
||||
/* Should match nm_device_factory_get_device_type() */
|
||||
typedef NMDeviceType (*NMDeviceFactoryDeviceTypeFunc) (void);
|
||||
|
||||
/********************************************************************/
|
||||
|
||||
#define NM_TYPE_DEVICE_FACTORY (nm_device_factory_get_type ())
|
||||
|
|
@ -75,6 +65,25 @@ typedef NMDeviceType (*NMDeviceFactoryDeviceTypeFunc) (void);
|
|||
struct _NMDeviceFactory {
|
||||
GTypeInterface g_iface;
|
||||
|
||||
/**
|
||||
* get_device_type:
|
||||
* @factory: the #NMDeviceFactory
|
||||
*
|
||||
* This function MUST be implemented.
|
||||
*
|
||||
* Returns: the #NMDeviceType that this plugin creates
|
||||
*/
|
||||
NMDeviceType (*get_device_type) (NMDeviceFactory *factory);
|
||||
|
||||
/**
|
||||
* start:
|
||||
* @factory: the #NMDeviceFactory
|
||||
*
|
||||
* Start the factory and discover any existing devices that the factory
|
||||
* can manage.
|
||||
*/
|
||||
void (*start) (NMDeviceFactory *factory);
|
||||
|
||||
/**
|
||||
* new_link:
|
||||
* @factory: the #NMDeviceFactory
|
||||
|
|
@ -141,6 +150,10 @@ struct _NMDeviceFactory {
|
|||
|
||||
GType nm_device_factory_get_type (void);
|
||||
|
||||
NMDeviceType nm_device_factory_get_device_type (NMDeviceFactory *factory);
|
||||
|
||||
void nm_device_factory_start (NMDeviceFactory *factory);
|
||||
|
||||
NMDevice * nm_device_factory_new_link (NMDeviceFactory *factory,
|
||||
NMPlatformLink *plink,
|
||||
GError **error);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
global:
|
||||
nm_device_factory_create;
|
||||
nm_device_factory_get_device_type;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -35,12 +35,13 @@ static void device_factory_interface_init (NMDeviceFactory *factory_iface);
|
|||
G_DEFINE_TYPE_EXTENDED (NMTeamFactory, nm_team_factory, G_TYPE_OBJECT, 0,
|
||||
G_IMPLEMENT_INTERFACE (NM_TYPE_DEVICE_FACTORY, device_factory_interface_init))
|
||||
|
||||
#define NM_TEAM_FACTORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_TEAM_FACTORY, NMTeamFactoryPrivate))
|
||||
|
||||
typedef struct {
|
||||
char dummy;
|
||||
} NMTeamFactoryPrivate;
|
||||
/************************************************************************/
|
||||
|
||||
G_MODULE_EXPORT NMDeviceFactory *
|
||||
nm_device_factory_create (GError **error)
|
||||
{
|
||||
return (NMDeviceFactory *) g_object_new (NM_TYPE_TEAM_FACTORY, NULL);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
|
|
@ -62,20 +63,10 @@ create_virtual_device_for_connection (NMDeviceFactory *factory,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#define PLUGIN_TYPE NM_DEVICE_TYPE_TEAM
|
||||
|
||||
G_MODULE_EXPORT NMDeviceFactory *
|
||||
nm_device_factory_create (GError **error)
|
||||
static NMDeviceType
|
||||
get_device_type (NMDeviceFactory *factory)
|
||||
{
|
||||
return (NMDeviceFactory *) g_object_new (NM_TYPE_TEAM_FACTORY, NULL);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT NMDeviceType
|
||||
nm_device_factory_get_device_type (void)
|
||||
{
|
||||
return PLUGIN_TYPE;
|
||||
return NM_DEVICE_TYPE_TEAM;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
|
@ -90,21 +81,10 @@ device_factory_interface_init (NMDeviceFactory *factory_iface)
|
|||
{
|
||||
factory_iface->new_link = new_link;
|
||||
factory_iface->create_virtual_device_for_connection = create_virtual_device_for_connection;
|
||||
}
|
||||
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
/* Chain up to the parent class */
|
||||
G_OBJECT_CLASS (nm_team_factory_parent_class)->dispose (object);
|
||||
factory_iface->get_device_type = get_device_type;
|
||||
}
|
||||
|
||||
static void
|
||||
nm_team_factory_class_init (NMTeamFactoryClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (NMTeamFactoryPrivate));
|
||||
|
||||
object_class->dispose = dispose;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
global:
|
||||
nm_device_factory_create;
|
||||
nm_device_factory_get_device_type;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -46,20 +46,12 @@ G_DEFINE_TYPE_EXTENDED (NMWifiFactory, nm_wifi_factory, G_TYPE_OBJECT, 0,
|
|||
|
||||
/**************************************************************************/
|
||||
|
||||
#define PLUGIN_TYPE NM_DEVICE_TYPE_WIFI
|
||||
|
||||
G_MODULE_EXPORT NMDeviceFactory *
|
||||
nm_device_factory_create (GError **error)
|
||||
{
|
||||
return (NMDeviceFactory *) g_object_new (NM_TYPE_WIFI_FACTORY, NULL);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT NMDeviceType
|
||||
nm_device_factory_get_device_type (void)
|
||||
{
|
||||
return PLUGIN_TYPE;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
static NMDevice *
|
||||
|
|
@ -72,10 +64,17 @@ new_link (NMDeviceFactory *factory, NMPlatformLink *plink, GError **error)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static NMDeviceType
|
||||
get_device_type (NMDeviceFactory *factory)
|
||||
{
|
||||
return NM_DEVICE_TYPE_WIFI;
|
||||
}
|
||||
|
||||
static void
|
||||
device_factory_interface_init (NMDeviceFactory *factory_iface)
|
||||
{
|
||||
factory_iface->new_link = new_link;
|
||||
factory_iface->get_device_type = get_device_type;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
global:
|
||||
nm_device_factory_create;
|
||||
nm_device_factory_get_device_type;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -44,20 +44,12 @@ G_DEFINE_TYPE_EXTENDED (NMWimaxFactory, nm_wimax_factory, G_TYPE_OBJECT, 0,
|
|||
|
||||
/**************************************************************************/
|
||||
|
||||
#define PLUGIN_TYPE NM_DEVICE_TYPE_WIMAX
|
||||
|
||||
G_MODULE_EXPORT NMDeviceFactory *
|
||||
nm_device_factory_create (GError **error)
|
||||
{
|
||||
return (NMDeviceFactory *) g_object_new (NM_TYPE_WIMAX_FACTORY, NULL);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT NMDeviceType
|
||||
nm_device_factory_get_device_type (void)
|
||||
{
|
||||
return PLUGIN_TYPE;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
static NMDevice *
|
||||
|
|
@ -72,10 +64,17 @@ new_link (NMDeviceFactory *factory, NMPlatformLink *plink, GError **error)
|
|||
return (NMDevice *) nm_device_wimax_new (plink);
|
||||
}
|
||||
|
||||
static NMDeviceType
|
||||
get_device_type (NMDeviceFactory *factory)
|
||||
{
|
||||
return NM_DEVICE_TYPE_WIMAX;
|
||||
}
|
||||
|
||||
static void
|
||||
device_factory_interface_init (NMDeviceFactory *factory_iface)
|
||||
{
|
||||
factory_iface->new_link = new_link;
|
||||
factory_iface->get_device_type = get_device_type;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
global:
|
||||
nm_device_factory_create;
|
||||
nm_device_factory_get_device_type;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -43,20 +43,12 @@ typedef struct {
|
|||
|
||||
/************************************************************************/
|
||||
|
||||
#define PLUGIN_TYPE NM_DEVICE_TYPE_MODEM
|
||||
|
||||
G_MODULE_EXPORT NMDeviceFactory *
|
||||
nm_device_factory_create (GError **error)
|
||||
{
|
||||
return (NMDeviceFactory *) g_object_new (NM_TYPE_WWAN_FACTORY, NULL);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT NMDeviceType
|
||||
nm_device_factory_get_device_type (void)
|
||||
{
|
||||
return PLUGIN_TYPE;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
static void
|
||||
|
|
@ -93,9 +85,17 @@ modem_added_cb (NMModemManager *manager,
|
|||
g_object_unref (device);
|
||||
}
|
||||
|
||||
static void
|
||||
nm_wwan_factory_init (NMWwanFactory *self)
|
||||
|
||||
static NMDeviceType
|
||||
get_device_type (NMDeviceFactory *factory)
|
||||
{
|
||||
return NM_DEVICE_TYPE_MODEM;
|
||||
}
|
||||
|
||||
static void
|
||||
start (NMDeviceFactory *factory)
|
||||
{
|
||||
NMWwanFactory *self = NM_WWAN_FACTORY (factory);
|
||||
NMWwanFactoryPrivate *priv = NM_WWAN_FACTORY_GET_PRIVATE (self);
|
||||
|
||||
priv->mm = g_object_new (NM_TYPE_MODEM_MANAGER, NULL);
|
||||
|
|
@ -106,9 +106,16 @@ nm_wwan_factory_init (NMWwanFactory *self)
|
|||
self);
|
||||
}
|
||||
|
||||
static void
|
||||
nm_wwan_factory_init (NMWwanFactory *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
device_factory_interface_init (NMDeviceFactory *factory_iface)
|
||||
{
|
||||
factory_iface->get_device_type = get_device_type;
|
||||
factory_iface->start = start;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -1873,7 +1873,6 @@ factory_component_added_cb (NMDeviceFactory *factory,
|
|||
|
||||
#define PLUGIN_PREFIX "libnm-device-plugin-"
|
||||
#define PLUGIN_PATH_TAG "NMManager-plugin-path"
|
||||
#define PLUGIN_TYPEFUNC_TAG "typefunc"
|
||||
|
||||
struct read_device_factory_paths_data {
|
||||
char *path;
|
||||
|
|
@ -1980,8 +1979,7 @@ load_device_factories (NMManager *self)
|
|||
GModule *plugin;
|
||||
NMDeviceFactory *factory;
|
||||
NMDeviceFactoryCreateFunc create_func;
|
||||
NMDeviceFactoryDeviceTypeFunc type_func;
|
||||
NMDeviceType dev_type;
|
||||
NMDeviceType plugin_type;
|
||||
const char *found = NULL;
|
||||
GSList *iter;
|
||||
const char *item;
|
||||
|
|
@ -1996,30 +1994,6 @@ load_device_factories (NMManager *self)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!g_module_symbol (plugin, "nm_device_factory_get_device_type", (gpointer) &type_func)) {
|
||||
nm_log_warn (LOGD_HW, "(%s): failed to find device factory type: %s", item, g_module_error ());
|
||||
g_module_close (plugin);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Make sure we don't double-load plugins */
|
||||
dev_type = type_func ();
|
||||
for (iter = priv->factories; iter; iter = iter->next) {
|
||||
NMDeviceFactoryDeviceTypeFunc loaded_type_func;
|
||||
|
||||
loaded_type_func = g_object_get_data (G_OBJECT (iter->data), PLUGIN_TYPEFUNC_TAG);
|
||||
if (dev_type == loaded_type_func ()) {
|
||||
found = g_object_get_data (G_OBJECT (iter->data), PLUGIN_PATH_TAG);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
nm_log_warn (LOGD_HW, "Found multiple device plugins for same type: use '%s' instead of '%s'",
|
||||
found, g_module_name (plugin));
|
||||
g_module_close (plugin);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!g_module_symbol (plugin, "nm_device_factory_create", (gpointer) &create_func)) {
|
||||
nm_log_warn (LOGD_HW, "(%s): failed to find device factory creator: %s", item, g_module_error ());
|
||||
g_module_close (plugin);
|
||||
|
|
@ -2036,6 +2010,21 @@ load_device_factories (NMManager *self)
|
|||
}
|
||||
g_clear_error (&error);
|
||||
|
||||
/* Make sure we don't double-register plugins */
|
||||
plugin_type = nm_device_factory_get_device_type (factory);
|
||||
for (iter = priv->factories; iter; iter = iter->next) {
|
||||
if (plugin_type == nm_device_factory_get_device_type (iter->data)) {
|
||||
found = g_object_get_data (G_OBJECT (iter->data), PLUGIN_PATH_TAG);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
nm_log_warn (LOGD_HW, "Found multiple device plugins for same type: use '%s' instead of '%s'",
|
||||
found, g_module_name (plugin));
|
||||
g_module_close (plugin);
|
||||
continue;
|
||||
}
|
||||
|
||||
g_module_make_resident (plugin);
|
||||
priv->factories = g_slist_prepend (priv->factories, factory);
|
||||
|
||||
|
|
@ -2049,7 +2038,6 @@ load_device_factories (NMManager *self)
|
|||
self);
|
||||
g_object_set_data_full (G_OBJECT (factory), PLUGIN_PATH_TAG,
|
||||
g_strdup (g_module_name (plugin)), g_free);
|
||||
g_object_set_data (G_OBJECT (factory), PLUGIN_TYPEFUNC_TAG, type_func);
|
||||
|
||||
nm_log_info (LOGD_HW, "Loaded device plugin: %s", g_module_name (plugin));
|
||||
};
|
||||
|
|
@ -4144,6 +4132,7 @@ void
|
|||
nm_manager_start (NMManager *self)
|
||||
{
|
||||
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
|
||||
GSList *iter;
|
||||
guint i;
|
||||
|
||||
/* Set initial radio enabled/disabled state */
|
||||
|
|
@ -4174,6 +4163,10 @@ nm_manager_start (NMManager *self)
|
|||
system_unmanaged_devices_changed_cb (priv->settings, NULL, self);
|
||||
system_hostname_changed_cb (priv->settings, NULL, self);
|
||||
|
||||
/* Start device factories */
|
||||
for (iter = priv->factories; iter; iter = iter->next)
|
||||
nm_device_factory_start (iter->data);
|
||||
|
||||
nm_platform_query_devices ();
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue