Subject: Re: port-i386/567: mt is broken (fails on "mt stat", gives bad error for no tape)
To: None <greywolf@autodesk.com>
From: Kenneth Stailey <staileyk@spacenet.com>
List: netbsd-bugs
Date: 11/18/1994 08:18:14
I have a corny "fix" but it doesn't allow mt to exhibit its classic behavior.

I use it because I think it's better than nothing.

The problem is that the underlying structure "mtget" doesn't exist for
scsi tapes, there is no "screg.h".

--- mt.c.DIST	Wed Apr  6 06:03:00 1994
+++ mt.c.new	Fri Nov 18 08:00:24 1994
@@ -49,6 +49,9 @@
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <sys/mtio.h>
+#ifdef i386
+#include "/usr/src/sys/scsi/scsi_tape.h"
+#endif
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -195,6 +198,9 @@
 #ifdef tahoe
 	{ MT_ISCY,	"cipher",	CYS_BITS,	CYCW_BITS },
 #endif
+#ifdef i386
+	{ 7,		"scsi", 	0,	 	0 },
+#endif
 	{ 0 }
 };
 
@@ -214,10 +220,30 @@
 		printf("unknown tape drive type (%d)\n", bp->mt_type);
 		return;
 	}
+#ifdef i386
+	printf("%s tape drive, ", mt->t_name);
+	if (bp->mt_blksiz)
+	  printf("block size = %d, ", bp->mt_blksiz);
+	else
+	  printf("variable block size, ");
+	switch (bp->mt_density) {
+	case QIC_11:	printf("QIC 11");	break;
+	case QIC_24:	printf("QIC 24");	break;
+	case QIC_120:	printf("QIC 120");	break;
+	case QIC_150:	printf("QIC 150");	break;
+	case QIC_525:	printf("QIC 525");	break;
+	case QIC_1320:	printf("QIC 1320");	break;
+	case 19:	printf("DDS");		break;
+	default:
+	  printf("density code = %d\n",  bp->mt_density);
+	}
+	putchar('\n');
+#else
 	printf("%s tape drive, residual=%d\n", mt->t_name, bp->mt_resid);
 	printreg("ds", bp->mt_dsreg, mt->t_dsbits);
 	printreg("\ner", bp->mt_erreg, mt->t_erbits);
 	putchar('\n');
+#endif
 }
 
 /*