Current-Users archive

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

Re: sys/dev/scsipi/scsipi_base.c




To: "Steven M. Bellovin" <smb%cs.columbia.edu@localhost>

Subject: Re: sys/dev/scsipi/scsipi_base.c

From: Manuel Bouyer <bouyer%antioche.eu.org@localhost>

Date: Mon, 7 Jan 2008 00:30:02 +0100


On Sun, Jan 06, 2008 at 11:22:56PM +0000, Steven M. Bellovin wrote:
> On Sun, 6 Jan 2008 23:56:49 +0100
> Manuel Bouyer <bouyer%antioche.eu.org@localhost> wrote:
> 
> > On Sun, Jan 06, 2008 at 02:36:32PM -0800, John Nemeth wrote:
> > > } A "gratuitous padding" here would break anyway, as this structure
> > > is } filled in by hardware (it's what's returned by a device to an
> > > INQUIRY } command).
> > > 
> > >      The hardware returns a sequence of bytes not a struct.
> > 
> > Yes of course. And if padding is introduced in this structure, the
> > fields will point to the wrong place in the sequence of bytes.
> > 
> Yes.  To quote Henry Spencer, "If you lie to the compiler, it will get
> its revenge."  (see
> http://www.armoredpenguin.com/quotes/Henry_Spencer.html)
> 
> More seriously -- is there any reason not to create a union, and point
> the hardware at the contiguous string?

I'm not sure it'd change anything. If the compiler wants to add padding,
it would add it in the union too. What makes a difference here is that the
structure is declared __attribute__((__packed__))

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



Follow-Ups:

Re: sys/dev/scsipi/scsipi_base.c
From: Martin Husemann


References:

Re: sys/dev/scsipi/scsipi_base.c
From: John Nemeth

Re: sys/dev/scsipi/scsipi_base.c
From: Manuel Bouyer

Re: sys/dev/scsipi/scsipi_base.c
From: Steven M. Bellovin




Prev by Date: Re: wm(4) issues with 4.99.48

Next by Date: Some alpha problems in current

Previous by Thread: Re: sys/dev/scsipi/scsipi_base.c

Next by Thread: Re: sys/dev/scsipi/scsipi_base.c

Indexes:

reverse Date

reverse Thread

Old Index



Home | Main Index | Thread Index | Old Index