public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix scsi/scsi_transport.h compile error
@ 2006-07-31  7:43 Rolf Eike Beer
  2006-07-31 13:14 ` Kyle McMartin
  0 siblings, 1 reply; 6+ messages in thread
From: Rolf Eike Beer @ 2006-07-31  7:43 UTC (permalink / raw)
  To: linux-scsi; +Cc: James Bottomley

scsi_transport.h defines the inline function scsi_transport_device_data()
that dereferences a pointer of "struct scsi_device *". Since the struct is
not known by the header this might break compilation.

Include scsi/scsi_device.h to not rely on users doing the correct magic
include order.

Signed-off-by: Rolf Eike Beer <eike-kernel@sf-tec.de>

---
commit 2ce61cfef5642b3a7414d2f430acf179f50f7228
tree 4d9c48a499dd47028bf28dfdd931c501efc32db3
parent 788fd16e408ca6c1008829d52bca9f13cbec64ce
author Rolf Eike Beer <eike-kernel@sf-tec.de> Mon, 31 Jul 2006 09:08:09 +0200
committer Rolf Eike Beer <beer@siso-eb-i34d.silicon-software.de> Mon, 31 Jul 2006 09:08:09 +0200

 include/scsi/scsi_transport.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h
index cca1d49..3c18baa 100644
--- a/include/scsi/scsi_transport.h
+++ b/include/scsi/scsi_transport.h
@@ -22,6 +22,7 @@ #define SCSI_TRANSPORT_H
 
 #include <linux/transport_class.h>
 #include <scsi/scsi_host.h>
+#include <scsi/scsi_device.h>
 
 struct scsi_transport_template {
 	/* the attribute containers */

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fix scsi/scsi_transport.h compile error
  2006-07-31  7:43 [PATCH] Fix scsi/scsi_transport.h compile error Rolf Eike Beer
@ 2006-07-31 13:14 ` Kyle McMartin
  2006-07-31 13:37   ` Stefan Richter
  0 siblings, 1 reply; 6+ messages in thread
From: Kyle McMartin @ 2006-07-31 13:14 UTC (permalink / raw)
  To: Rolf Eike Beer; +Cc: linux-scsi, James Bottomley

On Mon, Jul 31, 2006 at 09:43:25AM +0200, Rolf Eike Beer wrote:
> scsi_transport.h defines the inline function scsi_transport_device_data()
> that dereferences a pointer of "struct scsi_device *". Since the struct is
> not known by the header this might break compilation.

This should be solved with a "struct scsi_device;" decl, instead of
Yet More Header Dependancies...

--Kyle

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fix scsi/scsi_transport.h compile error
  2006-07-31 13:14 ` Kyle McMartin
@ 2006-07-31 13:37   ` Stefan Richter
  2006-07-31 14:38     ` Kyle McMartin
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Richter @ 2006-07-31 13:37 UTC (permalink / raw)
  To: Kyle McMartin; +Cc: Rolf Eike Beer, linux-scsi, James Bottomley

On 7/31/2006 3:14 PM, Kyle McMartin wrote:
> On Mon, Jul 31, 2006 at 09:43:25AM +0200, Rolf Eike Beer wrote:
>> scsi_transport.h defines the inline function scsi_transport_device_data()
>> that dereferences a pointer of "struct scsi_device *". Since the struct is
>> not known by the header this might break compilation.
> 
> This should be solved with a "struct scsi_device;" decl, instead of
> Yet More Header Dependancies...

That function accesses members of the struct, i.e. the compiler needs to
know offsets into struct scsi_device at this point. Therefore it needs
the definition, not a declaration.
-- 
Stefan Richter
-=====-=-==- -=== ==---
http://arcgraph.de/sr/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fix scsi/scsi_transport.h compile error
  2006-07-31 13:37   ` Stefan Richter
@ 2006-07-31 14:38     ` Kyle McMartin
  2006-07-31 15:26       ` Stefan Richter
  2006-08-01  6:10       ` Rolf Eike Beer
  0 siblings, 2 replies; 6+ messages in thread
From: Kyle McMartin @ 2006-07-31 14:38 UTC (permalink / raw)
  To: Stefan Richter; +Cc: Rolf Eike Beer, linux-scsi, James Bottomley

On Mon, Jul 31, 2006 at 03:37:46PM +0200, Stefan Richter wrote:
> > This should be solved with a "struct scsi_device;" decl, instead of
> > Yet More Header Dependancies...
> 
> That function accesses members of the struct, i.e. the compiler needs to
> know offsets into struct scsi_device at this point. Therefore it needs
> the definition, not a declaration.

Odd, ISTR that it only needed to be defined at the point the inline was
used. Oh well, my bad.

--Kyle

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fix scsi/scsi_transport.h compile error
  2006-07-31 14:38     ` Kyle McMartin
@ 2006-07-31 15:26       ` Stefan Richter
  2006-08-01  6:10       ` Rolf Eike Beer
  1 sibling, 0 replies; 6+ messages in thread
From: Stefan Richter @ 2006-07-31 15:26 UTC (permalink / raw)
  To: Kyle McMartin; +Cc: Rolf Eike Beer, linux-scsi, James Bottomley

Kyle McMartin wrote:
> On Mon, Jul 31, 2006 at 03:37:46PM +0200, Stefan Richter wrote:
>> That function accesses members of the struct, i.e. the compiler needs to
>> know offsets into struct scsi_device at this point. Therefore it needs
>> the definition, not a declaration.
> 
> Odd, ISTR that it only needed to be defined at the point the inline was
> used. Oh well, my bad.

One would think so. Maybe it depends on the compiler version.

(Actually I haven't checked scsi_transport.h myself but I recall fixing
another header with the same issue. Although I don't remember anymore
whether it lead to a warning or to an error and which gcc version I used
then.)
-- 
Stefan Richter
-=====-=-==- -=== ==---
http://arcgraph.de/sr/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fix scsi/scsi_transport.h compile error
  2006-07-31 14:38     ` Kyle McMartin
  2006-07-31 15:26       ` Stefan Richter
@ 2006-08-01  6:10       ` Rolf Eike Beer
  1 sibling, 0 replies; 6+ messages in thread
From: Rolf Eike Beer @ 2006-08-01  6:10 UTC (permalink / raw)
  To: Kyle McMartin; +Cc: Stefan Richter, linux-scsi, James Bottomley

[-- Attachment #1: Type: text/plain, Size: 581 bytes --]

Am Montag, 31. Juli 2006 16:38 schrieb Kyle McMartin:
> On Mon, Jul 31, 2006 at 03:37:46PM +0200, Stefan Richter wrote:
> > > This should be solved with a "struct scsi_device;" decl, instead of
> > > Yet More Header Dependancies...
> >
> > That function accesses members of the struct, i.e. the compiler needs to
> > know offsets into struct scsi_device at this point. Therefore it needs
> > the definition, not a declaration.
>
> Odd, ISTR that it only needed to be defined at the point the inline was
> used. Oh well, my bad.

That would be expected behaviour on a define.

Eike

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-08-01  6:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-31  7:43 [PATCH] Fix scsi/scsi_transport.h compile error Rolf Eike Beer
2006-07-31 13:14 ` Kyle McMartin
2006-07-31 13:37   ` Stefan Richter
2006-07-31 14:38     ` Kyle McMartin
2006-07-31 15:26       ` Stefan Richter
2006-08-01  6:10       ` Rolf Eike Beer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox