From 7b0c1d850960f3b2fd6f6fa172bc2689b5314ee0 Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Fri, 5 Oct 1984 23:56:20 -0800 Subject: [PATCH] maintain consistent dump tapes on active systems (decvax!watmath!srradia) SCCS-vsn: sbin/dump/main.c 1.17 SCCS-vsn: sbin/dump/traverse.c 1.17 SCCS-vsn: sbin/dump/dump.h 1.13 --- usr/src/sbin/dump/dump.h | 3 ++- usr/src/sbin/dump/main.c | 4 ++-- usr/src/sbin/dump/traverse.c | 13 ++++++++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/usr/src/sbin/dump/dump.h b/usr/src/sbin/dump/dump.h index 2759ef794e..890bd45854 100644 --- a/usr/src/sbin/dump/dump.h +++ b/usr/src/sbin/dump/dump.h @@ -1,4 +1,4 @@ -/* dump.h 1.12 83/07/01 */ +/* dump.h 1.13 84/10/05 */ #define NI 16 #define MAXINOPB (MAXBSIZE / sizeof(struct dinode)) @@ -66,6 +66,7 @@ char *prdate(); long atol(); int mark(); int add(); +int dirdump(); int dump(); int tapsrec(); int dmpspc(); diff --git a/usr/src/sbin/dump/main.c b/usr/src/sbin/dump/main.c index e7ddfef7cf..823f421bba 100644 --- a/usr/src/sbin/dump/main.c +++ b/usr/src/sbin/dump/main.c @@ -1,4 +1,4 @@ -static char *sccsid = "@(#)main.c 1.16 (Berkeley) %G%"; +static char *sccsid = "@(#)main.c 1.17 (Berkeley) %G%"; #include "dump.h" int notify = 0; /* notify operator flag */ @@ -265,7 +265,7 @@ main(argc, argv) bitmap(clrmap, TS_CLRI); msg("dumping (Pass III) [directories]\n"); - pass(dump, dirmap); + pass(dirdump, dirmap); msg("dumping (Pass IV) [regular files]\n"); pass(dump, nodmap); diff --git a/usr/src/sbin/dump/traverse.c b/usr/src/sbin/dump/traverse.c index 12c4f1b230..de146c9242 100644 --- a/usr/src/sbin/dump/traverse.c +++ b/usr/src/sbin/dump/traverse.c @@ -1,4 +1,4 @@ -static char *sccsid = "@(#)traverse.c 1.16 (Berkeley) %G%"; +static char *sccsid = "@(#)traverse.c 1.17 (Berkeley) %G%"; #include "dump.h" @@ -105,6 +105,15 @@ indir(d, n, filesize) } } +dirdump(ip) + struct dinode *ip; +{ + /* watchout for dir inodes deleted and maybe reallocated */ + if ((ip->di_mode & IFMT) != IFDIR) + return; + dump(ip); +} + dump(ip) struct dinode *ip; { @@ -120,6 +129,8 @@ dump(ip) spcl.c_type = TS_INODE; spcl.c_count = 0; i = ip->di_mode & IFMT; + if (i == 0) /* free inode */ + return; if ((i != IFDIR && i != IFREG && i != IFLNK) || ip->di_size == 0) { spclrec(); return; -- 2.20.1