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  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]
Date:	Sat, 13 Sep 2014 20:43:09 -0700
From:	Raghuram Kothakota <Raghuram.Kothakota@...cle.com>
To:	David Miller <davem@...emloft.net>
Cc:	david.stevens@...cle.com, netdev@...r.kernel.org
Subject: Re: [PATCHv3 net-next 1/3] sunvnet: upgrade to VIO protocol version 1.6


On Sep 13, 2014, at 8:01 PM, David Miller <davem@...emloft.net> wrote:

> From: David L Stevens <david.stevens@...cle.com>
> Date: Sat, 13 Sep 2014 22:39:25 -0400
> 
>> 
>> 
>> On 09/13/2014 04:18 PM, David Miller wrote:
>>> From: David L Stevens <david.stevens@...cle.com>
>> 
>>> static inline bool vio_version_before(struct vio_driver_state *vio,
>>> 				      u16 major, u16 minor)
>>> {
>>> 	u32 have = (u32)vio->major << 16 | vio->minor;
>>> 	u32 want = (u32)major << 16 | minor;
>>> 
>>> 	return have < want;
>>> }
>>> static inline bool vio_version_after_eq(struct vio_driver_state *vio,
>>> 					u16 major, u16 minor)
>>> {
>>> 	u32 have = (u32)vio->major << 16 | vio->minor;
>>> 	u32 want = (u32)major << 16 | minor;
>>> 
>>> 	return have >= want;
>>> }
>>> 
>>> Something like that.
>> 
>> Sure. I was thinking about something like:
>> 
>> #define VIO_VER(major, minor)	(((major)<<16)|(minor))
>> 
>> change the version struct to a 32-bit int, and do things like:
>> 
>> 	if (vio->ver > VIO_VER(1,6)) {
>> 
>> unless you have a preference. (?)
> 
> I hate wasting space in a structure just to avoid some harmless
> casting in a helper function that is simply trying to optimize
> a comparison.
> 
> That's why I suggested the inline helpers above, which arguments
> are strongly typed.

IMO, it would be more readable if we introduce the helper functions
that check for a specific feature than a specific version number
and hide the version number detail inside that helper function. Otherwise,
it will be harder to follow each version number check and why it is
being done. 

-Raghuram

> --
> 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

--
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