Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Sep 2001 09:46:37 -0700
From:      Mike Smith <msmith@freebsd.org>
To:        Yar Tikhiy <yar@freebsd.org>
Cc:        Mike Smith <msmith@freebsd.org>, hackers@freebsd.org
Subject:   Re: Driver structures & alignment 
Message-ID:  <200109141646.f8EGkb501038@mass.dis.org>
In-Reply-To: Your message of "Fri, 14 Sep 2001 12:23:44 %2B0400." <20010914122344.A38530@snark.rinet.ru> 

next in thread | previous in thread | raw e-mail | index | archive | help
> On Thu, Sep 13, 2001 at 04:09:57PM -0700, Mike Smith wrote:
> > > 
> > > Is there a single blessed way to define packed structures
> > > for use in drivers?  I suspect that using "#pragma pack(1)"
> > > will lead to alignment errors in non-Intel architectures.
> > 
> > Any form of packing is going to cause problems for items that are
> > located in illegal fashions. 
> > 
> > Having said that, I recommend using __attribute__ ((packed))
> > to explicitly request that a structure be packed.
> 
> Should the __attribute__ be supplied to each structure's member?
> Or can it be the whole structure's attribute?

You could just search for examples in /sys/dev, perhaps. 8)

But for the record, the attribute applies to the structure as a whole.

-- 
... every activity meets with opposition, everyone who acts has his
rivals and unfortunately opponents also.  But not because people want
to be opponents, rather because the tasks and relationships force
people to take different points of view.  [Dr. Fritz Todt]
           V I C T O R Y   N O T   V E N G E A N C E



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200109141646.f8EGkb501038>