bugfix: SA driver will unwind when close device even with SA_MODE_NOREWIND
Peter Xu
xzpeter at gmail.com
Fri Jan 30 05:55:18 UTC 2015
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
More information about the freebsd-scsi
mailing list