From owner-freebsd-hackers Fri Sep 14 9:39: 6 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from mass.dis.org (mass.dis.org [216.240.45.41]) by hub.freebsd.org (Postfix) with ESMTP id D3D0C37B40B; Fri, 14 Sep 2001 09:39:01 -0700 (PDT) Received: from mass.dis.org (localhost [127.0.0.1]) by mass.dis.org (8.11.6/8.11.3) with ESMTP id f8EGkb501038; Fri, 14 Sep 2001 09:46:37 -0700 (PDT) (envelope-from msmith@mass.dis.org) Message-Id: <200109141646.f8EGkb501038@mass.dis.org> X-Mailer: exmh version 2.1.1 10/15/1999 To: Yar Tikhiy Cc: Mike Smith , hackers@freebsd.org Subject: Re: Driver structures & alignment In-reply-to: Your message of "Fri, 14 Sep 2001 12:23:44 +0400." <20010914122344.A38530@snark.rinet.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 14 Sep 2001 09:46:37 -0700 From: Mike Smith Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > 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