PKGBUILDs/community/qpxtool/qpx_transport.patch
2009-10-09 21:15:33 -05:00

32 lines
911 B
Diff

--- ./lib/qpxtransport/qpx_transport.cpp 2008-05-01 01:11:36.000000000 +0200
+++ ./lib/qpxtransport/qpx_transport.cpp2 2008-05-01 01:11:54.000000000 +0200
@@ -14,6 +14,7 @@
int sense2str(int err, char* str);
#if defined(__unix) || defined(__unix__)
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -211,6 +211,21 @@
#define KERNEL_BROKEN 0
if (use_sg_io)
{
+ /* see linux-2.6.23/block/scsi_ioctl.c:36 */
+ static const unsigned char scsi_command_size[8] =
+ {
+ 6, 10, 10, 12,
+ 16, 12, 10, 10
+ };
+ char cmdsize, opcode;
+
+ opcode = cgc.cmd[0];
+ /* see linux-2.6.23/include/scsi/scsi.h:25 */
+ cmdsize = scsi_command_size[((opcode) >> 5) & 7];
+ if ((sg_io.cmd_len > 0) && (sg_io.cmd_len < cmdsize)) {
+ sg_io.cmd_len = cmdsize;
+ }
+
sg_io.dxferp = buf;
sg_io.dxfer_len = sz;
sg_io.dxfer_direction = use_sg_io[dir];