Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/dump - use correct type for minTime in findlru() (size...



details:   https://anonhg.NetBSD.org/src/rev/c0d714974cfa
branches:  trunk
changeset: 519620:c0d714974cfa
user:      lukem <lukem%NetBSD.org@localhost>
date:      Sat Dec 22 08:05:24 2001 +0000

description:
- use correct type for minTime in findlru()  (size_t instead of int)
- clean up whitespace

diffstat:

 sbin/dump/dump.h      |  20 ++++++++++----------
 sbin/dump/ffs_inode.c |  16 ++++++----------
 sbin/dump/main.c      |  12 ++++++------
 sbin/dump/optr.c      |  14 +++++++-------
 sbin/dump/rcache.c    |  22 +++++++++++-----------
 sbin/dump/tape.c      |  17 +++++++++--------
 6 files changed, 49 insertions(+), 52 deletions(-)

diffs (truncated from 314 to 300 lines):

diff -r bdee4039b200 -r c0d714974cfa sbin/dump/dump.h
--- a/sbin/dump/dump.h  Sat Dec 22 07:45:38 2001 +0000
+++ b/sbin/dump/dump.h  Sat Dec 22 08:05:24 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dump.h,v 1.30 2001/12/14 14:43:33 bouyer Exp $ */
+/*     $NetBSD: dump.h,v 1.31 2001/12/22 08:05:24 lukem Exp $  */
 
 /*-
  * Copyright (c) 1980, 1993
@@ -49,21 +49,21 @@
        int32_t ufs_bsize;      /* block size */
        int32_t ufs_bshift;     /* log2(ufs_bsize) */
        int32_t ufs_fsize;      /* fragment size */
-       int32_t ufs_frag;       /* block size / frag size */
+       int32_t ufs_frag;       /* block size / frag size */
        int32_t ufs_fsatoda;    /* disk address conversion constant */
        int32_t ufs_nindir;     /* disk addresses per indirect block */
-       int32_t ufs_inopb;      /* inodes per block */
+       int32_t ufs_inopb;      /* inodes per block */
        int32_t ufs_maxsymlinklen; /* max symlink length */
-       int32_t ufs_bmask;      /* block mask */
-       int32_t ufs_fmask;      /* frag mask */
-       int64_t ufs_qbmask;     /* ~ufs_bmask */
-       int64_t ufs_qfmask;     /* ~ufs_fmask */
+       int32_t ufs_bmask;      /* block mask */
+       int32_t ufs_fmask;      /* frag mask */
+       int64_t ufs_qbmask;     /* ~ufs_bmask */
+       int64_t ufs_qfmask;     /* ~ufs_fmask */
 };
 #define fsatoda(u,a) ((a) << (u)->ufs_fsatoda)
 #define ufs_fragroundup(u,size) /* calculates roundup(size, ufs_fsize) */ \
-        (((size) + (u)->ufs_qfmask) & (u)->ufs_fmask)
+       (((size) + (u)->ufs_qfmask) & (u)->ufs_fmask)
 #define ufs_blkoff(u,loc)   /* calculates (loc % u->ufs_bsize) */ \
-        ((loc) & (u)->ufs_qbmask)
+       ((loc) & (u)->ufs_qbmask)
 #define ufs_dblksize(u,d,b) \
        ((((b) >= NDADDR || (d)->di_size >= ((b)+1) << (u)->ufs_bshift \
                ? (u)->ufs_bsize \
@@ -112,7 +112,7 @@
 
 extern int     density;        /* density in 0.1" units */
 extern int     notify;         /* notify operator flag */
-extern int      timestamp;      /* timestamp messages */
+extern int     timestamp;      /* timestamp messages */
 extern int     blockswritten;  /* number of blocks written on current tape */
 extern int     tapeno;         /* current tape number */
 
diff -r bdee4039b200 -r c0d714974cfa sbin/dump/ffs_inode.c
--- a/sbin/dump/ffs_inode.c     Sat Dec 22 07:45:38 2001 +0000
+++ b/sbin/dump/ffs_inode.c     Sat Dec 22 08:05:24 2001 +0000
@@ -1,8 +1,8 @@
-/*      $NetBSD: ffs_inode.c,v 1.8 2001/11/01 08:03:03 lukem Exp $ */
+/*     $NetBSD: ffs_inode.c,v 1.9 2001/12/22 08:05:24 lukem Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993, 1994
- *      The Regents of the University of California.  All rights reserved.
+ *     The Regents of the University of California.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -14,8 +14,8 @@
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
- *      This product includes software developed by the University of
- *      California, Berkeley and its contributors.
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -36,15 +36,11 @@
 #include <sys/cdefs.h>
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993, 1994\n\
-        The Regents of the University of California.  All rights reserved.\n");
+       The Regents of the University of California.  All rights reserved.\n");
 #endif /* not lint */
 
 #ifndef lint
-#if 0
-static char sccsid[] = "@(#)main.c      8.6 (Berkeley) 5/1/95";
-#else
-__RCSID("$NetBSD: ffs_inode.c,v 1.8 2001/11/01 08:03:03 lukem Exp $");
-#endif
+__RCSID("$NetBSD: ffs_inode.c,v 1.9 2001/12/22 08:05:24 lukem Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
diff -r bdee4039b200 -r c0d714974cfa sbin/dump/main.c
--- a/sbin/dump/main.c  Sat Dec 22 07:45:38 2001 +0000
+++ b/sbin/dump/main.c  Sat Dec 22 08:05:24 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.43 2001/12/20 20:20:38 soren Exp $  */
+/*     $NetBSD: main.c,v 1.44 2001/12/22 08:05:24 lukem Exp $  */
 
 /*-
  * Copyright (c) 1980, 1991, 1993, 1994
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.6 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.43 2001/12/20 20:20:38 soren Exp $");
+__RCSID("$NetBSD: main.c,v 1.44 2001/12/22 08:05:24 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -81,7 +81,7 @@
 #include "pathnames.h"
 
 gid_t  egid;                   /* Retain tty privs for notification */
-int     timestamp;              /* print message timestamps */
+int    timestamp;              /* print message timestamps */
 int    notify;                 /* notify operator flag */
 int    blockswritten;          /* number of blocks written on current tape */
 int    tapeno;                 /* current tape number */
@@ -331,7 +331,7 @@
                }
        }
        if (Tflag && uflag) {
-               (void)fprintf(stderr,
+               (void)fprintf(stderr,
                    "You cannot use the T and u flags together.\n");
                exit(X_ABORT);
        }
@@ -346,7 +346,7 @@
                /*
                 * Determine how to default tape size and density
                 *
-                *              density                         tape size
+                *              density                         tape size
                 * 9-track      1600 bpi (160 bytes/.1")        2300 ft.
                 * 9-track      6250 bpi (625 bytes/.1")        2300 ft.
                 * cartridge    8000 bpi (100 bytes/.1")        1700 ft.
@@ -432,7 +432,7 @@
        spcl.c_date = iswap32(spcl.c_date);
        spcl.c_ddate = iswap32(spcl.c_ddate);
        if (!Tflag)
-               getdumptime();          /* /etc/dumpdates snarfed */
+               getdumptime();          /* /etc/dumpdates snarfed */
 
        date = iswap32(spcl.c_date);
        msg("Date of this level %c dump: %s", level,
diff -r bdee4039b200 -r c0d714974cfa sbin/dump/optr.c
--- a/sbin/dump/optr.c  Sat Dec 22 07:45:38 2001 +0000
+++ b/sbin/dump/optr.c  Sat Dec 22 08:05:24 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: optr.c,v 1.21 2001/11/01 08:03:03 lukem Exp $  */
+/*     $NetBSD: optr.c,v 1.22 2001/12/22 08:05:24 lukem Exp $  */
 
 /*-
  * Copyright (c) 1980, 1988, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)optr.c     8.2 (Berkeley) 1/6/94";
 #else
-__RCSID("$NetBSD: optr.c,v 1.21 2001/11/01 08:03:03 lukem Exp $");
+__RCSID("$NetBSD: optr.c,v 1.22 2001/12/22 08:05:24 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -309,7 +309,7 @@
 }
 
 /*
- *      print out the timestamp string to stderr.
+ *     print out the timestamp string to stderr.
  */
 #define STAMP_LENGTH 80
 
@@ -365,14 +365,14 @@
 void
 msg(const char *fmt, ...)
 {
-        time_t  tnow;
+       time_t  tnow;
        va_list ap;
 
        fprintf(stderr, "  ");
-        if (timestamp == 1) {
-                (void) time((time_t *) &tnow);
+       if (timestamp == 1) {
+               (void) time((time_t *) &tnow);
                do_timestamp(tnow, "[%s] ");
-        }
+       }
 
        (void) fprintf(stderr,"DUMP: ");
 #ifdef TDEBUG
diff -r bdee4039b200 -r c0d714974cfa sbin/dump/rcache.c
--- a/sbin/dump/rcache.c        Sat Dec 22 07:45:38 2001 +0000
+++ b/sbin/dump/rcache.c        Sat Dec 22 08:05:24 2001 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: rcache.c,v 1.7 2001/12/22 07:45:38 lukem Exp $       */
+/*     $NetBSD: rcache.c,v 1.8 2001/12/22 08:05:25 lukem Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -18,8 +18,8 @@
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
- *      This product includes software developed by the NetBSD
- *      Foundation, Inc. and its contributors.
+ *     This product includes software developed by the NetBSD
+ *     Foundation, Inc. and its contributors.
  * 4. Neither the name of The NetBSD Foundation nor the names of its
  *    contributors may be used to endorse or promote products derived
  *    from this software without specific prior written permission.
@@ -145,9 +145,9 @@
 static int 
 findlru(void)
 {
-       int     i;
-       int     minTime = cdesc[0].time;
-       int     minIdx = 0;
+       int     i;
+       size_t  minTime = cdesc[0].time;
+       int     minIdx = 0;
 
        for (i = 0; i < cachebufs; i++) {
                if (cdesc[i].time < minTime) {
@@ -243,7 +243,7 @@
 void 
 bread(daddr_t blkno, char *buf, int size)
 {
-       int     osize = size;
+       int     osize = size;
        daddr_t oblkno = blkno;
        char   *obuf = buf;
        daddr_t numBlocks = (size + dev_bsize -1) / dev_bsize;
@@ -268,7 +268,7 @@
 
 retry:
        while(size > 0) {
-               int     i;
+               int     i;
                
                for (i = 0; i < cachebufs; i++) {
                        struct cdesc *curr = &cdesc[i];
@@ -354,9 +354,9 @@
                        rawread(oblkno, obuf, osize);
                        break;
                } else {
-                       int     idx;
-                       ssize_t rsize;
-                       daddr_t blockBlkNo;
+                       int     idx;
+                       ssize_t rsize;
+                       daddr_t blockBlkNo;
 
                        blockBlkNo = (blkno / nblksread) * nblksread;
                        idx = findlru();
diff -r bdee4039b200 -r c0d714974cfa sbin/dump/tape.c
--- a/sbin/dump/tape.c  Sat Dec 22 07:45:38 2001 +0000
+++ b/sbin/dump/tape.c  Sat Dec 22 08:05:24 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tape.c,v 1.31 2001/12/14 14:43:34 bouyer Exp $ */
+/*     $NetBSD: tape.c,v 1.32 2001/12/22 08:05:25 lukem Exp $  */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)tape.c     8.4 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: tape.c,v 1.31 2001/12/14 14:43:34 bouyer Exp $");
+__RCSID("$NetBSD: tape.c,v 1.32 2001/12/22 08:05:25 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -669,7 +669,7 @@
                 * use the name before the comma first, and save
                 * the remaining names for subsequent volumes.
                 */
-               tapeno++;               /* current tape sequence */
+               tapeno++;                       /* current tape sequence */
                if (nexttape || strchr(tape, ',')) {
                        if (nexttape && *nexttape)
                                tape = nexttape;
@@ -785,7 +785,7 @@
                slaves[i].sent = 0;
                if (slaves[i].pid == 0) {           /* Slave starts up here */
                        for (j = 0; j <= i; j++)
-                               (void) close(slaves[j].fd);
+                               (void) close(slaves[j].fd);
                        signal(SIGINT, SIG_IGN);    /* Master handles this */
                        signal(SIGINFO, SIG_IGN);
                        doslave(cmd[0], i);
@@ -795,8 +795,8 @@
        
        for (i = 0; i < SLAVES; i++)
                (void) atomic_write(slaves[i].fd, 
-                             (char *) &slaves[(i + 1) % SLAVES].pid, 
-                             sizeof slaves[0].pid);
+                               (char *) &slaves[(i + 1) % SLAVES].pid, 
+                               sizeof slaves[0].pid);
                



Home | Main Index | Thread Index | Old Index