*BSD News Article 3451


Return to BSD News archive

Path: sserve!manuel!munnari.oz.au!samsung!uakari.primate.wisc.edu!ames!haven.umd.edu!mimsy!jds
From: jds@cs.umd.edu (James da Silva)
Newsgroups: comp.unix.bsd
Subject: SCSI tape: summary of known problems/solutions
Message-ID: <59550@mimsy.umd.edu>
Date: 8 Aug 92 20:20:20 GMT
Sender: news@mimsy.umd.edu
Organization: University of Maryland, Department of Computer Science
Lines: 91

Here is a summary of the bugs and fixes that have appeared here related to
the SCSI tape handling in as.c, including a new one (lack of filemarks)
that I haven't seen posted before.

Problem: Can't get the tape at SCSI target 4 to work.
Solution: The devices for ras4[ad] in the distribution are wrong.  The major
	  numbers should be 13, not 11.  Try:
		# rm /dev/ras4[ad]
		# mknod /dev/ras4a c 13 32
		# mknod /dev/ras4d c 13 35
	  (but you don't really need the d partition for tapes)
Due-to: Bill Jolitz

Problem: Can't read multi-file tapes; no no-rewind devices.
Solution: The as.c code supports no-rewind devices, but there's some code
	  in asopen that disables this capability.  Apply the patch below.
	  The no-rewind devices have a minor number one greater than the
	  base number for the target (eg same as partition b for disks).
	  Here's what I did with a tape at target 2:
		# ln /dev/ras2a /dev/rst2
		# mknod /dev/nrst2 c 13 17
	  Now I refer to the tape as "/dev/rst2" and "/dev/nrst2".

Problem: Can't read back multi-file tapes that were written with 386BSD; it's
	 as if only one file was written on tape.
Solution: as.c doesn't write any file marks!!  There is code for it, but
	  it is essentially commented out behind an "if(0 && ....)". Apply
	  the patch below.  The driver still doesn't write two filemarks
	  for end-of-medium, but that is less important.

Problem: Can't get a variable-block-size tape drive to work with 386BSD.
Solution: as.c assumes fixed-block-size tape drives.  Apply the patch below.
Due-to: Scott Burris (and yes, Scott, your fix works with fixed-block drives
	too).

Here is the patch to /sys/i386/isa/as.c:


*** /tmp/,RCSt1020837	Sat Aug  8 16:41:49 1992
--- as.c	Sun Aug  9 16:06:48 1992
***************
*** 429,439 ****
  		}
  	}
  	
- 	if (as->tape &&  dev_part(dev)) {
- 		error = EIO;
- 		goto done;
- 	}
- 
  	as->scsi_cdb_len = 10;
  	bzero(cdb, 10);
  	cdb[0] = 0x25;  /* SCSI_READCAPACITY */
--- 429,434 ----
***************
*** 554,560 ****
  		
  		bp = geteblk (DEV_BSIZE);
  
!              if (0 && (flag & FWRITE) != 0) {
                               /* presume user will use tape again */
                       as->scsi_cdb_len = 6;
                       cdb = as->scsi_cdb;
--- 549,555 ----
  		
  		bp = geteblk (DEV_BSIZE);
  
!              if ((flag & FWRITE) != 0) {
                               /* presume user will use tape again */
                       as->scsi_cdb_len = 6;
                       cdb = as->scsi_cdb;
***************
*** 889,894 ****
--- 884,891 ----
  	n = 0;
  	sp = as->scatter_list;
  	nscatter = 0;
+ 	if (as->tape && as->bs == 1)
+ 		total = bp->b_bcount;
  	while (n < total && nscatter < NSCATTER) {
  		thistime = page_size - ((vm_offset_t)p - trunc_page (p));
  


Someone please alert me to any errors in the above.

Enjoy,
Jaime
.............................................................................
: Stand on my shoulders, : jds@cs.umd.edu  :		      James da Silva
: not on my toes.	 : uunet!mimsy!jds : Systems Design & Analysis Group