diff options
author | Bart Van Assche <bvanassche@google.com> | 2022-11-23 18:56:18 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-11-23 18:56:18 +0000 |
commit | 71b9916bab71328ec690b8677524e512d580d28f (patch) | |
tree | 207cdb23f8257e270a30143fde23d2033901581f /include/sg_linux_inc.h | |
parent | 8718296061e35ba33bf88847e7498f3d7e38f8f1 (diff) | |
parent | 448b67b18a80f8cc0feaaa669deaf169faa169f3 (diff) | |
download | sg3_utils-71b9916bab71328ec690b8677524e512d580d28f.tar.gz |
Merge remote-tracking branch 'aosp/upstream-main' into HEAD am: 448b67b18a
Original change: https://android-review.googlesource.com/c/platform/external/sg3_utils/+/2312210
Change-Id: I9653250a81928fffacf92bb5d9daffbc0ad7b2a8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'include/sg_linux_inc.h')
-rw-r--r-- | include/sg_linux_inc.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/include/sg_linux_inc.h b/include/sg_linux_inc.h new file mode 100644 index 00000000..e6f6b523 --- /dev/null +++ b/include/sg_linux_inc.h @@ -0,0 +1,58 @@ +#ifndef SG_LINUX_INC_H +#define SG_LINUX_INC_H + +#ifdef SG_KERNEL_INCLUDES + #include <stdint.h> /* C99 header for exact integer types */ + #define __user + typedef uint8_t u8; + #include "/usr/src/linux/include/scsi/sg.h" + #include "/usr/src/linux/include/scsi/scsi.h" +#else + #ifdef SG_TRICK_GNU_INCLUDES + #include <linux/../scsi/sg.h> + #include <linux/../scsi/scsi.h> + #else + #define __user + #include <scsi/sg.h> + #include <scsi/scsi.h> + #endif +#endif + +#ifdef BLKGETSIZE64 + #ifndef u64 + #include <stdint.h> /* C99 header for exact integer types */ + typedef uint64_t u64; /* problems with BLKGETSIZE64 ioctl in lk 2.4 */ + #endif +#endif + +/* + Getting the correct include files for the sg interface can be an ordeal. + In a perfect world, one would just write: + #include <scsi/sg.h> + #include <scsi/scsi.h> + This would include the files found in the /usr/include/scsi directory. + Those files are maintained with the GNU library which may or may not + agree with the kernel and version of sg driver that is running. Any + many cases this will not matter. However in some it might, for example + glibc 2.1's include files match the sg driver found in the lk 2.2 + series. Hence if glibc 2.1 is used with lk 2.4 then the additional + sg v3 interface will not be visible. + If this is a problem then defining SG_KERNEL_INCLUDES will access the + kernel supplied header files (assuming they are in the normal place). + The GNU library maintainers and various kernel people don't like + this approach (but it does work). + The technique selected by defining SG_TRICK_GNU_INCLUDES worked (and + was used) prior to glibc 2.2 . Prior to that version /usr/include/linux + was a symbolic link to /usr/src/linux/include/linux . + + There are other approaches if this include "mixup" causes pain. These + would involve include files being copied or symbolic links being + introduced. + + Sorry about the inconvenience. Typically neither SG_KERNEL_INCLUDES + nor SG_TRICK_GNU_INCLUDES is defined. + + dpg 20010415, 20030522 +*/ + +#endif |