Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/dump PR/42883: Greywolf: Add -i flag which brings "true...



details:   https://anonhg.NetBSD.org/src/rev/8c7d8764591a
branches:  trunk
changeset: 752449:8c7d8764591a
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Feb 26 02:11:40 2010 +0000

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

diffstat:

 sbin/dump/dump.8  |  20 ++++++++++++++++----
 sbin/dump/dump.h  |   3 ++-
 sbin/dump/itime.c |  10 ++++++----
 sbin/dump/main.c  |  11 ++++++++---
 4 files changed, 32 insertions(+), 12 deletions(-)

diffs (153 lines):

diff -r 5e4cce0c9c9b -r 8c7d8764591a sbin/dump/dump.8
--- a/sbin/dump/dump.8  Fri Feb 26 01:16:09 2010 +0000
+++ b/sbin/dump/dump.8  Fri Feb 26 02:11:40 2010 +0000
@@ -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
diff -r 5e4cce0c9c9b -r 8c7d8764591a sbin/dump/dump.h
--- a/sbin/dump/dump.h  Fri Feb 26 01:16:09 2010 +0000
+++ b/sbin/dump/dump.h  Fri Feb 26 02:11:40 2010 +0000
@@ -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 */
diff -r 5e4cce0c9c9b -r 8c7d8764591a sbin/dump/itime.c
--- a/sbin/dump/itime.c Fri Feb 26 01:16:09 2010 +0000
+++ b/sbin/dump/itime.c Fri Feb 26 02:11:40 2010 +0000
@@ -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;
diff -r 5e4cce0c9c9b -r 8c7d8764591a sbin/dump/main.c
--- a/sbin/dump/main.c  Fri Feb 26 01:16:09 2010 +0000
+++ b/sbin/dump/main.c  Fri Feb 26 02:11:40 2010 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index