Fix scsi/scsi_transport.h compile error
PATCH 1/1 Fix scsi/scsi_transport.h compile error
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.
---
commit 2ce61cfef5642b3a7414d2f430acf179f50f7228
tree 4d9c48a499dd47028bf28dfdd931c501efc32db3
parent 788fd16e408ca6c1008829d52bca9f13cbec64ce
author Rolf Eike Beer <[email protected]> Mon, 31 Jul 2006 09:08:09 +0200 committer Rolf Eike Beer <[email protected]> Mon, 31 Jul 2006 09:08:09 +0200
include/scsi/scsi_transport.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
include/scsi/scsi_transport.h +1 -0
@@ -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 */
Quoted 3 lines · Rolf Eike Beer
scsi_transport.hdefines the inline functionscsi_transport_device_data()that dereferences a pointer of "structscsi_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
Quoted 7 lines · Kyle McMartin
Quoted 3 lines · Rolf Eike Beer
scsi_transport.hdefines the inline functionscsi_transport_device_data()that dereferences a pointer of "structscsi_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.
Signature · 3 lines
Stefan Richter -=====-=-==- -=== ==--- http://arcgraph.de/sr/
Quoted 6 lines · Stefan Richter
Quoted 2 lines
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_deviceat 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
Quoted 7 lines · Kyle McMartin
Quoted 3 lines · Stefan Richter
That function accesses members of the struct, i.e. the compiler needs to know offsets into struct
scsi_deviceat 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.)
Signature · 3 lines
Stefan Richter -=====-=-==- -=== ==--- http://arcgraph.de/sr/
Am Montag, 31. Juli 2006 16:38 schrieb Kyle McMartin:
Quoted 10 lines · Stefan Richter
Quoted 6 lines
Quoted 2 lines
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_deviceat 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