pesky sizing options) -- from FreeBSD.
also make -b option aware of MAXPHYS issues (via a little hack)
-# $OpenBSD: Makefile,v 1.4 1996/09/14 19:26:56 deraadt Exp $
+# $OpenBSD: Makefile,v 1.5 1997/02/03 11:53:23 deraadt Exp $
# $NetBSD: Makefile,v 1.16 1995/03/18 14:54:53 cgd Exp $
# dump.h header file
PROG= dump
LINKS= ${BINDIR}/dump ${BINDIR}/rdump
CFLAGS+=-DRDUMP
-SRCS= itime.c main.c optr.c dumprmt.c tape.c traverse.c unctime.c
+SRCS= itime.c main.c optr.c dumprmt.c tape.c traverse.c unctime.c maxbsize.c
MAN= dump.8
MLINKS+=dump.8 rdump.8
-.\" $OpenBSD: dump.8,v 1.3 1996/06/23 14:30:09 deraadt Exp $
+.\" $OpenBSD: dump.8,v 1.4 1997/02/03 11:53:24 deraadt Exp $
.\" $NetBSD: dump.8,v 1.14 1996/02/05 23:59:37 mrg Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.Nd filesystem backup
.Sh SYNOPSIS
.Nm dump
-.Op Fl 0123456789cnu
+.Op Fl 0123456789cnua
.Op Fl B Ar records
.Op Fl b Ar blocksize
.Op Fl d Ar density
A dump that is larger than the output medium is broken into
multiple volumes.
On most media the size is determined by writing until an
-end-of-media indication is returned.
+end-of-media indication is returned. This can be enforced
+by using the
+.Cm a
+option.
+.Pp
On media that cannot reliably return an end-of-media indication
(such as some cartridge tape drives)
each volume is of a fixed size;
The number of kilobytes per volume, rounded
down to a multiple of the blocksize.
This option overrides the calculation of tape size
+.It Cm a
+.Dq auto-size .
+Bypass all tape length considerations, and enforce writing
+until an end-of-media indication is returned. This fits best
+for most modern tape drives. Use of this option is particularly
+recommended when appending to an existing tape, or using a tape
+drive with hardware compression (where you can never be sure about
+the compression ratio).
based on length and density.
.It Fl b Ar blocksize
+Since the IO system slices all requests into chunks of MAXBSIZE
+(typically 64KB), it is not possible to use a larger blocksize
+without having problems later with
+.Xr restore 8 .
+Therefore
+.Nm
+will constrain writes to MAXBSIZE.
+.It Cm c
+Change the defaults for use with a cartridge tape drive, with a density
+of 8000 bpi, and a length of 1700 feet.
The number of kilobytes per dump record.
.It Fl c
Modify the calculation of the default density and tape size to be more
-/* $OpenBSD: dump.h,v 1.3 1996/09/01 13:12:35 deraadt Exp $ */
+/* $OpenBSD: dump.h,v 1.4 1997/02/03 11:53:25 deraadt Exp $ */
/* $NetBSD: dump.h,v 1.9 1995/03/18 14:54:57 cgd Exp $ */
/*-
int density; /* density in 0.1" units */
long tapesize; /* estimated tape size, blocks */
long tsize; /* tape size in 0.1" units */
+int unlimited; /* if set, write to end of medium */
long asize; /* number of 0.1" units written on current tape */
int etapes; /* estimated number of tapes */
int nonodump; /* if set, do not honor UF_NODUMP user flags */
-/* $OpenBSD: main.c,v 1.11 1996/12/16 17:11:32 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.12 1997/02/03 11:53:25 deraadt Exp $ */
/* $NetBSD: main.c,v 1.8 1996/03/15 22:39:32 scottr Exp $ */
/*-
static void obsolete __P((int *, char **[]));
static void usage __P((void));
+extern int maxbsize;
+
int
main(argc, argv)
int argc;
case 'b': /* blocks per tape write */
ntrec = numarg("blocks per write", 1L, 1000L);
+ if (ntrec > maxbsize/1024) {
+ msg("Please choose a blocksize <= %dKB\n",
+ maxbsize/1024);
+ exit(X_ABORT);
+ }
break;
case 'c': /* Tape is cart. not 9-track */
lastdump(ch);
exit(0); /* do nothing else */
+ case 'a': /* `auto-size', Write to EOM. */
+ unlimited = 1;
+ break;
+
default:
usage();
}
if (blocksperfile)
blocksperfile = blocksperfile / ntrec * ntrec; /* round down */
- else {
+ else if (!unlimited) {
/*
* Determine how to default tape size and density
*
anydirskipped = mapdirs(maxino, &tapesize);
}
- if (pipeout) {
+ if (pipeout || unlimited) {
tapesize += 10; /* 10 trailer blocks */
msg("estimated %ld tape blocks.\n", tapesize);
} else {
--- /dev/null
+/* $OpenBSD: maxbsize.c,v 1.1 1997/02/03 11:53:26 deraadt Exp $ */
+
+/*
+ * Copyright (c) 1997 Theo de Raadt
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Theo de Raadt.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define _KERNEL
+#include <sys/param.h>
+
+int maxbsize = MAXBSIZE;
-/* $OpenBSD: tape.c,v 1.2 1996/06/23 14:30:13 deraadt Exp $ */
+/* $OpenBSD: tape.c,v 1.3 1997/02/03 11:53:27 deraadt Exp $ */
/* $NetBSD: tape.c,v 1.7 1995/03/21 18:48:47 mycroft Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)tape.c 8.2 (Berkeley) 3/17/94";
#else
-static char rcsid[] = "$OpenBSD: tape.c,v 1.2 1996/06/23 14:30:13 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: tape.c,v 1.3 1997/02/03 11:53:27 deraadt Exp $";
#endif
#endif /* not lint */
* repositioning after stopping, i.e, streaming mode, where the gap is
* variable, 0.30" to 0.45". The gap is maximal when the tape stops.
*/
- if (blocksperfile == 0)
+ if (blocksperfile == 0 && !unlimited)
tenths = writesize / density +
(cartridge ? 16 : density == 625 ? 5 : 8);
/*
asize += tenths;
blockswritten += ntrec;
blocksthisvol += ntrec;
- if (!pipeout && (blocksperfile ?
+ if (!pipeout && !unlimited && (blocksperfile ?
(blocksthisvol >= blocksperfile) : (asize > tsize))) {
close_rewind();
startnewtape(0);