1/* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License as 4 * published by the Free Software Foundation; either version 2 of 5 * the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software 14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 15 * MA 02111-1307 USA 16 */ 17#ifndef SG_LINUX_INC_H 18#define SG_LINUX_INC_H 19 20#ifdef SG_KERNEL_INCLUDES 21 #define __user 22 typedef unsigned char u8; 23 #include "/usr/src/linux/include/scsi/sg.h" 24 #include "/usr/src/linux/include/scsi/scsi.h" 25#else 26 #ifdef SG_TRICK_GNU_INCLUDES 27 #include <linux/../scsi/sg.h> 28 #include <linux/../scsi/scsi.h> 29 #else 30 #include <scsi/sg.h> 31 #include <scsi/scsi.h> 32 #endif 33#endif 34 35#ifdef BLKGETSIZE64 36 #ifndef u64 37 #include <stdint.h> /* C99 header for exact integer types */ 38 typedef uint64_t u64; /* problems with BLKGETSIZE64 ioctl in lk 2.4 */ 39 #endif 40#endif 41 42/* 43 Getting the correct include files for the sg interface can be an ordeal. 44 In a perfect world, one would just write: 45 #include <scsi/sg.h> 46 #include <scsi/scsi.h> 47 This would include the files found in the /usr/include/scsi directory. 48 Those files are maintained with the GNU library which may or may not 49 agree with the kernel and version of sg driver that is running. Any 50 many cases this will not matter. However in some it might, for example 51 glibc 2.1's include files match the sg driver found in the lk 2.2 52 series. Hence if glibc 2.1 is used with lk 2.4 then the additional 53 sg v3 interface will not be visible. 54 If this is a problem then defining SG_KERNEL_INCLUDES will access the 55 kernel supplied header files (assuming they are in the normal place). 56 The GNU library maintainers and various kernel people don't like 57 this approach (but it does work). 58 The technique selected by defining SG_TRICK_GNU_INCLUDES worked (and 59 was used) prior to glibc 2.2 . Prior to that version /usr/include/linux 60 was a symbolic link to /usr/src/linux/include/linux . 61 62 There are other approaches if this include "mixup" causes pain. These 63 would involve include files being copied or symbolic links being 64 introduced. 65 66 Sorry about the inconvenience. Typically neither SG_KERNEL_INCLUDES 67 nor SG_TRICK_GNU_INCLUDES is defined. 68 69 dpg 20010415, 20030522 70*/ 71 72#endif 73