Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 75557
b: refs/heads/master
c: ece95f7
h: refs/heads/master
i:
  75555: 4dc82cb
v: v3
  • Loading branch information
Jay Vosburgh authored and Jeff Garzik committed Jan 18, 2008
1 parent 6f8a956 commit d448f9b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3b96c858fcb27120fcba222366180c3293393ccf
refs/heads/master: ece95f7fefe3afae19e641e1b3f5e64b00d5b948
23 changes: 16 additions & 7 deletions trunk/drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4540,18 +4540,27 @@ static void bond_free_all(void)

/*
* Convert string input module parms. Accept either the
* number of the mode or its string name.
* number of the mode or its string name. A bit complicated because
* some mode names are substrings of other names, and calls from sysfs
* may have whitespace in the name (trailing newlines, for example).
*/
int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl)
int bond_parse_parm(const char *buf, struct bond_parm_tbl *tbl)
{
int i;
int mode = -1, i, rv;
char modestr[BOND_MAX_MODENAME_LEN + 1] = { 0, };

rv = sscanf(buf, "%d", &mode);
if (!rv) {
rv = sscanf(buf, "%20s", modestr);
if (!rv)
return -1;
}

for (i = 0; tbl[i].modename; i++) {
if ((isdigit(*mode_arg) &&
tbl[i].mode == simple_strtol(mode_arg, NULL, 0)) ||
(strcmp(mode_arg, tbl[i].modename) == 0)) {
if (mode == tbl[i].mode)
return tbl[i].mode;
if (strcmp(modestr, tbl[i].modename) == 0)
return tbl[i].mode;
}
}

return -1;
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/net/bonding/bond_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ static ssize_t bonding_store_mode(struct device *d,
goto out;
}

new_value = bond_parse_parm((char *)buf, bond_mode_tbl);
new_value = bond_parse_parm(buf, bond_mode_tbl);
if (new_value < 0) {
printk(KERN_ERR DRV_NAME
": %s: Ignoring invalid mode value %.*s.\n",
Expand Down Expand Up @@ -478,7 +478,7 @@ static ssize_t bonding_store_xmit_hash(struct device *d,
goto out;
}

new_value = bond_parse_parm((char *)buf, xmit_hashtype_tbl);
new_value = bond_parse_parm(buf, xmit_hashtype_tbl);
if (new_value < 0) {
printk(KERN_ERR DRV_NAME
": %s: Ignoring invalid xmit hash policy value %.*s.\n",
Expand Down Expand Up @@ -518,7 +518,7 @@ static ssize_t bonding_store_arp_validate(struct device *d,
int new_value;
struct bonding *bond = to_bond(d);

new_value = bond_parse_parm((char *)buf, arp_validate_tbl);
new_value = bond_parse_parm(buf, arp_validate_tbl);
if (new_value < 0) {
printk(KERN_ERR DRV_NAME
": %s: Ignoring invalid arp_validate value %s\n",
Expand Down Expand Up @@ -941,7 +941,7 @@ static ssize_t bonding_store_lacp(struct device *d,
goto out;
}

new_value = bond_parse_parm((char *)buf, bond_lacp_tbl);
new_value = bond_parse_parm(buf, bond_lacp_tbl);

if ((new_value == 1) || (new_value == 0)) {
bond->params.lacp_fast = new_value;
Expand Down
4 changes: 3 additions & 1 deletion trunk/drivers/net/bonding/bonding.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ struct bond_parm_tbl {
int mode;
};

#define BOND_MAX_MODENAME_LEN 20

struct vlan_entry {
struct list_head vlan_list;
__be32 vlan_ip;
Expand Down Expand Up @@ -314,7 +316,7 @@ void bond_mii_monitor(struct work_struct *);
void bond_loadbalance_arp_mon(struct work_struct *);
void bond_activebackup_arp_mon(struct work_struct *);
void bond_set_mode_ops(struct bonding *bond, int mode);
int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl);
int bond_parse_parm(const char *mode_arg, struct bond_parm_tbl *tbl);
void bond_select_active_slave(struct bonding *bond);
void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
void bond_register_arp(struct bonding *);
Expand Down

0 comments on commit d448f9b

Please sign in to comment.