all: rename nmtst_* functions that are used by the daemon

The name prefix "nmtst_*" is reserved for test helpers and stub
function. Such functions should not be in the actual build artifacts,
like the NetworkManager binary.

Instead, nmtst_connection_assert_unchanging() is not a test helper. It
is a assertion function that is only enabled with NM_MORE_ASSERTS
builds. That's different.

Rename.

In other words,

  $ nm src/core/NetworkManager src/libnm-client-impl/.libs/libnm.so | grep nmtst

should give no results.
This commit is contained in:
Thomas Haller 2021-09-07 11:21:08 +02:00
parent 7df4b2a2eb
commit e38ddb52e3
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
10 changed files with 27 additions and 27 deletions

View file

@ -382,7 +382,7 @@ _nm_settings_connection_set_connection(NMSettingsConnection * self,
NM_SETTING_COMPARE_FLAG_EXACT)) {
connection_old = priv->connection;
priv->connection = g_object_ref(new_connection);
nmtst_connection_assert_unchanging(priv->connection);
nm_assert_connection_unchanging(priv->connection);
_getsettings_cached_clear(priv);
_nm_settings_notify_sorted_by_autoconnect_priority_maybe_changed(priv->settings);

View file

@ -1352,7 +1352,7 @@ _connection_changed_track(NMSettings * self,
|| (_nm_connection_verify(connection, NULL) == NM_SETTING_VERIFY_SUCCESS));
nm_assert(!connection || nm_streq0(uuid, nm_connection_get_uuid(connection)));
nmtst_connection_assert_unchanging(connection);
nm_assert_connection_unchanging(connection);
sett_conn_entry =
_sett_conn_entries_get(self, uuid) ?: _sett_conn_entries_create_and_add(self, uuid);

View file

@ -112,7 +112,7 @@ nms_ifcfg_rh_storage_new_connection(NMSIfcfgRHPlugin * plugin,
nm_assert(NM_IS_CONNECTION(connection_take));
nm_assert(_nm_connection_verify(connection_take, NULL) == NM_SETTING_VERIFY_SUCCESS);
nmtst_connection_assert_unchanging(connection_take);
nm_assert_connection_unchanging(connection_take);
self = _storage_new(plugin, nm_connection_get_uuid(connection_take), filename);
self->connection = connection_take;

View file

@ -323,7 +323,7 @@ load_eni_ifaces(NMSIfupdownPlugin *self)
NM_PRINT_FMT_QUOTED(local, " (", local->message, ")", ""));
sd = NULL;
} else {
nmtst_connection_assert_unchanging(connection);
nm_assert_connection_unchanging(connection);
uuid = nm_connection_get_uuid(connection);
if (!storage)

View file

@ -168,7 +168,7 @@ nms_keyfile_storage_new_connection(NMSKeyfilePlugin * plugin,
nm_assert(filename && filename[0] == '/');
nm_assert(storage_type >= NMS_KEYFILE_STORAGE_TYPE_RUN
&& storage_type <= _NMS_KEYFILE_STORAGE_TYPE_LIB_LAST);
nmtst_connection_assert_unchanging(connection_take);
nm_assert_connection_unchanging(connection_take);
self = _storage_new(plugin,
nm_connection_get_uuid(connection_take),

View file

@ -2115,23 +2115,23 @@ _nm_connection_ensure_normalized(NMConnection * connection,
#if NM_MORE_ASSERTS
static void
_nmtst_connection_unchanging_changed_cb(NMConnection *connection, gpointer user_data)
_nm_assert_connection_unchanging_changed_cb(NMConnection *connection, gpointer user_data)
{
nm_assert_not_reached();
}
static void
_nmtst_connection_unchanging_secrets_updated_cb(NMConnection *connection,
const char * setting_name,
gpointer user_data)
_nm_assert_connection_unchanging_secrets_updated_cb(NMConnection *connection,
const char * setting_name,
gpointer user_data)
{
nm_assert_not_reached();
}
const char _nmtst_connection_unchanging_user_data = 0;
const char _nm_assert_connection_unchanging_user_data = 0;
void
nmtst_connection_assert_unchanging(NMConnection *connection)
nm_assert_connection_unchanging(NMConnection *connection)
{
if (!connection)
return;
@ -2144,7 +2144,7 @@ nmtst_connection_assert_unchanging(NMConnection *connection)
0,
NULL,
NULL,
(gpointer) &_nmtst_connection_unchanging_user_data)
(gpointer) &_nm_assert_connection_unchanging_user_data)
!= 0) {
/* avoid connecting the assertion handler multiple times. */
return;
@ -2152,16 +2152,16 @@ nmtst_connection_assert_unchanging(NMConnection *connection)
g_signal_connect(connection,
NM_CONNECTION_CHANGED,
G_CALLBACK(_nmtst_connection_unchanging_changed_cb),
(gpointer) &_nmtst_connection_unchanging_user_data);
G_CALLBACK(_nm_assert_connection_unchanging_changed_cb),
(gpointer) &_nm_assert_connection_unchanging_user_data);
g_signal_connect(connection,
NM_CONNECTION_SECRETS_CLEARED,
G_CALLBACK(_nmtst_connection_unchanging_changed_cb),
(gpointer) &_nmtst_connection_unchanging_user_data);
G_CALLBACK(_nm_assert_connection_unchanging_changed_cb),
(gpointer) &_nm_assert_connection_unchanging_user_data);
g_signal_connect(connection,
NM_CONNECTION_SECRETS_UPDATED,
G_CALLBACK(_nmtst_connection_unchanging_secrets_updated_cb),
(gpointer) &_nmtst_connection_unchanging_user_data);
G_CALLBACK(_nm_assert_connection_unchanging_secrets_updated_cb),
(gpointer) &_nm_assert_connection_unchanging_user_data);
}
#endif
@ -2338,7 +2338,7 @@ nm_connection_need_secrets(NMConnection *connection, GPtrArray **hints)
if (!setting)
continue;
nm_assert(!setting_before || _nmtst_nm_setting_sort(setting_before, setting) < 0);
nm_assert(!setting_before || _nm_setting_sort_for_nm_assert(setting_before, setting) < 0);
nm_assert(!setting_before || _nm_setting_compare_priority(setting_before, setting) <= 0);
setting_before = setting;
@ -2660,7 +2660,7 @@ nm_connection_is_type(NMConnection *connection, const char *type)
}
int
_nmtst_nm_setting_sort(NMSetting *a, NMSetting *b)
_nm_setting_sort_for_nm_assert(NMSetting *a, NMSetting *b)
{
g_assert(NM_IS_SETTING(a));
g_assert(NM_IS_SETTING(b));
@ -2727,7 +2727,7 @@ nm_connection_get_settings(NMConnection *connection, guint *out_length)
NMSetting *setting = priv->settings[nm_meta_setting_types_by_priority[i]];
if (setting) {
nm_assert(j == 0 || _nmtst_nm_setting_sort(arr[j - 1], setting) < 0);
nm_assert(j == 0 || _nm_setting_sort_for_nm_assert(arr[j - 1], setting) < 0);
arr[j++] = setting;
}
}

View file

@ -175,7 +175,7 @@ void _nm_setting_ip_config_private_init(gpointer self, NMSettingIPConfigPrivate
NMSettingPriority _nm_setting_get_base_type_priority(NMSetting *setting);
int _nm_setting_compare_priority(gconstpointer a, gconstpointer b);
int _nmtst_nm_setting_sort(NMSetting *a, NMSetting *b);
int _nm_setting_sort_for_nm_assert(NMSetting *a, NMSetting *b);
/*****************************************************************************/

View file

@ -161,7 +161,7 @@ dispose(GObject *object)
#if NM_MORE_ASSERTS
g_signal_handlers_disconnect_by_data(object,
(gpointer) &_nmtst_connection_unchanging_user_data);
(gpointer) &_nm_assert_connection_unchanging_user_data);
#endif
nm_connection_clear_secrets(connection);

View file

@ -152,7 +152,7 @@ test_nm_meta_setting_types_by_priority(void)
for (j = 0; j < i; j++) {
NMSetting *other = arr->pdata[j];
if (_nmtst_nm_setting_sort(other, setting) >= 0) {
if (_nm_setting_sort_for_nm_assert(other, setting) >= 0) {
g_error("sort order for nm_meta_setting_types_by_priority[%d vs %d] is wrong: %s "
"should be before %s",
j,

View file

@ -272,11 +272,11 @@ gboolean _nm_connection_ensure_normalized(NMConnection * connection,
gboolean _nm_connection_remove_setting(NMConnection *connection, GType setting_type);
#if NM_MORE_ASSERTS
extern const char _nmtst_connection_unchanging_user_data;
void nmtst_connection_assert_unchanging(NMConnection *connection);
extern const char _nm_assert_connection_unchanging_user_data;
void nm_assert_connection_unchanging(NMConnection *connection);
#else
static inline void
nmtst_connection_assert_unchanging(NMConnection *connection)
nm_assert_connection_unchanging(NMConnection *connection)
{}
#endif