lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20130726.135330.232525167518786234.davem@davemloft.net>
Date:	Fri, 26 Jul 2013 13:53:30 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	joe@...ches.com
Cc:	shhuiw@...il.com, fubar@...ibm.com, andy@...yhouse.net,
	netdev@...r.kernel.org
Subject: Re: [PATCH] bonding: use pre-defined macro in bond_mode_name
 instead of magic number 0

From: Joe Perches <joe@...ches.com>
Date: Wed, 24 Jul 2013 00:10:19 -0700

> Probably be simpler, less confusing, and more normal style
> to use a switch case.
> 
> 	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:
> 		return "unknown";
> 	}

I have to say that I do not prefer this approach.

I have a good idea what the compiler ends up outputting for the above,
and the "indexed table of strings" approach is much less code.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ