diff --git a/src/nm-checkpoint.c b/src/nm-checkpoint.c index 405baf5743..5bde924c27 100644 --- a/src/nm-checkpoint.c +++ b/src/nm-checkpoint.c @@ -254,12 +254,12 @@ activate: if (need_update) { _LOGD ("rollback: updating connection %s", nm_settings_connection_get_uuid (connection)); - nm_settings_connection_commit_changes (connection, - dev_checkpoint->settings_connection, - NM_SETTINGS_CONNECTION_PERSIST_MODE_DISK, - NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, - "checkpoint-rollback", - NULL); + nm_settings_connection_update (connection, + dev_checkpoint->settings_connection, + NM_SETTINGS_CONNECTION_PERSIST_MODE_DISK, + NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, + "checkpoint-rollback", + NULL); } } else { /* The connection was deleted, recreate it */ diff --git a/src/nm-manager.c b/src/nm-manager.c index 00dac4fbd7..178fbfa71b 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -4022,12 +4022,12 @@ activation_add_done (NMSettings *settings, nm_active_connection_set_settings_connection (active, new_connection); if (_internal_activate_generic (self, active, &local)) { - nm_settings_connection_commit_changes (new_connection, - NULL, - NM_SETTINGS_CONNECTION_PERSIST_MODE_DISK, - NM_SETTINGS_CONNECTION_COMMIT_REASON_USER_ACTION | NM_SETTINGS_CONNECTION_COMMIT_REASON_ID_CHANGED, - "add-and-activate", - NULL); + nm_settings_connection_update (new_connection, + NULL, + NM_SETTINGS_CONNECTION_PERSIST_MODE_DISK, + NM_SETTINGS_CONNECTION_COMMIT_REASON_USER_ACTION | NM_SETTINGS_CONNECTION_COMMIT_REASON_ID_CHANGED, + "add-and-activate", + NULL); g_dbus_method_invocation_return_value ( context, g_variant_new ("(oo)", diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c index c2ab1c4089..00a5bb0c05 100644 --- a/src/settings/nm-settings-connection.c +++ b/src/settings/nm-settings-connection.c @@ -694,31 +694,12 @@ out: } gboolean -nm_settings_connection_commit_changes (NMSettingsConnection *self, - NMConnection *new_connection, - NMSettingsConnectionPersistMode persist_mode, - NMSettingsConnectionCommitReason commit_reason, - const char *log_diff_name, - GError **error) -{ - return _update (self, - new_connection, - persist_mode, - commit_reason, - log_diff_name, - error); -} - -/* Update the settings of this connection to match that of 'new_connection', - * taking care to make a private copy of secrets. - */ -gboolean -nm_settings_connection_replace_settings (NMSettingsConnection *self, - NMConnection *new_connection, - NMSettingsConnectionPersistMode persist_mode, - NMSettingsConnectionCommitReason commit_reason, - const char *log_diff_name, - GError **error) +nm_settings_connection_update (NMSettingsConnection *self, + NMConnection *new_connection, + NMSettingsConnectionPersistMode persist_mode, + NMSettingsConnectionCommitReason commit_reason, + const char *log_diff_name, + GError **error) { return _update (self, new_connection, @@ -1002,12 +983,12 @@ nm_settings_connection_new_secrets (NMSettingsConnection *self, update_system_secrets_cache (self); update_agent_secrets_cache (self, NULL); - nm_settings_connection_commit_changes (self, - NULL, - NM_SETTINGS_CONNECTION_PERSIST_MODE_DISK, - NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, - "new-secrets", - NULL); + nm_settings_connection_update (self, + NULL, + NM_SETTINGS_CONNECTION_PERSIST_MODE_DISK, + NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, + "new-secrets", + NULL); return TRUE; } @@ -1121,12 +1102,12 @@ get_secrets_done_cb (NMAgentManager *manager, setting_name, call_id); - nm_settings_connection_commit_changes (self, - NULL, - NM_SETTINGS_CONNECTION_PERSIST_MODE_DISK, - NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, - "get-new-secrets", - NULL); + nm_settings_connection_update (self, + NULL, + NM_SETTINGS_CONNECTION_PERSIST_MODE_DISK, + NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, + "get-new-secrets", + NULL); } else { _LOGD ("(%s:%p) new agent secrets processed", setting_name, @@ -2143,12 +2124,12 @@ dbus_clear_secrets_auth_cb (NMSettingsConnection *self, nm_connection_get_path (NM_CONNECTION (self)), NM_CONNECTION (self)); - nm_settings_connection_commit_changes (self, - NULL, - NM_SETTINGS_CONNECTION_PERSIST_MODE_DISK, - NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, - "clear-secrets", - &local); + nm_settings_connection_update (self, + NULL, + NM_SETTINGS_CONNECTION_PERSIST_MODE_DISK, + NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, + "clear-secrets", + &local); nm_audit_log_connection_op (NM_AUDIT_OP_CONN_CLEAR_SECRETS, self, !local, NULL, subject, local ? local->message : NULL); diff --git a/src/settings/nm-settings-connection.h b/src/settings/nm-settings-connection.h index 6156711973..80acf359a9 100644 --- a/src/settings/nm-settings-connection.h +++ b/src/settings/nm-settings-connection.h @@ -137,19 +137,12 @@ typedef enum { NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY, } NMSettingsConnectionPersistMode; -gboolean nm_settings_connection_commit_changes (NMSettingsConnection *self, - NMConnection *new_connection, - NMSettingsConnectionPersistMode persist_mode, - NMSettingsConnectionCommitReason commit_reason, - const char *log_diff_name, - GError **error); - -gboolean nm_settings_connection_replace_settings (NMSettingsConnection *self, - NMConnection *new_connection, - NMSettingsConnectionPersistMode persist_mode, - NMSettingsConnectionCommitReason commit_reason, - const char *log_diff_name, - GError **error); +gboolean nm_settings_connection_update (NMSettingsConnection *self, + NMConnection *new_connection, + NMSettingsConnectionPersistMode persist_mode, + NMSettingsConnectionCommitReason commit_reason, + const char *log_diff_name, + GError **error); gboolean nm_settings_connection_delete (NMSettingsConnection *self, GError **error); diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index 081997058f..0cfe8abcef 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -90,7 +90,7 @@ EXPORT(nm_inotify_helper_add_watch) EXPORT(nm_inotify_helper_remove_watch) EXPORT(nm_settings_connection_get_type) -EXPORT(nm_settings_connection_replace_settings) +EXPORT(nm_settings_connection_update) /*****************************************************************************/ diff --git a/src/settings/plugins/ibft/nms-ibft-connection.c b/src/settings/plugins/ibft/nms-ibft-connection.c index 62c88f58ee..2a7c5f4a02 100644 --- a/src/settings/plugins/ibft/nms-ibft-connection.c +++ b/src/settings/plugins/ibft/nms-ibft-connection.c @@ -60,12 +60,12 @@ nms_ibft_connection_new (const GPtrArray *block, GError **error) object = g_object_new (NMS_TYPE_IBFT_CONNECTION, NULL); /* Update settings with what was read from iscsiadm */ - if (!nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (object), - source, - NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP, - NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, - NULL, - error)) + if (!nm_settings_connection_update (NM_SETTINGS_CONNECTION (object), + source, + NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP, + NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, + NULL, + error)) g_clear_object (&object); return (NMSIbftConnection *) object; diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c index ceaac2266e..d0962dda1f 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c @@ -458,14 +458,14 @@ nm_ifcfg_connection_new (NMConnection *source, NM_IFCFG_CONNECTION_UNRECOGNIZED_SPEC, unrecognized_spec, NULL); /* Update our settings with what was read from the file */ - if (nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (object), - tmp, - full_path - ? NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP /* connection is already on disk */ - : NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY, - NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, - NULL, - error)) + if (nm_settings_connection_update (NM_SETTINGS_CONNECTION (object), + tmp, + full_path + ? NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP /* connection is already on disk */ + : NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY, + NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, + NULL, + error)) nm_ifcfg_connection_check_devtimeout (NM_IFCFG_CONNECTION (object)); else g_clear_object (&object); diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c index 6b6b82c6cc..8ad3a53f3d 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c @@ -313,12 +313,12 @@ update_connection (SettingsPluginIfcfg *self, NM_IFCFG_CONNECTION_UNRECOGNIZED_SPEC, new_unrecognized, NULL); - if (!nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (connection_by_uuid), - NM_CONNECTION (connection_new), - NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP, - NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, - "ifcfg-update", - &local)) { + if (!nm_settings_connection_update (NM_SETTINGS_CONNECTION (connection_by_uuid), + NM_CONNECTION (connection_new), + NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP, + NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, + "ifcfg-update", + &local)) { /* Shouldn't ever get here as 'connection_new' was verified by the reader already * and the UUID did not change. */ g_assert_not_reached (); diff --git a/src/settings/plugins/ifnet/nms-ifnet-connection.c b/src/settings/plugins/ifnet/nms-ifnet-connection.c index 67ad55ca69..8aa53ad1f8 100644 --- a/src/settings/plugins/ifnet/nms-ifnet-connection.c +++ b/src/settings/plugins/ifnet/nms-ifnet-connection.c @@ -186,14 +186,14 @@ nm_ifnet_connection_new (NMConnection *source, const char *conn_name) object = (GObject *) g_object_new (NM_TYPE_IFNET_CONNECTION, NULL); NM_IFNET_CONNECTION_GET_PRIVATE ((NMIfnetConnection *) object)->conn_name = g_strdup (conn_name); - if (!nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (object), - tmp, - update_unsaved - ? NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY - : NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP, - NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, - NULL, - NULL)) { + if (!nm_settings_connection_update (NM_SETTINGS_CONNECTION (object), + tmp, + update_unsaved + ? NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY + : NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP, + NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, + NULL, + NULL)) { g_object_unref (object); return NULL; } diff --git a/src/settings/plugins/ifnet/nms-ifnet-plugin.c b/src/settings/plugins/ifnet/nms-ifnet-plugin.c index b485072c95..98e56e449a 100644 --- a/src/settings/plugins/ifnet/nms-ifnet-plugin.c +++ b/src/settings/plugins/ifnet/nms-ifnet-plugin.c @@ -269,12 +269,12 @@ reload_connections (NMSettingsPlugin *config) } } else { /* Update existing connection with new settings */ - if (!nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (old), - NM_CONNECTION (new), - NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP, - NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, - "ifnet-update", - &error)) { + if (!nm_settings_connection_update (NM_SETTINGS_CONNECTION (old), + NM_CONNECTION (new), + NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP, + NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, + "ifnet-update", + &error)) { /* Shouldn't ever get here as 'new' was verified by the reader already * and the UUID did not change. */ g_assert_not_reached (); diff --git a/src/settings/plugins/ifupdown/nms-ifupdown-plugin.c b/src/settings/plugins/ifupdown/nms-ifupdown-plugin.c index 1461ea86c4..87afb6c8e9 100644 --- a/src/settings/plugins/ifupdown/nms-ifupdown-plugin.c +++ b/src/settings/plugins/ifupdown/nms-ifupdown-plugin.c @@ -139,12 +139,12 @@ bind_device_to_connection (SettingsPluginIfupdown *self, g_object_set (s_wifi, NM_SETTING_WIRELESS_MAC_ADDRESS, address, NULL); } - nm_settings_connection_commit_changes (NM_SETTINGS_CONNECTION (exported), - NULL, - NM_SETTINGS_CONNECTION_PERSIST_MODE_DISK, - NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, - "ifupdown-new", - NULL); + nm_settings_connection_update (NM_SETTINGS_CONNECTION (exported), + NULL, + NM_SETTINGS_CONNECTION_PERSIST_MODE_DISK, + NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, + "ifupdown-new", + NULL); } static void diff --git a/src/settings/plugins/keyfile/nms-keyfile-connection.c b/src/settings/plugins/keyfile/nms-keyfile-connection.c index c2ac8e91ae..6e1d911626 100644 --- a/src/settings/plugins/keyfile/nms-keyfile-connection.c +++ b/src/settings/plugins/keyfile/nms-keyfile-connection.c @@ -159,14 +159,14 @@ nms_keyfile_connection_new (NMConnection *source, NULL); /* Update our settings with what was read from the file */ - if (!nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (object), - tmp, - update_unsaved - ? NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY - : NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP, - NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, - NULL, - error)) { + if (!nm_settings_connection_update (NM_SETTINGS_CONNECTION (object), + tmp, + update_unsaved + ? NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY + : NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP, + NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, + NULL, + error)) { g_object_unref (object); object = NULL; } diff --git a/src/settings/plugins/keyfile/nms-keyfile-plugin.c b/src/settings/plugins/keyfile/nms-keyfile-plugin.c index 626a42ecd2..dd179565a2 100644 --- a/src/settings/plugins/keyfile/nms-keyfile-plugin.c +++ b/src/settings/plugins/keyfile/nms-keyfile-plugin.c @@ -258,12 +258,12 @@ update_connection (NMSKeyfilePlugin *self, else _LOGI ("update and persist "NMS_KEYFILE_CONNECTION_LOG_FMT, NMS_KEYFILE_CONNECTION_LOG_ARG (connection_new)); - if (!nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (connection_by_uuid), - NM_CONNECTION (connection_new), - NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP, - NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, - "keyfile-update", - &local)) { + if (!nm_settings_connection_update (NM_SETTINGS_CONNECTION (connection_by_uuid), + NM_CONNECTION (connection_new), + NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP, + NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, + "keyfile-update", + &local)) { /* Shouldn't ever get here as 'connection_new' was verified by the reader already * and the UUID did not change. */ g_assert_not_reached ();