Make scsi.h nominally userspace-clean
PATCH 1/1 Make scsi.h nominally userspace-clean
As Joerg Schilling, the author of cdrecord, has noted in threads such as
http://www.ussg.iu.edu/hypermail/linux/kernel/0309.3/1355.html and
http://www.ussg.iu.edu/hypermail/linux/kernel/0408.0/0799.html,
scsi/scsi.h does not compile cleanly in userspace programs due to its use of ``u8''. I have confirmed this bug and prepared and tested a fix that simply changes all such uses to ``__u8''. Please consider for inclusion.
I do not argue that including this header file in a program is appropriate, but other kernel headers already take as many precautions as this patch introduces. I chose __u8 over uint8_t as more in the style of the kernel generally.
Please keep me on cc:; I do not subscribe to the lists.
include/scsi/scsi.h +13 -13
@@ -214,25 +214,25 @@*/ struct ccs_modesel_head { -u8 _r1;/* reserved */ -u8 medium;/* device-specific medium type */ -u8 _r2;/* reserved */ -u8 block_desc_length;/* block descriptor length */ -u8 density;/* device-specific density code */ -u8 number_blocks_hi;/* number of blocks in this block desc */ -u8 number_blocks_med; -u8 number_blocks_lo; -u8 _r3; -u8 block_length_hi;/* block length for blocks in this desc */ -u8 block_length_med; -u8 block_length_lo; +__u8 _r1;/* reserved */ +__u8 medium;/* device-specific medium type */ +__u8 _r2;/* reserved */ +__u8 block_desc_length;/* block descriptor length */ +__u8 density;/* device-specific density code */ +__u8 number_blocks_hi;/* number of blocks in this block desc */ +__u8 number_blocks_med; +__u8 number_blocks_lo; +__u8 _r3; +__u8 block_length_hi;/* block length for blocks in this desc */ +__u8 block_length_med; +__u8 block_length_lo; };/* * ScsiLun: 8 byte LUN. */ struct scsi_lun { -u8 scsi_lun[8 ]; +__u8 scsi_lun[8 ]; };/*
Quoted 10 lines · Noah Misch
As Joerg Schilling, the author of cdrecord, has noted in threads such as
http://www.ussg.iu.edu/hypermail/linux/kernel/0309.3/1355.html and
http://www.ussg.iu.edu/hypermail/linux/kernel/0408.0/0799.html,
scsi/scsi.hdoes not compile cleanly in userspace programs due to its use of ``u8''. I have confirmed this bug and prepared and tested a fix that simply changes all such uses to ``__u8''. Please consider for inclusion.
Quoted 6 lines
I do not argue that including this header file in a program is appropriate, but other kernel headers already take as many precautions as this patch introduces. I chose
__u8overuint8_tas more in the style of the kernel generally.Please keep me on cc:; I do not subscribe to the lists.
I already sent such a patch to Linus.
Signature · 1 line
Jens Axboe
Quoted 9 lines · Noah Misch
As Joerg Schilling, the author of cdrecord, has noted in threads such as
http://www.ussg.iu.edu/hypermail/linux/kernel/0309.3/1355.html and
http://www.ussg.iu.edu/hypermail/linux/kernel/0408.0/0799.html,
scsi/scsi.hdoes not compile cleanly in userspace programs due to its use of ``u8''. I have confirmed this bug and prepared and tested a fix that simply changes all such uses to ``__u8''. Please consider for inclusion.
Quoted 6 lines
I do not argue that including this header file in a program is appropriate, but other kernel headers already take as many precautions as this patch introduces. I chose
__u8overuint8_tas more in the style of the kernel generally.Please keep me on cc:; I do not subscribe to the lists.
Why not use /usr/include/scsi/scsi.h instead of /usr/src/linux/include/scsi/scsi.h ? That already has uint8_t.
Quoted 8 lines · Jens Axboe
Quoted 6 lines
I do not argue that including this header file in a program is appropriate, but other kernel headers already take as many precautions as this patch introduces. I chose
__u8overuint8_tas more in the style of the kernel generally.Please keep me on cc:; I do not subscribe to the lists.
I already sent such a patch to Linus.
Do you accept patches like '#include <linux/compiler.h>' (for header file to be used by userspace) or was this an exception ?
<<V13>>