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