Subject: UPDATED: dump(8)ing multiple subdirs & files of a filesystem
To: None <current-users@netbsd.org, tech-userlevel@netbsd.org>
From: Luke Mewburn <lukem@connect.com.au>
List: current-users
Date: 04/11/1997 18:09:14
I wrote:
> I've added the ability to dump(8) multiple sub directories and files
> of a single filesystem, a la Solaris' ufsdump(1M).
Here's the patches:
DISCLAIMER: Please note that whilst I've made every effort to test these
so far, I make no claim about their suitability.
That said, please test them in various invocations of 'subset' dumps
(i.e, dumping only certain files and directories in a mounted
filesystem), and see if what you can restore is what should have been
backed up.
Please get back to me via private email. If people are happy with
them, I'll post a followup in a few days, then commit it to the main
tree...
---
Index: dump.8
===================================================================
RCS file: /cvsroot/src/sbin/dump/dump.8,v
retrieving revision 1.14
diff -u -r1.14 dump.8
--- dump.8 1996/02/05 23:59:37 1.14
+++ dump.8 1997/04/11 07:41:16
@@ -34,14 +34,14 @@
.\"
.\" @(#)dump.8 8.1 (Berkeley) 6/16/93
.\"
-.Dd June 16, 1993
+.Dd April 11, 1997
.Dt DUMP 8
.Os BSD 4
.Sh NAME
.Nm dump
.Nd filesystem backup
.Sh SYNOPSIS
-.Nm dump
+.Nm
.Op Fl 0123456789cnu
.Op Fl B Ar records
.Op Fl b Ar blocksize
@@ -50,7 +50,7 @@
.Op Fl h Ar level
.Op Fl s Ar feet
.Op Fl T Ar date
-.Ar filesystem
+.Ar files_to_dump
.Nm dump
.Op Fl W Li \&| Fl w
.Pp
@@ -60,7 +60,7 @@
option syntax is implemented for backward compatibility, but
is not documented here.)
.Sh DESCRIPTION
-.Nm Dump
+.Nm
examines files
on a filesystem
and determines which files
@@ -81,6 +81,15 @@
By default, the same output file name is used for each volume
after prompting the operator to change media.
.Pp
+.Ar files_to_dump
+is either a single mountpoint or device of an umounted filesystem,
+or a list of files and directories on a single filesystem to be backed
+up as a subset of the filesystem.
+In the latter case, certain restrictions are placed on the backup:
+.Fl u
+is ignored, and the only dump level that is supported is
+.Fl 0 .
+.Pp
The following options are supported by
.Nm dump :
.Bl -tag -width Ds
@@ -134,7 +143,7 @@
.Dq host:file ,
or
.Dq user@host:file ,
-.Nm dump
+.Nm
writes to the named file on the remote host using
.Xr rmt 8 .
.It Fl h Ar level
@@ -149,7 +158,7 @@
but full backups retain them.
.It Fl n
Whenever
-.Nm dump
+.Nm
requires operator attention,
notify all operators in the group
.Dq operator
@@ -159,7 +168,7 @@
Attempt to calculate the amount of tape needed
at a particular density.
If this amount is exceeded,
-.Nm dump
+.Nm
prompts for a new tape.
It is recommended to be a bit conservative on this option.
The default tape length is 2300 feet.
@@ -194,8 +203,12 @@
.Pa /etc/dumpdates
may be edited to change any of the fields,
if necessary.
+If a list of files or subdirectories is being dumped
+(as opposed to and entire filesystem), then
+.Fl u
+is ignored.
.It Fl W
-.Nm Dump
+.Nm
tells the operator what file systems need to be dumped.
This information is gleaned from the files
.Pa /etc/dumpdates
@@ -204,7 +217,7 @@
The
.Fl W
flag causes
-.Nm dump
+.Nm
to print out, for each file system in
.Pa /etc/dumpdates
the most recent dump date and level,
@@ -212,13 +225,13 @@
If the
.Fl W
flag is set, all other options are ignored, and
-.Nm dump
+.Nm
exits immediately.
.It Fl w
Is like W, but prints only those filesystems which need to be dumped.
.El
.Pp
-.Nm Dump
+.Nm
requires operator intervention on these conditions:
end of tape,
end of dump,
@@ -228,15 +241,15 @@
In addition to alerting all operators implied by the
.Fl n
flag,
-.Nm dump
+.Nm
interacts with the operator on
.Nm dump Ns 's
control terminal at times when
-.Nm dump
+.Nm
can no longer proceed,
or if something is grossly wrong.
All questions
-.Nm dump
+.Nm
poses
.Em must
be answered by typing
@@ -246,17 +259,17 @@
appropriately.
.Pp
Since making a dump involves a lot of time and effort for full dumps,
-.Nm dump
+.Nm
checkpoints itself at the start of each tape volume.
If writing that volume fails for some reason,
-.Nm dump
+.Nm
will,
with operator permission,
restart itself from the checkpoint
after the old tape has been rewound and removed,
and a new tape has been mounted.
.Pp
-.Nm Dump
+.Nm
tells the operator what is going on at periodic intervals,
including usually low estimates of the number of blocks to write,
the number of tapes it will take, the time to completion, and
@@ -264,7 +277,7 @@
The output is verbose,
so that others know that the terminal
controlling
-.Nm dump
+.Nm
is busy,
and will be for some time.
.Pp
@@ -301,6 +314,19 @@
.Pp
After several months or so, the daily and weekly tapes should get
rotated out of the dump cycle and fresh tapes brought in.
+.Pp
+If
+.Nm
+receives a
+.Dv SIGINFO
+signal
+(see the
+.Dq status
+argument of
+.Xr stty 1 )
+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.
.Sh FILES
.Bl -tag -width /etc/dumpdates -compact
.It Pa /dev/rmt8
@@ -316,14 +342,16 @@
.Em operator
.El
.Sh SEE ALSO
+.Xr dump 5 ,
+.Xr fstab 5 ,
.Xr restore 8 ,
.Xr rmt 8 ,
-.Xr dump 5 ,
-.Xr fstab 5
+.Xr stty 1
.Sh DIAGNOSTICS
Many, and verbose.
.Pp
-Dump exits with zero status on success.
+.Nm
+exits with zero status on success.
Startup errors are indicated with an exit code of 1;
abnormal termination is indicated with an exit code of 3.
.Sh BUGS
@@ -333,7 +361,7 @@
reels already written just hang around until the entire tape
is written.
.Pp
-.Nm Dump
+.Nm
with the
.Fl W
or
@@ -344,8 +372,13 @@
even if listed in
.Pa /etc/fstab .
.Pp
+When dumping a list of files or subdirectories, access privileges are
+required to scan the directory (as this is done via the
+.Xr fts 3
+routines rather than directly accessing the filesystem).
+.Pp
It would be nice if
-.Nm dump
+.Nm
knew about the dump sequence,
kept track of the tapes scribbled on,
told the operator which tape to mount when,
@@ -354,5 +387,5 @@
.Xr restore .
.Sh HISTORY
A
-.Nm dump
+.Nm
command appeared in Version 6 AT&T UNIX.
Index: dump.h
===================================================================
RCS file: /cvsroot/src/sbin/dump/dump.h,v
retrieving revision 1.10
diff -u -r1.10 dump.h
--- dump.h 1997/04/10 05:36:23 1.10
+++ dump.h 1997/04/11 07:41:16
@@ -101,13 +101,15 @@
void quit __P((const char *fmt, ...));
void set_operators __P((void));
time_t do_stats __P((void));
+void statussig __P((int));
void timeest __P((void));
time_t unctime __P((char *str));
/* mapping routines */
struct dinode;
long blockest __P((struct dinode *dp));
-int mapfiles __P((ino_t maxino, long *tapesize));
+int mapfiles __P((ino_t maxino, long *tapesize, char *disk,
+ char * const *dirv));
int mapdirs __P((ino_t maxino, long *tapesize));
/* file dumping routines */
Index: dumprmt.c
===================================================================
RCS file: /cvsroot/src/sbin/dump/dumprmt.c,v
retrieving revision 1.11
diff -u -r1.11 dumprmt.c
--- dumprmt.c 1996/11/05 23:59:01 1.11
+++ dumprmt.c 1997/04/11 07:41:17
@@ -121,7 +121,7 @@
void
rmtgetconn()
{
- register char *cp;
+ char *cp;
static struct servent *sp = NULL;
static struct passwd *pwd = NULL;
#ifdef notdef
@@ -179,8 +179,8 @@
okname(cp0)
char *cp0;
{
- register char *cp;
- register int c;
+ char *cp;
+ int c;
for (cp = cp0; *cp; cp++) {
c = *cp;
@@ -292,8 +292,8 @@
struct mtget *
rmtstatus()
{
- register int i;
- register char *cp;
+ int i;
+ char *cp;
if (rmtstate != TS_OPEN)
return (NULL);
@@ -329,7 +329,7 @@
rmtreply(cmd)
char *cmd;
{
- register char *cp;
+ char *cp;
char code[30], emsg[BUFSIZ];
rmtgets(code, sizeof (code));
@@ -371,7 +371,7 @@
char *line;
int len;
{
- register char *cp = line;
+ char *cp = line;
while (len > 1) {
*cp = rmtgetb();
Index: itime.c
===================================================================
RCS file: /cvsroot/src/sbin/dump/itime.c,v
retrieving revision 1.3
diff -u -r1.3 itime.c
--- itime.c 1995/03/18 14:55:01 1.3
+++ itime.c 1997/04/11 07:41:20
@@ -112,8 +112,8 @@
readdumptimes(df)
FILE *df;
{
- register int i;
- register struct dumptime *dtwalk;
+ int i;
+ struct dumptime *dtwalk;
for (;;) {
dtwalk = (struct dumptime *)calloc(1, sizeof (struct dumptime));
@@ -139,8 +139,8 @@
void
getdumptime()
{
- register struct dumpdates *ddp;
- register int i;
+ struct dumpdates *ddp;
+ int i;
char *fname;
fname = disk;
@@ -172,8 +172,8 @@
putdumptime()
{
FILE *df;
- register struct dumpdates *dtwalk;
- register int i;
+ struct dumpdates *dtwalk;
+ int i;
int fd;
char *fname;
Index: main.c
===================================================================
RCS file: /cvsroot/src/sbin/dump/main.c,v
retrieving revision 1.10
diff -u -r1.10 main.c
--- main.c 1997/04/10 05:36:24 1.10
+++ main.c 1997/04/11 07:41:20
@@ -49,6 +49,9 @@
#include <sys/param.h>
#include <sys/time.h>
+#include <sys/stat.h>
+#include <sys/mount.h>
+
#ifdef sunos
#include <sys/vnode.h>
@@ -101,15 +104,17 @@
int argc;
char *argv[];
{
- register ino_t ino;
- register int dirty;
- register struct dinode *dp;
- register struct fstab *dt;
- register char *map;
- register int ch;
+ ino_t ino;
+ int dirty;
+ struct dinode *dp;
+ struct fstab *dt;
+ char *map;
+ int ch;
int i, anydirskipped, bflag = 0, Tflag = 0, honorlevel = 1;
ino_t maxino;
time_t tnow;
+ int dirlist;
+ char *toplevel;
uid = getuid();
euid = geteuid();
@@ -204,14 +209,66 @@
(void)fprintf(stderr, "Must specify disk or filesystem\n");
exit(X_ABORT);
}
- disk = *argv++;
- argc--;
- if (argc >= 1) {
- (void)fprintf(stderr, "Unknown arguments to dump:");
- while (argc--)
- (void)fprintf(stderr, " %s", *argv++);
- (void)fprintf(stderr, "\n");
- exit(X_ABORT);
+
+ /*
+ * determine if disk is a subdirectory, and setup appropriately
+ */
+ dirlist = 0;
+ toplevel = NULL;
+ for (i = 0; i < argc; i++) {
+ struct stat sb;
+ struct statfs fsbuf;
+
+ if (stat(argv[i], &sb) == -1) {
+ msg("Cannot stat %s: %s\n", argv[i], strerror(errno));
+ exit(X_ABORT);
+ }
+ if (!S_ISDIR(sb.st_mode) && !S_ISREG(sb.st_mode))
+ break;
+ if (statfs(argv[i], &fsbuf) == -1) {
+ msg("Cannot statfs %s: %s\n", argv[i], strerror(errno));
+ exit(X_ABORT);
+ }
+ if (strcmp(argv[i], fsbuf.f_mntonname) == 0) {
+ if (dirlist != 0) {
+ msg("Can't dump a mountpoint and a filelist\n");
+ exit(X_ABORT);
+ }
+ break; /* exit if sole mountpoint */
+ }
+ if (!disk) {
+ if ((toplevel = strdup(fsbuf.f_mntonname)) == NULL) {
+ msg("Cannot malloc diskname\n");
+ exit(X_ABORT);
+ }
+ disk = toplevel;
+ if (uflag) {
+ msg("Ignoring u flag for subdir dump\n");
+ uflag = 0;
+ }
+ if (level > '0') {
+ msg("Subdir dump is done at level 0\n");
+ level = '0';
+ }
+ msg("Dumping sub files/directories from %s\n", disk);
+ } else {
+ if (strcmp(disk, fsbuf.f_mntonname) != 0) {
+ msg("%s is not on %s\n", argv[i], disk);
+ exit(X_ABORT);
+ }
+ }
+ msg("Dumping file/directory %s\n", argv[i]);
+ dirlist++;
+ }
+ if (dirlist == 0) {
+ disk = *argv++;
+ if (argc != 1) {
+ (void)fprintf(stderr, "Excess arguments to dump:");
+ while (--argc)
+ (void)fprintf(stderr, " %s", *argv++);
+ (void)fprintf(stderr, "\n");
+ exit(X_ABORT);
+ }
}
if (Tflag && uflag) {
(void)fprintf(stderr,
@@ -272,6 +329,7 @@
set_operators(); /* /etc/group snarfed */
getfstab(); /* /etc/fstab snarfed */
+
/*
* disk can be either the full special file name,
* the suffix of the special file name,
@@ -336,8 +394,11 @@
nonodump = spcl.c_level < honorlevel;
+ (void)signal(SIGINFO, statussig);
+
msg("mapping (Pass I) [regular files]\n");
- anydirskipped = mapfiles(maxino, &tapesize);
+ anydirskipped = mapfiles(maxino, &tapesize, toplevel,
+ (dirlist ? argv : NULL));
msg("mapping (Pass II) [directories]\n");
while (anydirskipped) {
@@ -452,7 +513,7 @@
msg("Date of this level %c dump: %s", level,
spcl.c_date == 0 ? "the epoch\n" : ctime(&spcl.c_date));
msg("Date this dump completed: %s", ctime(&tnow));
- msg("Average transfer rate: %ldK/s\n", xferrate / tapeno);
+ msg("Average transfer rate: %ld KB/s\n", xferrate / tapeno);
putdumptime();
trewind();
broadcast("DUMP IS DONE!\7\7\n");
@@ -559,7 +620,7 @@
/* Allocate space for new arguments. */
if ((*argvp = nargv = malloc((argc + 1) * sizeof(char *))) == NULL ||
(p = flagsp = malloc(strlen(ap) + 2)) == NULL)
- err(1, NULL);
+ err(1, "malloc");
*nargv++ = *argv;
argv += 2;
@@ -578,7 +639,7 @@
usage();
}
if ((nargv[0] = malloc(strlen(*argv) + 2 + 1)) == NULL)
- err(1, NULL);
+ err(1, "malloc");
nargv[0][0] = '-';
nargv[0][1] = *ap;
(void)strcpy(&nargv[0][2], *argv);
@@ -602,7 +663,8 @@
}
/* Copy remaining arguments. */
- while (*nargv++ = *argv++);
+ while ((*nargv++ = *argv++) != NULL)
+ ;
/* Update argument count. */
*argcp = nargv - *argvp - 1;
Index: optr.c
===================================================================
RCS file: /cvsroot/src/sbin/dump/optr.c,v
retrieving revision 1.6
diff -u -r1.6 optr.c
--- optr.c 1997/04/10 05:36:25 1.6
+++ optr.c 1997/04/11 07:41:21
@@ -269,7 +269,7 @@
char *tty, *message;
{
char t[50], buf[BUFSIZ];
- register char *cp;
+ char *cp;
int lmsg = 1;
FILE *f_tty;
@@ -314,7 +314,7 @@
(void) time((time_t *) &tnow);
if (tnow >= tschedule) {
- tschedule = tnow + 300;
+ tschedule = tnow + 600; /* ten minutes */
if (blockswritten < 500)
return;
deltat = tstart_writing - tnow +
@@ -406,9 +406,9 @@
struct fstab *
allocfsent(fs)
- register struct fstab *fs;
+ struct fstab *fs;
{
- register struct fstab *new;
+ struct fstab *new;
new = (struct fstab *)malloc(sizeof (*fs));
if (new == NULL ||
@@ -431,8 +431,8 @@
void
getfstab()
{
- register struct fstab *fs;
- register struct pfstab *pf;
+ struct fstab *fs;
+ struct pfstab *pf;
if (setfsent() == 0) {
msg("Can't open %s for dump table information: %s\n",
@@ -472,8 +472,8 @@
fstabsearch(key)
char *key;
{
- register struct pfstab *pf;
- register struct fstab *fs;
+ struct pfstab *pf;
+ struct fstab *fs;
char *rn;
for (pf = table; pf != NULL; pf = pf->pf_next) {
@@ -503,9 +503,9 @@
lastdump(arg)
char arg; /* w ==> just what to do; W ==> most recent dumps */
{
- register int i;
- register struct fstab *dt;
- register struct dumpdates *dtwalk;
+ int i;
+ struct fstab *dt;
+ struct dumpdates *dtwalk;
char *lastname, *date;
int dumpme;
time_t tnow;
Index: tape.c
===================================================================
RCS file: /cvsroot/src/sbin/dump/tape.c,v
retrieving revision 1.8
diff -u -r1.8 tape.c
--- tape.c 1997/04/10 05:36:26 1.8
+++ tape.c 1997/04/11 07:41:23
@@ -260,13 +260,38 @@
if (ttaken > 0) {
msg("Volume %d took %d:%02d:%02d\n", tapeno,
ttaken / 3600, (ttaken % 3600) / 60, ttaken % 60);
- msg("Volume %d transfer rate: %ldK/s\n", tapeno,
+ msg("Volume %d transfer rate: %ld KB/s\n", tapeno,
blocks / ttaken);
xferrate += blocks / ttaken;
}
return(tnow);
}
+/*
+ * statussig --
+ * information message upon receipt of SIGINFO
+ * (derived from optr.c::timeest())
+ */
+void
+statussig(notused)
+ int notused;
+{
+ time_t tnow, deltat;
+ char msgbuf[128];
+
+ if (blockswritten < 500)
+ return;
+ (void) time((time_t *) &tnow);
+ deltat = tstart_writing - tnow + (1.0 * (tnow - tstart_writing))
+ / blockswritten * tapesize;
+ snprintf(msgbuf, sizeof(msgbuf),
+ "%3.2f%% done at %ld KB/s, finished in %d:%02d\n",
+ (blockswritten * 100.0) / tapesize,
+ (spcl.c_tapea - tapea_volume) / (tnow - tstart_volume),
+ (int)(deltat / 3600), (int)((deltat % 3600) / 60));
+ write(STDERR_FILENO, msgbuf, strlen(msgbuf));
+}
+
static void
flushtape()
{
@@ -418,8 +443,8 @@
void
rollforward()
{
- register struct req *p, *q, *prev;
- register struct slave *tslp;
+ struct req *p, *q, *prev;
+ struct slave *tslp;
int i, size, savedtapea, got;
union u_spcl *ntb, *otb;
tslp = &slaves[SLAVES];
@@ -714,7 +739,7 @@
enslave()
{
int cmd[2];
- register int i, j;
+ int i, j;
master = getpid();
@@ -757,7 +782,7 @@
void
killall()
{
- register int i;
+ int i;
for (i = 0; i < SLAVES; i++)
if (slaves[i].pid > 0)
@@ -773,10 +798,10 @@
*/
static void
doslave(cmd, slave_number)
- register int cmd;
+ int cmd;
int slave_number;
{
- register int nread;
+ int nread;
int nextslave, size, wrote, eot_count;
sigset_t sigset;
@@ -799,7 +824,7 @@
* Get list of blocks to dump, read the blocks into tape buffer
*/
while ((nread = atomic(read, cmd, (char *)slp->req, reqsiz)) == reqsiz) {
- register struct req *p = slp->req;
+ struct req *p = slp->req;
for (trecno = 0; trecno < ntrec;
trecno += p->count, p += p->count) {
Index: traverse.c
===================================================================
RCS file: /cvsroot/src/sbin/dump/traverse.c,v
retrieving revision 1.15
diff -u -r1.15 traverse.c
--- traverse.c 1996/11/30 18:03:27 1.15
+++ traverse.c 1997/04/11 07:41:25
@@ -59,6 +59,8 @@
#include <protocols/dumprestore.h>
#include <ctype.h>
+#include <errno.h>
+#include <fts.h>
#include <stdio.h>
#ifdef __STDC__
#include <string.h>
@@ -89,7 +91,7 @@
*/
long
blockest(dp)
- register struct dinode *dp;
+ struct dinode *dp;
{
long blkest, sizeest;
@@ -134,6 +136,36 @@
#endif
/*
+ * Determine if given inode should be dumped
+ */
+void
+mapfileino(ino, tapesize, dirskipped)
+ ino_t ino;
+ long *tapesize;
+ int *dirskipped;
+{
+ int mode;
+ struct dinode *dp;
+
+ dp = getino(ino);
+ if ((mode = (dp->di_mode & IFMT)) == 0)
+ return;
+ SETINO(ino, usedinomap);
+ if (mode == IFDIR)
+ SETINO(ino, dumpdirmap);
+ if (WANTTODUMP(dp)) {
+ SETINO(ino, dumpinomap);
+ if (mode != IFREG && mode != IFDIR && mode != IFLNK)
+ *tapesize += 1;
+ else
+ *tapesize += blockest(dp);
+ return;
+ }
+ if (mode == IFDIR)
+ *dirskipped = 1;
+}
+
+/*
* Dump pass 1.
*
* Walk the inode list for a filesystem to find all allocated inodes
@@ -141,32 +173,86 @@
* the directories in the filesystem.
*/
int
-mapfiles(maxino, tapesize)
+mapfiles(maxino, tapesize, disk, dirv)
ino_t maxino;
long *tapesize;
+ char *disk;
+ char * const *dirv;
{
- register int mode;
- register ino_t ino;
- register struct dinode *dp;
int anydirskipped = 0;
- for (ino = ROOTINO; ino < maxino; ino++) {
- dp = getino(ino);
- if ((mode = (dp->di_mode & IFMT)) == 0)
- continue;
- SETINO(ino, usedinomap);
- if (mode == IFDIR)
- SETINO(ino, dumpdirmap);
- if (WANTTODUMP(dp)) {
- SETINO(ino, dumpinomap);
- if (mode != IFREG && mode != IFDIR && mode != IFLNK)
- *tapesize += 1;
+ if (dirv != NULL) {
+ char curdir[MAXPATHLEN];
+ FTS *dirh;
+ FTSENT *entry;
+ int d;
+
+ if (getcwd(curdir, sizeof(curdir)) == NULL) {
+ msg("Can't determine cwd: %s\n", strerror(errno));
+ dumpabort(0);
+ }
+ if ((dirh = fts_open(dirv, FTS_PHYSICAL|FTS_SEEDOT|FTS_XDEV,
+ (int (*)())NULL)) == NULL) {
+ msg("fts_open failed: %s\n", strerror(errno));
+ dumpabort(0);
+ }
+ while ((entry = fts_read(dirh)) != NULL) {
+ switch (entry->fts_info) {
+ case FTS_DNR: /* an error */
+ case FTS_ERR:
+ case FTS_NS:
+ msg("Can't fts_read %s: %s\n", entry->fts_path,
+ strerror(errno));
+ case FTS_DP: /* already seen dir */
+ continue;
+ }
+ mapfileino(entry->fts_statp->st_ino, tapesize,
+ &anydirskipped);
+ }
+ (void)fts_close(dirh);
+
+ /*
+ * Add any parent directories
+ */
+ for (d = 0 ; dirv[d] != NULL ; d++) {
+ char path[MAXPATHLEN];
+
+ if (dirv[d][0] != '/')
+ snprintf(path, sizeof(path), "%s/%s",
+ curdir, dirv[d]);
else
- *tapesize += blockest(dp);
- continue;
+ snprintf(path, sizeof(path), "%s", dirv[d]);
+ while (strcmp(path, disk) != 0) {
+ char *p;
+ struct stat sb;
+
+ if (*path == '\0')
+ break;
+ if ((p = strrchr(path, '/')) == NULL)
+ break;
+ if (p == path)
+ break;
+ *p = '\0';
+ if (stat(path, &sb) == -1) {
+ msg("Can't stat %s: %s\n", path,
+ strerror(errno));
+ break;
+ }
+ mapfileino(sb.st_ino, tapesize, &anydirskipped);
+ }
+ }
+
+ /*
+ * Ensure that the root inode actually appears in the
+ * file list for a subdir
+ */
+ mapfileino(ROOTINO, tapesize, &anydirskipped);
+ } else {
+ ino_t ino;
+
+ for (ino = ROOTINO; ino < maxino; ino++) {
+ mapfileino(ino, tapesize, &anydirskipped);
}
- if (mode == IFDIR)
- anydirskipped = 1;
}
/*
* Restore gets very upset if the root is not dumped,
@@ -193,10 +279,10 @@
ino_t maxino;
long *tapesize;
{
- register struct dinode *dp;
- register int i, isdir;
- register char *map;
- register ino_t ino;
+ struct dinode *dp;
+ int i, isdir;
+ char *map;
+ ino_t ino;
long filesize;
int ret, change = 0;
@@ -254,7 +340,7 @@
long *filesize;
{
int ret = 0;
- register int i;
+ int i;
daddr_t idblk[MAXNINDIR];
bread(fsbtodb(sblock, blkno), (char *)idblk, (int)sblock->fs_bsize);
@@ -289,11 +375,11 @@
searchdir(ino, blkno, size, filesize)
ino_t ino;
daddr_t blkno;
- register long size;
+ long size;
long filesize;
{
- register struct direct *dp;
- register long loc, ret = 0;
+ struct direct *dp;
+ long loc, ret = 0;
char dblk[MAXBSIZE];
bread(fsbtodb(sblock, blkno), dblk, (int)size);
@@ -335,7 +421,7 @@
*/
void
dumpino(dp, ino)
- register struct dinode *dp;
+ struct dinode *dp;
ino_t ino;
{
int ind_level, cnt;
@@ -453,7 +539,7 @@
int frags;
ino_t ino;
{
- register daddr_t *bp;
+ daddr_t *bp;
int i, j, count, blks, tbperdb;
blks = howmany(frags * sblock->fs_fsize, TP_BSIZE);
@@ -490,7 +576,7 @@
int type;
ino_t ino;
{
- register int i;
+ int i;
char *cp;
spcl.c_type = type;
@@ -507,7 +593,7 @@
writeheader(ino)
ino_t ino;
{
- register int32_t sum, cnt, *lp;
+ int32_t sum, cnt, *lp;
spcl.c_inumber = ino;
spcl.c_magic = NFS_MAGIC;
Index: unctime.c
===================================================================
RCS file: /cvsroot/src/sbin/dump/unctime.c,v
retrieving revision 1.9
diff -u -r1.9 unctime.c
--- unctime.c 1995/03/18 14:55:11 1.9
+++ unctime.c 1997/04/11 07:41:26
@@ -103,7 +103,7 @@
lookup(str)
char *str;
{
- register char *cp, *cp2;
+ char *cp, *cp2;
for (cp = months, cp2 = str; *cp != '\0'; cp += 3)
if (strncmp(cp, cp2, 3) == 0)