Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sbin Pull up following revision(s) (requested by manu in ...
details: https://anonhg.NetBSD.org/src/rev/3881a1ef405a
branches: netbsd-8
changeset: 852317:3881a1ef405a
user: martin <martin%NetBSD.org@localhost>
date: Fri Mar 29 19:43:28 2019 +0000
description:
Pull up following revision(s) (requested by manu in ticket #1221):
sbin/dump/tape.c: revision 1.55
sbin/dump_lfs/dump_lfs.8: revision 1.18
sbin/dump/dump.h: revision 1.56
sbin/dump/dump.8: revision 1.69
sbin/dump/dump.h: revision 1.57
sbin/dump/ffs_inode.c: revision 1.23
sbin/dump/optr.c: revision 1.43
sbin/dump/itime.c: revision 1.21
sbin/dump/main.c: revision 1.74
sbin/dump/itime.c: revision 1.22
sbin/dump/main.c: revision 1.75
sbin/dump/dump.8: revision 1.70
sbin/dump/traverse.c: revision 1.52
sbin/dump/dump.8: revision 1.71
Document what rdump is (was once) for. PR 53442.
Use getfsspecname() to fill the filesystem argument in dumpdates.
While here, make sure that the error strings terminate with newline
consistently, and add a function that adds the system error string.
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.
Bump date for previous.
diffstat:
sbin/dump/dump.8 | 26 +++++++++++++++++++++++---
sbin/dump/dump.h | 10 ++++++----
sbin/dump/ffs_inode.c | 13 +++++++------
sbin/dump/itime.c | 28 ++++++++++++++--------------
sbin/dump/main.c | 45 +++++++++++++++++++++++++--------------------
sbin/dump/optr.c | 36 +++++++++++++++++++++++++++++-------
sbin/dump/tape.c | 27 ++++++++++++++-------------
sbin/dump/traverse.c | 6 +++---
sbin/dump_lfs/dump_lfs.8 | 17 +++++++++++++++--
9 files changed, 136 insertions(+), 72 deletions(-)
diffs (truncated from 671 to 300 lines):
diff -r 4f33c3219ba4 -r 3881a1ef405a sbin/dump/dump.8
--- a/sbin/dump/dump.8 Fri Mar 29 19:39:06 2019 +0000
+++ b/sbin/dump/dump.8 Fri Mar 29 19:43:28 2019 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: dump.8,v 1.68 2016/08/15 00:03:14 sevan Exp $
+.\" $NetBSD: dump.8,v 1.68.6.1 2019/03/29 19:43:28 martin 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 15, 2016
+.Dd March 25, 2019
.Dt DUMP 8
.Os
.Sh NAME
@@ -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.
@@ -449,6 +462,13 @@
whilst a backup is in progress, statistics on the amount completed,
current transfer rate, and estimated finished time, will be written
to the standard error output.
+.Pp
+The historic alternate name
+.Nm rdump
+was once required when dumping to a remote host.
+This functionality is now built into
+.Nm
+itself.
.Sh ENVIRONMENT
If the following environment variables exist, they are used by
.Nm .
diff -r 4f33c3219ba4 -r 3881a1ef405a sbin/dump/dump.h
--- a/sbin/dump/dump.h Fri Mar 29 19:39:06 2019 +0000
+++ b/sbin/dump/dump.h Fri Mar 29 19:43:28 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dump.h,v 1.54 2015/11/16 17:06:47 christos Exp $ */
+/* $NetBSD: dump.h,v 1.54.8.1 2019/03/29 19:43:28 martin 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 */
@@ -185,10 +186,11 @@
/* operator interface functions */
void broadcast(const char *);
void lastdump(char);
-void msg(const char *fmt, ...) __printflike(1, 2);
-void msgtail(const char *fmt, ...) __printflike(1, 2);
+void msg(const char *, ...) __printflike(1, 2);
+void msgtail(const char *, ...) __printflike(1, 2);
int query(const char *);
-void quit(const char *fmt, ...) __printflike(1, 2);
+void quit(const char *, ...) __printflike(1, 2);
+void quite(int, const char *, ...) __printflike(2, 3);
time_t do_stats(void);
void statussig(int);
void timeest(void);
diff -r 4f33c3219ba4 -r 3881a1ef405a sbin/dump/ffs_inode.c
--- a/sbin/dump/ffs_inode.c Fri Mar 29 19:39:06 2019 +0000
+++ b/sbin/dump/ffs_inode.c Fri Mar 29 19:43:28 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_inode.c,v 1.22 2013/06/23 02:06:04 dholland Exp $ */
+/* $NetBSD: ffs_inode.c,v 1.22.20.1 2019/03/29 19:43:28 martin Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@@ -36,7 +36,7 @@
#endif /* not lint */
#ifndef lint
-__RCSID("$NetBSD: ffs_inode.c,v 1.22 2013/06/23 02:06:04 dholland Exp $");
+__RCSID("$NetBSD: ffs_inode.c,v 1.22.20.1 2019/03/29 19:43:28 martin Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -79,7 +79,7 @@
sblock = (struct fs *)superblock;
for (i = 0; ; i++) {
if (sblock_try[i] == -1)
- quit("can't find superblock\n");
+ quit("can't find superblock");
rawread(sblock_try[i], (char *)superblock, MAXBSIZE);
switch(sblock->fs_magic) {
@@ -169,7 +169,7 @@
char *cp;
if ((cgp = malloc(sblock->fs_cgsize)) == NULL)
- quit("fs_mapinodes: cannot allocate memory.\n");
+ quite(errno, "fs_mapinodes: cannot allocate memory.");
for (cg = 0; cg < sblock->fs_ncg; cg++) {
ino = cg * sblock->fs_ipg;
@@ -190,7 +190,8 @@
*/
if (sblock->fs_flags & FS_DOSOFTDEP) {
if (!cg_chkmagic(cgp, 0))
- quit("mapfiles: cg %d: bad magic number\n", cg);
+ quit("%s: cg %d: bad magic number\n",
+ __func__, cg);
cp = &cg_inosused(cgp, 0)[(inosused - 1) / CHAR_BIT];
for ( ; inosused > 0; inosused -= CHAR_BIT, cp--) {
if (*cp == 0)
@@ -225,7 +226,7 @@
struct ufs2_dinode *dp2;
if (inoblock == NULL && (inoblock = malloc(ufsib->ufs_bsize)) == NULL)
- quit("cannot allocate inode memory.\n");
+ quite(errno, "cannot allocate inode memory.");
curino = inum;
if (inum >= minino && inum < maxino)
goto gotit;
diff -r 4f33c3219ba4 -r 3881a1ef405a sbin/dump/itime.c
--- a/sbin/dump/itime.c Fri Mar 29 19:39:06 2019 +0000
+++ b/sbin/dump/itime.c Fri Mar 29 19:43:28 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: itime.c,v 1.20 2013/06/15 01:27:19 christos Exp $ */
+/* $NetBSD: itime.c,v 1.20.20.1 2019/03/29 19:43:28 martin 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.20 2013/06/15 01:27:19 christos Exp $");
+__RCSID("$NetBSD: itime.c,v 1.20.20.1 2019/03/29 19:43:28 martin Exp $");
#endif
#endif /* not lint */
@@ -87,8 +87,8 @@
}
(void) fclose(df);
if ((df = fopen(dumpdates, "r")) == NULL) {
- quit("cannot read %s even after creating it: %s\n",
- dumpdates, strerror(errno));
+ quite(errno, "cannot read %s even after creating it",
+ dumpdates);
/* NOTREACHED */
}
}
@@ -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,21 +170,21 @@
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)
- quit("cannot rewrite %s: %s\n", dumpdates, strerror(errno));
+ 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;
readdumptimes(df);
if (fseek(df, 0L, 0) < 0)
- quit("fseek: %s\n", strerror(errno));
+ quite(errno, "can't fseek %s", dumpdates);
spcl.c_ddate = 0;
ITITERATE(i, dtwalk) {
if (strncmp(fname, dtwalk->dd_name,
@@ -211,9 +211,9 @@
dumprecout(df, dtwalk);
}
if (fflush(df))
- quit("%s: %s\n", dumpdates, strerror(errno));
+ quite(errno, "can't flush %s", dumpdates);
if (ftruncate(fd, ftell(df)))
- quit("ftruncate (%s): %s\n", dumpdates, strerror(errno));
+ quite(errno, "can't ftruncate %s", dumpdates);
(void) fclose(df);
msg("level %c dump on %s", level,
spcl.c_date == 0 ? "the epoch\n" : ctime(&dtfound->dd_ddate));
@@ -227,7 +227,7 @@
what->dd_name,
what->dd_level,
ctime(&what->dd_ddate)) < 0)
- quit("%s: %s\n", dumpdates, strerror(errno));
+ quite(errno, "can't write %s", dumpdates);
}
int recno;
diff -r 4f33c3219ba4 -r 3881a1ef405a sbin/dump/main.c
--- a/sbin/dump/main.c Fri Mar 29 19:39:06 2019 +0000
+++ b/sbin/dump/main.c Fri Mar 29 19:43:28 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.73 2015/08/24 17:37:10 bouyer Exp $ */
+/* $NetBSD: main.c,v 1.73.8.1 2019/03/29 19:43:28 martin 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.73 2015/08/24 17:37:10 bouyer Exp $");
+__RCSID("$NetBSD: main.c,v 1.73.8.1 2019/03/29 19:43:28 martin Exp $");
#endif
#endif /* not lint */
@@ -124,7 +124,7 @@
temp = _PATH_DTMP;
strcpy(labelstr, "none"); /* XXX safe strcpy. */
if (TP_BSIZE / DEV_BSIZE == 0 || TP_BSIZE % DEV_BSIZE != 0)
- quit("TP_BSIZE must be a multiple of DEV_BSIZE\n");
+ quit("TP_BSIZE must be a multiple of DEV_BSIZE");
level = '0';
timestamp = 0;
@@ -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);
@@ -286,11 +290,12 @@
error = lstat(argv[i], &sb);
if (Fflag || (!error && (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)))) {
if (error)
- quit("Cannot stat %s: %s\n", argv[i], strerror(errno));
+ quite(errno, "can't stat %s", argv[i]);
disk = argv[i];
multicheck:
if (dirc != 0)
- quit("Can't dump a disk or image at the same time as a file list\n");
+ quit("can't dump a disk or image at the same"
+ " time as a file list");
break;
Home |
Main Index |
Thread Index |
Old Index