lint, misc cleanups
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Fri, 8 Mar 1991 04:01:16 +0000 (20:01 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Fri, 8 Mar 1991 04:01:16 +0000 (20:01 -0800)
SCCS-vsn: sbin/dump/traverse.c 5.10
SCCS-vsn: sbin/dump/main.c 5.14
SCCS-vsn: sbin/dump/dump.h 5.14

usr/src/sbin/dump/dump.h
usr/src/sbin/dump/main.c
usr/src/sbin/dump/traverse.c

index 389b3a2..3e82708 100644 (file)
@@ -3,10 +3,9 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)dump.h      5.13 (Berkeley) %G%
+ *     @(#)dump.h      5.14 (Berkeley) %G%
  */
 
  */
 
-#define        NI              16
 #define MAXINOPB       (MAXBSIZE / sizeof(struct dinode))
 #define MAXNINDIR      (MAXBSIZE / sizeof(daddr_t))
 
 #define MAXINOPB       (MAXBSIZE / sizeof(struct dinode))
 #define MAXNINDIR      (MAXBSIZE / sizeof(daddr_t))
 
index 4e95ee4..19d0201 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     5.13 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c     5.14 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -46,7 +46,7 @@ main(argc, argv)
        char **argv;
 {
        register ino_t ino;
        char **argv;
 {
        register ino_t ino;
-       register long bits
+       register int dirty
        register struct dinode *dp;
        register struct fstab *dt;
        register char *map;
        register struct dinode *dp;
        register struct fstab *dt;
        register char *map;
@@ -117,7 +117,7 @@ main(argc, argv)
                        if (argc < 1)
                                break;
                        bflag++;
                        if (argc < 1)
                                break;
                        bflag++;
-                       ntrec = atol(*argv);
+                       ntrec = atoi(*argv);
                        if (ntrec < 1) {
                                fprintf(stderr, "%s \"%s\"\n",
                                    "bad number of blocks per write ", *argv);
                        if (ntrec < 1) {
                                fprintf(stderr, "%s \"%s\"\n",
                                    "bad number of blocks per write ", *argv);
@@ -363,11 +363,11 @@ main(argc, argv)
        msg("dumping (Pass III) [directories]\n");
        for (map = dumpdirmap, ino = 0; ino < maxino; ) {
                if ((ino % NBBY) == 0)
        msg("dumping (Pass III) [directories]\n");
        for (map = dumpdirmap, ino = 0; ino < maxino; ) {
                if ((ino % NBBY) == 0)
-                       bits = *map++;
+                       dirty = *map++;
                else
                else
-                       bits >>= 1;
+                       dirty >>= 1;
                ino++;
                ino++;
-               if ((bits & 1) == 0)
+               if ((dirty & 1) == 0)
                        continue;
                /*
                 * Skip directory inodes deleted and maybe reallocated
                        continue;
                /*
                 * Skip directory inodes deleted and maybe reallocated
@@ -381,11 +381,11 @@ main(argc, argv)
        msg("dumping (Pass IV) [regular files]\n");
        for (map = dumpinomap, ino = 0; ino < maxino; ) {
                if ((ino % NBBY) == 0)
        msg("dumping (Pass IV) [regular files]\n");
        for (map = dumpinomap, ino = 0; ino < maxino; ) {
                if ((ino % NBBY) == 0)
-                       bits = *map++;
+                       dirty = *map++;
                else
                else
-                       bits >>= 1;
+                       dirty >>= 1;
                ino++;
                ino++;
-               if ((bits & 1) == 0)
+               if ((dirty & 1) == 0)
                        continue;
                /*
                 * Skip inodes deleted and reallocated as directories.
                        continue;
                /*
                 * Skip inodes deleted and reallocated as directories.
index b20847a..fd8212e 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)traverse.c 5.9 (Berkeley) %G%";
+static char sccsid[] = "@(#)traverse.c 5.10 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -31,14 +31,14 @@ void        dmpindir();
  * hence the estimate may be high.
  */
 long
  * hence the estimate may be high.
  */
 long
-blockest(ip)
-       struct dinode *ip;
+blockest(dp)
+       register struct dinode *dp;
 {
        long blkest, sizeest;
 
        /*
 {
        long blkest, sizeest;
 
        /*
-        * ip->di_size is the size of the file in bytes.
-        * ip->di_blocks stores the number of sectors actually in the file.
+        * dp->di_size is the size of the file in bytes.
+        * dp->di_blocks stores the number of sectors actually in the file.
         * If there are more sectors than the size would indicate, this just
         *      means that there are indirect blocks in the file or unused
         *      sectors in the last file block; we can safely ignore these
         * If there are more sectors than the size would indicate, this just
         *      means that there are indirect blocks in the file or unused
         *      sectors in the last file block; we can safely ignore these
@@ -50,11 +50,11 @@ blockest(ip)
         *      dump blocks (sizeest vs. blkest in the indirect block
         *      calculation).
         */
         *      dump blocks (sizeest vs. blkest in the indirect block
         *      calculation).
         */
-       blkest = howmany(dbtob(ip->di_blocks), TP_BSIZE);
-       sizeest = howmany(ip->di_size, TP_BSIZE);
+       blkest = howmany(dbtob(dp->di_blocks), TP_BSIZE);
+       sizeest = howmany(dp->di_size, TP_BSIZE);
        if (blkest > sizeest)
                blkest = sizeest;
        if (blkest > sizeest)
                blkest = sizeest;
-       if (ip->di_size > sblock->fs_bsize * NDADDR) {
+       if (dp->di_size > sblock->fs_bsize * NDADDR) {
                /* calculate the number of indirect blocks on the dump tape */
                blkest +=
                        howmany(sizeest - NDADDR * sblock->fs_bsize / TP_BSIZE,
                /* calculate the number of indirect blocks on the dump tape */
                blkest +=
                        howmany(sizeest - NDADDR * sblock->fs_bsize / TP_BSIZE,
@@ -124,7 +124,7 @@ mapdirs(maxino, tapesize)
        long *tapesize;
 {
        register struct dinode *dp;
        long *tapesize;
 {
        register struct dinode *dp;
-       register int i, bits;
+       register int i, dirty;
        register char *map;
        register ino_t ino;
        long filesize, blkcnt = 0;
        register char *map;
        register ino_t ino;
        long filesize, blkcnt = 0;
@@ -132,11 +132,11 @@ mapdirs(maxino, tapesize)
 
        for (map = dumpdirmap, ino = 0; ino < maxino; ) {
                if ((ino % NBBY) == 0)
 
        for (map = dumpdirmap, ino = 0; ino < maxino; ) {
                if ((ino % NBBY) == 0)
-                       bits = *map++;
+                       dirty = *map++;
                else
                else
-                       bits >>= 1;
+                       dirty >>= 1;
                ino++;
                ino++;
-               if ((bits & 1) == 0 || TSTINO(ino, dumpinomap))
+               if ((dirty & 1) == 0 || TSTINO(ino, dumpinomap))
                        continue;
                dp = getino(ino);
                filesize = dp->di_size;
                        continue;
                dp = getino(ino);
                filesize = dp->di_size;
@@ -256,8 +256,8 @@ searchdir(ino, blkno, size, filesize)
  * Dump the contents of an inode to tape.
  */
 void
  * Dump the contents of an inode to tape.
  */
 void
-dumpino(ip, ino)
-       struct dinode *ip;
+dumpino(dp, ino)
+       register struct dinode *dp;
        ino_t ino;
 {
        int mode, level, cnt;
        ino_t ino;
 {
        int mode, level, cnt;
@@ -268,28 +268,28 @@ dumpino(ip, ino)
                dumpmap(dumpinomap, TS_BITS, ino);
        }
        CLRINO(ino, dumpinomap);
                dumpmap(dumpinomap, TS_BITS, ino);
        }
        CLRINO(ino, dumpinomap);
-       spcl.c_dinode = *ip;
+       spcl.c_dinode = *dp;
        spcl.c_type = TS_INODE;
        spcl.c_count = 0;
        /*
         * Check for freed inode.
         */
        spcl.c_type = TS_INODE;
        spcl.c_count = 0;
        /*
         * Check for freed inode.
         */
-       if ((mode = (ip->di_mode & IFMT)) == 0)
+       if ((mode = (dp->di_mode & IFMT)) == 0)
                return;
        if ((mode != IFDIR && mode != IFREG && mode != IFLNK) ||
                return;
        if ((mode != IFDIR && mode != IFREG && mode != IFLNK) ||
-           ip->di_size == 0) {
+           dp->di_size == 0) {
                writeheader(ino);
                return;
        }
                writeheader(ino);
                return;
        }
-       if (ip->di_size > NDADDR * sblock->fs_bsize)
+       if (dp->di_size > NDADDR * sblock->fs_bsize)
                cnt = NDADDR * sblock->fs_frag;
        else
                cnt = NDADDR * sblock->fs_frag;
        else
-               cnt = howmany(ip->di_size, sblock->fs_fsize);
-       blksout(&ip->di_db[0], cnt, ino);
-       if ((size = ip->di_size - NDADDR * sblock->fs_bsize) <= 0)
+               cnt = howmany(dp->di_size, sblock->fs_fsize);
+       blksout(&dp->di_db[0], cnt, ino);
+       if ((size = dp->di_size - NDADDR * sblock->fs_bsize) <= 0)
                return;
        for (level = 0; level < NIADDR; level++) {
                return;
        for (level = 0; level < NIADDR; level++) {
-               dmpindir(ino, ip->di_ib[level], level, &size);
+               dmpindir(ino, dp->di_ib[level], level, &size);
                if (size <= 0)
                        return;
        }
                if (size <= 0)
                        return;
        }