aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2014-06-04 00:24:20 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2014-06-04 00:24:20 +0000
commit240dd15692debe127e57ff0fb4bc320f70614d5f (patch)
tree3372b6fda5b2cd6959ebc7421b14c74ed760f3e0 /lib
parent4d770f100b237146adc51e9f4bdd194e83252d50 (diff)
downloadsg3_utils-240dd15692debe127e57ff0fb4bc320f70614d5f.tar.gz
sg_lib: linux, sg: support SCSI_PT_FLAGS_QUEUE_AT_TAIL fix
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@585 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'lib')
-rw-r--r--lib/sg_pt_common.c4
-rw-r--r--lib/sg_pt_linux.c25
2 files changed, 15 insertions, 14 deletions
diff --git a/lib/sg_pt_common.c b/lib/sg_pt_common.c
index 6af93ac6..cc84cc21 100644
--- a/lib/sg_pt_common.c
+++ b/lib/sg_pt_common.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009-2013 Douglas Gilbert.
+ * Copyright (c) 2009-2014 Douglas Gilbert.
* All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the BSD_LICENSE file.
@@ -14,7 +14,7 @@
#endif
-static const char * scsi_pt_version_str = "2.10 20130827";
+static const char * scsi_pt_version_str = "2.11 20140603";
const char *
scsi_pt_version()
diff --git a/lib/sg_pt_linux.c b/lib/sg_pt_linux.c
index 604c9f27..18c318c4 100644
--- a/lib/sg_pt_linux.c
+++ b/lib/sg_pt_linux.c
@@ -5,7 +5,7 @@
* license that can be found in the BSD_LICENSE file.
*/
-/* sg_pt_linux version 1.20 20131014 */
+/* sg_pt_linux version 1.21 20140603 */
#include <stdio.h>
@@ -278,25 +278,18 @@ set_scsi_pt_task_attr(struct sg_pt_base * vp, int attribute, int priority)
#ifndef SG_FLAG_Q_AT_TAIL
#define SG_FLAG_Q_AT_TAIL 0x10
#endif
-#ifndef SG_FLAG_Q_AT_HEAD
-#define SG_FLAG_Q_AT_HEAD 0x20
-#endif
void
set_scsi_pt_flags(struct sg_pt_base * vp, int flags)
{
struct sg_pt_linux_scsi * ptp = &vp->impl;
- /* default action of SG (v3) is QUEUE_AT_HEAD */
+ /* default action of sg driver [sg v3 interface] is QUEUE_AT_HEAD */
/* default action of block layer SG_IO ioctl is QUEUE_AT_TAIL */
- if (SCSI_PT_FLAGS_QUEUE_AT_TAIL & flags) {
+ if (SCSI_PT_FLAGS_QUEUE_AT_TAIL & flags)
ptp->io_hdr.flags |= SG_FLAG_Q_AT_TAIL;
- ptp->io_hdr.flags &= ~SG_FLAG_Q_AT_HEAD;
- }
- if (SCSI_PT_FLAGS_QUEUE_AT_HEAD & flags) {
- ptp->io_hdr.flags |= SG_FLAG_Q_AT_HEAD;
+ if (SCSI_PT_FLAGS_QUEUE_AT_HEAD & flags)
ptp->io_hdr.flags &= ~SG_FLAG_Q_AT_TAIL;
- }
}
/* Executes SCSI command (or at least forwards it to lower layers).
@@ -755,12 +748,18 @@ set_scsi_pt_task_attr(struct sg_pt_base * vp, int attribute, int priority)
#define BSG_FLAG_Q_AT_TAIL 0x10
#endif
+/* Need this later if translated to v3 interface */
+#ifndef SG_FLAG_Q_AT_TAIL
+#define SG_FLAG_Q_AT_TAIL 0x10
+#endif
+
void
set_scsi_pt_flags(struct sg_pt_base * vp, int flags)
{
struct sg_pt_linux_scsi * ptp = &vp->impl;
- /* default action of bsg (sg v4) is QUEUE_AT_HEAD */
+ /* default action of bsg driver (sg v4) is QUEUE_AT_HEAD */
+ /* default action of block layer SG_IO ioctl is QUEUE_AT_TAIL */
if (SCSI_PT_FLAGS_QUEUE_AT_TAIL & flags)
ptp->io_hdr.flags |= BSG_FLAG_Q_AT_TAIL;
if (SCSI_PT_FLAGS_QUEUE_AT_HEAD & flags)
@@ -931,6 +930,8 @@ do_scsi_pt_v3(struct sg_pt_linux_scsi * ptp, int fd, int time_secs,
v3_hdr.mx_sb_len = (unsigned char)ptp->io_hdr.max_response_len;
}
v3_hdr.pack_id = (int)ptp->io_hdr.spare_in;
+ if (BSG_FLAG_Q_AT_TAIL & ptp->io_hdr.flags)
+ v3_hdr.flags |= SG_FLAG_Q_AT_TAIL;
if (NULL == v3_hdr.cmdp) {
if (verbose)