linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Harvey Harrison <harvey.harrison@gmail.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Matthew Wilcox <matthew@wil.cx>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-scsi <linux-scsi@vger.kernel.org>
Subject: Re: [RFC PATCH-mm] scsi: use unaligned endian helpers rather than byteshifting
Date: Fri, 05 Dec 2008 01:07:18 -0800	[thread overview]
Message-ID: <1228468038.6166.14.camel@brick> (raw)
In-Reply-To: <1228336386.5551.66.camel@localhost.localdomain>

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@gmail.com>
> > ---
> > 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



      reply	other threads:[~2008-12-05  9:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-03 19:37 [RFC PATCH-mm] scsi: use unaligned endian helpers rather than byteshifting Harvey Harrison
2008-12-03 20:15 ` Matthew Wilcox
2008-12-03 20:27   ` Harvey Harrison
2008-12-03 20:33 ` James Bottomley
2008-12-05  9:07   ` Harvey Harrison [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1228468038.6166.14.camel@brick \
    --to=harvey.harrison@gmail.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=matthew@wil.cx \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).