mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 06:30:33 +01:00
atm: make ADSL support a plugin
Make ADSL support a plugin using the new device factory interface.
Provides a 1% size reduction in the core NM binary.
Before After
NM: 1265336 1253016 (-1%)
ATM: 0 27360
(all results from stripped files)
This commit is contained in:
parent
2a04df856b
commit
71a52347f3
9 changed files with 178 additions and 152 deletions
|
|
@ -762,6 +762,7 @@ src/platform/Makefile
|
|||
src/platform/tests/Makefile
|
||||
src/rdisc/Makefile
|
||||
src/rdisc/tests/Makefile
|
||||
src/devices/atm/Makefile
|
||||
src/devices/wimax/Makefile
|
||||
libnm-util/libnm-util.pc
|
||||
libnm-util/Makefile
|
||||
|
|
|
|||
|
|
@ -47,10 +47,10 @@ src/dhcp-manager/nm-dhcp-manager.c
|
|||
src/dns-manager/nm-dns-manager.c
|
||||
src/logging/nm-logging.c
|
||||
src/config/nm-config.c
|
||||
src/devices/atm/nm-device-adsl.c
|
||||
src/modem-manager/nm-modem-broadband.c
|
||||
src/modem-manager/nm-modem-old.c
|
||||
src/devices/nm-device-bond.c
|
||||
src/devices/nm-device-adsl.c
|
||||
src/devices/nm-device-bridge.c
|
||||
src/devices/nm-device-bt.c
|
||||
src/devices/nm-device-ethernet.c
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ include $(GLIB_MAKEFILE)
|
|||
|
||||
SUBDIRS = \
|
||||
. \
|
||||
devices/atm \
|
||||
dhcp-manager \
|
||||
ppp-manager \
|
||||
settings/plugins
|
||||
|
|
@ -70,8 +71,6 @@ nm_sources = \
|
|||
\
|
||||
devices/nm-device.c \
|
||||
devices/nm-device.h \
|
||||
devices/nm-device-adsl.c \
|
||||
devices/nm-device-adsl.h \
|
||||
devices/nm-device-bond.c \
|
||||
devices/nm-device-bond.h \
|
||||
devices/nm-device-bridge.c \
|
||||
|
|
@ -225,8 +224,6 @@ nm_sources = \
|
|||
nm-activation-request.h \
|
||||
nm-active-connection.c \
|
||||
nm-active-connection.h \
|
||||
nm-atm-manager.c \
|
||||
nm-atm-manager.h \
|
||||
nm-connection-provider.c \
|
||||
nm-connection-provider.h \
|
||||
nm-connectivity.c \
|
||||
|
|
@ -320,7 +317,6 @@ glue_sources = \
|
|||
nm-access-point-glue.h \
|
||||
nm-active-connection-glue.h \
|
||||
nm-agent-manager-glue.h \
|
||||
nm-device-adsl-glue.h \
|
||||
nm-device-bond-glue.h \
|
||||
nm-device-bridge-glue.h \
|
||||
nm-device-bt-glue.h \
|
||||
|
|
|
|||
48
src/devices/atm/Makefile.am
Normal file
48
src/devices/atm/Makefile.am
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
include $(GLIB_MAKEFILE)
|
||||
|
||||
@GNOME_CODE_COVERAGE_RULES@
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I${top_srcdir}/src \
|
||||
-I${top_builddir}/src \
|
||||
-I${top_srcdir}/src/logging \
|
||||
-I${top_srcdir}/src/devices \
|
||||
-I${top_srcdir}/src/settings \
|
||||
-I${top_srcdir}/src/platform \
|
||||
-I${top_srcdir}/src/ppp-manager \
|
||||
-I${top_builddir}/include \
|
||||
-I${top_srcdir}/include \
|
||||
-I${top_builddir}/libnm-util \
|
||||
-I${top_srcdir}/libnm-util \
|
||||
$(DBUS_CFLAGS) \
|
||||
$(POLKIT_CFLAGS) \
|
||||
$(LIBNL_CFLAGS) \
|
||||
$(GUDEV_CFLAGS)
|
||||
|
||||
GLIB_GENERATED = nm-adsl-enum-types.h nm-adsl-enum-types.c
|
||||
GLIB_MKENUMS_H_FLAGS = --identifier-prefix NM
|
||||
GLIB_MKENUMS_C_FLAGS = --identifier-prefix NM
|
||||
nm_adsl_enum_types_sources = $(srcdir)/nm-device-adsl.h
|
||||
|
||||
nm-device-adsl-glue.h: $(top_srcdir)/introspection/nm-device-adsl.xml
|
||||
dbus-binding-tool --prefix=nm_device_adsl --mode=glib-server --output=$@ $<
|
||||
|
||||
BUILT_SOURCES = $(GLIB_GENERATED) nm-device-adsl-glue.h
|
||||
|
||||
pkglib_LTLIBRARIES = libnm-device-plugin-atm.la
|
||||
|
||||
libnm_device_plugin_atm_la_SOURCES = \
|
||||
nm-atm-manager.c \
|
||||
nm-atm-manager.h \
|
||||
nm-device-adsl.c \
|
||||
nm-device-adsl.h \
|
||||
\
|
||||
$(BUILT_SOURCES)
|
||||
|
||||
libnm_device_plugin_atm_la_LDFLAGS = -module -avoid-version
|
||||
libnm_device_plugin_atm_la_LIBADD = \
|
||||
$(DBUS_LIBS) \
|
||||
$(GUDEV_LIBS)
|
||||
|
||||
CLEANFILES = $(BUILT_SOURCES)
|
||||
|
||||
|
|
@ -24,52 +24,61 @@
|
|||
#include <gudev/gudev.h>
|
||||
|
||||
#include "nm-atm-manager.h"
|
||||
#include "nm-device-adsl.h"
|
||||
#include "nm-device-factory.h"
|
||||
#include "nm-logging.h"
|
||||
|
||||
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))
|
||||
|
||||
G_DEFINE_TYPE (NMAtmManager, nm_atm_manager, G_TYPE_OBJECT)
|
||||
static GType nm_atm_manager_get_type (void);
|
||||
|
||||
static void device_factory_interface_init (NMDeviceFactory *factory_iface);
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (NMAtmManager, nm_atm_manager, G_TYPE_OBJECT, 0,
|
||||
G_IMPLEMENT_INTERFACE (NM_TYPE_DEVICE_FACTORY, device_factory_interface_init))
|
||||
|
||||
enum {
|
||||
DEVICE_ADDED,
|
||||
DEVICE_REMOVED,
|
||||
|
||||
LAST_SIGNAL
|
||||
PROP_0,
|
||||
PROP_DEVICE_TYPE,
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
/**************************************************************************/
|
||||
|
||||
NMAtmManager *
|
||||
nm_atm_manager_new (void)
|
||||
#define PLUGIN_TYPE NM_DEVICE_TYPE_ADSL
|
||||
|
||||
G_MODULE_EXPORT NMDeviceFactory *
|
||||
nm_device_factory_create (GError **error)
|
||||
{
|
||||
return NM_ATM_MANAGER (g_object_new (NM_TYPE_ATM_MANAGER, NULL));
|
||||
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
|
||||
dev_get_attrs (GUdevDevice *udev_device,
|
||||
const char **out_ifname,
|
||||
const char **out_path,
|
||||
char **out_driver)
|
||||
{
|
||||
GUdevDevice *parent = NULL;
|
||||
const char *ifname, *driver, *path;
|
||||
const char *driver, *path;
|
||||
|
||||
g_return_val_if_fail (udev_device != NULL, FALSE);
|
||||
g_return_val_if_fail (out_ifname != NULL, FALSE);
|
||||
g_return_val_if_fail (out_path != NULL, FALSE);
|
||||
g_return_val_if_fail (out_driver != NULL, FALSE);
|
||||
|
||||
ifname = g_udev_device_get_name (udev_device);
|
||||
if (!ifname) {
|
||||
nm_log_dbg (LOGD_HW, "failed to get device's interface");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
path = g_udev_device_get_sysfs_path (udev_device);
|
||||
if (!path) {
|
||||
nm_log_warn (LOGD_HW, "couldn't determine device path; ignoring...");
|
||||
|
|
@ -80,51 +89,92 @@ dev_get_attrs (GUdevDevice *udev_device,
|
|||
if (!driver) {
|
||||
/* Try the parent */
|
||||
parent = g_udev_device_get_parent (udev_device);
|
||||
if (parent) {
|
||||
if (parent)
|
||||
driver = g_udev_device_get_driver (parent);
|
||||
g_object_unref (parent);
|
||||
}
|
||||
}
|
||||
|
||||
*out_ifname = ifname;
|
||||
*out_path = path;
|
||||
*out_driver = g_strdup (driver);
|
||||
|
||||
g_clear_object (&parent);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
device_destroyed (gpointer user_data, GObject *dead)
|
||||
{
|
||||
NMAtmManager *self = NM_ATM_MANAGER (user_data);
|
||||
NMAtmManagerPrivate *priv = NM_ATM_MANAGER_GET_PRIVATE (self);
|
||||
|
||||
priv->devices = g_slist_remove (priv->devices, dead);
|
||||
}
|
||||
|
||||
static void
|
||||
adsl_add (NMAtmManager *self, GUdevDevice *udev_device)
|
||||
{
|
||||
const char *ifname = NULL, *path = NULL;
|
||||
NMAtmManagerPrivate *priv = NM_ATM_MANAGER_GET_PRIVATE (self);
|
||||
const char *ifname, *sysfs_path = NULL;
|
||||
char *driver = NULL;
|
||||
NMDevice *device;
|
||||
|
||||
g_return_if_fail (udev_device != NULL);
|
||||
|
||||
nm_log_dbg (LOGD_HW, "adsl_add: ATM Device detected from udev. Adding ..");
|
||||
ifname = g_udev_device_get_name (udev_device);
|
||||
if (!ifname) {
|
||||
nm_log_warn (LOGD_HW, "failed to get device's interface name");
|
||||
return;
|
||||
}
|
||||
|
||||
if (dev_get_attrs (udev_device, &ifname, &path, &driver))
|
||||
g_signal_emit (self, signals[DEVICE_ADDED], 0, ifname, path, driver);
|
||||
g_free (driver);
|
||||
nm_log_dbg (LOGD_HW, "(%s): found ATM device", ifname);
|
||||
|
||||
if (dev_get_attrs (udev_device, &sysfs_path, &driver)) {
|
||||
g_assert (sysfs_path);
|
||||
|
||||
device = nm_device_adsl_new (sysfs_path, ifname, driver);
|
||||
g_assert (device);
|
||||
|
||||
priv->devices = g_slist_prepend (priv->devices, device);
|
||||
g_object_weak_ref (G_OBJECT (device), device_destroyed, self);
|
||||
|
||||
g_signal_emit_by_name (self, NM_DEVICE_FACTORY_DEVICE_ADDED, device);
|
||||
g_object_unref (device);
|
||||
|
||||
g_free (driver);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
adsl_remove (NMAtmManager *self, GUdevDevice *device)
|
||||
adsl_remove (NMAtmManager *self, GUdevDevice *udev_device)
|
||||
{
|
||||
nm_log_dbg (LOGD_HW, "adsl_remove: Removing ATM Device");
|
||||
NMAtmManagerPrivate *priv = NM_ATM_MANAGER_GET_PRIVATE (self);
|
||||
const char *iface = g_udev_device_get_name (udev_device);
|
||||
GSList *iter;
|
||||
|
||||
g_signal_emit (self, signals[DEVICE_REMOVED], 0, g_udev_device_get_name (device));
|
||||
nm_log_dbg (LOGD_HW, "(%s): removing ATM device", iface);
|
||||
|
||||
for (iter = priv->devices; iter; iter = iter->next) {
|
||||
NMDevice *device = iter->data;
|
||||
|
||||
/* Match 'iface' not 'ip_iface' to the ATM device instead of the
|
||||
* NAS bridge interface or PPPoE interface.
|
||||
*/
|
||||
if (g_strcmp0 (nm_device_get_iface (device), iface) != 0)
|
||||
continue;
|
||||
|
||||
g_object_weak_unref (G_OBJECT (iter->data), device_destroyed, self);
|
||||
priv->devices = g_slist_remove (priv->devices, device);
|
||||
g_signal_emit_by_name (device, NM_DEVICE_REMOVED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nm_atm_manager_query_devices (NMAtmManager *self)
|
||||
static gboolean
|
||||
query_devices (NMAtmManager *self)
|
||||
{
|
||||
NMAtmManagerPrivate *priv = NM_ATM_MANAGER_GET_PRIVATE (self);
|
||||
GUdevEnumerator *enumerator;
|
||||
GList *devices, *iter;
|
||||
|
||||
g_return_if_fail (NM_IS_ATM_MANAGER (self));
|
||||
|
||||
enumerator = g_udev_enumerator_new (priv->client);
|
||||
g_udev_enumerator_add_match_subsystem (enumerator, "atm");
|
||||
g_udev_enumerator_add_match_is_initialized (enumerator);
|
||||
|
|
@ -135,6 +185,8 @@ nm_atm_manager_query_devices (NMAtmManager *self)
|
|||
}
|
||||
g_list_free (devices);
|
||||
g_object_unref (enumerator);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -165,6 +217,8 @@ handle_uevent (GUdevClient *client,
|
|||
adsl_remove (self, device);
|
||||
}
|
||||
|
||||
/*********************************************************************/
|
||||
|
||||
static void
|
||||
nm_atm_manager_init (NMAtmManager *self)
|
||||
{
|
||||
|
|
@ -173,6 +227,27 @@ 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)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
switch (prop_id) {
|
||||
case PROP_DEVICE_TYPE:
|
||||
g_value_set_uint (value, PLUGIN_TYPE);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -180,9 +255,21 @@ dispose (GObject *object)
|
|||
{
|
||||
NMAtmManager *self = NM_ATM_MANAGER (object);
|
||||
NMAtmManagerPrivate *priv = NM_ATM_MANAGER_GET_PRIVATE (self);
|
||||
GSList *iter;
|
||||
|
||||
if (priv->client)
|
||||
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);
|
||||
|
||||
G_OBJECT_CLASS (nm_atm_manager_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
|
@ -195,21 +282,9 @@ nm_atm_manager_class_init (NMAtmManagerClass *klass)
|
|||
|
||||
/* virtual methods */
|
||||
object_class->dispose = dispose;
|
||||
object_class->get_property = get_property;
|
||||
|
||||
/* Signals */
|
||||
signals[DEVICE_ADDED] =
|
||||
g_signal_new ("device-added",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (NMAtmManagerClass, device_added),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
|
||||
|
||||
signals[DEVICE_REMOVED] =
|
||||
g_signal_new ("device-removed",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (NMAtmManagerClass, device_removed),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_STRING);
|
||||
g_object_class_override_property (object_class,
|
||||
PROP_DEVICE_TYPE,
|
||||
NM_DEVICE_FACTORY_DEVICE_TYPE);
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2007 - 2008 Novell, Inc.
|
||||
* Copyright (C) 2007 - 2012 Red Hat, Inc.
|
||||
* Copyright (C) 2007 - 2014 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NM_ATM_MANAGER_H
|
||||
|
|
@ -25,16 +25,10 @@
|
|||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include <gudev/gudev.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define NM_TYPE_ATM_MANAGER (nm_atm_manager_get_type ())
|
||||
#define NM_ATM_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_ATM_MANAGER, NMAtmManager))
|
||||
#define NM_ATM_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_ATM_MANAGER, NMAtmManagerClass))
|
||||
#define NM_IS_ATM_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_ATM_MANAGER))
|
||||
#define NM_IS_ATM_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_ATM_MANAGER))
|
||||
#define NM_ATM_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_ATM_MANAGER, NMAtmManagerClass))
|
||||
|
||||
typedef struct {
|
||||
GObject parent;
|
||||
|
|
@ -42,22 +36,7 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
GObjectClass parent;
|
||||
|
||||
/* signals */
|
||||
void (*device_added) (NMAtmManager *manager,
|
||||
const char *iface,
|
||||
const char *sysfs_path,
|
||||
const char *driver);
|
||||
|
||||
void (*device_removed) (NMAtmManager *manager,
|
||||
const char *iface);
|
||||
} NMAtmManagerClass;
|
||||
|
||||
GType nm_atm_manager_get_type (void);
|
||||
|
||||
NMAtmManager *nm_atm_manager_new (void);
|
||||
|
||||
void nm_atm_manager_query_devices (NMAtmManager *manager);
|
||||
|
||||
#endif /* NM_ATM_MANAGER_H */
|
||||
|
||||
|
|
@ -51,7 +51,6 @@
|
|||
#include "nm-device-team.h"
|
||||
#include "nm-device-bridge.h"
|
||||
#include "nm-device-vlan.h"
|
||||
#include "nm-device-adsl.h"
|
||||
#include "nm-device-generic.h"
|
||||
#include "nm-device-veth.h"
|
||||
#include "nm-device-tun.h"
|
||||
|
|
@ -63,7 +62,6 @@
|
|||
#include "nm-setting-vpn.h"
|
||||
#include "nm-dbus-glib-types.h"
|
||||
#include "nm-platform.h"
|
||||
#include "nm-atm-manager.h"
|
||||
#include "nm-rfkill-manager.h"
|
||||
#include "nm-hostname-provider.h"
|
||||
#include "nm-bluez-manager.h"
|
||||
|
|
@ -165,7 +163,6 @@ static NMActiveConnection *_new_active_connection (NMManager *self,
|
|||
static void policy_activating_device_changed (GObject *object, GParamSpec *pspec, gpointer user_data);
|
||||
|
||||
static NMDevice *find_device_by_ip_iface (NMManager *self, const gchar *iface);
|
||||
static NMDevice *find_device_by_iface (NMManager *self, const gchar *iface);
|
||||
|
||||
static void rfkill_change_wifi (const char *desc, gboolean enabled);
|
||||
|
||||
|
|
@ -219,7 +216,6 @@ typedef struct {
|
|||
|
||||
NMDBusManager *dbus_mgr;
|
||||
gboolean prop_filter_added;
|
||||
NMAtmManager *atm_mgr;
|
||||
NMRfkillManager *rfkill_mgr;
|
||||
NMBluezManager *bluez_mgr;
|
||||
|
||||
|
|
@ -2026,21 +2022,6 @@ find_device_by_ip_iface (NMManager *self, const gchar *iface)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static NMDevice *
|
||||
find_device_by_iface (NMManager *self, const gchar *iface)
|
||||
{
|
||||
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
|
||||
GSList *iter;
|
||||
|
||||
for (iter = priv->devices; iter; iter = g_slist_next (iter)) {
|
||||
NMDevice *candidate = iter->data;
|
||||
|
||||
if (g_strcmp0 (nm_device_get_iface (candidate), iface) == 0)
|
||||
return candidate;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static NMDevice *
|
||||
find_device_by_ifindex (NMManager *self, guint32 ifindex)
|
||||
{
|
||||
|
|
@ -2316,49 +2297,6 @@ platform_link_removed_cb (NMPlatform *platform,
|
|||
remove_device (self, device, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
atm_device_added_cb (NMAtmManager *atm_mgr,
|
||||
const char *iface,
|
||||
const char *sysfs_path,
|
||||
const char *driver,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMManager *self = NM_MANAGER (user_data);
|
||||
NMDevice *device;
|
||||
|
||||
g_return_if_fail (iface != NULL);
|
||||
g_return_if_fail (sysfs_path != NULL);
|
||||
|
||||
device = find_device_by_iface (self, iface);
|
||||
if (device)
|
||||
return;
|
||||
|
||||
device = nm_device_adsl_new (sysfs_path, iface, driver);
|
||||
if (device)
|
||||
add_device (self, device, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
atm_device_removed_cb (NMAtmManager *manager,
|
||||
const char *iface,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMManager *self = NM_MANAGER (user_data);
|
||||
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
|
||||
NMDevice *device = NULL;
|
||||
GSList *iter;
|
||||
|
||||
for (iter = priv->devices; iter; iter = g_slist_next (iter)) {
|
||||
if (g_strcmp0 (nm_device_get_iface (NM_DEVICE (iter->data)), iface) == 0) {
|
||||
device = iter->data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (device)
|
||||
remove_device (self, device, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
rfkill_manager_rfkill_changed_cb (NMRfkillManager *rfkill_mgr,
|
||||
RfKillType rtype,
|
||||
|
|
@ -4230,7 +4168,6 @@ nm_manager_start (NMManager *self)
|
|||
system_hostname_changed_cb (priv->settings, NULL, self);
|
||||
|
||||
nm_platform_query_devices ();
|
||||
nm_atm_manager_query_devices (priv->atm_mgr);
|
||||
nm_bluez_manager_query_devices (priv->bluez_mgr);
|
||||
|
||||
/*
|
||||
|
|
@ -4789,16 +4726,6 @@ nm_manager_new (NMSettings *settings,
|
|||
G_CALLBACK (platform_link_removed_cb),
|
||||
singleton);
|
||||
|
||||
priv->atm_mgr = nm_atm_manager_new ();
|
||||
g_signal_connect (priv->atm_mgr,
|
||||
"device-added",
|
||||
G_CALLBACK (atm_device_added_cb),
|
||||
singleton);
|
||||
g_signal_connect (priv->atm_mgr,
|
||||
"device-removed",
|
||||
G_CALLBACK (atm_device_removed_cb),
|
||||
singleton);
|
||||
|
||||
priv->rfkill_mgr = nm_rfkill_manager_new ();
|
||||
g_signal_connect (priv->rfkill_mgr,
|
||||
"rfkill-changed",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue