From c35164a6a3236979092d31fc19aa5509fcbaacaa Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 16 May 2016 19:24:23 +0200 Subject: [PATCH] settings/trivial: rename nm_settings_get_connections() to nm_settings_get_connections_sorted() nm_settings_get_connections() returns a sorted list. We have many users of nm_connection_provider_get_connection(), which returns the same result, but undefined order. Next NMConnectionProvider will be dropped. Thus, we don't want to seamlessly replace nm_connection_provider_get_connection() by a sorted version nm_settings_get_connections(). Rename nm_settings_get_connections() to make clear it is sorted. --- src/nm-manager.c | 14 +++++++------- src/nm-policy.c | 10 +++++----- src/settings/nm-settings.c | 2 +- src/settings/nm-settings.h | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/nm-manager.c b/src/nm-manager.c index 9e782e4b80..d7cff07c72 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -407,7 +407,7 @@ find_ac_for_connection (NMManager *manager, NMConnection *connection) } /* Filter out connections that are already active. - * nm_settings_get_connections() returns sorted list. We need to preserve the + * nm_settings_get_connections_sorted() returns sorted list. We need to preserve the * order so that we didn't change auto-activation order (recent timestamps * are first). * Caller is responsible for freeing the returned list with g_slist_free(). @@ -416,7 +416,7 @@ GSList * nm_manager_get_activatable_connections (NMManager *manager) { NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager); - GSList *all_connections = nm_settings_get_connections (priv->settings); + GSList *all_connections = nm_settings_get_connections_sorted (priv->settings); GSList *connections = NULL, *iter; NMSettingsConnection *connection; @@ -1131,7 +1131,7 @@ system_create_virtual_device (NMManager *self, NMConnection *connection) } /* Create backing resources if the device has any autoconnect connections */ - connections = nm_settings_get_connections (priv->settings); + connections = nm_settings_get_connections_sorted (priv->settings); for (iter = connections; iter; iter = g_slist_next (iter)) { NMConnection *candidate = iter->data; NMSettingConnection *s_con; @@ -1166,7 +1166,7 @@ retry_connections_for_parent_device (NMManager *self, NMDevice *device) g_return_if_fail (device); - connections = nm_settings_get_connections (priv->settings); + connections = nm_settings_get_connections_sorted (priv->settings); for (iter = connections; iter; iter = g_slist_next (iter)) { NMConnection *candidate = iter->data; gs_free_error GError *error = NULL; @@ -2603,7 +2603,7 @@ find_slaves (NMManager *manager, * even if a slave was already active, it might be deactivated during * master reactivation. */ - all_connections = nm_settings_get_connections (priv->settings); + all_connections = nm_settings_get_connections_sorted (priv->settings); for (iter = all_connections; iter; iter = iter->next) { NMSettingsConnection *master_connection = NULL; NMDevice *master_device = NULL; @@ -3598,7 +3598,7 @@ impl_manager_add_and_activate_connection (NMManager *self, if (!subject) goto error; - all_connections = nm_settings_get_connections (priv->settings); + all_connections = nm_settings_get_connections_sorted (priv->settings); if (vpn) { /* Try to fill the VPN's connection setting and name at least */ if (!nm_connection_get_setting_vpn (connection)) { @@ -4546,7 +4546,7 @@ nm_manager_start (NMManager *self, GError **error) * connection-added signals thus devices have to be created manually. */ _LOGD (LOGD_CORE, "creating virtual devices..."); - connections = nm_settings_get_connections (priv->settings); + connections = nm_settings_get_connections_sorted (priv->settings); for (iter = connections; iter; iter = iter->next) connection_changed (self, NM_CONNECTION (iter->data)); g_slist_free (connections); diff --git a/src/nm-policy.c b/src/nm-policy.c index 7af311270d..0d39723344 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -862,7 +862,7 @@ reset_autoconnect_all (NMPolicy *self, NMDevice *device) } else _LOGD (LOGD_DEVICE, "re-enabling autoconnect for all connections"); - connections = nm_settings_get_connections (priv->settings); + connections = nm_settings_get_connections_sorted (priv->settings); for (iter = connections; iter; iter = g_slist_next (iter)) { if (!device || nm_device_check_connection_compatible (device, iter->data)) { nm_settings_connection_reset_autoconnect_retries (iter->data); @@ -880,7 +880,7 @@ reset_autoconnect_for_failed_secrets (NMPolicy *self) _LOGD (LOGD_DEVICE, "re-enabling autoconnect for all connections with failed secrets"); - connections = nm_settings_get_connections (priv->settings); + connections = nm_settings_get_connections_sorted (priv->settings); for (iter = connections; iter; iter = g_slist_next (iter)) { NMSettingsConnection *connection = NM_SETTINGS_CONNECTION (iter->data); @@ -908,7 +908,7 @@ block_autoconnect_for_device (NMPolicy *self, NMDevice *device) if (!nm_device_is_software (device)) return; - connections = nm_settings_get_connections (priv->settings); + connections = nm_settings_get_connections_sorted (priv->settings); for (iter = connections; iter; iter = g_slist_next (iter)) { if (nm_device_check_connection_compatible (device, iter->data)) { nm_settings_connection_set_autoconnect_blocked_reason (NM_SETTINGS_CONNECTION (iter->data), @@ -990,7 +990,7 @@ reset_connections_retries (gpointer user_data) min_stamp = 0; now = nm_utils_get_monotonic_timestamp_s (); - connections = nm_settings_get_connections (priv->settings); + connections = nm_settings_get_connections_sorted (priv->settings); for (iter = connections; iter; iter = g_slist_next (iter)) { NMSettingsConnection *connection = NM_SETTINGS_CONNECTION (iter->data); @@ -1043,7 +1043,7 @@ activate_slave_connections (NMPolicy *self, NMDevice *device) } } - connections = nm_settings_get_connections (priv->settings); + connections = nm_settings_get_connections_sorted (priv->settings); for (iter = connections; iter; iter = g_slist_next (iter)) { NMConnection *slave; NMSettingConnection *s_slave_con; diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index 7c42213585..db771f88f0 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -415,7 +415,7 @@ connection_sort (gconstpointer pa, gconstpointer pb) * Caller must free the list with g_slist_free(). */ GSList * -nm_settings_get_connections (NMSettings *self) +nm_settings_get_connections_sorted (NMSettings *self) { GHashTableIter iter; gpointer data = NULL; diff --git a/src/settings/nm-settings.h b/src/settings/nm-settings.h index 5d41e5bc92..d1711a4455 100644 --- a/src/settings/nm-settings.h +++ b/src/settings/nm-settings.h @@ -89,7 +89,7 @@ void nm_settings_add_connection_dbus (NMSettings *self, /* Returns a list of NMSettingsConnections. Caller must free the list with * g_slist_free(). */ -GSList *nm_settings_get_connections (NMSettings *settings); +GSList *nm_settings_get_connections_sorted (NMSettings *settings); NMSettingsConnection *nm_settings_add_connection (NMSettings *settings, NMConnection *connection,