libnm,core: drop internal function _nm_connection_get_setting_bond_port()

These type-specific getters are not very useful. _nm_connection_get_setting() is
better because the setting type is a parameter so they can be used more generically.
Have less code and use generic helpers.
This commit is contained in:
Thomas Haller 2021-08-26 22:53:48 +02:00
parent e3924a3ab6
commit 222c070412
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
5 changed files with 3 additions and 11 deletions

View file

@ -447,7 +447,7 @@ enslave_slave(NMDevice *device, NMDevice *port, NMConnection *connection, gboole
return FALSE;
}
s_port = _nm_connection_get_setting_bond_port(connection);
s_port = _nm_connection_get_setting(connection, NM_TYPE_SETTING_BOND_PORT);
commit_port_options(device, port, s_port);

View file

@ -1894,7 +1894,7 @@ write_bond_port_setting(NMConnection *connection, shvarFile *ifcfg)
{
NMSettingBondPort *s_port;
s_port = _nm_connection_get_setting_bond_port(connection);
s_port = _nm_connection_get_setting(connection, NM_TYPE_SETTING_BOND_PORT);
if (s_port)
svSetValueInt64(ifcfg, "BOND_PORT_QUEUE_ID", nm_setting_bond_port_get_queue_id(s_port));
}

View file

@ -9464,7 +9464,7 @@ test_read_bond_port(void)
g_assert_cmpstr(nm_setting_connection_get_master(s_con), ==, "bond99");
g_assert_cmpstr(nm_setting_connection_get_slave_type(s_con), ==, NM_SETTING_BOND_SETTING_NAME);
s_port = _nm_connection_get_setting_bond_port(connection);
s_port = _nm_connection_get_setting(connection, NM_TYPE_SETTING_BOND_PORT);
g_assert(s_port);
g_assert_cmpuint(nm_setting_bond_port_get_queue_id(s_port), ==, 1);
}

View file

@ -3771,9 +3771,3 @@ nm_connection_default_init(NMConnectionInterface *iface)
G_TYPE_NONE,
0);
}
NMSettingBondPort *
_nm_connection_get_setting_bond_port(NMConnection *connection)
{
return _connection_get_setting_by_meta_type_check(connection, NM_META_SETTING_TYPE_BOND_PORT);
}

View file

@ -986,6 +986,4 @@ gboolean _nm_ip_tunnel_mode_is_layer2(NMIPTunnelMode mode);
GPtrArray *_nm_setting_ip_config_get_dns_array(NMSettingIPConfig *setting);
NMSettingBondPort *_nm_connection_get_setting_bond_port(NMConnection *connection);
#endif