summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrançois Romieu <romieu@fr.zoreil.com>2003-08-19 07:23:59 -0700
committerStephen Hemminger <shemminger@osdl.org>2003-08-19 07:23:59 -0700
commit55ea13dfca431c56908c730712e0a8fed08bf111 (patch)
treefe82abd51277b92af0d42f18fa0e415d0cb56345
parentb61458a49793e1c085f2e67913da5ab0dc11f1f3 (diff)
[IRDA]: style: Separate data from code in irlan_print_filter().
-rw-r--r--net/irda/irlan/irlan_filter.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/net/irda/irlan/irlan_filter.c b/net/irda/irlan/irlan_filter.c
index ef9c1f40b9ca..87e4601231f6 100644
--- a/net/irda/irlan/irlan_filter.c
+++ b/net/irda/irlan/irlan_filter.c
@@ -218,23 +218,29 @@ void irlan_check_command_param(struct irlan_cb *self, char *param, char *value)
*
*/
#ifdef CONFIG_PROC_FS
+#define MASK2STR(m,s) { .mask = m, .str = s }
+
void irlan_print_filter(struct seq_file *seq, int filter_type)
{
- if (filter_type & IRLAN_DIRECTED)
- seq_printf(seq, "%s", "DIRECTED ");
- if (filter_type & IRLAN_FUNCTIONAL)
- seq_printf(seq, "%s", "FUNCTIONAL ");
- if (filter_type & IRLAN_GROUP)
- seq_printf(seq, "%s", "GROUP ");
- if (filter_type & IRLAN_MAC_FRAME)
- seq_printf(seq, "%s", "MAC_FRAME ");
- if (filter_type & IRLAN_MULTICAST)
- seq_printf(seq, "%s", "MULTICAST ");
- if (filter_type & IRLAN_BROADCAST)
- seq_printf(seq, "%s", "BROADCAST ");
- if (filter_type & IRLAN_IPX_SOCKET)
- seq_printf(seq, "%s", "IPX_SOCKET");
-
+ static struct {
+ int mask;
+ const char *str;
+ } filter_mask2str[] = {
+ MASK2STR(IRLAN_DIRECTED, "DIRECTED"),
+ MASK2STR(IRLAN_FUNCTIONAL, "FUNCTIONAL"),
+ MASK2STR(IRLAN_GROUP, "GROUP"),
+ MASK2STR(IRLAN_MAC_FRAME, "MAC_FRAME"),
+ MASK2STR(IRLAN_MULTICAST, "MULTICAST"),
+ MASK2STR(IRLAN_BROADCAST, "BROADCAST"),
+ MASK2STR(IRLAN_IPX_SOCKET, "IPX_SOCKET"),
+ MASK2STR(0, NULL)
+ }, *p;
+
+ for (p = filter_mask2str; p->str; p++) {
+ if (filter_type & p->mask)
+ seq_printf(seq, "%s ", p->str);
+ }
seq_putc(seq, '\n');
}
+#undef MASK2STR
#endif