Re: [PATCH 012/196] nozomi driver

Stefan Richter
2008-01-25T11:56:37Z

On 1/25/2008 9:31 AM, Jan Engelhardt wrote:
> On Jan 24 2008 23:09, Greg Kroah-Hartman wrote:
>>+#ifdef __BIG_ENDIAN
>>+/* Big endian */
>>+
>>+struct toggles {
>>+ unsigned enabled:5; /*
>>+ * Toggle fields are valid if enabled is 0,
>>+ * else A-channels must always be used.
>>+ */
>>+ unsigned diag_dl:1;
>>+ unsigned mdm_dl:1;
>>+ unsigned mdm_ul:1;
>>+} __attribute__ ((packed));
>
> Probably just me, unsigned int is a good bit more explicit.
> The driver may also use a combined struct with
> BIG_ENDIAN_BITFIELD/LITTLE_ENDIAN_BIGFIELD (see e.g. linux/ip.h).

I've been told we don't do bitfields anymore in on-the-wire data,
on-disk data, userspace ABIs, etc. because their layout is compiler
dependent in the end.
--
Stefan Richter
-=====-==--- ---= ==--=