On Tue, Oct 07, 2008 at 12:25:31PM -0700, Andrew Morton wrote: > On Tue, 07 Oct 2008 14:19:14 +0200 > Boaz Harrosh <bharrosh@xxxxxxxxxxx> wrote: > > I feel the opposite. That is: put_unaligned_be32(block, SCpnt->cmnd + 2); > > is much more readable for me. Coming from the spec, I'm looking for a __b32 > > at offset CDB+2 and not: "SCpnt->cmnd[4] = (unsigned char) (block >> 8) & 0xff;" > > At offset CDB+4 the 2nd-or-3rd? order byte of "block". > > > > And for BE systems it's a gain. So please DO > > Yeah. For neophytes it's a good change. This: > > SCpnt->cmnd[2] = (unsigned char) (block >> 24) & 0xff; > SCpnt->cmnd[3] = (unsigned char) (block >> 16) & 0xff; > SCpnt->cmnd[4] = (unsigned char) (block >> 8) & 0xff; > SCpnt->cmnd[5] = (unsigned char) block & 0xff; > > is "wtf is that doing?", whereas this: > > put_unaligned_be32(block, SCpnt->cmnd + 2); > > is "ah, I know what that's doing". And scsi_put_u32(block, SCpnt->cmnd + 2); is even more obvious. You don't even need to know that SCSI is a big-endian protocol that way, just that the u32 is being written in the appropriate way for SCSI (see also ntohl et al). Also, SCSI needs to be able to read/write 'u24' quantities, which is potentially an ambiguous thing if you consider it in terms of byteswapping. I don't think we want a put_unaligned_be24() function, but we do want a scsi_put_u24(). -- Matthew Wilcox Intel Open Source Technology Centre "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step." -- 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