summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2015-04-29 10:56:36 +0200
committerThomas Haller <thaller@redhat.com>2015-06-17 16:19:19 +0200
commit7473a248f4e770c497eb4089db746b54a5f5b451 (patch)
treec85827e310a25d46451fdf22210c05a9df163f1d
parentc174da8e1391f54396c01a7c20f3fe46d67533bb (diff)
downloadNetworkManager-7473a248f4e770c497eb4089db746b54a5f5b451.tar.gz
trivial: move code
(cherry picked from commit 42b272b604d8a40d699e1e08beb6135ad1f0caba)
-rw-r--r--src/devices/nm-device-factory.c112
-rw-r--r--src/nm-manager.c76
2 files changed, 94 insertions, 94 deletions
diff --git a/src/devices/nm-device-factory.c b/src/devices/nm-device-factory.c
index 9957efdc33..1038f75191 100644
--- a/src/devices/nm-device-factory.c
+++ b/src/devices/nm-device-factory.c
@@ -49,61 +49,6 @@ nm_device_factory_emit_component_added (NMDeviceFactory *factory, GObject *compo
return consumed;
}
-static void
-interface_init (gpointer g_iface)
-{
- GType iface_type = G_TYPE_FROM_INTERFACE (g_iface);
- static gboolean initialized = FALSE;
-
- if (G_LIKELY (initialized))
- return;
-
- /* Signals */
- signals[DEVICE_ADDED] = g_signal_new (NM_DEVICE_FACTORY_DEVICE_ADDED,
- iface_type,
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (NMDeviceFactory, device_added),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1, NM_TYPE_DEVICE);
-
- signals[COMPONENT_ADDED] = g_signal_new (NM_DEVICE_FACTORY_COMPONENT_ADDED,
- iface_type,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NMDeviceFactory, component_added),
- g_signal_accumulator_true_handled, NULL, NULL,
- G_TYPE_BOOLEAN, 1, G_TYPE_OBJECT);
-
- initialized = TRUE;
-}
-
-GType
-nm_device_factory_get_type (void)
-{
- static GType device_factory_type = 0;
-
- if (!device_factory_type) {
- const GTypeInfo device_factory_info = {
- sizeof (NMDeviceFactory), /* class_size */
- interface_init, /* base_init */
- NULL, /* base_finalize */
- NULL,
- NULL, /* class_finalize */
- NULL, /* class_data */
- 0,
- 0, /* n_preallocs */
- NULL
- };
-
- device_factory_type = g_type_register_static (G_TYPE_INTERFACE,
- "NMDeviceFactory",
- &device_factory_info,
- 0);
- g_type_interface_add_prerequisite (device_factory_type, G_TYPE_OBJECT);
- }
-
- return device_factory_type;
-}
-
void
nm_device_factory_get_supported_types (NMDeviceFactory *factory,
const NMLinkType **out_link_types,
@@ -217,6 +162,63 @@ nm_device_factory_create_virtual_device_for_connection (NMDeviceFactory *factory
/*******************************************************************/
+static void
+interface_init (gpointer g_iface)
+{
+ GType iface_type = G_TYPE_FROM_INTERFACE (g_iface);
+ static gboolean initialized = FALSE;
+
+ if (G_LIKELY (initialized))
+ return;
+
+ /* Signals */
+ signals[DEVICE_ADDED] = g_signal_new (NM_DEVICE_FACTORY_DEVICE_ADDED,
+ iface_type,
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (NMDeviceFactory, device_added),
+ NULL, NULL, NULL,
+ G_TYPE_NONE, 1, NM_TYPE_DEVICE);
+
+ signals[COMPONENT_ADDED] = g_signal_new (NM_DEVICE_FACTORY_COMPONENT_ADDED,
+ iface_type,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (NMDeviceFactory, component_added),
+ g_signal_accumulator_true_handled, NULL, NULL,
+ G_TYPE_BOOLEAN, 1, G_TYPE_OBJECT);
+
+ initialized = TRUE;
+}
+
+GType
+nm_device_factory_get_type (void)
+{
+ static GType device_factory_type = 0;
+
+ if (!device_factory_type) {
+ const GTypeInfo device_factory_info = {
+ sizeof (NMDeviceFactory), /* class_size */
+ interface_init, /* base_init */
+ NULL, /* base_finalize */
+ NULL,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ 0,
+ 0, /* n_preallocs */
+ NULL
+ };
+
+ device_factory_type = g_type_register_static (G_TYPE_INTERFACE,
+ "NMDeviceFactory",
+ &device_factory_info,
+ 0);
+ g_type_interface_add_prerequisite (device_factory_type, G_TYPE_OBJECT);
+ }
+
+ return device_factory_type;
+}
+
+/*******************************************************************/
+
static GSList *internal_types = NULL;
static GHashTable *factories_by_link = NULL;
static GHashTable *factories_by_setting = NULL;
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 172b4d194b..471479a9b9 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -127,8 +127,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 void rfkill_change (const char *desc, RfKillType rtype, gboolean enabled);
static gboolean find_master (NMManager *self,
@@ -515,6 +513,43 @@ nm_manager_get_device_by_ifindex (NMManager *manager, int ifindex)
return NULL;
}
+static NMDevice *
+get_device_from_hwaddr (NMManager *self, const char *setting_mac)
+{
+ NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
+ const char *device_mac;
+ GSList *iter;
+
+ if (!setting_mac)
+ return NULL;
+
+ for (iter = priv->devices; iter; iter = g_slist_next (iter)) {
+ NMDevice *device = iter->data;
+
+ device_mac = nm_device_get_hw_address (iter->data);
+ if (!device_mac)
+ continue;
+ if (nm_utils_hwaddr_matches (setting_mac, -1, device_mac, -1))
+ return device;
+ }
+ return NULL;
+}
+
+static NMDevice *
+find_device_by_ip_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_ip_iface (candidate), iface) == 0)
+ return candidate;
+ }
+ return NULL;
+}
+
static gboolean
manager_sleeping (NMManager *self)
{
@@ -848,28 +883,6 @@ nm_manager_get_state (NMManager *manager)
/*******************************************************************/
static NMDevice *
-get_device_from_hwaddr (NMManager *self, const char *setting_mac)
-{
- NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
- const char *device_mac;
- GSList *iter;
-
- if (!setting_mac)
- return NULL;
-
- for (iter = priv->devices; iter; iter = g_slist_next (iter)) {
- NMDevice *device = iter->data;
-
- device_mac = nm_device_get_hw_address (iter->data);
- if (!device_mac)
- continue;
- if (nm_utils_hwaddr_matches (setting_mac, -1, device_mac, -1))
- return device;
- }
- return NULL;
-}
-
-static NMDevice *
find_vlan_parent (NMManager *self,
NMConnection *connection)
{
@@ -1903,21 +1916,6 @@ add_device (NMManager *self, NMDevice *device, gboolean try_assume)
system_create_virtual_devices (self);
}
-static NMDevice *
-find_device_by_ip_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_ip_iface (candidate), iface) == 0)
- return candidate;
- }
- return NULL;
-}
-
/*******************************************************************/
static void