diff options
author | Holger Eitzenberger <holger@eitzenberger.org> | 2008-12-09 23:08:09 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-09 23:08:09 -0800 |
commit | 77afc92b7915b6bb21584474a429a04603ac8963 (patch) | |
tree | 12f9fd18dbc294a54a3d82531a5f8022cb601604 /drivers/net/bonding | |
parent | 58402054264fa33b405d1abcbcd8e528507aac1a (diff) | |
download | linux-77afc92b7915b6bb21584474a429a04603ac8963.tar.gz linux-77afc92b7915b6bb21584474a429a04603ac8963.tar.bz2 linux-77afc92b7915b6bb21584474a429a04603ac8963.zip |
bonding: use table for mode names
Use a small array in bond_mode_name() for the names, thus saving some
space:
before
text data bss dec hex filename
57736 9372 344 67452 1077c drivers/net/bonding/bonding.ko
after
text data bss dec hex filename
57441 9372 344 67157 10655 drivers/net/bonding/bonding.ko
Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 16cfe9efee7c..7f2ac499aac2 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -219,24 +219,20 @@ static void bond_deinit(struct net_device *bond_dev); static const char *bond_mode_name(int mode) { - switch (mode) { - case BOND_MODE_ROUNDROBIN : - return "load balancing (round-robin)"; - case BOND_MODE_ACTIVEBACKUP : - return "fault-tolerance (active-backup)"; - case BOND_MODE_XOR : - return "load balancing (xor)"; - case BOND_MODE_BROADCAST : - return "fault-tolerance (broadcast)"; - case BOND_MODE_8023AD: - return "IEEE 802.3ad Dynamic link aggregation"; - case BOND_MODE_TLB: - return "transmit load balancing"; - case BOND_MODE_ALB: - return "adaptive load balancing"; - default: + static const char *names[] = { + [BOND_MODE_ROUNDROBIN] = "load balancing (round-robin)", + [BOND_MODE_ACTIVEBACKUP] = "fault-tolerance (active-backup)", + [BOND_MODE_XOR] = "load balancing (xor)", + [BOND_MODE_BROADCAST] = "fault-tolerance (broadcast)", + [BOND_MODE_8023AD]= "IEEE 802.3ad Dynamic link aggregation", + [BOND_MODE_TLB] = "transmit load balancing", + [BOND_MODE_ALB] = "adaptive load balancing", + }; + + if (mode < 0 || mode > BOND_MODE_ALB) return "unknown"; - } + + return names[mode]; } /*---------------------------------- VLAN -----------------------------------*/ |