platform/trivial: rename sysctl slave/master option functions
These function purely operate on sysctl by reading/writing to file. Rename them to reflect that they are not related to netlink parts of platform.
This commit is contained in:
@@ -130,7 +130,7 @@ set_bond_attr (NMDevice *device, const char *attr, const char *value)
|
|||||||
gboolean ret;
|
gboolean ret;
|
||||||
int ifindex = nm_device_get_ifindex (device);
|
int ifindex = nm_device_get_ifindex (device);
|
||||||
|
|
||||||
ret = nm_platform_master_set_option (NM_PLATFORM_GET, ifindex, attr, value);
|
ret = nm_platform_sysctl_master_set_option (NM_PLATFORM_GET, ifindex, attr, value);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
_LOGW (LOGD_HW, "failed to set bonding attribute '%s' to '%s'", attr, value);
|
_LOGW (LOGD_HW, "failed to set bonding attribute '%s' to '%s'", attr, value);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -164,7 +164,7 @@ update_connection (NMDevice *device, NMConnection *connection)
|
|||||||
/* Read bond options from sysfs and update the Bond setting to match */
|
/* Read bond options from sysfs and update the Bond setting to match */
|
||||||
options = nm_setting_bond_get_valid_options (s_bond);
|
options = nm_setting_bond_get_valid_options (s_bond);
|
||||||
while (options && *options) {
|
while (options && *options) {
|
||||||
gs_free char *value = nm_platform_master_get_option (NM_PLATFORM_GET, ifindex, *options);
|
gs_free char *value = nm_platform_sysctl_master_get_option (NM_PLATFORM_GET, ifindex, *options);
|
||||||
const char *defvalue = nm_setting_bond_get_option_default (s_bond, *options);
|
const char *defvalue = nm_setting_bond_get_option_default (s_bond, *options);
|
||||||
|
|
||||||
if (value && !ignore_if_zero (*options, value) && (g_strcmp0 (value, defvalue) != 0)) {
|
if (value && !ignore_if_zero (*options, value) && (g_strcmp0 (value, defvalue) != 0)) {
|
||||||
@@ -320,7 +320,7 @@ apply_bonding_config (NMDevice *device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Clear ARP targets */
|
/* Clear ARP targets */
|
||||||
contents = nm_platform_master_get_option (NM_PLATFORM_GET, ifindex, "arp_ip_target");
|
contents = nm_platform_sysctl_master_get_option (NM_PLATFORM_GET, ifindex, "arp_ip_target");
|
||||||
set_arp_targets (device, contents, " \n", "-");
|
set_arp_targets (device, contents, " \n", "-");
|
||||||
g_free (contents);
|
g_free (contents);
|
||||||
|
|
||||||
|
@@ -199,9 +199,9 @@ commit_option (NMDevice *device, NMSetting *setting, const Option *option, gbool
|
|||||||
|
|
||||||
value = g_strdup_printf ("%u", uval);
|
value = g_strdup_printf ("%u", uval);
|
||||||
if (slave)
|
if (slave)
|
||||||
nm_platform_slave_set_option (NM_PLATFORM_GET, ifindex, option->sysname, value);
|
nm_platform_sysctl_slave_set_option (NM_PLATFORM_GET, ifindex, option->sysname, value);
|
||||||
else
|
else
|
||||||
nm_platform_master_set_option (NM_PLATFORM_GET, ifindex, option->sysname, value);
|
nm_platform_sysctl_master_set_option (NM_PLATFORM_GET, ifindex, option->sysname, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -245,7 +245,7 @@ update_connection (NMDevice *device, NMConnection *connection)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (option = master_options; option->name; option++) {
|
for (option = master_options; option->name; option++) {
|
||||||
gs_free char *str = nm_platform_master_get_option (NM_PLATFORM_GET, ifindex, option->sysname);
|
gs_free char *str = nm_platform_sysctl_master_get_option (NM_PLATFORM_GET, ifindex, option->sysname);
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
if (str) {
|
if (str) {
|
||||||
@@ -284,7 +284,7 @@ master_update_slave_connection (NMDevice *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (option = slave_options; option->name; option++) {
|
for (option = slave_options; option->name; option++) {
|
||||||
gs_free char *str = nm_platform_slave_get_option (NM_PLATFORM_GET, ifindex_slave, option->sysname);
|
gs_free char *str = nm_platform_sysctl_slave_get_option (NM_PLATFORM_GET, ifindex_slave, option->sysname);
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
if (str) {
|
if (str) {
|
||||||
|
@@ -1637,7 +1637,7 @@ nm_platform_link_tun_add (NMPlatform *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
nm_platform_master_set_option (NMPlatform *self, int ifindex, const char *option, const char *value)
|
nm_platform_sysctl_master_set_option (NMPlatform *self, int ifindex, const char *option, const char *value)
|
||||||
{
|
{
|
||||||
_CHECK_SELF (self, klass, FALSE);
|
_CHECK_SELF (self, klass, FALSE);
|
||||||
|
|
||||||
@@ -1650,7 +1650,7 @@ nm_platform_master_set_option (NMPlatform *self, int ifindex, const char *option
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
nm_platform_master_get_option (NMPlatform *self, int ifindex, const char *option)
|
nm_platform_sysctl_master_get_option (NMPlatform *self, int ifindex, const char *option)
|
||||||
{
|
{
|
||||||
_CHECK_SELF (self, klass, NULL);
|
_CHECK_SELF (self, klass, NULL);
|
||||||
|
|
||||||
@@ -1662,7 +1662,7 @@ nm_platform_master_get_option (NMPlatform *self, int ifindex, const char *option
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
nm_platform_slave_set_option (NMPlatform *self, int ifindex, const char *option, const char *value)
|
nm_platform_sysctl_slave_set_option (NMPlatform *self, int ifindex, const char *option, const char *value)
|
||||||
{
|
{
|
||||||
_CHECK_SELF (self, klass, FALSE);
|
_CHECK_SELF (self, klass, FALSE);
|
||||||
|
|
||||||
@@ -1675,7 +1675,7 @@ nm_platform_slave_set_option (NMPlatform *self, int ifindex, const char *option,
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
nm_platform_slave_get_option (NMPlatform *self, int ifindex, const char *option)
|
nm_platform_sysctl_slave_get_option (NMPlatform *self, int ifindex, const char *option)
|
||||||
{
|
{
|
||||||
_CHECK_SELF (self, klass, NULL);
|
_CHECK_SELF (self, klass, NULL);
|
||||||
|
|
||||||
|
@@ -757,10 +757,10 @@ gboolean nm_platform_link_supports_vlans (NMPlatform *self, int ifindex);
|
|||||||
gboolean nm_platform_link_enslave (NMPlatform *self, int master, int slave);
|
gboolean nm_platform_link_enslave (NMPlatform *self, int master, int slave);
|
||||||
gboolean nm_platform_link_release (NMPlatform *self, int master, int slave);
|
gboolean nm_platform_link_release (NMPlatform *self, int master, int slave);
|
||||||
|
|
||||||
gboolean nm_platform_master_set_option (NMPlatform *self, int ifindex, const char *option, const char *value);
|
gboolean nm_platform_sysctl_master_set_option (NMPlatform *self, int ifindex, const char *option, const char *value);
|
||||||
char *nm_platform_master_get_option (NMPlatform *self, int ifindex, const char *option);
|
char *nm_platform_sysctl_master_get_option (NMPlatform *self, int ifindex, const char *option);
|
||||||
gboolean nm_platform_slave_set_option (NMPlatform *self, int ifindex, const char *option, const char *value);
|
gboolean nm_platform_sysctl_slave_set_option (NMPlatform *self, int ifindex, const char *option, const char *value);
|
||||||
char *nm_platform_slave_get_option (NMPlatform *self, int ifindex, const char *option);
|
char *nm_platform_sysctl_slave_get_option (NMPlatform *self, int ifindex, const char *option);
|
||||||
|
|
||||||
const NMPObject *nm_platform_link_get_lnk (NMPlatform *self, int ifindex, NMLinkType link_type, const NMPlatformLink **out_link);
|
const NMPObject *nm_platform_link_get_lnk (NMPlatform *self, int ifindex, NMLinkType link_type, const NMPlatformLink **out_link);
|
||||||
const NMPlatformLnkGre *nm_platform_link_get_lnk_gre (NMPlatform *self, int ifindex, const NMPlatformLink **out_link);
|
const NMPlatformLnkGre *nm_platform_link_get_lnk_gre (NMPlatform *self, int ifindex, const NMPlatformLink **out_link);
|
||||||
|
@@ -274,8 +274,8 @@ test_slave (int master, int type, SignalData *master_changed)
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case NM_LINK_TYPE_BRIDGE:
|
case NM_LINK_TYPE_BRIDGE:
|
||||||
if (nmtstp_is_sysfs_writable ()) {
|
if (nmtstp_is_sysfs_writable ()) {
|
||||||
g_assert (nm_platform_slave_set_option (NM_PLATFORM_GET, ifindex, "priority", "789"));
|
g_assert (nm_platform_sysctl_slave_set_option (NM_PLATFORM_GET, ifindex, "priority", "789"));
|
||||||
value = nm_platform_slave_get_option (NM_PLATFORM_GET, ifindex, "priority");
|
value = nm_platform_sysctl_slave_get_option (NM_PLATFORM_GET, ifindex, "priority");
|
||||||
g_assert_cmpstr (value, ==, "789");
|
g_assert_cmpstr (value, ==, "789");
|
||||||
g_free (value);
|
g_free (value);
|
||||||
}
|
}
|
||||||
@@ -367,16 +367,16 @@ test_software (NMLinkType link_type, const char *link_typename)
|
|||||||
switch (link_type) {
|
switch (link_type) {
|
||||||
case NM_LINK_TYPE_BRIDGE:
|
case NM_LINK_TYPE_BRIDGE:
|
||||||
if (nmtstp_is_sysfs_writable ()) {
|
if (nmtstp_is_sysfs_writable ()) {
|
||||||
g_assert (nm_platform_master_set_option (NM_PLATFORM_GET, ifindex, "forward_delay", "789"));
|
g_assert (nm_platform_sysctl_master_set_option (NM_PLATFORM_GET, ifindex, "forward_delay", "789"));
|
||||||
value = nm_platform_master_get_option (NM_PLATFORM_GET, ifindex, "forward_delay");
|
value = nm_platform_sysctl_master_get_option (NM_PLATFORM_GET, ifindex, "forward_delay");
|
||||||
g_assert_cmpstr (value, ==, "789");
|
g_assert_cmpstr (value, ==, "789");
|
||||||
g_free (value);
|
g_free (value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NM_LINK_TYPE_BOND:
|
case NM_LINK_TYPE_BOND:
|
||||||
if (nmtstp_is_sysfs_writable ()) {
|
if (nmtstp_is_sysfs_writable ()) {
|
||||||
g_assert (nm_platform_master_set_option (NM_PLATFORM_GET, ifindex, "mode", "active-backup"));
|
g_assert (nm_platform_sysctl_master_set_option (NM_PLATFORM_GET, ifindex, "mode", "active-backup"));
|
||||||
value = nm_platform_master_get_option (NM_PLATFORM_GET, ifindex, "mode");
|
value = nm_platform_sysctl_master_get_option (NM_PLATFORM_GET, ifindex, "mode");
|
||||||
/* When reading back, the output looks slightly different. */
|
/* When reading back, the output looks slightly different. */
|
||||||
g_assert (g_str_has_prefix (value, "active-backup"));
|
g_assert (g_str_has_prefix (value, "active-backup"));
|
||||||
g_free (value);
|
g_free (value);
|
||||||
|
Reference in New Issue
Block a user