Module Name:    src
Committed By:   christos
Date:           Fri Feb 26 02:11:40 UTC 2010

Modified Files:
        src/sbin/dump: dump.8 dump.h itime.c main.c

Log Message:
PR/42883: Greywolf: Add -i flag which brings "true incremental" capability.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sbin/dump/dump.8
cvs rdiff -u -r1.45 -r1.46 src/sbin/dump/dump.h
cvs rdiff -u -r1.16 -r1.17 src/sbin/dump/itime.c
cvs rdiff -u -r1.64 -r1.65 src/sbin/dump/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/dump/dump.8
diff -u src/sbin/dump/dump.8:1.58 src/sbin/dump/dump.8:1.59
--- src/sbin/dump/dump.8:1.58	Fri Jan 30 06:55:04 2009
+++ src/sbin/dump/dump.8	Thu Feb 25 21:11:40 2010
@@ -1,4 +1,4 @@
-.\"	$NetBSD: dump.8,v 1.58 2009/01/30 11:55:04 enami Exp $
+.\"	$NetBSD: dump.8,v 1.59 2010/02/26 02:11:40 christos Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	 Regents of the University of California.
@@ -30,7 +30,7 @@
 .\"
 .\"     @(#)dump.8	8.3 (Berkeley) 5/1/95
 .\"
-.Dd August 12, 2008
+.Dd February 25, 2010
 .Dt DUMP 8
 .Os
 .Sh NAME
@@ -39,7 +39,7 @@
 .Nd file system backup
 .Sh SYNOPSIS
 .Nm
-.Op Fl 0123456789aceFnStuX
+.Op Fl 0123456789aceFinStuX
 .Bk -words
 .Op Fl B Ar records
 .Ek
@@ -147,7 +147,9 @@
 option below).
 A level number above 0, incremental backup,
 tells dump to copy all files new or modified since the
-last dump of a lower level.
+last dump of a lower level (but see also the
+.Fl i
+option below).
 The default level is 9.
 .It Fl a
 .Dq auto-size .
@@ -221,6 +223,10 @@
 The default honor level is 1,
 so that incremental backups omit such files
 but full backups retain them.
+.It Fl i Ar incremental
+The dump is treated as level 9 but takes into account a previous
+level 9, if one exists.  This makes it possible to perform a "true
+incremental" dump.
 .It Fl k Ar read-blocksize
 The size in kilobyte of the read buffers, rounded up to a multiple of the
 file system block size.
@@ -551,6 +557,12 @@
 .Nm
 command appeared in
 .At v6 .
+.Pp
+The
+.Fl i
+flag was inspired by the
+.Fl x
+flag from Sun's Solstice Backup utility.
 .Sh BUGS
 Fewer than 32 read errors on the file system are ignored.
 .Pp

Index: src/sbin/dump/dump.h
diff -u src/sbin/dump/dump.h:1.45 src/sbin/dump/dump.h:1.46
--- src/sbin/dump/dump.h:1.45	Sat Feb 16 12:58:01 2008
+++ src/sbin/dump/dump.h	Thu Feb 25 21:11:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dump.h,v 1.45 2008/02/16 17:58:01 matt Exp $	*/
+/*	$NetBSD: dump.h,v 1.46 2010/02/26 02:11:40 christos Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1993
@@ -110,6 +110,7 @@
 int	diskfd;		/* disk file descriptor */
 int	tapefd;		/* tape file descriptor */
 int	pipeout;	/* true => output to standard output */
+int	trueinc;	/* true => "true incremental", i.e use last 9 as ref */
 ino_t	curino;		/* current inumber; used globally */
 int	newtape;	/* new tape flag */
 u_int64_t	tapesize;	/* estimated tape size, blocks */

Index: src/sbin/dump/itime.c
diff -u src/sbin/dump/itime.c:1.16 src/sbin/dump/itime.c:1.17
--- src/sbin/dump/itime.c:1.16	Fri May 19 10:52:39 2006
+++ src/sbin/dump/itime.c	Thu Feb 25 21:11:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: itime.c,v 1.16 2006/05/19 14:52:39 christos Exp $	*/
+/*	$NetBSD: itime.c,v 1.17 2010/02/26 02:11:40 christos Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)itime.c	8.1 (Berkeley) 6/5/93";
 #else
-__RCSID("$NetBSD: itime.c,v 1.16 2006/05/19 14:52:39 christos Exp $");
+__RCSID("$NetBSD: itime.c,v 1.17 2010/02/26 02:11:40 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -145,12 +145,14 @@
 	initdumptimes();
 	/*
 	 *	Go find the entry with the same name for a lower increment
-	 *	and older date
+	 *	and older date.  If we are doing a true incremental, then
+	 *	we can use level 9 as a ref point
 	 */
 	ITITERATE(i, ddp) {
 		if (strncmp(fname, ddp->dd_name, sizeof (ddp->dd_name)) != 0)
 			continue;
-		if (ddp->dd_level >= level)
+		if ((!trueinc && (ddp->dd_level >= level)) ||
+		    (trueinc && (ddp->dd_level > level)))
 			continue;
 		if (ddp->dd_ddate <= iswap32(spcl.c_ddate))
 			continue;

Index: src/sbin/dump/main.c
diff -u src/sbin/dump/main.c:1.64 src/sbin/dump/main.c:1.65
--- src/sbin/dump/main.c:1.64	Sat Jul 19 21:20:22 2008
+++ src/sbin/dump/main.c	Thu Feb 25 21:11:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.64 2008/07/20 01:20:22 lukem Exp $	*/
+/*	$NetBSD: main.c,v 1.65 2010/02/26 02:11:40 christos Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c	8.6 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.64 2008/07/20 01:20:22 lukem Exp $");
+__RCSID("$NetBSD: main.c,v 1.65 2010/02/26 02:11:40 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -134,7 +134,7 @@
 
 	obsolete(&argc, &argv);
 	while ((ch = getopt(argc, argv,
-	    "0123456789aB:b:cd:eFf:h:k:l:L:nr:s:StT:uWwx:X")) != -1)
+	    "0123456789aB:b:cd:eFf:h:ik:l:L:nr:s:StT:uWwx:X")) != -1)
 		switch (ch) {
 		/* dump level */
 		case '0': case '1': case '2': case '3': case '4':
@@ -181,6 +181,11 @@
 			honorlevel = numarg("honor level", 0L, 10L);
 			break;
 
+		case 'i':	/* "true incremental" regardless level 9 */
+			level = '9';
+			trueinc = 1;
+			break;
+
 		case 'k':
 			readblksize = numarg("read block size", 0, 64) * 1024;
 			break;

Reply via email to