settings: unify settings-update API (nm_settings_connection_commit_changes())

This commit is contained in:
Thomas Haller 2017-12-01 10:09:43 +01:00
parent 8388f4ea1d
commit 1425be0397
5 changed files with 23 additions and 9 deletions

View file

@ -256,7 +256,9 @@ activate:
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);
}
} else {

View file

@ -4024,7 +4024,9 @@ activation_add_done (NMSettings *settings,
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);
g_dbus_method_invocation_return_value (
context,

View file

@ -696,16 +696,16 @@ 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,
NM_SETTINGS_CONNECTION_PERSIST_MODE_DISK,
persist_mode,
commit_reason,
new_connection
? "update-during-write"
: "replace-and-commit-disk",
log_diff_name,
error);
}
@ -1003,7 +1003,9 @@ nm_settings_connection_new_secrets (NMSettingsConnection *self,
nm_settings_connection_commit_changes (self,
NULL,
NM_SETTINGS_CONNECTION_PERSIST_MODE_DISK,
NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE,
"new-secrets",
NULL);
return TRUE;
}
@ -1120,7 +1122,9 @@ get_secrets_done_cb (NMAgentManager *manager,
nm_settings_connection_commit_changes (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",
@ -2140,7 +2144,9 @@ dbus_clear_secrets_auth_cb (NMSettingsConnection *self,
nm_settings_connection_commit_changes (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,

View file

@ -131,17 +131,19 @@ gboolean nm_settings_connection_has_unmodified_applied_connection (NMSettingsCon
NMConnection *applied_connection,
NMSettingCompareFlags compare_flage);
gboolean nm_settings_connection_commit_changes (NMSettingsConnection *self,
NMConnection *new_connection,
NMSettingsConnectionCommitReason commit_reason,
GError **error);
typedef enum {
NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP,
NM_SETTINGS_CONNECTION_PERSIST_MODE_DISK,
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,

View file

@ -141,7 +141,9 @@ bind_device_to_connection (SettingsPluginIfupdown *self,
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);
}