Re: [PATCH 07/37] block: use get/put_endian helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2008-05-30 at 09:22 +0200, Jens Axboe wrote:
> On Thu, May 29 2008, Harvey Harrison wrote:
> > Signed-off-by: Harvey Harrison <harvey.harrison@xxxxxxxxx>
> > ---
> >  drivers/block/cciss.c     |   11 +++++------
> >  drivers/block/paride/pd.c |    8 ++++----
> >  drivers/block/ub.c        |    4 ++--
> >  drivers/cdrom/cdrom.c     |    2 +-
> >  4 files changed, 12 insertions(+), 13 deletions(-)
> 
> What is the point of this? I'm honestly asking, what is the grand idea
> behind changing eg be32_to_cpu() to get_be32()?
> 

It started by introducing a put_be32(val, dest) to cover the idiom:

*(__be32 *)dest = cpu_to_be32(val);

I made put_be32 look like the existing put_unaligned_be32, essentially
adding an aligned helper.

Purely to make a symmetric api, I added the get_be32(ptr) which is
identical to be32_to_cpup (note the p suffix).

As part of this patchset I replaced places like:

be32_to_cpu(*(__be32 *)ptr) -> get_be32((__be32 *)ptr)

My initial version took a void *, but Al Viro requested I keep strict
typechecking, so I made it take a __be32 *.

This is profitable as some arches have an optimized return byte-swapped
from pointer implementation.  I could have just as easily replaced it
with be32_to_cpup.

Cheers,

Harvey

--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux