Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Mar 2002 22:02:50 +1100 (EST)
From:      Mark Hannon <markhannon@optushome.com.au>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/35450: PATCH: Add -S flag to dump to estimate size only
Message-ID:  <200203011102.g21B2of80344@doorway.homeip.net>

next in thread | raw e-mail | index | archive | help


>Number:         35450
>Category:       bin
>Synopsis:       PATCH: Add -S flag to dump to estimate size only
>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:   Fri Mar 01 03:10:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Mark Hannon
>Release:        FreeBSD 4.5-RELEASE i386
>Organization:
-
>Environment:
System: FreeBSD tbird.home.lan 4.5-RELEASE FreeBSD 4.5-RELEASE #0: Mon Jan 28 14:31:56 GMT 2002 murray@builder.freebsdmall.com:/usr/src/sys/compile/GENERIC i386
>Description:
	
Add -S flag to dump to allow it just print out dump estimate size and then
exit.  Taken from NetBSD
>How-To-Repeat:
	
>Fix:

	

Index: sbin/dump/main.c
===================================================================
RCS file: /home/ncvs/src/sbin/dump/main.c,v
retrieving revision 1.20.2.6
diff -c -r1.20.2.6 main.c
*** sbin/dump/main.c	2001/11/24 19:19:41	1.20.2.6
--- sbin/dump/main.c	2002/02/23 02:53:24
***************
*** 105,110 ****
--- 105,111 ----
  	register char *map;
  	register int ch;
  	int i, anydirskipped, bflag = 0, Tflag = 0, honorlevel = 1;
+ 	int just_estimate = 0;
  	ino_t maxino;
  
  	spcl.c_date = 0;
***************
*** 124,132 ****
  
  	obsolete(&argc, &argv);
  #ifdef KERBEROS
! #define optstring "0123456789aB:b:cd:f:h:kns:T:uWwD:"
  #else
! #define optstring "0123456789aB:b:cd:f:h:ns:T:uWwD:"
  #endif
  	while ((ch = getopt(argc, argv, optstring)) != -1)
  #undef optstring
--- 125,133 ----
  
  	obsolete(&argc, &argv);
  #ifdef KERBEROS
! #define optstring "0123456789aB:b:cd:f:h:kns:ST:uWwD:"
  #else
! #define optstring "0123456789aB:b:cd:f:h:ns:ST:uWwD:"
  #endif
  	while ((ch = getopt(argc, argv, optstring)) != -1)
  #undef optstring
***************
*** 187,192 ****
--- 188,197 ----
  			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) {
***************
*** 411,416 ****
--- 416,428 ----
  		    tapesize, fetapes);
  	}
  
+         /*
+          * If the user only wants an estimate of the number of
+          * tapes, exit now.
+          */
+         if (just_estimate)
+                 exit(0);
+  
  	/*
  	 * Allocate tape buffer.
  	 */
***************
*** 495,501 ****
  #ifdef KERBEROS
  		"k"
  #endif
! 		"nu] [-B records] [-b blocksize] [-D dumpdates]\n"
  		"            [-d density] [-f file ] [-h level] [-s feet] "
  		"[-T date] filesystem\n"
  		"       dump [-W | -w]\n");
--- 507,513 ----
  #ifdef KERBEROS
  		"k"
  #endif
! 		"nSu] [-B records] [-b blocksize] [-D dumpdates]\n"
  		"            [-d density] [-f file ] [-h level] [-s feet] "
  		"[-T date] filesystem\n"
  		"       dump [-W | -w]\n");


Index: sbin/dump/dump.8
===================================================================
RCS file: /home/ncvs/src/sbin/dump/dump.8,v
retrieving revision 1.27.2.9
diff -c -r1.27.2.9 dump.8
*** sbin/dump/dump.8	2001/08/16 11:35:42	1.27.2.9
--- sbin/dump/dump.8	2002/02/23 02:53:38
***************
*** 42,48 ****
  .Nd filesystem backup
  .Sh SYNOPSIS
  .Nm
! .Op Fl 0123456789acknu
  .Op Fl B Ar records
  .Op Fl b Ar blocksize
  .Op Fl D Ar dumpdates
--- 42,48 ----
  .Nd filesystem backup
  .Sh SYNOPSIS
  .Nm
! .Op Fl 0123456789acknSu
  .Op Fl B Ar records
  .Op Fl b Ar blocksize
  .Op Fl D Ar dumpdates
***************
*** 194,199 ****
--- 194,202 ----
  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
>Release-Note:
>Audit-Trail:
>Unformatted:

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?200203011102.g21B2of80344>