Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Jan 2015 13:55:17 +0800
From:      Peter Xu <xzpeter@gmail.com>
To:        freebsd-scsi@freebsd.org
Subject:   bugfix: SA driver will unwind when close device even with SA_MODE_NOREWIND
Message-ID:  <CAGRNztBwR1vz=by8SVgG_fNx%2B1RRogEjT4VueDDbXjjD1PrtdA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi,

In BSD system, when tape devices are discovered, CAM will create specific
/dev/saX.[0-3] automatically. Here when we does not the tape to auto rewind
when closing the device, we should access /dev/saX.1 (which means we are
using SA_MODE_NOREWIND mode).

Found one bug that tape will auto rewind even accessing /dev/saX.1.

diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c
index 83b8345..55ee293 100644
--- a/sys/cam/scsi/scsi_sa.c
+++ b/sys/cam/scsi/scsi_sa.c
@@ -186,8 +186,8 @@ typedef enum {
        "\007NO_MODESEL"        \
        "\010NO_CPAGE"

-#define        SAMODE(z)       (dev2unit(z) & 0x3)
-#define        SADENSITY(z)    ((dev2unit(z) >> 2) & 0x3)
+#define        SAMODE(z)       ((dev2unit(z) >> 2) & 0x3)
+#define        SADENSITY(z)    (dev2unit(z) & 0x3)
 #define        SA_IS_CTRL(z)   (dev2unit(z) & (1 << 4))

 #define SA_NOT_CTLDEV  0

Thanks.
Peter



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGRNztBwR1vz=by8SVgG_fNx%2B1RRogEjT4VueDDbXjjD1PrtdA>