Add a new "-S" flag to dump to allow it just print out dump estimate

size and then exit.

PR:		bin/35450
Submitted by:	Mark Hannon <markhannon@optushome.com.au>
Obtained from:	NetBSD
MFC after:	1 week
This commit is contained in:
Ian Dowse 2002-03-01 20:54:23 +00:00
parent b3aeda3f1f
commit 9ac0768d74
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=91540
2 changed files with 20 additions and 5 deletions

View File

@ -33,7 +33,7 @@
.\" @(#)dump.8 8.3 (Berkeley) 5/1/95
.\" $FreeBSD$
.\"
.Dd July 9, 2001
.Dd March 1, 2002
.Dt DUMP 8
.Os
.Sh NAME
@ -42,7 +42,7 @@
.Nd filesystem backup
.Sh SYNOPSIS
.Nm
.Op Fl 0123456789acknu
.Op Fl 0123456789acknSu
.Op Fl B Ar records
.Op Fl b Ar blocksize
.Op Fl D Ar dumpdates
@ -194,6 +194,9 @@ If this amount is exceeded,
prompts for a new tape.
It is recommended to be a bit conservative on this option.
The default tape length is 2300 feet.
.It Fl S
Display an estimate of the backup size and the number of
tapes required, and exit without actually performing the dump.
.It Fl T Ar date
Use the specified date as the starting time for the dump
instead of the time determined from looking in

View File

@ -99,6 +99,7 @@ main(argc, argv)
char *map;
int ch;
int i, anydirskipped, bflag = 0, Tflag = 0, honorlevel = 1;
int just_estimate = 0;
ino_t maxino;
char *tmsg;
time_t t;
@ -119,9 +120,9 @@ main(argc, argv)
obsolete(&argc, &argv);
#ifdef KERBEROS
#define optstring "0123456789aB:b:cd:f:h:kns:T:uWwD:"
#define optstring "0123456789aB:b:cd:f:h:kns:ST:uWwD:"
#else
#define optstring "0123456789aB:b:cd:f:h:ns:T:uWwD:"
#define optstring "0123456789aB:b:cd:f:h:ns:ST:uWwD:"
#endif
while ((ch = getopt(argc, argv, optstring)) != -1)
#undef optstring
@ -182,6 +183,10 @@ main(argc, argv)
tsize = numarg("tape size", 1L, 0L) * 12 * 10;
break;
case 'S': /* exit after estimating # of tapes */
just_estimate = 1;
break;
case 'T': /* time of last dump */
spcl.c_ddate = unctime(optarg);
if (spcl.c_ddate < 0) {
@ -420,6 +425,13 @@ main(argc, argv)
tapesize, fetapes);
}
/*
* If the user only wants an estimate of the number of
* tapes, exit now.
*/
if (just_estimate)
exit(0);
/*
* Allocate tape buffer.
*/
@ -508,7 +520,7 @@ usage()
#ifdef KERBEROS
"k"
#endif
"nu] [-B records] [-b blocksize] [-D dumpdates]\n"
"nSu] [-B records] [-b blocksize] [-D dumpdates]\n"
" [-d density] [-f file ] [-h level] [-s feet] "
"[-T date] filesystem\n"
" dump [-W | -w]\n");