Re: the joy of scsi headers and glibc...

Douglas Gilbert (dgilbert@interlog.com)
Sun, 07 Nov 1999 11:13:58 -0500


> > Now, the question that I have is... What in the name of god am I to do?

> Well, roughly speaking glibc and Debian and recent RedHat and recent SuSE
> are right, and the author of scsi-generic.txt is mistaken.
>
> [One does not recompile all one's software when upgrading kernels.
> Apparently ordinary software is independent of the includes used.
> In case the includes really do matter, one gives -I<some-linux-include-dir>
> to get the includes from one particular kernel version (and then knows
> that the program obtained that way may break when another kernel is used).>]
>
> Note that including linux kernel includes is meaningful only to get
> kernel interface definitions. In particular, if one only needs constants
> defined in the SCSI standard then a private include file is just as well
> as <linux/../scsi/scsi.h>.

If a Linux header file in the /usr/src/linux/include area
does not want the users to access a section programmatically
then it is surrounded by #ifdef __KERNEL__ ... #endif. Note
that there are 2 scsi.h files in the Linux kernel:
/usr/src/linux/include/scsi/scsi.h [for public consumption]
/usr/src/linux/drivers/scsi/scsi.h [for internal consumption]

The /usr/src/linux/include/scsi directory contains 4 files (not
1 or 2 as the GNU glibc library seems to think). They are:
scsi.h
scsi_ioctl.h
scsicam.h
sg.h
For instance one needs scsi_ioctl.h if one wishes to use
the SCSI_IOCTL_SEND_COMMAND ioctl(). Also note that these
files are (slightly) different between Linux kernel 2.2.13
and 2.3.25 .

So seen from my point of view if you maintain a Linux
driver whose _public_ interface is in the
/usr/src/linux/include/linux directory then you don't
have a problem. But if, for historical reasons, your driver's
public interface is in the /usr/src/linux/include/scsi
directory then you need to negotiate with the GNU glibc
maintainers. For example: the Linux IDE interface does
not have this problem.

And yes, for the time being
#include <linux/../scsi/scsi.h>
seems like the cleaniest, ugliest solution.

Doug Gilbert

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/