Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Aug 2000 09:00:04 -0700 (PDT)
From:      Matthew Jacob <mjacob@feral.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/20501: autoloader support in dump(8)
Message-ID:  <200008091600.JAA99854@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/20501; it has been noted by GNATS.

From: Matthew Jacob <mjacob@feral.com>
To: ip@mcc.ac.uk
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/20501: autoloader support in dump(8)
Date: Wed, 9 Aug 2000 08:56:35 -0700 (PDT)

 Why don't you just use the 'eject on close' tape device?
 
 
 On Wed, 9 Aug 2000 ip@mcc.ac.uk wrote:
 
 > 
 > >Number:         20501
 > >Category:       bin
 > >Synopsis:       extra flag to dump to offline autoloaders at EOT
 > >Confidential:   no
 > >Severity:       non-critical
 > >Priority:       low
 > >Responsible:    freebsd-bugs
 > >State:          open
 > >Quarter:        
 > >Keywords:       
 > >Date-Required:
 > >Class:          change-request
 > >Submitter-Id:   current-users
 > >Arrival-Date:   Wed Aug 09 04:10:01 PDT 2000
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     Ian Pallfreeman
 > >Release:        FreeBSD 3.5-STABLE i386
 > >Organization:
 > Manchester Computing
 > 	         The University
 > 		 Oxford Road
 > 	         Manchester M13 9PL
 > 		 UK
 > >Environment:
 > 
 > Half-a-dozen or so clunky old HP DAT autoloaders and no Solaris
 > 
 > >Description:
 > 
 > Solaris has an additional ("l") flag to dump (aka ufsdump) which offlines
 > a tape drive after EOT is detected. This tells DAT autoloaders which are
 > in manual mode (i.e. the changer LUN hasn't seen any commands since the
 > pod was loaded) to unload the current tape and load the next, if possible.
 > The dump then continues without manual intervention until all tapes are
 > written.
 > 
 > The code is pretty simple. When EOT is reached, and we've waited for the tape
 > to rewind, we do an OFFLINE ioctl and then wait again for two minutes or so
 > until the tape opens successfully. If it doesn't, we assume we've used all
 > the tapes in the pod and ask for manual intervention as before.
 > 
 > Similar patches applied to FreeBSD 4.1-STABLE and NetBSD/SPARC 1.4.1.
 > 
 > >How-To-Repeat:
 > 
 > 
 > 
 > >Fix:
 > 
 > --- main.c.orig	Mon May  8 10:52:15 2000
 > +++ main.c	Wed Aug  9 11:46:32 2000
 > @@ -87,6 +87,7 @@
 >  long	dev_bsize = 1;	/* recalculated below */
 >  long	blocksperfile;	/* output blocks per file */
 >  char	*host = NULL;	/* remote host (if any) */
 > +int	loader = 0;	/* offline tape autoloader */
 >  
 >  static long numarg __P((char *, long, long));
 >  static void obsolete __P((int *, char **[]));
 > @@ -123,9 +124,9 @@
 >  
 >  	obsolete(&argc, &argv);
 >  #ifdef KERBEROS
 > -#define optstring "0123456789aB:b:cd:f:h:kns:T:uWw"
 > +#define optstring "0123456789aB:b:cd:f:h:klns:T:uWw"
 >  #else
 > -#define optstring "0123456789aB:b:cd:f:h:ns:T:uWw"
 > +#define optstring "0123456789aB:b:cd:f:h:lns:T:uWw"
 >  #endif
 >  	while ((ch = getopt(argc, argv, optstring)) != -1)
 >  #undef optstring
 > @@ -173,6 +174,10 @@
 >  			dokerberos = 1;
 >  			break;
 >  #endif
 > +
 > +		case 'l':		/* tape loader */
 > +			loader = 1;
 > +			break;
 >  
 >  		case 'n':		/* notify operators */
 >  			notify = 1;
 > --- tape.c.orig	Sat Aug 28 01:12:39 1999
 > +++ tape.c	Wed Aug  9 11:46:03 2000
 > @@ -43,6 +43,8 @@
 >  #include <sys/socket.h>
 >  #include <sys/time.h>
 >  #include <sys/wait.h>
 > +#include <sys/ioctl.h>
 > +#include <sys/mtio.h>
 >  #ifdef sunos
 >  #include <sys/vnode.h>
 >  
 > @@ -78,6 +80,7 @@
 >  extern	int ntrec;		/* blocking factor on tape */
 >  extern	int cartridge;
 >  extern	char *host;
 > +extern  int loader;
 >  char	*nexttape;
 >  
 >  static	int atomic __P((ssize_t (*)(), int, char *, int));
 > @@ -374,20 +377,46 @@
 >  close_rewind()
 >  {
 >  	time_t tstart_changevol, tend_changevol;
 > +	int gottape=0;
 >  
 >  	trewind();
 >  	if (nexttape)
 >  		return;
 >  	(void)time((time_t *)&(tstart_changevol));
 > -	if (!nogripe) {
 > -		msg("Change Volumes: Mount volume #%d\n", tapeno+1);
 > -		broadcast("CHANGE DUMP VOLUMES!\7\7\n");
 > +	if (loader) {
 > +		struct mtop MtOp;
 > +		int f,tx=0;
 > +
 > +		msg("Mounting next tape on %s\n",tape);
 > +
 > +		if ((f = open(tape,0)) < 0) 
 > +		        quit("can't re-open tape loader after rewind");
 > +		
 > +		MtOp.mt_op = MTOFFL;
 > +		MtOp.mt_count = 1;
 > +		if (ioctl(f,MTIOCTOP,&MtOp) < 0)
 > +			quit("can't offline tape loader");
 > +                (void) close(f);
 > +		sleep(10);
 > +                while ((f = open(tape,0)) < 0 && tx++ < 12)
 > +                        sleep (10);
 > +		if (f >= 0) {
 > +		        (void) close(f);
 > +                        gottape = 1;
 > +		}
 >  	}
 > -	while (!query("Is the new volume mounted and ready to go?"))
 > -		if (query("Do you want to abort?")) {
 > -			dumpabort(0);
 > -			/*NOTREACHED*/
 > +	if (!gottape) {
 > +		if (!nogripe) {
 > +	        	msg("Change Volumes: Mount volume #%d\n", tapeno+1);
 > +                        broadcast("CHANGE DUMP VOLUMES!\7\7\n");               
 >  		}
 > +		while (!query("Is the new volume mounted and ready to go?"))
 > +	        	if (query("Do you want to abort?")) {
 > +	                	dumpabort(0);
 > +		         	/*NOTREACHED*/
 > +	         	}
 > +	}
 > +
 >  	(void)time((time_t *)&(tend_changevol));
 >  	if ((tstart_changevol != (time_t)-1) && (tend_changevol != (time_t)-1))
 >  		tstart_writing += (tend_changevol - tstart_changevol);
 > 
 > 
 > >Release-Note:
 > >Audit-Trail:
 > >Unformatted:
 > 
 > 
 > To Unsubscribe: send mail to majordomo@FreeBSD.org
 > with "unsubscribe freebsd-bugs" in the body of the message
 > 
 
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200008091600.JAA99854>