Am Freitag, 6. Januar 2006 21:23 schrieb Pete Zaitcev:
> On Fri, 6 Jan 2006 14:33:21 -0500 (EST), Alan Stern <[EMAIL PROTECTED]> wrote:
> 
> > > > > is there any architecture for which packed is required in structures 
> > > > > like this:
> > > > > 
> > > > > /* All standard descriptors have these 2 fields at the beginning */
> > > > > struct usb_descriptor_header {
> > > > >       __u8  bLength;
> > > > >       __u8  bDescriptorType;
> > > > > };
> > > > 
> > > > sizeof(struct usb_descriptor_header) will be 4 on ARM.  If this
> > > > concerns you, you need to pack the structure thusly:
> > > > 
> > > > struct usb_descriptor_header {
> > > >         __u8  bLength;
> > > >         __u8  bDescriptorType;
> > > > } __attribute__((packed));
> > > 
> > > I had feared so. The usb include files are incorrect for arm in this case.
> > > Did I overdo it?
> > 
> > Perhaps you are overreacting.  Even though the total size of the structure 
> > may be 4, I bet that bLength and bDescriptorType still occupy just the 
> > first two bytes of the structure.  Assuming this is so, there's nothing 
> > wrong with the existing headers.
> 
> Also, even if RMK is right, it either happens with some garbage gcc version
> or it is just a bug which didn't reach gcc people yet. It is dysfunctional
> to have structures padded in this way. On all other platforms they are
> only padded if they include a member which is bigger than the char.
> It is done to create properly aligned arrays of structures. This includes
> platforms without byte accesses like old Alpha.
> 
> In this particular case it's moot, like Alan said. But even in general
> adding packed attribute usually is stupid and pandering to people building
> with hacked-up chains on 28-bit ARM or something. Why do we all have to
> suffer because of them? Screw that. Every case of ((packed)) has to have
> a very explicit justification.

Well,

in any case the file is inconsistent. Either all structures there have to
be packed or none. Unless someone can come up with something better
I am afraid an "#ifdef ARM" is needed. Comments?

        Regards
                Oliver


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to