diff options
author | Nikolay Aleksandrov <nikolay@redhat.com> | 2014-01-22 13:53:22 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-22 23:38:42 (GMT) |
commit | 1df6b6aa334c99b39f9366f4199b7f5e479a8899 (patch) | |
tree | db9fc82c70ba94d02bd646650b914cb910ff8f80 /drivers/net/bonding/bond_sysfs.c | |
parent | edf36b24c58dbbd5f2e708096537bf0a88ffa477 (diff) | |
download | linux-1df6b6aa334c99b39f9366f4199b7f5e479a8899.tar.xz |
bonding: convert fail_over_mac to use the new option API
This patch adds the necessary changes so fail_over_mac would use
the new bonding option API. Also fixes a trivial copy/paste error in
bond_check_params where the wrong variable was used for the error msg.
Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_sysfs.c')
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 83463fc..968c099 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c @@ -391,34 +391,25 @@ static ssize_t bonding_show_fail_over_mac(struct device *d, char *buf) { struct bonding *bond = to_bond(d); + struct bond_opt_value *val; - return sprintf(buf, "%s %d\n", - fail_over_mac_tbl[bond->params.fail_over_mac].modename, - bond->params.fail_over_mac); + val = bond_opt_get_val(BOND_OPT_FAIL_OVER_MAC, + bond->params.fail_over_mac); + + return sprintf(buf, "%s %d\n", val->string, bond->params.fail_over_mac); } static ssize_t bonding_store_fail_over_mac(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - int new_value, ret; struct bonding *bond = to_bond(d); + int ret; - new_value = bond_parse_parm(buf, fail_over_mac_tbl); - if (new_value < 0) { - pr_err("%s: Ignoring invalid fail_over_mac value %s.\n", - bond->dev->name, buf); - return -EINVAL; - } - - if (!rtnl_trylock()) - return restart_syscall(); - - ret = bond_option_fail_over_mac_set(bond, new_value); + ret = bond_opt_tryset_rtnl(bond, BOND_OPT_FAIL_OVER_MAC, (char *)buf); if (!ret) ret = count; - rtnl_unlock(); return ret; } |