Re: [RFC] Normalizing byteorder/unaligned access API

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

 



On Tue, 2008-10-07 at 17:33 -0600, Matthew Wilcox wrote:
> On Tue, Oct 07, 2008 at 03:39:25PM -0700, Harvey Harrison wrote:
> > As an example, in the write command handling in achba.c, a patch similar to the following
> > (assumes the existence of a __be24 type somewhere):
> 
> What type could be defined to be '__be24'?  Would
> 
> typedef struct {
> 	unsigned char data[3];
> } __be24;

__packed

> 
> do the trick?  It's not an integral type, but I'm not sure if that matters.
> 
> > +				cmnd_lba = unaligned_be24_to_cpup(&tmp->lba) & 0x001FFFFF;
> 
> That might be easier to read if you're using a 500-column terminal.  For
> the rest of us,
> 				cmnd_lba = scsi_get_u24(cmnd + 2) & 0x1FFFFF;
> is much easier to read.

Suggestions welcome on shorter common names for the unaligned helpers.

Cheers,

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