*BSD News Article 34650


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msuinfo!agate!howland.reston.ans.net!swrinde!cs.utexas.edu!uunet!zib-berlin.de!irz401!uriah!not-for-mail
From: j@uriah.sax.de (J Wunsch)
Newsgroups: comp.os.386bsd.questions
Subject: st eom [Was: Re: 'mt' options (of FreeBSD 1.1.5[.1])]
Date: 19 Aug 1994 19:32:07 +0200
Organization: Private U**X site; member IN e.V.
Lines: 95
Message-ID: <332qanINN8d6@bonnie.sax.de>
References: <32nlfk$aul@gabriel.keele.ac.uk> <32teebINN6hm@bonnie.sax.de>
NNTP-Posting-Host: bonnie.sax.de

j@uriah.sax.de (J Wunsch) writes:
(yup, that's me)

>I used to have some patches for hacking the st driver and the /sbin/st
>utility to recognize the `eom' keyword. This is the best way for my
>oldish Archive Viper 150 to append a file.

>I gonna extract the patch and post it here...

Now, here we go. I've succesfully applied them against my 1.1.5.1
/usr/src tree, and it appears to work.

*** sbin/st/st.1.orig	Thu Nov 18 06:05:22 1993
--- sbin/st/st.1	Sun Apr 10 23:08:55 1994
***************
*** 203,208 ****
--- 203,212 ----
  Print status information about the tape unit.
  Information is printed out about the present active parameters and
  also the four Operating modes available.
+ 
+ .It Cm eom
+ Position to end of recorded medium. Only way for some tape drives
+ to get ready to append data.
  .El
  .Pp
  If a tape name is not specified, and the environment variable
*** sbin/st/st.c.orig	Thu Nov 18 10:06:17 1993
--- sbin/st/st.c	Sun Apr 10 23:08:55 1994
***************
*** 71,76 ****
--- 71,77 ----
  	{ "status",	MTNOP,	1 },
  	{ "blocksize",	MTSETBSIZ,	0 },
  	{ "density",	MTSETDNSTY,	0 },
+ 	{ "eom",	MTEOM,  1 },
  	{ 0 }
  };
  
*** sys/sys/mtio.h.orig	Thu Nov 18 10:07:52 1993
--- sys/sys/mtio.h	Sun Apr 10 23:08:56 1994
***************
*** 72,77 ****
--- 72,81 ----
  /* and range from 0 to 0x17. Sets the value for the openned mode only	*/
  
  #define MTSETDNSTY	11
+ 
+ /* Position to end of recorded medium. Only way for some tapes drives   */
+ /* to append data.                                                      */
+ #define MTEOM           12
  #endif
  
  /* structure for MTIOCGET - mag tape get status command */
*** sys/scsi/st.c.orig	Wed Mar 23 18:09:06 1994
--- sys/scsi/st.c	Sun Apr 10 23:08:56 1994
***************
*** 1167,1172 ****
--- 1167,1178 ----
  				if (errcode == ESUCCESS)
  					errcode = st_space(unit, number, SP_BLKS, flags);
  				break;
+ 			case MTEOM:	/* space to end of recorded medium */
+ 				errcode = st_chkeod(unit, FALSE, &nmarks, flags);
+ 				if (errcode == ESUCCESS)
+ 					errcode = st_space(unit, 0, SP_EOM,
+ 							   flags);
+ 				break;
  			case MTREW:	/* rewind */
  				errcode = st_rewind(unit, FALSE, flags);
  				break;
***************
*** 1569,1574 ****
--- 1575,1590 ----
  			st->flags &= ~ST_BLANK_READ;
  			number++;	/* dubious */
  		}
+ 		break;
+ 	case	SP_EOM:
+ 		if (st->flags & ST_EIO_PENDING)
+ 		{
+ 			/* we are already at EOM */
+ 			st->flags &= ~ST_EIO_PENDING;
+ 			return(ESUCCESS);
+ 		}
+ 		number = 1;	/* we have only one end-of-medium */
+ 		break;
  	}
  	if (number == 0) {
  		return (ESUCCESS);
-- 
cheers, J"org                             work:    joerg_wunsch@tcd-dresden.de
                                          private:   joerg_wunsch@uriah.sax.de
Steinbach's Guideline for Systems Programming:
        Never test for an error condition you don't know how to handle.