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