Re: [RFC PATCH-mm] scsi: use unaligned endian helpers rather than byteshifting

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

 



On Wed, 2008-12-03 at 14:33 -0600, James Bottomley wrote:
> On Wed, 2008-12-03 at 11:37 -0800, Harvey Harrison wrote:
> > Signed-off-by: Harvey Harrison <harvey.harrison@xxxxxxxxx>
> > ---
> > Depends on the unaligned access work in -mm.  Just so you can see what the
> > transition would look like.  See in particular the READ/WRITE6 bits
> > as just reading the full 32 bits and masking ends up being better on
> > lots of arches. (x86/powerpc/SH at least)
> 
> Well, as I've said before, I'm not particularly interested in moving
> SCSI over to the generic accessors.  It does look like the proponents of
> SCSI specific ones gave up as well (most driver writers even open coded
> their own over the u32 one we already have).

Well, I thought this over some more, since it seems that the offset
provides useful information to scsi-developers, how about an interface
like:

u16 load_be16_offset(u8 *buf, unsigned int offset)
u32 load_be24_offset(u8 *buf, unsigned int offset)
u32 load_be32_offset(u8 *buf, unsigned int offset)
u64 load_be64_offset(u8 *buf, unsigned int offset)

Which reads the given value in the given endianness from a (positive)
offset?  Since there don't exist any common structs in scsi-land that
would allow sparse checking and you'd have to have casts everywhere,
this might be a nice compromise.

Document that these guys make no alignment assumptions and use the
generic accessors inside...they are simple enough that they would
fit in the common code and be useful elsewhere as well.

What do you think of that James/Matthew?

Harvey


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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux