From c1d9efcbb9ab7727c66d808450665ce82edf50e7 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Mon, 10 Oct 1994 01:04:55 +0000 Subject: [PATCH] Cosmetics. make gcc less noisy. Still some way to go here. --- sys/ufs/ffs/ffs_alloc.c | 42 ++++++++++++++++++++----------------- sys/ufs/ffs/ffs_balloc.c | 26 ++++++++++++++--------- sys/ufs/ffs/ffs_inode.c | 33 ++++++++++++++++------------- sys/ufs/ffs/ffs_subr.c | 11 +++++----- sys/ufs/ffs/ffs_vfsops.c | 9 ++++++-- sys/ufs/ffs/ffs_vnops.c | 3 ++- sys/ufs/lfs/lfs.h | 12 ++++++++--- sys/ufs/lfs/lfs_alloc.c | 3 ++- sys/ufs/lfs/lfs_bio.c | 7 ++++--- sys/ufs/lfs/lfs_inode.c | 4 ++-- sys/ufs/ufs/ufs_readwrite.c | 7 ++++--- 11 files changed, 94 insertions(+), 63 deletions(-) diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index 6f566806ad4..9830e4fd0ad 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_alloc.c 8.8 (Berkeley) 2/21/94 - * $Id: ffs_alloc.c,v 1.3 1994/08/02 07:54:17 davidg Exp $ + * $Id: ffs_alloc.c,v 1.4 1994/09/20 05:53:24 bde Exp $ */ #include @@ -101,8 +101,8 @@ ffs_alloc(ip, lbn, bpref, size, cred, bnp) fs = ip->i_fs; #ifdef DIAGNOSTIC if ((u_int)size > fs->fs_bsize || fragoff(fs, size) != 0) { - printf("dev = 0x%x, bsize = %d, size = %d, fs = %s\n", - ip->i_dev, fs->fs_bsize, size, fs->fs_fsmnt); + printf("dev = 0x%lx, bsize = %ld, size = %d, fs = %s\n", + (u_long)ip->i_dev, fs->fs_bsize, size, fs->fs_fsmnt); panic("ffs_alloc: bad size"); } if (cred == NOCRED) @@ -113,7 +113,8 @@ ffs_alloc(ip, lbn, bpref, size, cred, bnp) if (cred->cr_uid != 0 && freespace(fs, fs->fs_minfree) <= 0) goto nospace; #ifdef QUOTA - if (error = chkdq(ip, (long)btodb(size), cred, 0)) + error = chkdq(ip, (long)btodb(size), cred, 0); + if (error) return (error); #endif if (bpref >= fs->fs_size) @@ -170,8 +171,8 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp) if ((u_int)osize > fs->fs_bsize || fragoff(fs, osize) != 0 || (u_int)nsize > fs->fs_bsize || fragoff(fs, nsize) != 0) { printf( - "dev = 0x%x, bsize = %d, osize = %d, nsize = %d, fs = %s\n", - ip->i_dev, fs->fs_bsize, osize, nsize, fs->fs_fsmnt); + "dev = 0x%lx, bsize = %d, osize = %d, nsize = %d, fs = %s\n", + (u_long)ip->i_dev, fs->fs_bsize, osize, nsize, fs->fs_fsmnt); panic("ffs_realloccg: bad size"); } if (cred == NOCRED) @@ -187,12 +188,14 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp) /* * Allocate the extra space in the buffer. */ - if (error = bread(ITOV(ip), lbprev, osize, NOCRED, &bp)) { + error = bread(ITOV(ip), lbprev, osize, NOCRED, &bp); + if (error) { brelse(bp); return (error); } #ifdef QUOTA - if (error = chkdq(ip, (long)btodb(nsize - osize), cred, 0)) { + error = chkdq(ip, (long)btodb(nsize - osize), cred, 0); + if (error) { brelse(bp); return (error); } @@ -201,7 +204,8 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp) * Check for extension in the existing location. */ cg = dtog(fs, bprev); - if (bno = ffs_fragextend(ip, cg, (long)bprev, osize, nsize)) { + bno = ffs_fragextend(ip, cg, (long)bprev, osize, nsize); + if (bno) { if (bp->b_blkno != fsbtodb(fs, bno)) panic("bad blockno"); ip->i_blocks += btodb(nsize - osize); @@ -255,8 +259,8 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp) fs->fs_optim = FS_OPTSPACE; break; default: - printf("dev = 0x%x, optim = %d, fs = %s\n", - ip->i_dev, fs->fs_optim, fs->fs_fsmnt); + printf("dev = 0x%lx, optim = %ld, fs = %s\n", + (u_long)ip->i_dev, fs->fs_optim, fs->fs_fsmnt); panic("ffs_realloccg: bad optim"); /* NOTREACHED */ } @@ -325,7 +329,7 @@ ffs_reallocblks(ap) struct buf *sbp, *ebp; daddr_t *bap, *sbap, *ebap = 0; struct cluster_save *buflist; - daddr_t start_lbn, end_lbn, soff, eoff, newblk, blkno; + daddr_t start_lbn, end_lbn, soff, newblk, blkno; struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp; int i, len, start_lvl, end_lvl, pref, ssize; @@ -513,12 +517,12 @@ ffs_valloc(ap) } ip = VTOI(*ap->a_vpp); if (ip->i_mode) { - printf("mode = 0%o, inum = %d, fs = %s\n", + printf("mode = 0%o, inum = %ld, fs = %s\n", ip->i_mode, ip->i_number, fs->fs_fsmnt); panic("ffs_valloc: dup alloc"); } if (ip->i_blocks) { /* XXX */ - printf("free inode %s/%d had %d blocks\n", + printf("free inode %s/%ld had %ld blocks\n", fs->fs_fsmnt, ino, ip->i_blocks); ip->i_blocks = 0; } @@ -1172,8 +1176,8 @@ ffs_blkfree(ip, bno, size) fs = ip->i_fs; if ((u_int)size > fs->fs_bsize || fragoff(fs, size) != 0) { - printf("dev = 0x%x, bsize = %d, size = %d, fs = %s\n", - ip->i_dev, fs->fs_bsize, size, fs->fs_fsmnt); + printf("dev = 0x%lx, bsize = %ld, size = %ld, fs = %s\n", + (u_long)ip->i_dev, fs->fs_bsize, size, fs->fs_fsmnt); panic("blkfree: bad size"); } cg = dtog(fs, bno); @@ -1298,8 +1302,8 @@ ffs_vfree(ap) cgp->cg_time = time.tv_sec; ino %= fs->fs_ipg; if (isclr(cg_inosused(cgp), ino)) { - printf("dev = 0x%x, ino = %d, fs = %s\n", - pip->i_dev, ino, fs->fs_fsmnt); + printf("dev = 0x%lx, ino = %d, fs = %s\n", + (u_long)pip->i_dev, ino, fs->fs_fsmnt); if (fs->fs_ronly == 0) panic("ifree: freeing free inode"); } @@ -1379,7 +1383,7 @@ ffs_mapsearch(fs, cgp, bpref, allocsiz) subfield <<= 1; } } - printf("bno = %d, fs = %s\n", bno, fs->fs_fsmnt); + printf("bno = %lu, fs = %s\n", (u_long)bno, fs->fs_fsmnt); panic("ffs_alloccg: block not in map"); return (-1); } diff --git a/sys/ufs/ffs/ffs_balloc.c b/sys/ufs/ffs/ffs_balloc.c index de51704694b..fbbbc436a7f 100644 --- a/sys/ufs/ffs/ffs_balloc.c +++ b/sys/ufs/ffs/ffs_balloc.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_balloc.c 8.4 (Berkeley) 9/23/93 - * $Id$ + * $Id: ffs_balloc.c,v 1.3 1994/08/02 07:54:18 davidg Exp $ */ #include @@ -159,7 +159,8 @@ ffs_balloc(ip, bn, size, cred, bpp, flags) * Determine the number of levels of indirection. */ pref = 0; - if (error = ufs_getlbns(vp, bn, indirs, &num)) + error = ufs_getlbns(vp, bn, indirs, &num); + if (error) return(error); #ifdef DIAGNOSTIC if (num < 1) @@ -172,8 +173,9 @@ ffs_balloc(ip, bn, size, cred, bpp, flags) nb = ip->i_ib[indirs[0].in_off]; if (nb == 0) { pref = ffs_blkpref(ip, lbn, 0, (daddr_t *)0); - if (error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, - cred, &newb)) + error = ffs_alloc(ip, lbn, pref, + (int)fs->fs_bsize, cred, &newb); + if (error) return (error); nb = newb; bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0); @@ -183,7 +185,8 @@ ffs_balloc(ip, bn, size, cred, bpp, flags) * Write synchronously so that indirect blocks * never point at garbage. */ - if (error = bwrite(bp)) { + error = bwrite(bp); + if (error) { ffs_blkfree(ip, nb, fs->fs_bsize); return (error); } @@ -211,8 +214,9 @@ ffs_balloc(ip, bn, size, cred, bpp, flags) } if (pref == 0) pref = ffs_blkpref(ip, lbn, 0, (daddr_t *)0); - if (error = - ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, cred, &newb)) { + error = + ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, cred, &newb); + if (error) { brelse(bp); return (error); } @@ -224,7 +228,8 @@ ffs_balloc(ip, bn, size, cred, bpp, flags) * Write synchronously so that indirect blocks * never point at garbage. */ - if (error = bwrite(nbp)) { + error = bwrite(nbp); + if (error) { ffs_blkfree(ip, nb, fs->fs_bsize); brelse(bp); return (error); @@ -245,8 +250,9 @@ ffs_balloc(ip, bn, size, cred, bpp, flags) */ if (nb == 0) { pref = ffs_blkpref(ip, lbn, indirs[i].in_off, &bap[0]); - if (error = ffs_alloc(ip, - lbn, pref, (int)fs->fs_bsize, cred, &newb)) { + error = ffs_alloc(ip, + lbn, pref, (int)fs->fs_bsize, cred, &newb); + if (error) { brelse(bp); return (error); } diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 04b6c700644..defa2e85b01 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_inode.c 8.5 (Berkeley) 12/30/93 - * $Id: ffs_inode.c,v 1.6 1994/08/29 06:09:13 davidg Exp $ + * $Id: ffs_inode.c,v 1.7 1994/09/02 10:24:55 davidg Exp $ */ #include @@ -115,9 +115,9 @@ ffs_update(ap) ip->i_din.di_ouid = ip->i_uid; /* XXX */ ip->i_din.di_ogid = ip->i_gid; /* XXX */ } /* XXX */ - if (error = bread(ip->i_devvp, - fsbtodb(fs, ino_to_fsba(fs, ip->i_number)), - (int)fs->fs_bsize, NOCRED, &bp)) { + error = bread(ip->i_devvp, fsbtodb(fs, ino_to_fsba(fs, ip->i_number)), + (int)fs->fs_bsize, NOCRED, &bp); + if (error) { brelse(bp); return (error); } @@ -183,7 +183,8 @@ ffs_truncate(ap) return (VOP_UPDATE(ovp, &tv, &tv, 0)); } #ifdef QUOTA - if (error = getinoquota(oip)) + error = getinoquota(oip); + if (error) return (error); #endif vnode_pager_setsize(ovp, (u_long)length); @@ -200,8 +201,9 @@ ffs_truncate(ap) aflags = B_CLRBUF; if (ap->a_flags & IO_SYNC) aflags |= B_SYNC; - if (error = ffs_balloc(oip, lbn, offset + 1, ap->a_cred, &bp, - aflags)) + error = ffs_balloc(oip, lbn, offset + 1, ap->a_cred, + &bp, aflags); + if (error) return (error); oip->i_size = length; if (aflags & IO_SYNC) @@ -226,8 +228,8 @@ ffs_truncate(ap) aflags = B_CLRBUF; if (ap->a_flags & IO_SYNC) aflags |= B_SYNC; - if (error = ffs_balloc(oip, lbn, offset, ap->a_cred, &bp, - aflags)) + error = ffs_balloc(oip, lbn, offset, ap->a_cred, &bp, aflags); + if (error) return (error); oip->i_size = length; size = blksize(fs, oip, lbn); @@ -264,7 +266,8 @@ ffs_truncate(ap) for (i = NDADDR - 1; i > lastblock; i--) oip->i_db[i] = 0; oip->i_flag |= IN_CHANGE | IN_UPDATE; - if (error = VOP_UPDATE(ovp, &tv, &tv, MNT_WAIT)) + error = VOP_UPDATE(ovp, &tv, &tv, MNT_WAIT); + if (error) allerror = error; /* * Having written the new inode to disk, save its new configuration @@ -462,8 +465,9 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp) if (nb == 0) continue; if (level > SINGLE) { - if (error = ffs_indirtrunc(ip, nlbn, - fsbtodb(fs, nb), (daddr_t)-1, level - 1, &blkcount)) + error = ffs_indirtrunc(ip, nlbn, + fsbtodb(fs, nb), (daddr_t)-1, level - 1, &blkcount); + if (error) allerror = error; blocksreleased += blkcount; } @@ -478,8 +482,9 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp) last = lastbn % factor; nb = bap[i]; if (nb != 0) { - if (error = ffs_indirtrunc(ip, nlbn, fsbtodb(fs, nb), - last, level - 1, &blkcount)) + error = ffs_indirtrunc(ip, nlbn, fsbtodb(fs, nb), + last, level - 1, &blkcount); + if (error) allerror = error; blocksreleased += blkcount; } diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c index faebf637fce..4a02c4b2a26 100644 --- a/sys/ufs/ffs/ffs_subr.c +++ b/sys/ufs/ffs/ffs_subr.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_subr.c 8.2 (Berkeley) 9/21/93 - * $Id$ + * $Id: ffs_subr.c,v 1.2 1994/08/02 07:54:22 davidg Exp $ */ #include @@ -71,7 +71,8 @@ ffs_blkatoff(ap) bsize = blksize(fs, ip, lbn); *ap->a_bpp = NULL; - if (error = bread(ap->a_vp, lbn, bsize, NOCRED, &bp)) { + error = bread(ap->a_vp, lbn, bsize, NOCRED, &bp); + if (error) { brelse(bp); return (error); } @@ -143,9 +144,9 @@ ffs_checkoverlap(bp, ip) ep->b_blkno + btodb(ep->b_bcount) <= start) continue; vprint("Disk overlap", vp); - (void)printf("\tstart %d, end %d overlap start %d, end %d\n", - start, last, ep->b_blkno, - ep->b_blkno + btodb(ep->b_bcount) - 1); + (void)printf("\tstart %lu, end %lu overlap start %lu, end %lu\n", + (u_long)start, (u_long)last, (u_long)ep->b_blkno, + (u_long)(ep->b_blkno + btodb(ep->b_bcount) - 1)); panic("Disk buffer overlap"); } } diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index c0f0ce27b26..73c8c0bb0a2 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94 - * $Id: ffs_vfsops.c,v 1.7 1994/09/22 01:57:27 wollman Exp $ + * $Id: ffs_vfsops.c,v 1.8 1994/10/08 06:20:06 phk Exp $ */ #include @@ -558,7 +558,9 @@ ffs_flushfiles(mp, flags, p) ump = VFSTOUFS(mp); #ifdef QUOTA if (mp->mnt_flag & MNT_QUOTA) { - if (error = vflush(mp, NULLVP, SKIPSYSTEM|flags)) + int i; + error = vflush(mp, NULLVP, SKIPSYSTEM|flags); + if (error) return (error); for (i = 0; i < MAXQUOTAS; i++) { if (ump->um_quotas[i] == NULLVP) @@ -724,8 +726,11 @@ ffs_vget(mp, ino, vpp) ip->i_dev = dev; ip->i_number = ino; #ifdef QUOTA + { + int i; for (i = 0; i < MAXQUOTAS; i++) ip->i_dquot[i] = NODQUOT; + } #endif /* * Put it onto its hash chain and lock it so that other requests for diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index bfc5f3a58fe..35c90575091 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -31,12 +31,13 @@ * SUCH DAMAGE. * * @(#)ffs_vnops.c 8.7 (Berkeley) 2/3/94 - * $Id: ffs_vnops.c,v 1.5 1994/09/22 19:38:32 wollman Exp $ + * $Id: ffs_vnops.c,v 1.6 1994/10/06 21:06:59 davidg Exp $ */ #include #include #include +#include #include #include #include diff --git a/sys/ufs/lfs/lfs.h b/sys/ufs/lfs/lfs.h index 3f5aa07261d..9003eced73c 100644 --- a/sys/ufs/lfs/lfs.h +++ b/sys/ufs/lfs/lfs.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)lfs.h 8.3 (Berkeley) 9/23/93 - * $Id: lfs.h,v 1.2 1994/08/02 07:54:28 davidg Exp $ + * $Id: lfs.h,v 1.3 1994/08/21 07:16:08 paul Exp $ */ #ifndef _UFS_LFS_LFS_H_ @@ -271,12 +271,18 @@ struct segsum { #define LFS_SEGENTRY(SP, F, IN, BP) { \ int _e; \ VTOI((F)->lfs_ivnode)->i_flag |= IN_ACCESS; \ - if (_e = bread((F)->lfs_ivnode, \ + _e = bread((F)->lfs_ivnode, \ ((IN) >> (F)->lfs_sushift) + (F)->lfs_cleansz, \ - (F)->lfs_bsize, NOCRED, &(BP))) \ + (F)->lfs_bsize, NOCRED, &(BP)); \ + if (_e) \ panic("lfs: ifile read: %d", _e); \ (SP) = (SEGUSE *)(BP)->b_data + ((IN) & (F)->lfs_sepb - 1); \ } +#ifdef CC_WALL +/* The above ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + * looks like a potential bug to me. + */ +#endif /* * Determine if there is enough room currently available to write db diff --git a/sys/ufs/lfs/lfs_alloc.c b/sys/ufs/lfs/lfs_alloc.c index 5e8f2b97877..feaa8d22eb8 100644 --- a/sys/ufs/lfs/lfs_alloc.c +++ b/sys/ufs/lfs/lfs_alloc.c @@ -31,10 +31,11 @@ * SUCH DAMAGE. * * @(#)lfs_alloc.c 8.4 (Berkeley) 1/4/94 - * $Id: lfs_alloc.c,v 1.3 1994/08/20 03:49:00 davidg Exp $ + * $Id: lfs_alloc.c,v 1.4 1994/08/29 06:09:14 davidg Exp $ */ #include +#include #include #include #include diff --git a/sys/ufs/lfs/lfs_bio.c b/sys/ufs/lfs/lfs_bio.c index 59a8d15ecf1..9344dbb590f 100644 --- a/sys/ufs/lfs/lfs_bio.c +++ b/sys/ufs/lfs/lfs_bio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)lfs_bio.c 8.4 (Berkeley) 12/30/93 - * $Id: lfs_bio.c,v 1.3 1994/08/02 07:54:31 davidg Exp $ + * $Id: lfs_bio.c,v 1.4 1994/08/20 03:49:01 davidg Exp $ */ #include @@ -100,8 +100,9 @@ lfs_bwrite(ap) bp->b_lblkno > 0) { /* Out of space, need cleaner to run */ wakeup(&lfs_allclean_wakeup); - if (error = tsleep(&fs->lfs_avail, PCATCH | PUSER, - "cleaner", NULL)) { + error = tsleep(&fs->lfs_avail, PCATCH | PUSER, + "cleaner", NULL); + if (error) { brelse(bp); return (error); } diff --git a/sys/ufs/lfs/lfs_inode.c b/sys/ufs/lfs/lfs_inode.c index 36d0b94fa15..0df3366831b 100644 --- a/sys/ufs/lfs/lfs_inode.c +++ b/sys/ufs/lfs/lfs_inode.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)lfs_inode.c 8.5 (Berkeley) 12/30/93 - * $Id: lfs_inode.c,v 1.2 1994/08/02 07:54:35 davidg Exp $ + * $Id: lfs_inode.c,v 1.3 1994/08/29 06:09:15 davidg Exp $ */ #include @@ -347,7 +347,7 @@ lfs_truncate(ap) ip->i_blocks -= blocksreleased; #ifdef DIAGNOSTIC if (length == 0 && ip->i_blocks != 0) - printf("lfs_inode: Warning! %s%d%s\n", + printf("lfs_inode: Warning! %s%ld%s\n", "Truncation to zero, but ", ip->i_blocks, " blocks left on inode"); #endif diff --git a/sys/ufs/ufs/ufs_readwrite.c b/sys/ufs/ufs/ufs_readwrite.c index 34c0e9e8d86..058af53f4d6 100644 --- a/sys/ufs/ufs/ufs_readwrite.c +++ b/sys/ufs/ufs/ufs_readwrite.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ufs_readwrite.c 8.7 (Berkeley) 1/21/94 - * $Id: ufs_readwrite.c,v 1.3 1994/08/02 07:55:00 davidg Exp $ + * $Id: ufs_readwrite.c,v 1.4 1994/08/08 09:11:44 davidg Exp $ */ #ifdef LFS_READWRITE @@ -143,8 +143,9 @@ READ(ap) break; xfersize = size; } - if (error = - uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio)) + error = + uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio); + if (error) break; brelse(bp);