RFC: mtx problem & fix.

Louis J. LaBash (labash@lou1.ll.siue.edu)
Wed, 29 Sep 1999 08:49:50 -0500


The media tape changer "mtx" fails after loading a write-protected
cartridge when using Linux 2.2.7 /libc6 (see below). I've used mtx
for a couple of years with kernel 2.0.x /libc5 without problems.

Note: Cartridge in slot-2 is write-protected.

lou1:/usr/src/mtx-1.1 # uname -a
Linux lou1 2.2.7 #12 Wed Sep 22 14:32:23 CDT 1999 i586 unknown

lou1:~ # ldd `which mtx`
libc.so.6 => /lib/libc.so.6 (0x40007000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaaa000)

lou1:/usr/src/mtx-1.1 #echo $TAPE
/dev/nst0

lou1:/usr/src/mtx-1.1 # ls -l /dev/nst0
crw-rw---- 1 root disk 9, 128 Apr 15 00:14 /dev/nst0

lou1:/usr/src/mtx-1.1 # mtx status
Data Transfer Element: Empty
Storage Element 1: Full
Storage Element 2: Full
Storage Element 3: Full
Storage Element 4: Full

lou1:/usr/src/mtx-1.1 # mtx load 1
Loading Storage Element 1 into Data Transfer Element...done

lou1:/usr/src/mtx-1.1 # mtx unload 1
Unloading Data Transfer Element into Storage Element 1...done

lou1:/usr/src/mtx-1.1 # mtx load 2
Loading Storage Element 2 into Data Transfer Element...done

lou1:/usr/src/mtx-1.1 # mtx unload 2
mtx: cannot open SCSI device '/dev/nst0' - Read-only file system

lou1:/usr/src/mtx-1.1 # mtx status
mtx: cannot open SCSI device '/dev/nst0' - Read-only file system

Error-message was from trying to open tape-device as read/write.

After making the following change:

------------------- cut here mtx-1.1a.dif -----------------------
--- mtx.c-orig Tue May 12 23:59:01 1998
+++ mtx.c Mon Sep 27 12:34:21 1999
@@ -355,7 +355,7 @@

static int SCSI_OpenDevice(char *DeviceName)
{
- int DeviceFD = open(DeviceName, O_RDWR);
+ int DeviceFD = open(DeviceName, O_RDONLY);
if (DeviceFD < 0)
FatalError("cannot open SCSI device '%s' - %m\n", DeviceName);
return DeviceFD;
------------------- cut here mtx-1.1a.dif -----------------------

mtx seems to function properly on my old as well as new system.

Does anyone see problems with my change.

Thanks.

-- 
Louis-ljl-{labash@lou1.ll.siue.edu}

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/