]> granicus.if.org Git - strace/commitdiff
scsi: add fallback definitions for SG_* ioctl command constants
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 9 Jan 2017 02:40:08 +0000 (02:40 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 10 Jan 2017 00:05:17 +0000 (00:05 +0000)
Unfortunately, <scsi/sg.h> from libc does not provide all constants
recognized by the kernel.

* xlat/scsi_sg_commands.in: New file.
* scsi.c: Include "xlat/scsi_sg_commands.h" instead of providing
a fallback definition of SG_IO.

scsi.c
xlat/scsi_sg_commands.in [new file with mode: 0644]

diff --git a/scsi.c b/scsi.c
index 2f93de1e02b8b9e6116c4fa26a93ce4711200b81..7da6dece246d660e8efa46b155bc565941fd0819 100644 (file)
--- a/scsi.c
+++ b/scsi.c
@@ -32,9 +32,7 @@
 # include <scsi/sg.h>
 #endif
 
-#ifndef SG_IO
-# define SG_IO 0x2285
-#endif
+#include "xlat/scsi_sg_commands.h"
 
 static int
 decode_sg_io(struct tcb *const tcp, const uint32_t iid,
diff --git a/xlat/scsi_sg_commands.in b/xlat/scsi_sg_commands.in
new file mode 100644 (file)
index 0000000..e95e0d1
--- /dev/null
@@ -0,0 +1,26 @@
+SG_SET_TIMEOUT         0x2201
+SG_GET_TIMEOUT         0x2202
+SG_EMULATED_HOST       0x2203
+SG_SET_TRANSFORM       0x2204
+SG_GET_TRANSFORM       0x2205
+SG_GET_COMMAND_Q       0x2270
+SG_SET_COMMAND_Q       0x2271
+SG_GET_RESERVED_SIZE   0x2272
+SG_SET_RESERVED_SIZE   0x2275
+SG_GET_SCSI_ID         0x2276
+SG_SET_FORCE_LOW_DMA   0x2279
+SG_GET_LOW_DMA         0x227a
+SG_SET_FORCE_PACK_ID   0x227b
+SG_GET_PACK_ID         0x227c
+SG_GET_NUM_WAITING     0x227d
+SG_SET_DEBUG           0x227e
+SG_GET_SG_TABLESIZE    0x227F
+SG_GET_VERSION_NUM     0x2282
+SG_NEXT_CMD_LEN                0x2283
+SG_SCSI_RESET          0x2284
+SG_IO                  0x2285
+SG_GET_REQUEST_TABLE   0x2286
+SG_SET_KEEP_ORPHAN     0x2287
+SG_GET_KEEP_ORPHAN     0x2288
+SG_GET_ACCESS_COUNT    0x2289
+#stop