summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-05-04 16:54:51 +0200
committerThomas Haller <thaller@redhat.com>2015-06-05 16:52:50 +0200
commitd7a312d17a09b748d5aa06d7dfbebc66f0e8cf68 (patch)
tree5c34e64fc7602a9451ffc5ebd7b606292c353ff7
parentd6ce01f115e0195da08e0b1c0cde1c25ea747f77 (diff)
downloadNetworkManager-d7a312d17a09b748d5aa06d7dfbebc66f0e8cf68.tar.gz
platform: move nm_platform_query_devices() to nm-manager
nm_platform_query_devices() would raise an 'added' signal for all its links. That is bad style because it could confuse other listeners for platform signals which don't expect such artificial change signals. The public API of NMPlatform already gives NMManager the ability to 'pull' all the links and iterate them itself. Before, nm_platform_query_devices() would also initialize udev devices, so there was a more compelling reason for this function.
-rw-r--r--src/nm-manager.c17
-rw-r--r--src/platform/nm-platform.c26
-rw-r--r--src/platform/nm-platform.h2
3 files changed, 16 insertions, 29 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 924d772356..5e2aff8c65 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -1937,6 +1937,21 @@ platform_link_cb (NMPlatform *platform,
}
static void
+platform_query_devices (NMManager *self)
+{
+ GArray *links_array;
+ NMPlatformLink *links;
+ int i;
+
+ links_array = nm_platform_link_get_all (NM_PLATFORM_GET);
+ links = (NMPlatformLink *) links_array->data;
+ for (i = 0; i < links_array->len; i++)
+ platform_link_added (self, links[i].ifindex, &links[i], NM_PLATFORM_REASON_INTERNAL);
+
+ g_array_unref (links_array);
+}
+
+static void
rfkill_manager_rfkill_changed_cb (NMRfkillManager *rfkill_mgr,
RfKillType rtype,
RfKillState udev_state,
@@ -3946,7 +3961,7 @@ nm_manager_start (NMManager *self)
/* Start device factories */
nm_device_factory_manager_for_each_factory (start_factory, NULL);
- nm_platform_query_devices (NM_PLATFORM_GET);
+ platform_query_devices (self);
/*
* Connections added before the manager is started do not emit
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index e521fb1552..6c50144aab 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -382,32 +382,6 @@ nm_platform_sysctl_get_int_checked (NMPlatform *self, const char *path, guint ba
/******************************************************************/
/**
- * nm_platform_query_devices:
- * self: platform instance
- *
- * Emit #NMPlatform:link-changed ADDED signals for all currently-known links.
- * Should only be called at startup.
- */
-void
-nm_platform_query_devices (NMPlatform *self)
-{
- GArray *links_array;
- NMPlatformLink *links;
- int i;
-
- _CHECK_SELF_VOID (self, klass);
-
- links_array = nm_platform_link_get_all (self);
- links = (NMPlatformLink *) links_array->data;
- for (i = 0; i < links_array->len; i++) {
- g_signal_emit (self, signals[SIGNAL_LINK_CHANGED], 0,
- links[i].ifindex, &links[i], NM_PLATFORM_SIGNAL_ADDED,
- NM_PLATFORM_REASON_INTERNAL);
- }
- g_array_unref (links_array);
-}
-
-/**
* nm_platform_link_get_all:
* self: platform instance
*
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index f34ae811b2..f5966233cb 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -533,8 +533,6 @@ void nm_platform_set_error (NMPlatform *self, NMPlatformError error);
NMPlatformError nm_platform_get_error (NMPlatform *self);
const char *nm_platform_get_error_msg (NMPlatform *self);
-void nm_platform_query_devices (NMPlatform *self);
-
gboolean nm_platform_sysctl_set (NMPlatform *self, const char *path, const char *value);
char *nm_platform_sysctl_get (NMPlatform *self, const char *path);
gint32 nm_platform_sysctl_get_int32 (NMPlatform *self, const char *path, gint32 fallback);