cdrom.h (was Re: [RFC] Splitting kernel headers...)

From: Matthew Wilcox
Date: Tue Nov 30 2004 - 21:04:34 EST


On Tue, Nov 30, 2004 at 11:50:56PM +0000, David Woodhouse wrote:
> Now, there are cases (like _perhaps_ byteorder.h) where we should
> probably allow this kind of 'abuse' to continue because it's fairly
> harmless and it does actually _work_.

OK, time for my pet peeve: linux/cdrom.h.

#include <asm/byteorder.h>

[...]

/* for CDROM_PACKET_COMMAND ioctl */
struct cdrom_generic_command
{
[...]
struct request_sense __user *sense;
[...]
}

struct request_sense {
#if defined(__BIG_ENDIAN_BITFIELD)
__u8 valid : 1;
__u8 error_code : 7;
#elif defined(__LITTLE_ENDIAN_BITFIELD)
__u8 error_code : 7;
__u8 valid : 1;
#endif
__u8 segment_number;
[...]
}

At least one architecture's asm/byteorder.h has been C++-incompatible
in the past (I forget what; it was 2 years ago that I cared about it).
So to fix this, we need a asm-*/user/byteorder.h that only describes
the endianness. Except ... what about mips/mipsel?

--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/