diff --git a/sbin/dump/Makefile b/sbin/dump/Makefile index e6a927a049cf..aa3100d23e2e 100644 --- a/sbin/dump/Makefile +++ b/sbin/dump/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.25 1999/10/01 04:35:22 perseant Exp $ +# $NetBSD: Makefile,v 1.26 2001/12/23 12:29:55 lukem Exp $ # @(#)Makefile 8.1 (Berkeley) 6/5/93 # dump.h header file @@ -26,6 +26,6 @@ BINMODE=2555 MAN= dump.8 MLINKS+=dump.8 rdump.8 -.PATH: ${.CURDIR}/../../sys/ufs/ffs +.PATH: ${.CURDIR}/../../sys/ufs/ffs .include diff --git a/sbin/dump/main.c b/sbin/dump/main.c index d7b9e7d21fe2..9824278d601a 100644 --- a/sbin/dump/main.c +++ b/sbin/dump/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.44 2001/12/22 08:05:24 lukem Exp $ */ +/* $NetBSD: main.c,v 1.45 2001/12/23 12:29:56 lukem Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993, 1994\n\ #if 0 static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/1/95"; #else -__RCSID("$NetBSD: main.c,v 1.44 2001/12/22 08:05:24 lukem Exp $"); +__RCSID("$NetBSD: main.c,v 1.45 2001/12/23 12:29:56 lukem Exp $"); #endif #endif /* not lint */ @@ -105,7 +105,7 @@ int main(int argc, char *argv[]) { ino_t ino; - int dirty; + int dirty; struct dinode *dp; struct fstab *dt; struct statfs *mntinfo, fsbuf; @@ -119,13 +119,13 @@ main(int argc, char *argv[]) int just_estimate = 0; char labelstr[LBLSIZE]; char *new_time_format; - + spcl.c_date = 0; (void)time((time_t *)&spcl.c_date); tzset(); /* set up timezone for strftime */ if ((new_time_format = getenv("TIMEFORMAT")) != NULL) time_string = new_time_format; - + /* Save setgid bit for use later */ egid = getegid(); setegid(getgid()); @@ -140,7 +140,7 @@ main(int argc, char *argv[]) quit("TP_BSIZE must be a multiple of DEV_BSIZE\n"); level = '0'; timestamp = 0; - + if (argc < 2) usage(); @@ -221,7 +221,7 @@ main(int argc, char *argv[]) case 'r': /* read cache size */ readcache = numarg("read cache size", 0, 512); break; - + case 's': /* tape size, feet */ tsize = numarg("tape size", 1L, 0L) * 12 * 10; break; @@ -468,7 +468,7 @@ main(int argc, char *argv[]) nonodump = iswap32(spcl.c_level) < honorlevel; initcache(readcache, readblksize); - + (void)signal(SIGINFO, statussig); msg("mapping (Pass I) [regular files]\n"); @@ -493,7 +493,7 @@ main(int argc, char *argv[]) the end of each block written, and not in mid-block. Assume no erroneous blocks; this can be compensated for with an artificially low tape size. */ - fetapes = + fetapes = ( tapesize /* blocks */ * TP_BSIZE /* bytes/block */ * (1.0/density) /* 0.1" / byte */ diff --git a/sbin/dump/optr.c b/sbin/dump/optr.c index 9489eeb3cdb3..4ecba511e2e6 100644 --- a/sbin/dump/optr.c +++ b/sbin/dump/optr.c @@ -1,4 +1,4 @@ -/* $NetBSD: optr.c,v 1.22 2001/12/22 08:05:24 lukem Exp $ */ +/* $NetBSD: optr.c,v 1.23 2001/12/23 12:29:56 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.22 2001/12/22 08:05:24 lukem Exp $"); +__RCSID("$NetBSD: optr.c,v 1.23 2001/12/23 12:29:56 lukem Exp $"); #endif #endif /* not lint */ @@ -190,7 +190,7 @@ struct group *gp; /* * Get the names from the group entry "operator" to notify. - */ + */ void set_operators(void) { @@ -224,7 +224,7 @@ broadcast(char *message) if (!notify || gp == NULL) return; - /* Restore 'tty' privs for the child's use only. */ + /* Restore 'tty' privs for the child's use only. */ setegid(egid); switch (pid = fork()) { case -1: @@ -318,7 +318,7 @@ do_timestamp(time_t thistime, char *message) { struct tm tm_time; char then[STAMP_LENGTH + 1]; - + (void) localtime_r(&thistime, &tm_time); if (strftime(then, STAMP_LENGTH, time_string, &tm_time) == 0) { time_string = default_time_string; @@ -326,11 +326,11 @@ do_timestamp(time_t thistime, char *message) fprintf(stderr, "DUMP: ERROR: TIMEFORMAT too long, reverting to default\n"); } - + fprintf(stderr, message, then); } - + /* * print out an estimate of the amount of time left to do the dump */ @@ -346,7 +346,7 @@ timeest(void) if (tnow >= tschedule) { tschedule = tnow + 300; if (blockswritten < 500) - return; + return; deltat = tstart_writing - tnow + (1.0 * (tnow - tstart_writing)) / blockswritten * tapesize; @@ -354,7 +354,7 @@ timeest(void) msg("%3.2f%% done, finished in %ld:%02ld", (blockswritten * 100.0) / tapesize, (long)(deltat / 3600), (long)((deltat % 3600) / 60)); - + if (timestamp == 1) do_timestamp(tnow + deltat, " (at %s)"); diff --git a/sbin/dump/rcache.c b/sbin/dump/rcache.c index 84c0f9028e0b..7da766869f9d 100644 --- a/sbin/dump/rcache.c +++ b/sbin/dump/rcache.c @@ -1,11 +1,11 @@ -/* $NetBSD: rcache.c,v 1.9 2001/12/22 08:45:36 lukem Exp $ */ +/* $NetBSD: rcache.c,v 1.10 2001/12/23 12:29:56 lukem Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation - * by Martin J. Laubach and + * by Martin J. Laubach and * Manuel Bouyer . * * Redistribution and use in source and binary forms, with or without @@ -27,7 +27,7 @@ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -90,7 +90,7 @@ static int64_t physreadsize; #define CDATA(i) (cdata + ((i) * nblksread * dev_bsize)) -void +void initcache(int cachesize, int readblksize) { size_t len; @@ -100,7 +100,7 @@ initcache(int cachesize, int readblksize) if(cachesize == -1) { /* Compute from memory available */ int usermem; int mib[2] = { CTL_HW, HW_USERMEM }; - + len = sizeof(usermem); if (sysctl(mib, 2, &usermem, &len, NULL, 0) < 0) { msg("sysctl(hw.usermem) failed: %s\n", strerror(errno)); @@ -110,7 +110,7 @@ initcache(int cachesize, int readblksize) } else { /* User specified */ cachebufs = cachesize; } - + if(cachebufs) { /* Don't allocate if zero --> no caching */ if (cachebufs > MAXCACHEBUFS) cachebufs = MAXCACHEBUFS; @@ -118,7 +118,7 @@ initcache(int cachesize, int readblksize) sharedSize = sizeof(struct cheader) + sizeof(struct cdesc) * cachebufs + nblksread * cachebufs * dev_bsize; -#ifdef STATS +#ifdef STATS fprintf(stderr, "Using %d buffers (%d bytes)\n", cachebufs, sharedSize); #endif @@ -142,7 +142,7 @@ initcache(int cachesize, int readblksize) /* * Find the cache buffer descriptor that shows the minimal access time */ -static int +static int findlru(void) { int i; @@ -169,7 +169,7 @@ findlru(void) static int breaderrors = 0; #define BREADEMAX 32 -void +void rawread(daddr_t blkno, char *buf, int size) { int cnt, i; @@ -240,7 +240,7 @@ err: } } -void +void bread(daddr_t blkno, char *buf, int size) { int osize = size; @@ -268,7 +268,7 @@ bread(daddr_t blkno, char *buf, int size) retry: while(size > 0) { int i; - + for (i = 0; i < cachebufs; i++) { struct cdesc *curr = &cdesc[i]; @@ -309,7 +309,7 @@ retry: curr->blkstart) * dev_bsize, CDATA(i)); fprintf(stderr, "cdesc[i].blkstart %d " - "blkno %d dev_bsize %ld\n", + "blkno %d dev_bsize %ld\n", curr->blkstart, blkno, dev_bsize); dumpabort(0); } @@ -423,7 +423,7 @@ retry: */ } } - + if (flock(diskfd, LOCK_UN)) msg("flock(LOCK_UN) failed: %s\n", strerror(errno)); diff --git a/sbin/dump/tape.c b/sbin/dump/tape.c index dc1b0b006b29..9a0c139045a2 100644 --- a/sbin/dump/tape.c +++ b/sbin/dump/tape.c @@ -1,4 +1,4 @@ -/* $NetBSD: tape.c,v 1.32 2001/12/22 08:05:25 lukem Exp $ */ +/* $NetBSD: tape.c,v 1.33 2001/12/23 12:29:57 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.32 2001/12/22 08:05:25 lukem Exp $"); +__RCSID("$NetBSD: tape.c,v 1.33 2001/12/23 12:29:57 lukem Exp $"); #endif #endif /* not lint */ @@ -254,7 +254,7 @@ do_stats(void) if (ttaken > 0) { msg("Volume %d took %d:%02d:%02d\n", tapeno, (int) (ttaken / 3600), (int) ((ttaken % 3600) / 60), - (int) (ttaken % 60)); + (int) (ttaken % 60)); msg("Volume %d transfer rate: %d KB/s\n", tapeno, (int) (blocks / ttaken)); xferrate += blocks / ttaken; @@ -274,7 +274,7 @@ statussig(int notused) char msgbuf[128]; if (blockswritten < 500) - return; + return; (void) time((time_t *) &tnow); deltat = tstart_writing - tnow + (1.0 * (tnow - tstart_writing)) / blockswritten * tapesize; @@ -371,12 +371,12 @@ trewind(int eject) for (f = 0; f < SLAVES; f++) { /* - * Drain the results, but unlike EOT we DO (or should) care - * what the return values were, since if we detect EOT after - * we think we've written the last blocks to the tape anyway, + * Drain the results, but unlike EOT we DO (or should) care + * what the return values were, since if we detect EOT after + * we think we've written the last blocks to the tape anyway, * we have to replay those blocks with rollforward. * - * fixme: punt for now. + * fixme: punt for now. */ if (slaves[f].sent) { if (atomic_read(slaves[f].fd, (char *)&got, sizeof got) @@ -457,7 +457,7 @@ close_rewind(void) sleep (10); } } - + while (!query("Is the new volume mounted and ready to go?")) if (query("Do you want to abort?")) { dumpabort(0); @@ -476,9 +476,9 @@ rollforward(void) ntb = (union u_spcl *)tslp->tblock[1]; /* - * Each of the N slaves should have requests that need to - * be replayed on the next tape. Use the extra slave buffers - * (slaves[SLAVES]) to construct request lists to be sent to + * Each of the N slaves should have requests that need to + * be replayed on the next tape. Use the extra slave buffers + * (slaves[SLAVES]) to construct request lists to be sent to * each slave in turn. */ for (i = 0; i < SLAVES; i++) { @@ -486,7 +486,7 @@ rollforward(void) otb = (union u_spcl *)slp->tblock; /* - * For each request in the current slave, copy it to tslp. + * For each request in the current slave, copy it to tslp. */ prev = NULL; @@ -530,8 +530,8 @@ rollforward(void) if (prev->dblk != 0) { /* - * If the last one was a disk block, make the - * first of this one be the last bit of that disk + * If the last one was a disk block, make the + * first of this one be the last bit of that disk * block... */ q->dblk = prev->dblk + @@ -539,7 +539,7 @@ rollforward(void) ntb = (union u_spcl *)tslp->tblock; } else { /* - * It wasn't a disk block. Copy the data to its + * It wasn't a disk block. Copy the data to its * new location in the buffer. */ q->dblk = 0; @@ -634,7 +634,7 @@ restore_check_point: case X_FINOK: msg("Child %d finishes X_FINOK\n", childpid); break; - case X_ABORT: + case X_ABORT: msg("Child %d finishes X_ABORT\n", childpid); break; case X_REWRITE: @@ -684,7 +684,7 @@ restore_check_point: while ((tapefd = (host ? rmtopen(tape, 2, 1) : pipeout ? 1 : open(tape, O_WRONLY|O_CREAT, 0666))) < 0) #else - while ((tapefd = (pipeout ? 1 : + while ((tapefd = (pipeout ? 1 : open(tape, O_WRONLY|O_CREAT, 0666))) < 0) #endif { @@ -792,13 +792,13 @@ enslave(void) Exit(X_FINOK); } } - + for (i = 0; i < SLAVES; i++) - (void) atomic_write(slaves[i].fd, - (char *) &slaves[(i + 1) % SLAVES].pid, + (void) atomic_write(slaves[i].fd, + (char *) &slaves[(i + 1) % SLAVES].pid, sizeof slaves[0].pid); - - master = 0; + + master = 0; } void @@ -853,7 +853,7 @@ doslave(int cmd, int slave_number) p->count * TP_BSIZE); } else { if (p->count != 1 || atomic_read(cmd, - (char *)slp->tblock[trecno], + (char *)slp->tblock[trecno], TP_BSIZE) != TP_BSIZE) quit("master/slave protocol botched.\n"); } @@ -882,7 +882,7 @@ doslave(int cmd, int slave_number) #ifdef WRITEDEBUG fprintf(stderr, "slave %d wrote %d\n", slave_number, wrote); #endif - if (wrote < 0) + if (wrote < 0) break; if (wrote == 0) eot_count++; @@ -890,7 +890,7 @@ doslave(int cmd, int slave_number) } #ifdef WRITEDEBUG - if (size != writesize) + if (size != writesize) fprintf(stderr, "slave %d only wrote %d out of %d bytes and gave up.\n", slave_number, size, writesize); @@ -914,7 +914,7 @@ doslave(int cmd, int slave_number) * (for EOT handling) */ (void) atomic_write(cmd, (char *)&size, sizeof size); - } + } /* * If partial write, don't want next slave to go.