mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 03:50:10 +01:00
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.
This commit is contained in:
parent
d6ce01f115
commit
d7a312d17a
3 changed files with 16 additions and 29 deletions
|
|
@ -1936,6 +1936,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,
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -381,32 +381,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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue