bond: drop _get_option_or_default() and use _get_option_normalized()

Currently nm_setting_bond_get_option_normalized() and
nm_setting_bond_get_option_or_default() are identical functions. As the
first one is exposed as public API and has a better name, let's drop the
second one.
This commit is contained in:
Fernando Fernandez Mancera
2022-05-06 10:27:48 +02:00
parent 5d5e27528d
commit 62f461ebeb
3 changed files with 4 additions and 15 deletions

View File

@@ -312,7 +312,7 @@ set_bond_attr_or_default(NMDevice *device, NMSettingBond *s_bond, const char *op
NMDeviceBond *self = NM_DEVICE_BOND(device); NMDeviceBond *self = NM_DEVICE_BOND(device);
const char *value; const char *value;
value = nm_setting_bond_get_option_or_default(s_bond, opt); value = nm_setting_bond_get_option_normalized(s_bond, opt);
if (!value) { if (!value) {
if (_LOGT_ENABLED(LOGD_BOND) && nm_setting_bond_get_option_by_name(s_bond, opt)) if (_LOGT_ENABLED(LOGD_BOND) && nm_setting_bond_get_option_by_name(s_bond, opt))
_LOGT(LOGD_BOND, "bond option '%s' not set as it conflicts with other options", opt); _LOGT(LOGD_BOND, "bond option '%s' not set as it conflicts with other options", opt);
@@ -346,7 +346,7 @@ set_bond_arp_ip_targets(NMDevice *device, NMSettingBond *s_bond)
set_arp_targets( set_arp_targets(
device, device,
cur_arp_ip_target, cur_arp_ip_target,
nm_setting_bond_get_option_or_default(s_bond, NM_SETTING_BOND_OPTION_ARP_IP_TARGET)); nm_setting_bond_get_option_normalized(s_bond, NM_SETTING_BOND_OPTION_ARP_IP_TARGET));
} }
static gboolean static gboolean
@@ -361,7 +361,7 @@ apply_bonding_config(NMDeviceBond *self)
s_bond = nm_device_get_applied_setting(device, NM_TYPE_SETTING_BOND); s_bond = nm_device_get_applied_setting(device, NM_TYPE_SETTING_BOND);
g_return_val_if_fail(s_bond, FALSE); g_return_val_if_fail(s_bond, FALSE);
mode_str = nm_setting_bond_get_option_or_default(s_bond, NM_SETTING_BOND_OPTION_MODE); mode_str = nm_setting_bond_get_option_normalized(s_bond, NM_SETTING_BOND_OPTION_MODE);
mode = _nm_setting_bond_mode_from_string(mode_str); mode = _nm_setting_bond_mode_from_string(mode_str);
g_return_val_if_fail(mode != NM_BOND_MODE_UNKNOWN, FALSE); g_return_val_if_fail(mode != NM_BOND_MODE_UNKNOWN, FALSE);
@@ -618,7 +618,7 @@ reapply_connection(NMDevice *device, NMConnection *con_old, NMConnection *con_ne
s_bond = nm_connection_get_setting_bond(con_new); s_bond = nm_connection_get_setting_bond(con_new);
g_return_if_fail(s_bond); g_return_if_fail(s_bond);
value = nm_setting_bond_get_option_or_default(s_bond, NM_SETTING_BOND_OPTION_MODE); value = nm_setting_bond_get_option_normalized(s_bond, NM_SETTING_BOND_OPTION_MODE);
mode = _nm_setting_bond_mode_from_string(value); mode = _nm_setting_bond_mode_from_string(value);
g_return_if_fail(mode != NM_BOND_MODE_UNKNOWN); g_return_if_fail(mode != NM_BOND_MODE_UNKNOWN);

View File

@@ -362,15 +362,6 @@ _bond_get_option_normalized(NMSettingBond *self, const char *option, gboolean ge
return _bond_get_option_or_default(self, option); return _bond_get_option_or_default(self, option);
} }
const char *
nm_setting_bond_get_option_or_default(NMSettingBond *self, const char *option)
{
g_return_val_if_fail(NM_IS_SETTING_BOND(self), NULL);
g_return_val_if_fail(option, NULL);
return _bond_get_option_normalized(self, option, FALSE);
}
static int static int
_atoi(const char *value) _atoi(const char *value)
{ {

View File

@@ -491,8 +491,6 @@ typedef enum {
NMBondOptionType _nm_setting_bond_get_option_type(NMSettingBond *setting, const char *name); NMBondOptionType _nm_setting_bond_get_option_type(NMSettingBond *setting, const char *name);
const char *nm_setting_bond_get_option_or_default(NMSettingBond *self, const char *option);
#define NM_BOND_AD_ACTOR_SYSTEM_DEFAULT "00:00:00:00:00:00" #define NM_BOND_AD_ACTOR_SYSTEM_DEFAULT "00:00:00:00:00:00"
/*****************************************************************************/ /*****************************************************************************/