Source-Changes-HG archive

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

[src/trunk]: src/sbin Add -U flag to dump(8) and dump_lfs(8) to specify dumpd...



details:   https://anonhg.NetBSD.org/src/rev/9a21cb4c1d91
branches:  trunk
changeset: 449812:9a21cb4c1d91
user:      manu <manu%NetBSD.org@localhost>
date:      Mon Mar 25 02:13:01 2019 +0000

description:
Add -U flag to dump(8) and dump_lfs(8) to specify dumpdates entry

This address situations where dump(8) cannot figure out the device being
dumped. It also allows tracking of subvolume dumps by using virtual
device as dumpdates entry.

diffstat:

 sbin/dump/dump.8         |  17 +++++++++++++++--
 sbin/dump/dump.h         |   3 ++-
 sbin/dump/itime.c        |  14 +++++++-------
 sbin/dump/main.c         |  12 ++++++++----
 sbin/dump_lfs/dump_lfs.8 |  17 +++++++++++++++--
 5 files changed, 47 insertions(+), 16 deletions(-)

diffs (195 lines):

diff -r 785ac94e6a3b -r 9a21cb4c1d91 sbin/dump/dump.8
--- a/sbin/dump/dump.8  Mon Mar 25 01:06:34 2019 +0000
+++ b/sbin/dump/dump.8  Mon Mar 25 02:13:01 2019 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: dump.8,v 1.69 2018/07/15 06:14:13 dholland Exp $
+.\"    $NetBSD: dump.8,v 1.70 2019/03/25 02:13:01 manu Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"     Regents of the University of California.
@@ -51,6 +51,7 @@
 .Op Fl r Ar cachesize
 .Op Fl s Ar feet
 .Op Fl T Ar date
+.Op Fl U Ar dumpdev
 .Op Fl x Ar snap-backup
 .Ar files-to-dump
 .Nm
@@ -299,10 +300,22 @@
 .Pa /etc/dumpdates
 may be edited to change any of the fields,
 if necessary.
-If a list of files or subdirectories is being dumped
+If the
+.Fl T
+option is used or if a list of files or subdirectories is being dumped
 (as opposed to an entire file system), then
 .Fl u
 is ignored.
+.It Fl U Ar dumpdev
+Same as
+.Fl u
+but specifies the device in
+.Pa /etc/dumpdates
+as
+.Ar dumpdev .
+This option can be used with subdir dumps and with the
+.Fl T
+option.
 .It Fl W
 .Nm
 tells the operator what file systems need to be dumped.
diff -r 785ac94e6a3b -r 9a21cb4c1d91 sbin/dump/dump.h
--- a/sbin/dump/dump.h  Mon Mar 25 01:06:34 2019 +0000
+++ b/sbin/dump/dump.h  Mon Mar 25 02:13:01 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dump.h,v 1.56 2019/03/01 16:42:11 christos Exp $       */
+/*     $NetBSD: dump.h,v 1.57 2019/03/25 02:13:01 manu Exp $   */
 
 /*-
  * Copyright (c) 1980, 1993
@@ -115,6 +115,7 @@
 char   lastlevel;      /* dump level of previous dump */
 char   level;          /* dump level of this dump */
 int    uflag;          /* update flag */
+const char *dumpdev;   /* device name in dumpdates */
 int    eflag;          /* eject flag */
 int    lflag;          /* autoload flag */
 int    diskfd;         /* disk file descriptor */
diff -r 785ac94e6a3b -r 9a21cb4c1d91 sbin/dump/itime.c
--- a/sbin/dump/itime.c Mon Mar 25 01:06:34 2019 +0000
+++ b/sbin/dump/itime.c Mon Mar 25 02:13:01 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: itime.c,v 1.21 2019/03/01 16:42:11 christos Exp $      */
+/*     $NetBSD: itime.c,v 1.22 2019/03/25 02:13:01 manu 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.21 2019/03/01 16:42:11 christos Exp $");
+__RCSID("$NetBSD: itime.c,v 1.22 2019/03/25 02:13:01 manu Exp $");
 #endif
 #endif /* not lint */
 
@@ -129,9 +129,9 @@
 {
        struct dumpdates *ddp;
        int i;
-       char *fname;
+       const char *fname;
 
-       fname = disk;
+       fname = dumpdev ? dumpdev : disk;
 #ifdef FDEBUG
        msg("Looking for name %s in dumpdates = %s for level = %c\n",
                fname, dumpdates, level);
@@ -170,15 +170,15 @@
        struct dumpdates *dtwalk, *dtfound;
        int i;
        int fd;
-       char *fname;
+       const char *fname;
 
-       if(uflag == 0)
+       if (uflag == 0 && dumpdev == NULL)
                return;
        if ((df = fopen(dumpdates, "r+")) == NULL)
                quite(errno, "cannot rewrite %s", dumpdates);
        fd = fileno(df);
        (void) flock(fd, LOCK_EX);
-       fname = disk;
+       fname = dumpdev ? dumpdev : disk;
        free((char *)ddatev);
        ddatev = 0;
        nddates = 0;
diff -r 785ac94e6a3b -r 9a21cb4c1d91 sbin/dump/main.c
--- a/sbin/dump/main.c  Mon Mar 25 01:06:34 2019 +0000
+++ b/sbin/dump/main.c  Mon Mar 25 02:13:01 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.74 2019/03/01 16:42:11 christos Exp $       */
+/*     $NetBSD: main.c,v 1.75 2019/03/25 02:13:01 manu 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.74 2019/03/01 16:42:11 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.75 2019/03/25 02:13:01 manu Exp $");
 #endif
 #endif /* not lint */
 
@@ -133,7 +133,7 @@
 
        obsolete(&argc, &argv);
        while ((ch = getopt(argc, argv,
-           "0123456789aB:b:cd:eFf:h:ik:l:L:nr:s:StT:uWwx:X")) != -1)
+           "0123456789aB:b:cd:eFf:h:ik:l:L:nr:s:StT:uU:Wwx:X")) != -1)
                switch (ch) {
                /* dump level */
                case '0': case '1': case '2': case '3': case '4':
@@ -245,6 +245,10 @@
                        uflag = 1;
                        break;
 
+               case 'U':               /* dump device in /etc/dumpdates */
+                       dumpdev = optarg;
+                       break;
+
                case 'W':               /* what to do */
                case 'w':
                        lastdump(ch);
@@ -674,7 +678,7 @@
 "usage: %s [-0123456789aceFinStuX] [-B records] [-b blocksize]\n"
 "            [-d density] [-f file] [-h level] [-k read-blocksize]\n"
 "            [-L label] [-l timeout] [-r cachesize] [-s feet]\n"
-"            [-T date] [-x snap-backup] files-to-dump\n"
+"            [-T date] [-U dumpdev] [-x snap-backup] files-to-dump\n"
 "       %s [-W | -w]\n", prog, prog);
        exit(X_STARTUP);
 }
diff -r 785ac94e6a3b -r 9a21cb4c1d91 sbin/dump_lfs/dump_lfs.8
--- a/sbin/dump_lfs/dump_lfs.8  Mon Mar 25 01:06:34 2019 +0000
+++ b/sbin/dump_lfs/dump_lfs.8  Mon Mar 25 02:13:01 2019 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: dump_lfs.8,v 1.17 2017/06/07 15:24:50 abhinav Exp $
+.\"    $NetBSD: dump_lfs.8,v 1.18 2019/03/25 02:13:01 manu Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"     Regents of the University of California.
@@ -51,6 +51,7 @@
 .Op Fl r Ar cachesize
 .Op Fl s Ar feet
 .Op Fl T Ar date
+.Op Fl U Ar dumpdev
 .Op Fl x Ar snap-backup
 .Ar files-to-dump
 .Nm
@@ -280,10 +281,22 @@
 .Pa /etc/dumpdates
 may be edited to change any of the fields,
 if necessary.
-If a list of files or subdirectories is being dumped
+If the
+.Fl T
+option is used or if a list of files or subdirectories is being dumped
 (as opposed to an entire file system), then
 .Fl u
 is ignored.
+.It Fl U Ar dumpdev
+Same as
+.Fl u
+but specifies the device in
+.Pa /etc/dumpdates
+as
+.Ar dumpdev .
+This option can be used with subdir dumps and with the
+.Fl T
+option.
 .It Fl X
 Prevent the log from wrapping until the dump completes, guaranteeing
 a consistent backup.



Home | Main Index | Thread Index | Old Index