From: holger@eitzenberger.org
To: Jay Vosburgh <fubar@us.ibm.com>
Cc: netdev@vger.kernel.org
Subject: [patch 2/7] bonding: use table for mode names
Date: Tue, 09 Dec 2008 21:07:52 +0100 [thread overview]
Message-ID: <20081209201446.222212807@eitzenberger.org> (raw)
In-Reply-To: 20081209200750.490739902@eitzenberger.org
[-- Attachment #1: bonding-use-table-for-3ad-mode-names.diff --]
[-- Type: text/plain, Size: 1879 bytes --]
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>
Index: bonding-2.6/drivers/net/bonding/bond_main.c
===================================================================
--- bonding-2.6.orig/drivers/net/bonding/bond_main.c 2008-12-08 20:55:52.000000000 +0100
+++ bonding-2.6/drivers/net/bonding/bond_main.c 2008-12-08 22:16:02.000000000 +0100
@@ -219,24 +219,20 @@
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 -----------------------------------*/
--
next prev parent reply other threads:[~2008-12-09 20:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-09 20:07 [patch 0/7] [RFC] bonding updates to net-next-2.6 holger
2008-12-09 20:07 ` [patch 1/7] bonding: add and use bond_is_lb() holger
2008-12-10 7:07 ` David Miller
2008-12-09 20:07 ` holger [this message]
2008-12-10 7:08 ` [patch 2/7] bonding: use table for mode names David Miller
2008-12-09 20:07 ` [patch 3/7] bonding: fix compile error if debug enabled holger
2008-12-10 7:09 ` David Miller
2008-12-09 20:07 ` [patch 4/7] bonding: use pr_debug instead of own macros holger
2008-12-10 7:09 ` David Miller
2008-12-09 20:07 ` [patch 5/7] bonding: remove duplicate declarations holger
2008-12-10 7:09 ` David Miller
2008-12-09 20:07 ` [patch 6/7] bonding: make tbl argument to bond_parse_parm() const holger
2008-12-10 7:10 ` David Miller
2008-12-09 20:07 ` [patch 7/7] bonding: turn all bond_parm_tbls const holger
2008-12-10 7:10 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081209201446.222212807@eitzenberger.org \
--to=holger@eitzenberger.org \
--cc=fubar@us.ibm.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).