Fix copyright
[unix-history] / usr / src / sbin / dump / traverse.c
index 0bd63d3..bedcd49 100644 (file)
@@ -1,4 +1,12 @@
-static char *sccsid = "@(#)traverse.c  1.15 (Berkeley) %G%";
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)traverse.c 5.1 (Berkeley) %G%";
+#endif not lint
 
 #include "dump.h"
 
 
 #include "dump.h"
 
@@ -105,6 +113,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;
 {
 dump(ip)
        struct dinode *ip;
 {
@@ -120,6 +137,8 @@ dump(ip)
        spcl.c_type = TS_INODE;
        spcl.c_count = 0;
        i = ip->di_mode & IFMT;
        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;
        if ((i != IFDIR && i != IFREG && i != IFLNK) || ip->di_size == 0) {
                spclrec();
                return;
@@ -203,18 +222,11 @@ blksout(blkp, frags)
 bitmap(map, typ)
        char *map;
 {
 bitmap(map, typ)
        char *map;
 {
-       register i, n;
+       register i;
        char *cp;
 
        char *cp;
 
-       n = -1;
-       for (i = 0; i < msiz; i++)
-               if(map[i])
-                       n = i;
-       if (n < 0)
-               return;
-       n++;
        spcl.c_type = typ;
        spcl.c_type = typ;
-       spcl.c_count = howmany(n * sizeof(map[0]), TP_BSIZE);
+       spcl.c_count = howmany(msiz * sizeof(map[0]), TP_BSIZE);
        spclrec();
        for (i = 0, cp = map; i < spcl.c_count; i++, cp += TP_BSIZE)
                taprec(cp);
        spclrec();
        for (i = 0, cp = map; i < spcl.c_count; i++, cp += TP_BSIZE)
                taprec(cp);