chiark / gitweb /
[PATCH] more extras/multipath updates
[elogind.git] / extras / multipath / sg_include.h
1 #ifdef SG_KERNEL_INCLUDES
2   #define __user
3   typedef unsigned char u8;
4   #include "/usr/src/linux/include/scsi/sg.h"
5   #include "/usr/src/linux/include/scsi/scsi.h"
6 #else
7   #ifdef SG_TRICK_GNU_INCLUDES
8     #include <linux/../scsi/sg.h>
9     #include <linux/../scsi/scsi.h>
10   #else
11     #include <scsi/sg.h>
12   #endif
13 #endif
14
15 /*
16   Getting the correct include files for the sg interface can be an ordeal.
17   In a perfect world, one would just write:
18     #include <scsi/sg.h>
19     #include <scsi/scsi.h>
20   This would include the files found in the /usr/include/scsi directory.
21   Those files are maintained with the GNU library which may or may not
22   agree with the kernel and version of sg driver that is running. Any
23   many cases this will not matter. However in some it might, for example
24   glibc 2.1's include files match the sg driver found in the lk 2.2
25   series. Hence if glibc 2.1 is used with lk 2.4 then the additional
26   sg v3 interface will not be visible.
27   If this is a problem then defining SG_KERNEL_INCLUDES will access the
28   kernel supplied header files (assuming they are in the normal place).
29   The GNU library maintainers and various kernel people don't like
30   this approach (but it does work).
31   The technique selected by defining SG_TRICK_GNU_INCLUDES worked (and
32   was used) prior to glibc 2.2 . Prior to that version /usr/include/linux
33   was a symbolic link to /usr/src/linux/include/linux .
34
35   There are other approaches if this include "mixup" causes pain. These
36   would involve include files being copied or symbolic links being
37   introduced.
38
39   Sorry about the inconvenience. Typically neither SG_KERNEL_INCLUDES
40   nor SG_TRICK_GNU_INCLUDES is defined.
41
42   dpg 20010415, 20030522
43 */