tech-kern archive

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

Re: Implement mode_select for atapi tape drives - round 4



On Sun, Aug 09, 2009 at 09:48:08PM +0100, David Laight wrote:
> On Sun, Aug 09, 2009 at 09:47:29PM +0200, Manuel Bouyer wrote:
> > 
> > I don't get it. If the hardware (scsi devices in this case) defines
> > a structure like e.g
> > struct foo {
> >     int8_t data1;
> >     int32_t data2;
> >     int8_t data3
> >     int32_t data4;
> > };
> > the software on the host side will have to do misaligned accesses whatever
> > we do, isn't it ? How do we avoid the compiler from padding the members
> > without __packed ?
> 
> For data2 use __attribute__((__aligned__(1)))
> and for data4 __attribute__((__aligned__(2)))

And what will happen if this structure is inclued in a larger one
which isn't naturally-aligned, or if we are on a platform where the
natural alignement is larger than 32bits ?

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index