lkml.org 
[lkml]   [2008]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] 24-bit types: typedef and functions for accessing 3-byte arrays as integers
Chris Leech wrote:
> Both iSCSI and Fibre Channel make use of 24-bit big-endian values in
> frame headers. This patch defines __be24 and __le24 typedefs for a
> structure wrapped around a 3-byte array, and functions to convert back and
> forth to a 32-bit integer.
>
> The undefs in iscsi_proto.h are because of the different calling
> convention for the existing hton24 macro in the iSCSI code. iSCSI will
> be converted in a subsequent patch.
>
> Changes from last posting:
>
> Switched from preprocessor macros to inline functions. The generated assembly
> is the same with gcc 4.1.2 as long as the function is actually inlined. I
> applied the __always_inline attribute to all of these, after seeing that with
> one of my test kernel configurations they were not being inlined without it
> and the generated instructions in the iSCSI code could be considered a
> regression from the existing macro.
>
> Signed-off-by: Chris Leech <christopher.leech@intel.com>
> ---
>
> include/linux/byteorder.h | 44 ++++++++++++++++++++++++++++++++++++
> include/linux/byteorder/generic.h | 45 +++++++++++++++++++++++++++++++++++++
> include/linux/types.h | 2 ++
> include/scsi/iscsi_proto.h | 2 ++
> 4 files changed, 93 insertions(+), 0 deletions(-)
>
<snip>

Thanks! Personally I like this much better.

Sorry to be nit picking but again I hate that double implementation thing.
From what I could see, and considering a few of the ARCHs you mentioned,
it looks to me like <linux/swab.h> is common to the two implementations,
(old and new). Perhaps put the "__xxx" implementations in swab.h and
only the xxx => __xxx switching in the double byteorder headers, which
fits better with the surrounding style of these headers.

Thanks
Boaz


\
 
 \ /
  Last update: 2008-09-10 14:59    [W:0.976 / U:0.660 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site