Module Name: src
Committed By: martin
Date: Fri Mar 29 19:43:28 UTC 2019
Modified Files:
src/sbin/dump [netbsd-8]: dump.8 dump.h ffs_inode.c itime.c main.c
optr.c tape.c traverse.c
src/sbin/dump_lfs [netbsd-8]: dump_lfs.8
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.68.6.1 src/sbin/dump/dump.8
cvs rdiff -u -r1.54 -r1.54.8.1 src/sbin/dump/dump.h src/sbin/dump/tape.c
cvs rdiff -u -r1.22 -r1.22.20.1 src/sbin/dump/ffs_inode.c
cvs rdiff -u -r1.20 -r1.20.20.1 src/sbin/dump/itime.c
cvs rdiff -u -r1.73 -r1.73.8.1 src/sbin/dump/main.c
cvs rdiff -u -r1.42 -r1.42.18.1 src/sbin/dump/optr.c
cvs rdiff -u -r1.50 -r1.50.20.1 src/sbin/dump/traverse.c
cvs rdiff -u -r1.16 -r1.16.24.1 src/sbin/dump_lfs/dump_lfs.8
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.68 src/sbin/dump/dump.8:1.68.6.1
--- src/sbin/dump/dump.8:1.68 Mon Aug 15 00:03:14 2016
+++ src/sbin/dump/dump.8 Fri Mar 29 19:43:28 2019
@@ -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 @@ The file
.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 @@ argument of
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 .
Index: src/sbin/dump/dump.h
diff -u src/sbin/dump/dump.h:1.54 src/sbin/dump/dump.h:1.54.8.1
--- src/sbin/dump/dump.h:1.54 Mon Nov 16 17:06:47 2015
+++ src/sbin/dump/dump.h Fri Mar 29 19:43:28 2019
@@ -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 @@ const char *temp; /* name of the file fo
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 @@ void fs_mapinodes(ino_t, u_int64_t *, in
/* 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);
Index: src/sbin/dump/tape.c
diff -u src/sbin/dump/tape.c:1.54 src/sbin/dump/tape.c:1.54.8.1
--- src/sbin/dump/tape.c:1.54 Mon Aug 24 17:37:10 2015
+++ src/sbin/dump/tape.c Fri Mar 29 19:43:28 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: tape.c,v 1.54 2015/08/24 17:37:10 bouyer Exp $ */
+/* $NetBSD: tape.c,v 1.54.8.1 2019/03/29 19:43:28 martin Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)tape.c 8.4 (Berkeley) 5/1/95";
#else
-__RCSID("$NetBSD: tape.c,v 1.54 2015/08/24 17:37:10 bouyer Exp $");
+__RCSID("$NetBSD: tape.c,v 1.54.8.1 2019/03/29 19:43:28 martin Exp $");
#endif
#endif /* not lint */
@@ -196,7 +196,7 @@ tperror(int signo __unused)
if (pipeout) {
msg("write error on %s\n", tape);
- quit("Cannot recover\n");
+ quit("Cannot recover");
/* NOTREACHED */
}
msg("write error %ld blocks into volume %d\n", blocksthisvol, tapeno);
@@ -215,7 +215,7 @@ static void
sigpipe(int signo __unused)
{
- quit("Broken pipe\n");
+ quit("Broken pipe");
}
/*
@@ -284,7 +284,7 @@ flushtape(void)
slp->req[trecno].count = 0; /* Sentinel */
if (atomic_write(slp->fd, slp->req, siz) != siz)
- quit("error writing command pipe: %s\n", strerror(errno));
+ quite(errno, "error writing command pipe");
slp->sent = 1; /* we sent a request, read the response later */
lastfirstrec = slp->firstrec;
@@ -375,7 +375,7 @@ trewind(int eject)
if (got != writesize) {
msg("EOT detected in last 2 tape records!\n");
msg("Use a longer tape, decrease the size estimate\n");
- quit("or use no size estimate at all.\n");
+ quit("or use no size estimate at all");
}
}
(void) close(slaves[f].fd);
@@ -554,7 +554,7 @@ rollforward(void)
slp->sent = 0;
if (got != writesize) {
- quit("EOT detected at start of the tape!\n");
+ quit("EOT detected at start of the tape");
}
}
}
@@ -768,8 +768,8 @@ enslave(void)
if (socketpair(AF_LOCAL, SOCK_STREAM, 0, cmd) < 0 ||
(slaves[i].pid = fork()) < 0)
- quit("too many slaves, %d (recompile smaller): %s\n",
- i, strerror(errno));
+ quite(errno, "too many slaves, %d (recompile smaller)",
+ i);
slaves[i].fd = cmd[1];
slaves[i].sent = 0;
@@ -822,14 +822,15 @@ doslave(int cmd, int slave_number __unus
*/
(void) close(diskfd);
if ((diskfd = open(disk_dev, O_RDONLY)) < 0)
- quit("slave couldn't reopen disk: %s\n", strerror(errno));
+ quite(errno, "slave couldn't reopen disk");
/*
* Need the pid of the next slave in the loop...
*/
if ((nread = atomic_read(cmd, &nextslave, sizeof nextslave))
!= sizeof nextslave) {
- quit("master/slave protocol botched - didn't get pid of next slave.\n");
+ quit("master/slave protocol botched - didn't get pid"
+ " of next slave");
}
/*
@@ -847,7 +848,7 @@ doslave(int cmd, int slave_number __unus
if (p->count != 1 || atomic_read(cmd,
slp->tblock[trecno],
TP_BSIZE) != TP_BSIZE)
- quit("master/slave protocol botched.\n");
+ quit("master/slave protocol botched");
}
}
@@ -924,7 +925,7 @@ doslave(int cmd, int slave_number __unus
}
printcachestats();
if (nread != 0)
- quit("error reading command pipe: %s\n", strerror(errno));
+ quite(errno, "error reading command pipe");
}
/*
Index: src/sbin/dump/ffs_inode.c
diff -u src/sbin/dump/ffs_inode.c:1.22 src/sbin/dump/ffs_inode.c:1.22.20.1
--- src/sbin/dump/ffs_inode.c:1.22 Sun Jun 23 02:06:04 2013
+++ src/sbin/dump/ffs_inode.c Fri Mar 29 19:43:28 2019
@@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
#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 @@ fs_read_sblock(char *superblock)
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 @@ fs_mapinodes(ino_t maxino __unused, u_in
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 @@ fs_mapinodes(ino_t maxino __unused, u_in
*/
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 @@ getino(ino_t inum)
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;
Index: src/sbin/dump/itime.c
diff -u src/sbin/dump/itime.c:1.20 src/sbin/dump/itime.c:1.20.20.1
--- src/sbin/dump/itime.c:1.20 Sat Jun 15 01:27:19 2013
+++ src/sbin/dump/itime.c Fri Mar 29 19:43:28 2019
@@ -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 @@ initdumptimes(void)
}
(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 @@ getdumptime(void)
{
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 @@ putdumptime(void)
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 @@ putdumptime(void)
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 @@ dumprecout(FILE *file, struct dumpdates
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;
Index: src/sbin/dump/main.c
diff -u src/sbin/dump/main.c:1.73 src/sbin/dump/main.c:1.73.8.1
--- src/sbin/dump/main.c:1.73 Mon Aug 24 17:37:10 2015
+++ src/sbin/dump/main.c Fri Mar 29 19:43:28 2019
@@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
#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 @@ main(int argc, char *argv[])
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 @@ main(int argc, char *argv[])
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 @@ main(int argc, char *argv[])
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 @@ main(int argc, char *argv[])
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;
}
if ((dt = fstabsearch(argv[i])) != NULL) {
@@ -299,8 +304,7 @@ main(int argc, char *argv[])
goto multicheck;
}
if (statvfs(argv[i], &fsbuf) == -1)
- quit("Cannot statvfs %s: %s\n", argv[i],
- strerror(errno));
+ quite(errno, "can't statvfs %s", argv[i]);
disk = fsbuf.f_mntfromname;
if (strcmp(argv[i], fsbuf.f_mntonname) == 0)
goto multicheck;
@@ -318,7 +322,7 @@ main(int argc, char *argv[])
mountpoint);
} else {
if (strcmp(mountpoint, fsbuf.f_mntonname) != 0)
- quit("%s is not on %s\n", argv[i], mountpoint);
+ quit("%s is not on %s", argv[i], mountpoint);
}
msg("Dumping file/directory %s\n", argv[i]);
dirc++;
@@ -403,18 +407,18 @@ main(int argc, char *argv[])
mntinfo = mntinfosearch(disk);
if ((dt = fstabsearch(disk)) != NULL) {
if (getfsspecname(buf, sizeof(buf), dt->fs_spec) == NULL)
- quit("%s (%s)", buf, strerror(errno));
+ quite(errno, "can't resolve mount %s (%s)", dt->fs_spec,
+ buf);
if (getdiskrawname(rbuf, sizeof(rbuf), buf) == NULL)
- quit("Can't get disk raw name for `%s' (%s)",
- buf, strerror(errno));
+ quite(errno, "can't get disk raw name for %s", buf);
disk = rbuf;
mountpoint = dt->fs_file;
msg("Found %s on %s in %s\n", disk, mountpoint, _PATH_FSTAB);
} else if (mntinfo != NULL) {
if (getdiskrawname(rbuf, sizeof(rbuf), mntinfo->f_mntfromname)
== NULL)
- quit("Can't get disk raw name for `%s' (%s)",
- mntinfo->f_mntfromname, strerror(errno));
+ quite(errno, "can't get disk raw name for %s",
+ mntinfo->f_mntfromname);
disk = rbuf;
mountpoint = mntinfo->f_mntonname;
msg("Found %s on %s in mount table\n", disk, mountpoint);
@@ -592,7 +596,8 @@ main(int argc, char *argv[])
* Allocate tape buffer.
*/
if (!alloctape())
- quit("can't allocate tape buffers - try a smaller blocking factor.\n");
+ quit("can't allocate tape buffers - try a smaller"
+ " blocking factor.");
startnewtape(1);
(void)time((time_t *)&(tstart_writing));
@@ -673,7 +678,7 @@ usage(void)
"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);
}
@@ -709,7 +714,7 @@ sig(int signo)
case SIGTERM:
case SIGTRAP:
if (pipeout)
- quit("Signal on pipe: cannot recover\n");
+ quit("Signal on pipe: cannot recover");
msg("Rewriting attempted as response to signal %s.\n", sys_siglist[signo]);
(void)fflush(stderr);
(void)fflush(stdout);
@@ -805,7 +810,7 @@ xcalloc(size_t number, size_t size)
p = calloc(number, size);
if (p == NULL)
- quit("%s\n", strerror(errno));
+ quite(errno, "Can't allocate %zu bytes", size * number);
return (p);
}
@@ -816,7 +821,7 @@ xmalloc(size_t size)
p = malloc(size);
if (p == NULL)
- quit("%s\n", strerror(errno));
+ quite(errno, "Can't allocate %zu bytes", size);
return (p);
}
@@ -827,6 +832,6 @@ xstrdup(const char *str)
p = strdup(str);
if (p == NULL)
- quit("%s\n", strerror(errno));
+ quite(errno, "Can't copy %s", str);
return (p);
}
Index: src/sbin/dump/optr.c
diff -u src/sbin/dump/optr.c:1.42 src/sbin/dump/optr.c:1.42.18.1
--- src/sbin/dump/optr.c:1.42 Sun Sep 8 13:26:05 2013
+++ src/sbin/dump/optr.c Fri Mar 29 19:43:28 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: optr.c,v 1.42 2013/09/08 13:26:05 mlelstv Exp $ */
+/* $NetBSD: optr.c,v 1.42.18.1 2019/03/29 19:43:28 martin Exp $ */
/*-
* Copyright (c) 1980, 1988, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)optr.c 8.2 (Berkeley) 1/6/94";
#else
-__RCSID("$NetBSD: optr.c,v 1.42 2013/09/08 13:26:05 mlelstv Exp $");
+__RCSID("$NetBSD: optr.c,v 1.42.18.1 2019/03/29 19:43:28 martin Exp $");
#endif
#endif /* not lint */
@@ -94,7 +94,7 @@ query(const char *question)
firstprompt = time((time_t *)0);
if ((mytty = fopen(_PATH_TTY, "r")) == NULL)
- quit("fopen on %s fails: %s\n", _PATH_TTY, strerror(errno));
+ quite(errno, "fopen on %s fails", _PATH_TTY);
attnmessage = question;
timeout = 0;
alarmcatch(0);
@@ -104,7 +104,7 @@ query(const char *question)
if (fgets(replybuffer, 63, mytty) == NULL) {
clearerr(mytty);
if (++errcount > 30) /* XXX ugly */
- quit("excessive operator query failures\n");
+ quit("excessive operator query failures");
} else if (replybuffer[0] == 'y' || replybuffer[0] == 'Y') {
back = 1;
} else if (replybuffer[0] == 'n' || replybuffer[0] == 'N') {
@@ -295,6 +295,24 @@ msgtail(const char *fmt, ...)
}
void
+quite(int e, const char *fmt, ...)
+{
+ va_list ap;
+
+ (void) fprintf(stderr," DUMP: ");
+#ifdef TDEBUG
+ (void) fprintf(stderr, "pid=%d ", getpid());
+#endif
+ va_start(ap, fmt);
+ (void) vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ (void) fprintf(stderr, ": %s\n", strerror(e));
+ (void) fflush(stdout);
+ (void) fflush(stderr);
+ dumpabort(0);
+}
+
+void
quit(const char *fmt, ...)
{
va_list ap;
@@ -306,6 +324,7 @@ quit(const char *fmt, ...)
va_start(ap, fmt);
(void) vfprintf(stderr, fmt, ap);
va_end(ap);
+ (void) fprintf(stderr, "\n");
(void) fflush(stdout);
(void) fflush(stderr);
dumpabort(0);
@@ -324,10 +343,13 @@ allocfsent(const struct fstab *fs)
new = xmalloc(sizeof (*fs));
new->fs_file = xstrdup(fs->fs_file);
new->fs_type = xstrdup(fs->fs_type);
- new->fs_spec = xstrdup(fs->fs_spec);
+ new->fs_spec = xmalloc(FILENAME_MAX);
+ if (getfsspecname(new->fs_spec, FILENAME_MAX, fs->fs_spec) == NULL)
+ quite(errno, "can't resolve mount point %s (%s)",
+ fs->fs_spec, new->fs_spec);
new->fs_passno = fs->fs_passno;
new->fs_freq = fs->fs_freq;
- return (new);
+ return new;
}
struct pfstab {
@@ -426,7 +448,7 @@ mntinfosearch(const char *key)
char buf[MAXPATHLEN];
if ((mntbufc = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
- quit("Can't get mount list: %s", strerror(errno));
+ quite(errno, "Can't get mount list");
for (fs = mntbuf, i = 0; i < mntbufc; i++, fs++) {
#ifdef DUMP_LFS
if (strcmp(fs->f_fstypename, "lfs") != 0)
Index: src/sbin/dump/traverse.c
diff -u src/sbin/dump/traverse.c:1.50 src/sbin/dump/traverse.c:1.50.20.1
--- src/sbin/dump/traverse.c:1.50 Sat Jun 15 01:27:19 2013
+++ src/sbin/dump/traverse.c Fri Mar 29 19:43:28 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: traverse.c,v 1.50 2013/06/15 01:27:19 christos Exp $ */
+/* $NetBSD: traverse.c,v 1.50.20.1 2019/03/29 19:43:28 martin Exp $ */
/*-
* Copyright (c) 1980, 1988, 1991, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)traverse.c 8.7 (Berkeley) 6/15/95";
#else
-__RCSID("$NetBSD: traverse.c,v 1.50 2013/06/15 01:27:19 christos Exp $");
+__RCSID("$NetBSD: traverse.c,v 1.50.20.1 2019/03/29 19:43:28 martin Exp $");
#endif
#endif /* not lint */
@@ -413,7 +413,7 @@ searchdir(ino_t dino, daddr_t blkno, lon
dblk = malloc(size);
if (dblk == NULL)
- quit("searchdir: cannot allocate directory memory.\n");
+ quit("%s: cannot allocate directory memory", __func__);
bread(fsatoda(ufsib, blkno), dblk, (int)size);
if (filesize < size)
size = filesize;
Index: src/sbin/dump_lfs/dump_lfs.8
diff -u src/sbin/dump_lfs/dump_lfs.8:1.16 src/sbin/dump_lfs/dump_lfs.8:1.16.24.1
--- src/sbin/dump_lfs/dump_lfs.8:1.16 Sun Apr 8 22:00:37 2012
+++ src/sbin/dump_lfs/dump_lfs.8 Fri Mar 29 19:43:28 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: dump_lfs.8,v 1.16 2012/04/08 22:00:37 wiz Exp $
+.\" $NetBSD: dump_lfs.8,v 1.16.24.1 2019/03/29 19:43:28 martin 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 @@ The file
.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.