libnm: drop API nm_connection_get_setting_{6lowpan,sriov,wpan}()
Note that NMSettingEthtool and NMSettingMatch don't have such
functions either.
We have API
nm_connection_get_setting (NMConnection *, GType)
nm_connection_get_setting_by_name (NMConnection *, const char *)
which can be used generically, meaning: the requested setting type
is an argument to the function. That is generally more useful and
flexible.
Don't add API which duplicates existing functionality and is (arguably)
inferiour. Drop it now. This is an ABI/API break for the current development
cycle where the 1.14.0 API is still unstable. Indeed it's already after
1.14-rc1, which is ugly. But it's also unlikely that somebody already uses
this API/ABI and is badly impacted by this change.
Note that nm_connection_get_setting() and nm_connection_get_setting_by_name()
are slightly inconvenient in C still, because they usually require a cast.
We should fix that by changing the return type to "void *". Such
a change may be possibly any time without breaking API/ABI (almost, it'd
be an API change when taking a function pointer without casting).
(cherry picked from commit a10156f516
)
This commit is contained in:
@@ -1216,7 +1216,7 @@ _normalize_sriov_vf_order (NMConnection *self, GHashTable *parameters)
|
||||
{
|
||||
NMSettingSriov *s_sriov;
|
||||
|
||||
s_sriov = nm_connection_get_setting_sriov (self);
|
||||
s_sriov = NM_SETTING_SRIOV (nm_connection_get_setting (self, NM_TYPE_SETTING_SRIOV));
|
||||
if (!s_sriov)
|
||||
return FALSE;
|
||||
|
||||
@@ -2278,22 +2278,6 @@ nm_connection_get_virtual_device_description (NMConnection *connection)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* nm_connection_get_setting_6lowpan:
|
||||
* @connection: the #NMConnection
|
||||
*
|
||||
* A shortcut to return any #NMSetting6Lowpan the connection might contain.
|
||||
*
|
||||
* Returns: (transfer none): an #NMSetting6Lowpan if the connection contains one, otherwise %NULL
|
||||
*
|
||||
* Since: 1.14
|
||||
**/
|
||||
NMSetting6Lowpan *
|
||||
nm_connection_get_setting_6lowpan (NMConnection *connection)
|
||||
{
|
||||
return _connection_get_setting_check (connection, NM_TYPE_SETTING_6LOWPAN);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_connection_get_setting_802_1x:
|
||||
* @connection: the #NMConnection
|
||||
@@ -2700,22 +2684,6 @@ nm_connection_get_setting_serial (NMConnection *connection)
|
||||
return _connection_get_setting_check (connection, NM_TYPE_SETTING_SERIAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_connection_get_setting_sriov:
|
||||
* @connection: the #NMConnection
|
||||
*
|
||||
* A shortcut to return any #NMSettingSriov the connection might contain.
|
||||
*
|
||||
* Returns: (transfer none): an #NMSettingSriov if the connection contains one, otherwise %NULL
|
||||
*
|
||||
* Since: 1.14
|
||||
**/
|
||||
NMSettingSriov *
|
||||
nm_connection_get_setting_sriov (NMConnection *connection)
|
||||
{
|
||||
return _connection_get_setting_check (connection, NM_TYPE_SETTING_SRIOV);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_connection_get_setting_tc_config:
|
||||
* @connection: the #NMConnection
|
||||
@@ -2876,22 +2844,6 @@ nm_connection_get_setting_vlan (NMConnection *connection)
|
||||
return _connection_get_setting_check (connection, NM_TYPE_SETTING_VLAN);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_connection_get_setting_wpan:
|
||||
* @connection: the #NMConnection
|
||||
*
|
||||
* A shortcut to return any #NMSettingWpan the connection might contain.
|
||||
*
|
||||
* Returns: (transfer none): an #NMSettingWpan if the connection contains one, otherwise %NULL
|
||||
*
|
||||
* Since: 1.14
|
||||
**/
|
||||
NMSettingWpan *
|
||||
nm_connection_get_setting_wpan (NMConnection *connection)
|
||||
{
|
||||
return _connection_get_setting_check (connection, NM_TYPE_SETTING_WPAN);
|
||||
}
|
||||
|
||||
NMSettingBluetooth *
|
||||
_nm_connection_get_setting_bluetooth_for_nap (NMConnection *connection)
|
||||
{
|
||||
|
@@ -193,8 +193,6 @@ const char * nm_connection_get_connection_type (NMConnection *connection);
|
||||
gboolean nm_connection_is_virtual (NMConnection *connection);
|
||||
char * nm_connection_get_virtual_device_description (NMConnection *connection);
|
||||
|
||||
NM_AVAILABLE_IN_1_14
|
||||
NMSetting6Lowpan * nm_connection_get_setting_6lowpan (NMConnection *connection);
|
||||
NMSetting8021x * nm_connection_get_setting_802_1x (NMConnection *connection);
|
||||
NMSettingBluetooth * nm_connection_get_setting_bluetooth (NMConnection *connection);
|
||||
NMSettingBond * nm_connection_get_setting_bond (NMConnection *connection);
|
||||
@@ -231,8 +229,6 @@ NMSettingPppoe * nm_connection_get_setting_pppoe (NMConnec
|
||||
NM_AVAILABLE_IN_1_6
|
||||
NMSettingProxy * nm_connection_get_setting_proxy (NMConnection *connection);
|
||||
NMSettingSerial * nm_connection_get_setting_serial (NMConnection *connection);
|
||||
NM_AVAILABLE_IN_1_14
|
||||
NMSettingSriov * nm_connection_get_setting_sriov (NMConnection *connection);
|
||||
NM_AVAILABLE_IN_1_12
|
||||
NMSettingTCConfig * nm_connection_get_setting_tc_config (NMConnection *connection);
|
||||
NMSettingTun * nm_connection_get_setting_tun (NMConnection *connection);
|
||||
@@ -245,8 +241,6 @@ NMSettingWirelessSecurity *nm_connection_get_setting_wireless_security (NMConnec
|
||||
NMSettingVlan * nm_connection_get_setting_vlan (NMConnection *connection);
|
||||
NM_AVAILABLE_IN_1_2
|
||||
NMSettingVxlan * nm_connection_get_setting_vxlan (NMConnection *connection);
|
||||
NM_AVAILABLE_IN_1_14
|
||||
NMSettingWpan * nm_connection_get_setting_wpan (NMConnection *connection);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -1382,9 +1382,6 @@ libnm_1_12_2 {
|
||||
|
||||
libnm_1_14_0 {
|
||||
global:
|
||||
nm_connection_get_setting_6lowpan;
|
||||
nm_connection_get_setting_sriov;
|
||||
nm_connection_get_setting_wpan;
|
||||
nm_connection_multi_connect_get_type;
|
||||
nm_device_6lowpan_get_type;
|
||||
nm_device_wireguard_get_fwmark;
|
||||
|
@@ -114,7 +114,7 @@ create_and_realize (NMDevice *device,
|
||||
NMSetting6Lowpan *s_6lowpan;
|
||||
int parent_ifindex;
|
||||
|
||||
s_6lowpan = nm_connection_get_setting_6lowpan (connection);
|
||||
s_6lowpan = NM_SETTING_6LOWPAN (nm_connection_get_setting (connection, NM_TYPE_SETTING_6LOWPAN));
|
||||
g_return_val_if_fail (s_6lowpan, FALSE);
|
||||
|
||||
parent_ifindex = parent ? nm_device_get_ifindex (parent) : 0;
|
||||
@@ -192,7 +192,7 @@ complete_connection (NMDevice *device,
|
||||
NULL,
|
||||
TRUE);
|
||||
|
||||
s_6lowpan = nm_connection_get_setting_6lowpan (connection);
|
||||
s_6lowpan = NM_SETTING_6LOWPAN (nm_connection_get_setting (connection, NM_TYPE_SETTING_6LOWPAN));
|
||||
if (!s_6lowpan) {
|
||||
g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INVALID_CONNECTION,
|
||||
"A '6lowpan' setting is required.");
|
||||
@@ -215,7 +215,7 @@ complete_connection (NMDevice *device,
|
||||
static void
|
||||
update_connection (NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
NMSetting6Lowpan *s_6lowpan = nm_connection_get_setting_6lowpan (connection);
|
||||
NMSetting6Lowpan *s_6lowpan = NM_SETTING_6LOWPAN (nm_connection_get_setting (connection, NM_TYPE_SETTING_6LOWPAN));
|
||||
|
||||
if (!s_6lowpan) {
|
||||
s_6lowpan = (NMSetting6Lowpan *) nm_setting_6lowpan_new ();
|
||||
@@ -310,7 +310,7 @@ get_connection_parent (NMDeviceFactory *factory, NMConnection *connection)
|
||||
|
||||
g_return_val_if_fail (nm_connection_is_type (connection, NM_SETTING_6LOWPAN_SETTING_NAME), NULL);
|
||||
|
||||
s_6lowpan = nm_connection_get_setting_6lowpan (connection);
|
||||
s_6lowpan = NM_SETTING_6LOWPAN (nm_connection_get_setting (connection, NM_TYPE_SETTING_6LOWPAN));
|
||||
g_assert (s_6lowpan);
|
||||
|
||||
return nm_setting_6lowpan_get_parent (s_6lowpan);
|
||||
@@ -326,7 +326,7 @@ get_connection_iface (NMDeviceFactory *factory,
|
||||
|
||||
g_return_val_if_fail (nm_connection_is_type (connection, NM_SETTING_6LOWPAN_SETTING_NAME), NULL);
|
||||
|
||||
s_6lowpan = nm_connection_get_setting_6lowpan (connection);
|
||||
s_6lowpan = NM_SETTING_6LOWPAN (nm_connection_get_setting (connection, NM_TYPE_SETTING_6LOWPAN));
|
||||
g_assert (s_6lowpan);
|
||||
|
||||
if (!parent_iface)
|
||||
|
@@ -69,7 +69,7 @@ complete_connection (NMDevice *device,
|
||||
NULL,
|
||||
TRUE);
|
||||
|
||||
s_wpan = nm_connection_get_setting_wpan (connection);
|
||||
s_wpan = NM_SETTING_WPAN (nm_connection_get_setting (connection, NM_TYPE_SETTING_WPAN));
|
||||
if (!s_wpan) {
|
||||
g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INVALID_CONNECTION,
|
||||
"A 'wpan' setting is required.");
|
||||
@@ -82,7 +82,7 @@ complete_connection (NMDevice *device,
|
||||
static void
|
||||
update_connection (NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
NMSettingWpan *s_wpan = nm_connection_get_setting_wpan (connection);
|
||||
NMSettingWpan *s_wpan = NM_SETTING_WPAN (nm_connection_get_setting (connection, NM_TYPE_SETTING_WPAN));
|
||||
|
||||
if (!s_wpan) {
|
||||
s_wpan = (NMSettingWpan *) nm_setting_wpan_new ();
|
||||
@@ -99,7 +99,7 @@ check_connection_compatible (NMDevice *device, NMConnection *connection, GError
|
||||
if (!NM_DEVICE_CLASS (nm_device_wpan_parent_class)->check_connection_compatible (device, connection, error))
|
||||
return FALSE;
|
||||
|
||||
s_wpan = nm_connection_get_setting_wpan (connection);
|
||||
s_wpan = NM_SETTING_WPAN (nm_connection_get_setting (connection, NM_TYPE_SETTING_WPAN));
|
||||
|
||||
mac = nm_setting_wpan_get_mac_address (s_wpan);
|
||||
if (mac) {
|
||||
@@ -143,7 +143,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||
connection = nm_device_get_applied_connection (device);
|
||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
s_wpan = nm_connection_get_setting_wpan (connection);
|
||||
s_wpan = NM_SETTING_WPAN (nm_connection_get_setting (connection, NM_TYPE_SETTING_WPAN));
|
||||
g_return_val_if_fail (s_wpan, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
hwaddr = nm_platform_link_get_address (platform, ifindex, &hwaddr_len);
|
||||
|
@@ -2223,7 +2223,7 @@ write_sriov_setting (NMConnection *connection, shvarFile *ifcfg)
|
||||
|
||||
svUnsetAll (ifcfg, SV_KEY_TYPE_SRIOV_VF);
|
||||
|
||||
s_sriov = nm_connection_get_setting_sriov (connection);
|
||||
s_sriov = NM_SETTING_SRIOV (nm_connection_get_setting (connection, NM_TYPE_SETTING_SRIOV));
|
||||
if (s_sriov)
|
||||
num = nm_setting_sriov_get_total_vfs (s_sriov);
|
||||
if (num == 0) {
|
||||
|
@@ -9721,7 +9721,7 @@ test_sriov_read (void)
|
||||
|
||||
g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, "eth0");
|
||||
|
||||
s_sriov = nm_connection_get_setting_sriov (connection);
|
||||
s_sriov = NM_SETTING_SRIOV (nm_connection_get_setting (connection, NM_TYPE_SETTING_SRIOV));
|
||||
g_assert (s_sriov);
|
||||
|
||||
g_assert_cmpint (nm_setting_sriov_get_total_vfs (s_sriov), ==, 16);
|
||||
|
Reference in New Issue
Block a user