diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-09-18 17:43:16 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-09-18 17:43:16 +0000 |
commit | 7bcd34acfad0ac7aa7af49eee26c04a041036d09 (patch) | |
tree | 3351556c103c3d6273c2668222f748694258b1a4 | |
parent | 99bd170b24532a76d75bab53ef3c13b4dfc7348e (diff) |
cleanups and endianness fixes. Mostly from NetBSD
-rw-r--r-- | sbin/fsck_ext2fs/dir.c | 55 | ||||
-rw-r--r-- | sbin/fsck_ext2fs/inode.c | 103 | ||||
-rw-r--r-- | sbin/fsck_ext2fs/pass1.c | 24 | ||||
-rw-r--r-- | sbin/fsck_ext2fs/pass1b.c | 24 | ||||
-rw-r--r-- | sbin/fsck_ext2fs/pass2.c | 24 | ||||
-rw-r--r-- | sbin/fsck_ext2fs/pass3.c | 18 | ||||
-rw-r--r-- | sbin/fsck_ext2fs/pass4.c | 24 | ||||
-rw-r--r-- | sbin/fsck_ext2fs/pass5.c | 22 | ||||
-rw-r--r-- | sbin/fsck_ext2fs/preen.c | 32 | ||||
-rw-r--r-- | sbin/fsck_ext2fs/setup.c | 22 | ||||
-rw-r--r-- | sbin/fsck_ext2fs/utilities.c | 39 |
11 files changed, 128 insertions, 259 deletions
diff --git a/sbin/fsck_ext2fs/dir.c b/sbin/fsck_ext2fs/dir.c index c9cf7f1397d..610dc1d3c64 100644 --- a/sbin/fsck_ext2fs/dir.c +++ b/sbin/fsck_ext2fs/dir.c @@ -1,5 +1,5 @@ -/* $OpenBSD: dir.c,v 1.5 2001/07/07 18:26:11 deraadt Exp $ */ -/* $NetBSD: dir.c,v 1.1 1997/06/11 11:21:46 bouyer Exp $ */ +/* $OpenBSD: dir.c,v 1.6 2001/09/18 17:43:15 art Exp $ */ +/* $NetBSD: dir.c,v 1.5 2000/01/28 16:01:46 bouyer Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -35,20 +35,9 @@ * SUCH DAMAGE. */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)dir.c 8.5 (Berkeley) 12/8/94"; -#else -#if 0 -static char rcsid[] = "$NetBSD: dir.c,v 1.1 1997/06/11 11:21:46 bouyer Exp $"; -#else -static char rcsid[] = "$OpenBSD: dir.c,v 1.5 2001/07/07 18:26:11 deraadt Exp $"; -#endif -#endif -#endif /* not lint */ - #include <sys/param.h> #include <sys/time.h> +#include <ufs/ufs/dir.h> #include <ufs/ext2fs/ext2fs_dinode.h> #include <ufs/ext2fs/ext2fs_dir.h> #include <ufs/ext2fs/ext2fs.h> @@ -65,8 +54,6 @@ static char rcsid[] = "$OpenBSD: dir.c,v 1.5 2001/07/07 18:26:11 deraadt Exp $"; char *lfname = "lost+found"; int lfmode = 01777; -/* XXX DIRBLKSIZ id bsize ! */ -#define DIRBLKSIZ 0 /* just for now */ struct ext2fs_dirtemplate emptydir = { 0, DIRBLKSIZ }; struct ext2fs_dirtemplate dirhead = { 0, 12, 1, EXT2_FT_DIR, ".", @@ -88,7 +75,7 @@ static int chgino __P((struct inodesc *)); void propagate() { - register struct inoinfo **inpp, *inp, *pinp; + struct inoinfo **inpp, *inp, *pinp; struct inoinfo **inpend; /* @@ -123,10 +110,10 @@ propagate() */ int dirscan(idesc) - register struct inodesc *idesc; + struct inodesc *idesc; { - register struct ext2fs_direct *dp; - register struct bufarea *bp; + struct ext2fs_direct *dp; + struct bufarea *bp; int dsize, n; long blksiz; char *dbuf = NULL; @@ -172,10 +159,10 @@ dirscan(idesc) */ static struct ext2fs_direct * fsck_readdir(idesc) - register struct inodesc *idesc; + struct inodesc *idesc; { - register struct ext2fs_direct *dp, *ndp; - register struct bufarea *bp; + struct ext2fs_direct *dp, *ndp; + struct bufarea *bp; long size, blksiz, fix, dploc; blksiz = idesc->id_numfrags * sblock.e2fs_bsize; @@ -279,7 +266,7 @@ fileerror(cwd, ino, errmesg) ino_t cwd, ino; char *errmesg; { - register struct ext2fs_dinode *dp; + struct ext2fs_dinode *dp; char pathbuf[MAXPATHLEN + 1]; pwarn("%s ", errmesg); @@ -300,10 +287,10 @@ fileerror(cwd, ino, errmesg) void adjust(idesc, lcnt) - register struct inodesc *idesc; + struct inodesc *idesc; short lcnt; { - register struct ext2fs_dinode *dp; + struct ext2fs_dinode *dp; dp = ginode(idesc->id_number); if (fs2h16(dp->e2di_nlink) == lcnt) { @@ -333,7 +320,7 @@ static int mkentry(idesc) struct inodesc *idesc; { - register struct ext2fs_direct *dirp = idesc->id_dirp; + struct ext2fs_direct *dirp = idesc->id_dirp; struct ext2fs_direct newent; int newlen, oldlen; @@ -363,7 +350,7 @@ static int chgino(idesc) struct inodesc *idesc; { - register struct ext2fs_direct *dirp = idesc->id_dirp; + struct ext2fs_direct *dirp = idesc->id_dirp; u_int16_t namlen = dirp->e2d_namlen; if (strlen(idesc->id_name) != namlen || @@ -383,7 +370,7 @@ linkup(orphan, parentdir) ino_t orphan; ino_t parentdir; { - register struct ext2fs_dinode *dp; + struct ext2fs_dinode *dp; int lostdir; ino_t oldlfdir; struct inodesc idesc; @@ -546,11 +533,11 @@ makeentry(parent, ino, name) */ static int expanddir(dp, name) - register struct ext2fs_dinode *dp; + struct ext2fs_dinode *dp; char *name; { daddr_t lastbn, newblk; - register struct bufarea *bp; + struct bufarea *bp; char *firstblk; if ((firstblk = malloc(sblock.e2fs_bsize)) == NULL) { @@ -611,7 +598,7 @@ allocdir(parent, request, mode) { ino_t ino; struct ext2fs_dinode *dp; - register struct bufarea *bp; + struct bufarea *bp; struct ext2fs_dirtemplate *dirp; ino = allocino(request, IFDIR|mode); @@ -688,8 +675,8 @@ lftempname(bufp, ino) char *bufp; ino_t ino; { - register ino_t in; - register char *cp; + ino_t in; + char *cp; int namlen; cp = bufp + 2; diff --git a/sbin/fsck_ext2fs/inode.c b/sbin/fsck_ext2fs/inode.c index c3bd1179b81..387c5ea2514 100644 --- a/sbin/fsck_ext2fs/inode.c +++ b/sbin/fsck_ext2fs/inode.c @@ -1,5 +1,5 @@ -/* $OpenBSD: inode.c,v 1.7 2001/05/15 19:37:55 mickey Exp $ */ -/* $NetBSD: inode.c,v 1.1 1997/06/11 11:21:49 bouyer Exp $ */ +/* $OpenBSD: inode.c,v 1.8 2001/09/18 17:43:15 art Exp $ */ +/* $NetBSD: inode.c,v 1.8 2000/01/28 16:01:46 bouyer Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -35,18 +35,6 @@ * SUCH DAMAGE. */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)inode.c 8.5 (Berkeley) 2/8/95"; -#else -#if 0 -static char rcsid[] = "$NetBSD: inode.c,v 1.1 1997/06/11 11:21:49 bouyer Exp $"; -#else -static char rcsid[] = "$OpenBSD: inode.c,v 1.7 2001/05/15 19:37:55 mickey Exp $"; -#endif -#endif -#endif /* not lint */ - #include <sys/param.h> #include <sys/time.h> #include <ufs/ext2fs/ext2fs_dinode.h> @@ -60,6 +48,7 @@ static char rcsid[] = "$OpenBSD: inode.c,v 1.7 2001/05/15 19:37:55 mickey Exp $" #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <time.h> #include "fsck.h" #include "fsutil.h" @@ -81,9 +70,9 @@ static int iblock __P((struct inodesc *, long, u_int64_t)); int ckinode(dp, idesc) struct ext2fs_dinode *dp; - register struct inodesc *idesc; + struct inodesc *idesc; { - register u_int32_t *ap; + u_int32_t *ap; long ret, n, ndb; struct ext2fs_dinode dino; u_int64_t remsize, sizepb; @@ -170,9 +159,9 @@ iblock(idesc, ilevel, isize) long ilevel; u_int64_t isize; { - register daddr_t *ap; - register daddr_t *aplim; - register struct bufarea *bp; + daddr_t *ap; + daddr_t *aplim; + struct bufarea *bp; int i, n, (*func) __P((struct inodesc *)), nif; u_int64_t sizepb; char buf[BUFSIZ]; @@ -257,8 +246,7 @@ chkrange(blk, cnt) daddr_t blk; int cnt; { - register int c; - int overh; + int c, overh; if ((unsigned)(blk + cnt) > maxfsblock) return (1); @@ -309,7 +297,7 @@ ginode(inumber) errexit("bad inode number %d to ginode\n", inumber); if (startinum == 0 || inumber < startinum || inumber >= startinum + sblock.e2fs_ipb) { - iblk = ino_to_fsba(&sblock, inumber); + iblk = fsck_ino_to_fsba(&sblock, inumber); if (pbp != 0) pbp->b_flags &= ~B_INUSE; pbp = getdatablk(iblk, sblock.e2fs_bsize); @@ -338,7 +326,7 @@ getnextinode(inumber) errexit("bad inode number %d to nextinode\n", inumber); if (inumber >= lastinum) { readcnt++; - dblk = fsbtodb(&sblock, ino_to_fsba(&sblock, lastinum)); + dblk = fsbtodb(&sblock, fsck_ino_to_fsba(&sblock, lastinum)); if (readcnt % readpercg == 0) { size = partialsize; lastinum += partialcnt; @@ -397,22 +385,20 @@ freeinodebuf() */ void cacheino(dp, inumber) - register struct ext2fs_dinode *dp; + struct ext2fs_dinode *dp; ino_t inumber; { - register struct inoinfo *inp; + struct inoinfo *inp; struct inoinfo **inpp; unsigned int blks; - blks = howmany(dp->e2di_size, sblock.e2fs_bsize); + blks = howmany(fs2h32(dp->e2di_size), sblock.e2fs_bsize); if (blks > NDADDR) blks = NDADDR + NIADDR; inp = (struct inoinfo *) malloc(sizeof(*inp) + (blks - 1) * sizeof(daddr_t)); - if (inp == NULL) { - errexit("cannot malloc inode cache entry\n"); + if (inp == NULL) return; - } inpp = &inphead[inumber % numdirs]; inp->i_nexthash = *inpp; *inpp = inp; @@ -423,7 +409,7 @@ cacheino(dp, inumber) inp->i_parent = (ino_t)0; inp->i_dotdot = (ino_t)0; inp->i_number = inumber; - inp->i_isize = dp->e2di_size; + inp->i_isize = fs2h32(dp->e2di_size); inp->i_numblks = blks * sizeof(daddr_t); memcpy(&inp->i_blks[0], &dp->e2di_blocks[0], (size_t)inp->i_numblks); if (inplast == listmax) { @@ -443,7 +429,7 @@ struct inoinfo * getinoinfo(inumber) ino_t inumber; { - register struct inoinfo *inp; + struct inoinfo *inp; for (inp = inphead[inumber % numdirs]; inp; inp = inp->i_nexthash) { if (inp->i_number != inumber) @@ -460,7 +446,7 @@ getinoinfo(inumber) void inocleanup() { - register struct inoinfo **inpp; + struct inoinfo **inpp; if (inphead == NULL) return; @@ -480,11 +466,11 @@ inodirty() void clri(idesc, type, flag) - register struct inodesc *idesc; + struct inodesc *idesc; char *type; int flag; { - register struct ext2fs_dinode *dp; + struct ext2fs_dinode *dp; dp = ginode(idesc->id_number); if (flag == 1) { @@ -507,12 +493,13 @@ int findname(idesc) struct inodesc *idesc; { - register struct ext2fs_direct *dirp = idesc->id_dirp; + struct ext2fs_direct *dirp = idesc->id_dirp; + u_int16_t namlen = dirp->e2d_namlen; - if (dirp->e2d_ino != idesc->id_parent) + if (fs2h32(dirp->e2d_ino) != idesc->id_parent) return (KEEPON); - memcpy(idesc->id_name, dirp->e2d_name, (size_t)dirp->e2d_namlen); - idesc->id_name[dirp->e2d_namlen] = '\0'; + memcpy(idesc->id_name, dirp->e2d_name, (size_t)namlen); + idesc->id_name[namlen] = '\0'; return (STOP|FOUND); } @@ -520,14 +507,15 @@ int findino(idesc) struct inodesc *idesc; { - register struct ext2fs_direct *dirp = idesc->id_dirp; + struct ext2fs_direct *dirp = idesc->id_dirp; + u_int32_t ino = fs2h32(dirp->e2d_ino); - if (dirp->e2d_ino == 0) + if (ino == 0) return (KEEPON); if (strcmp(dirp->e2d_name, idesc->id_name) == 0 && - (dirp->e2d_ino == EXT2_ROOTINO || dirp->e2d_ino >= EXT2_FIRSTINO) - && dirp->e2d_ino <= maxino) { - idesc->id_parent = dirp->e2d_ino; + (ino == EXT2_ROOTINO || ino >= EXT2_FIRSTINO) + && ino <= maxino) { + idesc->id_parent = ino; return (STOP|FOUND); } return (KEEPON); @@ -537,8 +525,8 @@ void pinode(ino) ino_t ino; { - register struct ext2fs_dinode *dp; - register char *p; + struct ext2fs_dinode *dp; + char *p; struct passwd *pw; time_t t; @@ -548,16 +536,16 @@ pinode(ino) dp = ginode(ino); printf(" OWNER="); #ifndef SMALL - if ((pw = getpwuid(dp->e2di_uid)) != 0) + if ((pw = getpwuid((int)dp->e2di_uid)) != 0) printf("%s ", pw->pw_name); else #endif - printf("%u ", (unsigned)dp->e2di_uid); - printf("MODE=%o\n", dp->e2di_mode); + printf("%u ", (unsigned)fs2h16(dp->e2di_uid)); + printf("MODE=%o\n", fs2h16(dp->e2di_mode)); if (preen) printf("%s: ", cdevname()); - printf("SIZE=%u ", dp->e2di_size); - t = dp->e2di_mtime; + printf("SIZE=%u ", fs2h32(dp->e2di_size)); + t = fs2h32(dp->e2di_mtime); p = ctime(&t); printf("MTIME=%12.12s %4.4s ", &p[4], &p[20]); } @@ -599,8 +587,8 @@ allocino(request, type) ino_t request; int type; { - register ino_t ino; - register struct ext2fs_dinode *dp; + ino_t ino; + struct ext2fs_dinode *dp; time_t t; if (request == 0) @@ -627,20 +615,21 @@ allocino(request, type) return (0); } dp = ginode(ino); - dp->e2di_blocks[0] = allocblk(); + dp->e2di_blocks[0] = h2fs32(allocblk()); if (dp->e2di_blocks[0] == 0) { statemap[ino] = USTATE; return (0); } - dp->e2di_mode = type; + dp->e2di_mode = h2fs16(type); (void)time(&t); - dp->e2di_atime = t; + dp->e2di_atime = h2fs32(t); dp->e2di_mtime = dp->e2di_ctime = dp->e2di_atime; dp->e2di_dtime = 0; - dp->e2di_size = sblock.e2fs_bsize; - dp->e2di_nblock = btodb(sblock.e2fs_bsize); + dp->e2di_size = h2fs32(sblock.e2fs_bsize); + dp->e2di_nblock = h2fs32(btodb(sblock.e2fs_bsize)); n_files++; inodirty(); + typemap[ino] = E2IFTODT(type); return (ino); } diff --git a/sbin/fsck_ext2fs/pass1.c b/sbin/fsck_ext2fs/pass1.c index b949d49f304..b9dd16644e4 100644 --- a/sbin/fsck_ext2fs/pass1.c +++ b/sbin/fsck_ext2fs/pass1.c @@ -1,5 +1,5 @@ -/* $OpenBSD: pass1.c,v 1.5 2000/04/26 23:26:06 jasoni Exp $ */ -/* $NetBSD: pass1.c,v 1.1 1997/06/11 11:21:51 bouyer Exp $ */ +/* $OpenBSD: pass1.c,v 1.6 2001/09/18 17:43:15 art Exp $ */ +/* $NetBSD: pass1.c,v 1.9 2000/01/31 11:40:12 bouyer Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -35,18 +35,6 @@ * SUCH DAMAGE. */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)pass1.c 8.1 (Berkeley) 6/5/93"; -#else -#if 0 -static char rcsid[] = "$NetBSD: pass1.c,v 1.1 1997/06/11 11:21:51 bouyer Exp $"; -#else -static char rcsid[] = "$OpenBSD: pass1.c,v 1.5 2000/04/26 23:26:06 jasoni Exp $"; -#endif -#endif -#endif /* not lint */ - #include <sys/param.h> #include <sys/time.h> #include <ufs/ext2fs/ext2fs_dinode.h> @@ -137,9 +125,9 @@ pass1() static void checkinode(inumber, idesc) ino_t inumber; - register struct inodesc *idesc; + struct inodesc *idesc; { - register struct ext2fs_dinode *dp; + struct ext2fs_dinode *dp; struct zlncnt *zlnp; int ndb, j; mode_t mode; @@ -306,12 +294,12 @@ unknown: int pass1check(idesc) - register struct inodesc *idesc; + struct inodesc *idesc; { int res = KEEPON; int anyout, nfrags; daddr_t blkno = idesc->id_blkno; - register struct dups *dlp; + struct dups *dlp; struct dups *new; if ((anyout = chkrange(blkno, idesc->id_numfrags)) != 0) { diff --git a/sbin/fsck_ext2fs/pass1b.c b/sbin/fsck_ext2fs/pass1b.c index 2da7ab58ca4..f10f36acbf1 100644 --- a/sbin/fsck_ext2fs/pass1b.c +++ b/sbin/fsck_ext2fs/pass1b.c @@ -1,5 +1,5 @@ -/* $OpenBSD: pass1b.c,v 1.3 1997/06/14 04:16:55 downsj Exp $ */ -/* $NetBSD: pass1b.c,v 1.1 1997/06/11 11:21:53 bouyer Exp $ */ +/* $OpenBSD: pass1b.c,v 1.4 2001/09/18 17:43:15 art Exp $ */ +/* $NetBSD: pass1b.c,v 1.2 1997/09/14 14:27:26 lukem Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -35,18 +35,6 @@ * SUCH DAMAGE. */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)pass1b.c 8.1 (Berkeley) 6/5/93"; -#else -#if 0 -static char rcsid[] = "$NetBSD: pass1b.c,v 1.1 1997/06/11 11:21:53 bouyer Exp $"; -#else -static char rcsid[] = "$OpenBSD: pass1b.c,v 1.3 1997/06/14 04:16:55 downsj Exp $"; -#endif -#endif -#endif /* not lint */ - #include <sys/param.h> #include <sys/time.h> #include <ufs/ext2fs/ext2fs_dinode.h> @@ -62,8 +50,8 @@ static struct dups *duphead; void pass1b() { - register int c, i; - register struct ext2fs_dinode *dp; + int c, i; + struct ext2fs_dinode *dp; struct inodesc idesc; ino_t inumber; @@ -89,9 +77,9 @@ pass1b() static int pass1bcheck(idesc) - register struct inodesc *idesc; + struct inodesc *idesc; { - register struct dups *dlp; + struct dups *dlp; int nfrags, res = KEEPON; daddr_t blkno = idesc->id_blkno; diff --git a/sbin/fsck_ext2fs/pass2.c b/sbin/fsck_ext2fs/pass2.c index 82adaef078e..47657dfbc2c 100644 --- a/sbin/fsck_ext2fs/pass2.c +++ b/sbin/fsck_ext2fs/pass2.c @@ -1,5 +1,5 @@ -/* $OpenBSD: pass2.c,v 1.4 2000/04/26 23:26:06 jasoni Exp $ */ -/* $NetBSD: pass2.c,v 1.1 1997/06/11 11:21:53 bouyer Exp $ */ +/* $OpenBSD: pass2.c,v 1.5 2001/09/18 17:43:15 art Exp $ */ +/* $NetBSD: pass2.c,v 1.6 2000/01/28 16:01:46 bouyer Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -35,18 +35,6 @@ * SUCH DAMAGE. */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)pass2.c 8.6 (Berkeley) 10/27/94"; -#else -#if 0 -static char rcsid[] = "$NetBSD: pass2.c,v 1.1 1997/06/11 11:21:53 bouyer Exp $"; -#else -static char rcsid[] = "$OpenBSD: pass2.c,v 1.4 2000/04/26 23:26:06 jasoni Exp $"; -#endif -#endif -#endif /* not lint */ - #include <sys/param.h> #include <sys/time.h> #include <ufs/ext2fs/ext2fs_dinode.h> @@ -71,8 +59,8 @@ static int blksort __P((const void *, const void *)); void pass2() { - register struct ext2fs_dinode *dp; - register struct inoinfo **inpp, *inp; + struct ext2fs_dinode *dp; + struct inoinfo **inpp, *inp; struct inoinfo **inpend; struct inodesc curino; struct ext2fs_dinode dino; @@ -206,8 +194,8 @@ static int pass2check(idesc) struct inodesc *idesc; { - register struct ext2fs_direct *dirp = idesc->id_dirp; - register struct inoinfo *inp; + struct ext2fs_direct *dirp = idesc->id_dirp; + struct inoinfo *inp; int n, entrysize, ret = 0; struct ext2fs_dinode *dp; char *errmsg; diff --git a/sbin/fsck_ext2fs/pass3.c b/sbin/fsck_ext2fs/pass3.c index f98b1723ab4..d72c20dcdf1 100644 --- a/sbin/fsck_ext2fs/pass3.c +++ b/sbin/fsck_ext2fs/pass3.c @@ -1,5 +1,5 @@ -/* $OpenBSD: pass3.c,v 1.3 1997/06/14 04:16:56 downsj Exp $ */ -/* $NetBSD: pass3.c,v 1.1 1997/06/11 11:21:55 bouyer Exp $ */ +/* $OpenBSD: pass3.c,v 1.4 2001/09/18 17:43:15 art Exp $ */ +/* $NetBSD: pass3.c,v 1.2 1997/09/14 14:27:28 lukem Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -35,18 +35,6 @@ * SUCH DAMAGE. */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)pass3.c 8.1 (Berkeley) 6/5/93"; -#else -#if 0 -static char rcsid[] = "$NetBSD: pass3.c,v 1.1 1997/06/11 11:21:55 bouyer Exp $"; -#else -static char rcsid[] = "$OpenBSD: pass3.c,v 1.3 1997/06/14 04:16:56 downsj Exp $"; -#endif -#endif -#endif /* not lint */ - #include <sys/param.h> #include <sys/time.h> #include <ufs/ext2fs/ext2fs_dinode.h> @@ -57,7 +45,7 @@ static char rcsid[] = "$OpenBSD: pass3.c,v 1.3 1997/06/14 04:16:56 downsj Exp $" void pass3() { - register struct inoinfo **inpp, *inp; + struct inoinfo **inpp, *inp; ino_t orphan; int loopcnt; diff --git a/sbin/fsck_ext2fs/pass4.c b/sbin/fsck_ext2fs/pass4.c index 3eb5b1c8a77..dd03234c3b6 100644 --- a/sbin/fsck_ext2fs/pass4.c +++ b/sbin/fsck_ext2fs/pass4.c @@ -1,5 +1,5 @@ -/* $OpenBSD: pass4.c,v 1.3 1997/06/14 04:16:57 downsj Exp $ */ -/* $NetBSD: pass4.c,v 1.1 1997/06/11 11:21:56 bouyer Exp $ */ +/* $OpenBSD: pass4.c,v 1.4 2001/09/18 17:43:15 art Exp $ */ +/* $NetBSD: pass4.c,v 1.2 1997/09/14 14:27:29 lukem Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -35,18 +35,6 @@ * SUCH DAMAGE. */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)pass4.c 8.1 (Berkeley) 6/5/93"; -#else -#if 0 -static char rcsid[] = "$NetBSD: pass4.c,v 1.1 1997/06/11 11:21:56 bouyer Exp $"; -#else -static char rcsid[] = "$OpenBSD: pass4.c,v 1.3 1997/06/14 04:16:57 downsj Exp $"; -#endif -#endif -#endif /* not lint */ - #include <sys/param.h> #include <sys/time.h> #include <ufs/ext2fs/ext2fs_dinode.h> @@ -61,8 +49,8 @@ static char rcsid[] = "$OpenBSD: pass4.c,v 1.3 1997/06/14 04:16:57 downsj Exp $" void pass4() { - register ino_t inumber; - register struct zlncnt *zlnp; + ino_t inumber; + struct zlncnt *zlnp; struct ext2fs_dinode *dp; struct inodesc idesc; int n; @@ -121,9 +109,9 @@ pass4() int pass4check(idesc) - register struct inodesc *idesc; + struct inodesc *idesc; { - register struct dups *dlp; + struct dups *dlp; int nfrags, res = KEEPON; daddr_t blkno = idesc->id_blkno; diff --git a/sbin/fsck_ext2fs/pass5.c b/sbin/fsck_ext2fs/pass5.c index 0318d183ff9..060c3237d32 100644 --- a/sbin/fsck_ext2fs/pass5.c +++ b/sbin/fsck_ext2fs/pass5.c @@ -1,5 +1,5 @@ -/* $OpenBSD: pass5.c,v 1.7 2001/09/18 03:24:09 deraadt Exp $ */ -/* $NetBSD: pass5.c,v 1.1 1997/06/11 11:21:58 bouyer Exp $ */ +/* $OpenBSD: pass5.c,v 1.8 2001/09/18 17:43:15 art Exp $ */ +/* $NetBSD: pass5.c,v 1.7 2000/01/28 16:01:46 bouyer Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -35,18 +35,6 @@ * SUCH DAMAGE. */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)pass5.c 8.6 (Berkeley) 11/30/94"; -#else -#if 0 -static char rcsid[] = "$NetBSD: pass5.c,v 1.1 1997/06/11 11:21:58 bouyer Exp $"; -#else -static char rcsid[] = "$OpenBSD: pass5.c,v 1.7 2001/09/18 03:24:09 deraadt Exp $"; -#endif -#endif -#endif /* not lint */ - #include <sys/param.h> #include <sys/time.h> #include <ufs/ufs/dinode.h> @@ -68,10 +56,10 @@ void pass5() { int c; - register struct m_ext2fs *fs = &sblock; + struct m_ext2fs *fs = &sblock; daddr_t dbase, dmax; - register daddr_t d; - register long i, j; + daddr_t d; + long i, j; struct inodesc idesc[3]; struct bufarea *ino_bitmap = NULL, *blk_bitmap = NULL; char *ibmap, *bbmap; diff --git a/sbin/fsck_ext2fs/preen.c b/sbin/fsck_ext2fs/preen.c index f9183fe44a7..2ea22ddb1e9 100644 --- a/sbin/fsck_ext2fs/preen.c +++ b/sbin/fsck_ext2fs/preen.c @@ -1,5 +1,5 @@ -/* $OpenBSD: preen.c,v 1.3 1997/06/14 04:16:58 downsj Exp $ */ -/* $NetBSD: preen.c,v 1.1 1997/06/11 11:21:59 bouyer Exp $ */ +/* $OpenBSD: preen.c,v 1.4 2001/09/18 17:43:15 art Exp $ */ +/* $NetBSD: preen.c,v 1.2 1997/09/14 14:27:30 lukem Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -35,18 +35,6 @@ * SUCH DAMAGE. */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)preen.c 8.3 (Berkeley) 12/6/94"; -#else -#if 0 -static char rcsid[] = "$NetBSD: preen.c,v 1.1 1997/06/11 11:21:59 bouyer Exp $"; -#else -static char rcsid[] = "$OpenBSD: preen.c,v 1.3 1997/06/14 04:16:58 downsj Exp $"; -#endif -#endif -#endif /* not lint */ - #include <sys/param.h> #include <sys/stat.h> #include <sys/wait.h> @@ -83,9 +71,9 @@ checkfstab(preen, maxrun, docheck, chkit) int preen, maxrun; int (*docheck)(), (*chkit)(); { - register struct fstab *fsp; - register struct disk *dk, *nextdisk; - register struct part *pt; + struct fstab *fsp; + struct disk *dk, *nextdisk; + struct part *pt; int ret, pid, retcode, passno, sumstatus, status; long auxdata; char *name; @@ -206,8 +194,8 @@ struct disk * finddisk(name) char *name; { - register struct disk *dk, **dkp; - register char *p; + struct disk *dk, **dkp; + char *p; size_t len; for (p = name + strlen(name) - 1; p >= name; --p) @@ -247,7 +235,7 @@ addpart(name, fsname, auxdata) long auxdata; { struct disk *dk = finddisk(name); - register struct part *pt, **ppt = &dk->part; + struct part *pt, **ppt = &dk->part; for (pt = dk->part; pt; ppt = &pt->next, pt = pt->next) if (strcmp(pt->name, name) == 0) { @@ -275,10 +263,10 @@ addpart(name, fsname, auxdata) int startdisk(dk, checkit) - register struct disk *dk; + struct disk *dk; int (*checkit)(); { - register struct part *pt = dk->part; + struct part *pt = dk->part; dk->pid = fork(); if (dk->pid < 0) { diff --git a/sbin/fsck_ext2fs/setup.c b/sbin/fsck_ext2fs/setup.c index e13d8c0055c..13f82b16d1e 100644 --- a/sbin/fsck_ext2fs/setup.c +++ b/sbin/fsck_ext2fs/setup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setup.c,v 1.6 2000/04/26 23:26:06 jasoni Exp $ */ +/* $OpenBSD: setup.c,v 1.7 2001/09/18 17:43:15 art Exp $ */ /* $NetBSD: setup.c,v 1.1 1997/06/11 11:22:01 bouyer Exp $ */ /* @@ -35,18 +35,6 @@ * SUCH DAMAGE. */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94"; -#else -#if 0 -static char rcsid[] = "$NetBSD: setup.c,v 1.1 1997/06/11 11:22:01 bouyer Exp $"; -#else -static char rcsid[] = "$OpenBSD: setup.c,v 1.6 2000/04/26 23:26:06 jasoni Exp $"; -#endif -#endif -#endif /* not lint */ - #define DKTYPENAMES #include <sys/param.h> #include <sys/time.h> @@ -439,11 +427,11 @@ int calcsb(dev, devfd, fs) char *dev; int devfd; - register struct m_ext2fs *fs; + struct m_ext2fs *fs; { - register struct disklabel *lp; - register struct partition *pp; - register char *cp; + struct disklabel *lp; + struct partition *pp; + char *cp; cp = strchr(dev, '\0') - 1; if ((cp == (char *)-1 || (*cp < 'a' || *cp > 'h')) && !isdigit(*cp)) { diff --git a/sbin/fsck_ext2fs/utilities.c b/sbin/fsck_ext2fs/utilities.c index 6359ef6bf02..c0eca929756 100644 --- a/sbin/fsck_ext2fs/utilities.c +++ b/sbin/fsck_ext2fs/utilities.c @@ -1,5 +1,5 @@ -/* $OpenBSD: utilities.c,v 1.8 2001/01/31 22:31:51 deraadt Exp $ */ -/* $NetBSD: utilities.c,v 1.1 1997/06/11 11:22:02 bouyer Exp $ */ +/* $OpenBSD: utilities.c,v 1.9 2001/09/18 17:43:15 art Exp $ */ +/* $NetBSD: utilities.c,v 1.6 2001/02/04 21:19:34 christos Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -35,18 +35,6 @@ * SUCH DAMAGE. */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)utilities.c 8.1 (Berkeley) 6/5/93"; -#else -#if 0 -static char rcsid[] = "$NetBSD: utilities.c,v 1.1 1997/06/11 11:22:02 bouyer Exp $"; -#else -static char rcsid[] = "$OpenBSD: utilities.c,v 1.8 2001/01/31 22:31:51 deraadt Exp $"; -#endif -#endif -#endif /* not lint */ - #include <sys/param.h> #include <sys/time.h> #include <ufs/ext2fs/ext2fs_dinode.h> @@ -67,6 +55,8 @@ long diskreads, totalreads; /* Disk cache statistics */ static void rwerror __P((char *, daddr_t)); +extern int returntosingle; + int ftypeok(dp) struct ext2fs_dinode *dp; @@ -84,7 +74,7 @@ ftypeok(dp) default: if (debug) - printf("bad file type 0%o\n", dp->e2di_mode); + printf("bad file type 0%o\n", fs2h16(dp->e2di_mode)); return (0); } } @@ -128,7 +118,7 @@ reply(question) void bufinit() { - register struct bufarea *bp; + struct bufarea *bp; long bufcnt, i; char *bufp; @@ -164,7 +154,7 @@ getdatablk(blkno, size) daddr_t blkno; long size; { - register struct bufarea *bp; + struct bufarea *bp; for (bp = bufhead.b_next; bp != &bufhead; bp = bp->b_next) if (bp->b_bno == fsbtodb(&sblock, blkno)) @@ -191,7 +181,7 @@ foundit: void getblk(bp, blk, size) - register struct bufarea *bp; + struct bufarea *bp; daddr_t blk; long size; { @@ -210,9 +200,9 @@ getblk(bp, blk, size) void flush(fd, bp) int fd; - register struct bufarea *bp; + struct bufarea *bp; { - register int i; + int i; if (!bp->b_dirty) return; @@ -250,7 +240,7 @@ void ckfini(markclean) int markclean; { - register struct bufarea *bp, *nbp; + struct bufarea *bp, *nbp; int cnt = 0; if (fswritefd < 0) { @@ -377,7 +367,7 @@ bwrite(fd, buf, blk, size) int allocblk() { - register int i; + int i; for (i = 0; i < maxfsblock - 1; i++) { if (testbmap(i)) @@ -412,7 +402,7 @@ getpathname(namebuf, curdir, ino) ino_t curdir, ino; { int len; - register char *cp; + char *cp; struct inodesc idesc; static int busy = 0; @@ -480,7 +470,6 @@ void catchquit(n) int n; { - extern int returntosingle; /* XXX signal race */ printf("returning to single-user after filesystem check\n"); @@ -508,7 +497,7 @@ voidquit(n) */ int dofix(idesc, msg) - register struct inodesc *idesc; + struct inodesc *idesc; char *msg; { |