From 8fb4a19fe0cf69cd2cd6fbe2b3eca609d149d40e Mon Sep 17 00:00:00 2001 From: pfg Date: Wed, 28 Dec 2016 15:43:17 +0000 Subject: [PATCH] style(9) cleanups. Just to reduce some of the issues found with indent(1). MFC after: 1 week --- sys/fs/ext2fs/ext2_alloc.c | 135 +++++++++++++++++---------------- sys/fs/ext2fs/ext2_balloc.c | 42 +++++----- sys/fs/ext2fs/ext2_bmap.c | 12 ++- sys/fs/ext2fs/ext2_dir.h | 22 +++--- sys/fs/ext2fs/ext2_extents.c | 9 +-- sys/fs/ext2fs/ext2_extents.h | 29 +++---- sys/fs/ext2fs/ext2_extern.h | 2 +- sys/fs/ext2fs/ext2_hash.c | 6 +- sys/fs/ext2fs/ext2_htree.c | 37 ++++----- sys/fs/ext2fs/ext2_inode.c | 13 ++-- sys/fs/ext2fs/ext2_inode_cnv.c | 51 +++++++------ sys/fs/ext2fs/ext2_lookup.c | 56 +++++++------- sys/fs/ext2fs/ext2_mount.h | 2 +- sys/fs/ext2fs/ext2_subr.c | 1 + sys/fs/ext2fs/ext2_vfsops.c | 38 +++++----- sys/fs/ext2fs/ext2_vnops.c | 66 ++++++++-------- sys/fs/ext2fs/ext2fs.h | 2 +- sys/fs/ext2fs/fs.h | 10 +-- sys/fs/ext2fs/htree.h | 22 +++--- sys/fs/ext2fs/inode.h | 20 ++--- 20 files changed, 295 insertions(+), 280 deletions(-) diff --git a/sys/fs/ext2fs/ext2_alloc.c b/sys/fs/ext2fs/ext2_alloc.c index c650dfc389b3..76d9d7ed0a9b 100644 --- a/sys/fs/ext2fs/ext2_alloc.c +++ b/sys/fs/ext2fs/ext2_alloc.c @@ -81,12 +81,13 @@ static daddr_t ext2_mapsearch(struct m_ext2fs *, char *, daddr_t); */ int ext2_alloc(struct inode *ip, daddr_t lbn, e4fs_daddr_t bpref, int size, - struct ucred *cred, e4fs_daddr_t *bnp) + struct ucred *cred, e4fs_daddr_t *bnp) { struct m_ext2fs *fs; struct ext2mount *ump; int32_t bno; - int cg; + int cg; + *bnp = 0; fs = ip->i_e2fs; ump = ip->i_ump; @@ -99,11 +100,11 @@ ext2_alloc(struct inode *ip, daddr_t lbn, e4fs_daddr_t bpref, int size, } if (cred == NOCRED) panic("ext2_alloc: missing credential"); -#endif /* INVARIANTS */ +#endif /* INVARIANTS */ if (size == fs->e2fs_bsize && fs->e2fs->e2fs_fbcount == 0) goto nospace; - if (cred->cr_uid != 0 && - fs->e2fs->e2fs_fbcount < fs->e2fs->e2fs_rbcount) + if (cred->cr_uid != 0 && + fs->e2fs->e2fs_fbcount < fs->e2fs->e2fs_rbcount) goto nospace; if (bpref >= fs->e2fs->e2fs_bcount) bpref = 0; @@ -112,7 +113,7 @@ ext2_alloc(struct inode *ip, daddr_t lbn, e4fs_daddr_t bpref, int size, else cg = dtog(fs, bpref); bno = (daddr_t)ext2_hashalloc(ip, cg, bpref, fs->e2fs_bsize, - ext2_alloccg); + ext2_alloccg); if (bno > 0) { /* set next_alloc fields as done in block_getblk */ ip->i_next_alloc_block = lbn; @@ -148,10 +149,12 @@ nospace: static SYSCTL_NODE(_vfs, OID_AUTO, ext2fs, CTLFLAG_RW, 0, "EXT2FS filesystem"); static int doasyncfree = 1; + SYSCTL_INT(_vfs_ext2fs, OID_AUTO, doasyncfree, CTLFLAG_RW, &doasyncfree, 0, "Use asychronous writes to update block pointers when freeing blocks"); static int doreallocblks = 1; + SYSCTL_INT(_vfs_ext2fs, OID_AUTO, doreallocblks, CTLFLAG_RW, &doreallocblks, 0, ""); int @@ -171,7 +174,7 @@ ext2_reallocblks(struct vop_reallocblks_args *ap) int i, len, start_lvl, end_lvl, pref, ssize; if (doreallocblks == 0) - return (ENOSPC); + return (ENOSPC); vp = ap->a_vp; ip = VTOI(vp); @@ -236,7 +239,7 @@ ext2_reallocblks(struct vop_reallocblks_args *ap) ssize = len; } else { #ifdef INVARIANTS - if (start_ap[start_lvl-1].in_lbn == idp->in_lbn) + if (start_ap[start_lvl - 1].in_lbn == idp->in_lbn) panic("ext2_reallocblks: start == end"); #endif ssize = len - (idp->in_off + 1); @@ -253,10 +256,10 @@ ext2_reallocblks(struct vop_reallocblks_args *ap) * Search the block map looking for an allocation of the desired size. */ if ((newblk = (e2fs_daddr_t)ext2_hashalloc(ip, dtog(fs, pref), pref, - len, ext2_clusteralloc)) == 0){ + len, ext2_clusteralloc)) == 0) { EXT2_UNLOCK(ump); goto fail; - } + } /* * We have found a new contiguous block. * @@ -267,7 +270,7 @@ ext2_reallocblks(struct vop_reallocblks_args *ap) #ifdef DEBUG printf("realloc: ino %ju, lbns %jd-%jd\n\told:", (uintmax_t)ip->i_number, (intmax_t)start_lbn, (intmax_t)end_lbn); -#endif /* DEBUG */ +#endif /* DEBUG */ blkno = newblk; for (bap = &sbap[soff], i = 0; i < len; i++, blkno += fs->e2fs_fpb) { if (i == ssize) { @@ -279,15 +282,15 @@ ext2_reallocblks(struct vop_reallocblks_args *ap) panic("ext2_reallocblks: alloc mismatch"); #endif #ifdef DEBUG - printf(" %d,", *bap); -#endif /* DEBUG */ + printf(" %d,", *bap); +#endif /* DEBUG */ *bap++ = blkno; } /* * Next we must write out the modified inode and indirect blocks. * For strict correctness, the writes should be synchronous since * the old block values may have been written to disk. In practise - * they are almost never written, but if we are concerned about + * they are almost never written, but if we are concerned about * strict correctness, the `doasyncfree' flag should be set to zero. * * The test on `doasyncfree' should be changed to test a flag @@ -318,18 +321,18 @@ ext2_reallocblks(struct vop_reallocblks_args *ap) */ #ifdef DEBUG printf("\n\tnew:"); -#endif /* DEBUG */ +#endif /* DEBUG */ for (blkno = newblk, i = 0; i < len; i++, blkno += fs->e2fs_fpb) { ext2_blkfree(ip, dbtofsb(fs, buflist->bs_children[i]->b_blkno), fs->e2fs_bsize); buflist->bs_children[i]->b_blkno = fsbtodb(fs, blkno); #ifdef DEBUG printf(" %d,", blkno); -#endif /* DEBUG */ +#endif /* DEBUG */ } #ifdef DEBUG printf("\n"); -#endif /* DEBUG */ +#endif /* DEBUG */ return (0); fail: @@ -342,7 +345,7 @@ fail: /* * Allocate an inode in the filesystem. - * + * */ int ext2_valloc(struct vnode *pvp, int mode, struct ucred *cred, struct vnode **vpp) @@ -354,7 +357,7 @@ ext2_valloc(struct vnode *pvp, int mode, struct ucred *cred, struct vnode **vpp) struct ext2mount *ump; ino_t ino, ipref; int i, error, cg; - + *vpp = NULL; pip = VTOI(pvp); fs = pip->i_e2fs; @@ -380,7 +383,7 @@ ext2_valloc(struct vnode *pvp, int mode, struct ucred *cred, struct vnode **vpp) ipref = cg * fs->e2fs->e2fs_ipg + 1; ino = (ino_t)ext2_hashalloc(pip, cg, (long)ipref, mode, ext2_nodealloccg); - if (ino == 0) + if (ino == 0) goto noinodes; error = VFS_VGET(pvp->v_mount, ino, LK_EXCLUSIVE, vpp); if (error) { @@ -411,7 +414,7 @@ ext2_valloc(struct vnode *pvp, int mode, struct ucred *cred, struct vnode **vpp) */ do { ip->i_gen = arc4random(); - } while ( ip->i_gen == 0); + } while (ip->i_gen == 0); vfs_timestamp(&ts); ip->i_birthtime = ts.tv_sec; @@ -457,7 +460,7 @@ ext2_dirpref(struct inode *pip) avgifree = fs->e2fs->e2fs_ficount / fs->e2fs_gcount; avgbfree = fs->e2fs->e2fs_fbcount / fs->e2fs_gcount; - avgndir = fs->e2fs_total_dir / fs->e2fs_gcount; + avgndir = fs->e2fs_total_dir / fs->e2fs_gcount; /* * Force allocation in another cg if creating a first level dir. @@ -481,10 +484,8 @@ ext2_dirpref(struct inode *pip) mincg = cg; minndir = fs->e2fs_gd[cg].ext2bgd_ndirs; } - return (mincg); } - /* * Count various limits which used for * optimal allocation of a directory inode. @@ -507,7 +508,7 @@ ext2_dirpref(struct inode *pip) maxcontigdirs = 1; /* - * Limit number of dirs in one cg and reserve space for + * Limit number of dirs in one cg and reserve space for * regular files, but only if we have no deficit in * inodes or space. */ @@ -539,7 +540,7 @@ ext2_dirpref(struct inode *pip) } /* - * Select the desired position for the next block in a file. + * Select the desired position for the next block in a file. * * we try to mimic what Remy does in inode_getblk/block_getblk * @@ -555,30 +556,34 @@ e4fs_daddr_t ext2_blkpref(struct inode *ip, e2fs_lbn_t lbn, int indx, e2fs_daddr_t *bap, e2fs_daddr_t blocknr) { - int tmp; + int tmp; + mtx_assert(EXT2_MTX(ip->i_ump), MA_OWNED); - /* if the next block is actually what we thought it is, - then set the goal to what we thought it should be - */ + /* + * If the next block is actually what we thought it is, then set the + * goal to what we thought it should be. + */ if (ip->i_next_alloc_block == lbn && ip->i_next_alloc_goal != 0) return ip->i_next_alloc_goal; - /* now check whether we were provided with an array that basically - tells us previous blocks to which we want to stay closeby - */ + /* + * Now check whether we were provided with an array that basically + * tells us previous blocks to which we want to stay close. + */ if (bap) - for (tmp = indx - 1; tmp >= 0; tmp--) - if (bap[tmp]) + for (tmp = indx - 1; tmp >= 0; tmp--) + if (bap[tmp]) return bap[tmp]; - /* else let's fall back to the blocknr, or, if there is none, - follow the rule that a block should be allocated near its inode - */ + /* + * Else lets fall back to the blocknr or, if there is none, follow + * the rule that a block should be allocated near its inode. + */ return blocknr ? blocknr : - (e2fs_daddr_t)(ip->i_block_group * - EXT2_BLOCKS_PER_GROUP(ip->i_e2fs)) + - ip->i_e2fs->e2fs->e2fs_first_dblock; + (e2fs_daddr_t)(ip->i_block_group * + EXT2_BLOCKS_PER_GROUP(ip->i_e2fs)) + + ip->i_e2fs->e2fs->e2fs_first_dblock; } /* @@ -591,7 +596,7 @@ ext2_blkpref(struct inode *ip, e2fs_lbn_t lbn, int indx, e2fs_daddr_t *bap, */ static u_long ext2_hashalloc(struct inode *ip, int cg, long pref, int size, - daddr_t (*allocator)(struct inode *, int, daddr_t, int)) + daddr_t (*allocator) (struct inode *, int, daddr_t, int)) { struct m_ext2fs *fs; ino_t result; @@ -655,8 +660,8 @@ ext2_alloccg(struct inode *ip, int cg, daddr_t bpref, int size) return (0); EXT2_UNLOCK(ump); error = bread(ip->i_devvp, fsbtodb(fs, - fs->e2fs_gd[cg].ext2bgd_b_bitmap), - (int)fs->e2fs_bsize, NOCRED, &bp); + fs->e2fs_gd[cg].ext2bgd_b_bitmap), + (int)fs->e2fs_bsize, NOCRED, &bp); if (error) { brelse(bp); EXT2_LOCK(ump); @@ -742,9 +747,8 @@ retry: start = 0; goto retry; } - bno = ext2_mapsearch(fs, bbp, bpref); - if (bno < 0){ + if (bno < 0) { brelse(bp); EXT2_LOCK(ump); return (0); @@ -753,7 +757,7 @@ gotit: #ifdef INVARIANTS if (isset(bbp, bno)) { printf("ext2fs_alloccgblk: cg=%d bno=%jd fs=%s\n", - cg, (intmax_t)bno, fs->e2fs_fsmnt); + cg, (intmax_t)bno, fs->e2fs_fsmnt); panic("ext2fs_alloccg: dup alloc"); } #endif @@ -813,9 +817,9 @@ ext2_clusteralloc(struct inode *ip, int cg, daddr_t bpref, int len) * to find no cluster. */ lp = &fs->e2fs_clustersum[cg].cs_sum[len - 1]; - for (i = len - 1; i > 0; i--) - if (*lp-- > 0) - break; + for (i = len - 1; i > 0; i--) + if (*lp-- > 0) + break; fs->e2fs_maxcluster[cg] = i; goto fail; } @@ -890,17 +894,18 @@ ext2_nodealloccg(struct inode *ip, int cg, daddr_t ipref, int mode) struct ext2mount *ump; int error, start, len; char *ibp, *loc; - ipref--; /* to avoid a lot of (ipref -1) */ + + ipref--; /* to avoid a lot of (ipref -1) */ if (ipref == -1) ipref = 0; fs = ip->i_e2fs; ump = ip->i_ump; if (fs->e2fs_gd[cg].ext2bgd_nifree == 0) return (0); - EXT2_UNLOCK(ump); + EXT2_UNLOCK(ump); error = bread(ip->i_devvp, fsbtodb(fs, - fs->e2fs_gd[cg].ext2bgd_i_bitmap), - (int)fs->e2fs_bsize, NOCRED, &bp); + fs->e2fs_gd[cg].ext2bgd_i_bitmap), + (int)fs->e2fs_bsize, NOCRED, &bp); if (error) { brelse(bp); EXT2_LOCK(ump); @@ -930,7 +935,7 @@ ext2_nodealloccg(struct inode *ip, int cg, daddr_t ipref, int mode) loc = memcchr(&ibp[start], 0xff, len); if (loc == NULL) { printf("cg = %d, ipref = %lld, fs = %s\n", - cg, (long long)ipref, fs->e2fs_fsmnt); + cg, (long long)ipref, fs->e2fs_fsmnt); panic("ext2fs_nodealloccg: map corrupted"); /* NOTREACHED */ } @@ -948,7 +953,7 @@ gotit: } EXT2_UNLOCK(ump); bdwrite(bp); - return (cg * fs->e2fs->e2fs_ipg + ipref +1); + return (cg * fs->e2fs->e2fs_ipg + ipref + 1); } /* @@ -974,8 +979,8 @@ ext2_blkfree(struct inode *ip, e4fs_daddr_t bno, long size) return; } error = bread(ip->i_devvp, - fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap), - (int)fs->e2fs_bsize, NOCRED, &bp); + fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap), + (int)fs->e2fs_bsize, NOCRED, &bp); if (error) { brelse(bp); return; @@ -984,7 +989,7 @@ ext2_blkfree(struct inode *ip, e4fs_daddr_t bno, long size) bno = dtogd(fs, bno); if (isclr(bbp, bno)) { printf("block = %lld, fs = %s\n", - (long long)bno, fs->e2fs_fsmnt); + (long long)bno, fs->e2fs_fsmnt); panic("ext2_blkfree: freeing free block"); } clrbit(bbp, bno); @@ -1009,7 +1014,7 @@ ext2_vfree(struct vnode *pvp, ino_t ino, int mode) struct buf *bp; struct ext2mount *ump; int error, cg; - char * ibp; + char *ibp; pip = VTOI(pvp); fs = pip->i_e2fs; @@ -1020,8 +1025,8 @@ ext2_vfree(struct vnode *pvp, ino_t ino, int mode) cg = ino_to_cg(fs, ino); error = bread(pip->i_devvp, - fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_i_bitmap), - (int)fs->e2fs_bsize, NOCRED, &bp); + fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_i_bitmap), + (int)fs->e2fs_bsize, NOCRED, &bp); if (error) { brelse(bp); return (0); @@ -1030,7 +1035,7 @@ ext2_vfree(struct vnode *pvp, ino_t ino, int mode) ino = (ino - 1) % fs->e2fs->e2fs_ipg; if (isclr(ibp, ino)) { printf("ino = %llu, fs = %s\n", - (unsigned long long)ino, fs->e2fs_fsmnt); + (unsigned long long)ino, fs->e2fs_fsmnt); if (fs->e2fs_ronly == 0) panic("ext2_vfree: freeing free inode"); } @@ -1076,7 +1081,7 @@ ext2_mapsearch(struct m_ext2fs *fs, char *bbp, daddr_t bpref) loc = memcchr(&bbp[start], 0xff, len); if (loc == NULL) { printf("start = %d, len = %d, fs = %s\n", - start, len, fs->e2fs_fsmnt); + start, len, fs->e2fs_fsmnt); panic("ext2_mapsearch: map corrupted"); /* NOTREACHED */ } @@ -1086,7 +1091,7 @@ ext2_mapsearch(struct m_ext2fs *fs, char *bbp, daddr_t bpref) /* * Fserr prints the name of a filesystem with an error diagnostic. - * + * * The form of the error message is: * fs: error message */ diff --git a/sys/fs/ext2fs/ext2_balloc.c b/sys/fs/ext2fs/ext2_balloc.c index 090298d2e31f..fcfccc2f6d53 100644 --- a/sys/fs/ext2fs/ext2_balloc.c +++ b/sys/fs/ext2fs/ext2_balloc.c @@ -76,22 +76,23 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size, struct ucred *cred, ump = ip->i_ump; /* - * check if this is a sequential block allocation. - * If so, increment next_alloc fields to allow ext2_blkpref + * check if this is a sequential block allocation. + * If so, increment next_alloc fields to allow ext2_blkpref * to make a good guess */ if (lbn == ip->i_next_alloc_block + 1) { ip->i_next_alloc_block++; ip->i_next_alloc_goal++; } - /* * The first NDADDR blocks are direct blocks */ if (lbn < NDADDR) { nb = ip->i_db[lbn]; - /* no new block is to be allocated, and no need to expand - the file */ + /* + * no new block is to be allocated, and no need to expand + * the file + */ if (nb != 0 && ip->i_size >= (lbn + 1) * fs->e2fs_bsize) { error = bread(vp, lbn, fs->e2fs_bsize, NOCRED, &bp); if (error) { @@ -116,10 +117,13 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size, struct ucred *cred, } bp->b_blkno = fsbtodb(fs, nb); } else { - /* Godmar thinks: this shouldn't happen w/o fragments */ - printf("nsize %d(%d) > osize %d(%d) nb %d\n", - (int)nsize, (int)size, (int)osize, - (int)ip->i_size, (int)nb); + /* + * Godmar thinks: this shouldn't happen w/o + * fragments + */ + printf("nsize %d(%d) > osize %d(%d) nb %d\n", + (int)nsize, (int)size, (int)osize, + (int)ip->i_size, (int)nb); panic( "ext2_balloc: Something is terribly wrong"); /* @@ -156,7 +160,7 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size, struct ucred *cred, return (error); #ifdef INVARIANTS if (num < 1) - panic ("ext2_balloc: ext2_getlbns returned indirect block"); + panic("ext2_balloc: ext2_getlbns returned indirect block"); #endif /* * Fetch the first indirect block allocating if necessary. @@ -165,10 +169,10 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size, struct ucred *cred, nb = ip->i_ib[indirs[0].in_off]; if (nb == 0) { EXT2_LOCK(ump); - pref = ext2_blkpref(ip, lbn, indirs[0].in_off + - EXT2_NDIR_BLOCKS, &ip->i_db[0], 0); + pref = ext2_blkpref(ip, lbn, indirs[0].in_off + + EXT2_NDIR_BLOCKS, &ip->i_db[0], 0); if ((error = ext2_alloc(ip, lbn, pref, fs->e2fs_bsize, cred, - &newb))) + &newb))) return (error); nb = newb; bp = getblk(vp, indirs[1].in_lbn, fs->e2fs_bsize, 0, 0, 0); @@ -207,8 +211,8 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size, struct ucred *cred, EXT2_LOCK(ump); if (pref == 0) pref = ext2_blkpref(ip, lbn, indirs[i].in_off, bap, - bp->b_lblkno); - error = ext2_alloc(ip, lbn, pref, (int)fs->e2fs_bsize, cred, &newb); + bp->b_lblkno); + error = ext2_alloc(ip, lbn, pref, (int)fs->e2fs_bsize, cred, &newb); if (error) { brelse(bp); return (error); @@ -245,8 +249,8 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size, struct ucred *cred, */ if (nb == 0) { EXT2_LOCK(ump); - pref = ext2_blkpref(ip, lbn, indirs[i].in_off, &bap[0], - bp->b_lblkno); + pref = ext2_blkpref(ip, lbn, indirs[i].in_off, &bap[0], + bp->b_lblkno); if ((error = ext2_alloc(ip, lbn, pref, (int)fs->e2fs_bsize, cred, &newb)) != 0) { brelse(bp); @@ -265,7 +269,7 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size, struct ucred *cred, if (flags & IO_SYNC) { bwrite(bp); } else { - if (bp->b_bufsize == fs->e2fs_bsize) + if (bp->b_bufsize == fs->e2fs_bsize) bp->b_flags |= B_CLUSTEROK; bdwrite(bp); } @@ -275,6 +279,7 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size, struct ucred *cred, brelse(bp); if (flags & BA_CLRBUF) { int seqcount = (flags & BA_SEQMASK) >> BA_SEQSHIFT; + if (seqcount && (vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) { error = cluster_read(vp, ip->i_size, lbn, (int)fs->e2fs_bsize, NOCRED, @@ -293,4 +298,3 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size, struct ucred *cred, *bpp = nbp; return (0); } - diff --git a/sys/fs/ext2fs/ext2_bmap.c b/sys/fs/ext2fs/ext2_bmap.c index b3e5d1482094..480f423fb3bb 100644 --- a/sys/fs/ext2fs/ext2_bmap.c +++ b/sys/fs/ext2fs/ext2_bmap.c @@ -95,7 +95,7 @@ ext4_bmapext(struct vnode *vp, int32_t bn, int64_t *bnp, int *runp, int *runb) struct inode *ip; struct m_ext2fs *fs; struct ext4_extent *ep; - struct ext4_extent_path path = { .ep_bp = NULL }; + struct ext4_extent_path path = {.ep_bp = NULL}; daddr_t lbn; int error; @@ -163,7 +163,7 @@ ext2_bmaparray(struct vnode *vp, daddr_t bn, daddr_t *bnp, int *runp, int *runb) struct buf *bp; struct ext2mount *ump; struct mount *mp; - struct indir a[NIADDR+1], *ap; + struct indir a[NIADDR + 1], *ap; daddr_t daddr; e2fs_lbn_t metalbn; int error, num, maxrun = 0, bsize; @@ -180,10 +180,8 @@ ext2_bmaparray(struct vnode *vp, daddr_t bn, daddr_t *bnp, int *runp, int *runb) maxrun = mp->mnt_iosize_max / bsize - 1; *runp = 0; } - - if (runb) { + if (runb) *runb = 0; - } ap = a; @@ -199,6 +197,7 @@ ext2_bmaparray(struct vnode *vp, daddr_t bn, daddr_t *bnp, int *runp, int *runb) *bnp = -1; } else if (runp) { daddr_t bnb = bn; + for (++bn; bn < NDADDR && *runp < maxrun && is_sequential(ump, ip->i_db[bn - 1], ip->i_db[bn]); ++bn, ++*runp); @@ -213,7 +212,6 @@ ext2_bmaparray(struct vnode *vp, daddr_t bn, daddr_t *bnp, int *runp, int *runb) return (0); } - /* Get disk address out of indirect block array */ daddr = ip->i_ib[ap->in_off]; @@ -290,7 +288,7 @@ ext2_bmaparray(struct vnode *vp, daddr_t bn, daddr_t *bnp, int *runp, int *runb) * return a request for a zeroed out buffer if attempts are made * to read a BLK_NOCOPY or BLK_SNAP block. */ - if ((ip->i_flags & SF_SNAPSHOT) && daddr > 0 && daddr < ump->um_seqinc){ + if ((ip->i_flags & SF_SNAPSHOT) && daddr > 0 && daddr < ump->um_seqinc) { *bnp = -1; return (0); } diff --git a/sys/fs/ext2fs/ext2_dir.h b/sys/fs/ext2fs/ext2_dir.h index 8d928829f70f..49b8aeb1822b 100644 --- a/sys/fs/ext2fs/ext2_dir.h +++ b/sys/fs/ext2fs/ext2_dir.h @@ -34,7 +34,7 @@ */ #define EXT2FS_MAXNAMLEN 255 -struct ext2fs_direct { +struct ext2fs_direct { uint32_t e2d_ino; /* inode number of entry */ uint16_t e2d_reclen; /* length of this record */ uint16_t e2d_namlen; /* length of string in e2d_name */ @@ -49,10 +49,10 @@ enum slotstatus { struct ext2fs_searchslot { enum slotstatus slotstatus; - doff_t slotoffset; /* offset of area with free space */ - int slotsize; /* size of area at slotoffset */ - int slotfreespace; /* amount of space free in slot */ - int slotneeded; /* sizeof the entry we are seeking */ + doff_t slotoffset; /* offset of area with free space */ + int slotsize; /* size of area at slotoffset */ + int slotfreespace; /* amount of space free in slot */ + int slotneeded; /* sizeof the entry we are seeking */ }; /* @@ -61,12 +61,13 @@ struct ext2fs_searchslot { * bigger than 255 chars, it's safe to reclaim the extra byte for the * file_type field. */ -struct ext2fs_direct_2 { +struct ext2fs_direct_2 { uint32_t e2d_ino; /* inode number of entry */ uint16_t e2d_reclen; /* length of this record */ - uint8_t e2d_namlen; /* length of string in e2d_name */ - uint8_t e2d_type; /* file type */ - char e2d_name[EXT2FS_MAXNAMLEN];/* name with length<=EXT2FS_MAXNAMLEN */ + uint8_t e2d_namlen; /* length of string in e2d_name */ + uint8_t e2d_type; /* file type */ + char e2d_name[EXT2FS_MAXNAMLEN]; /* name with + * length<=EXT2FS_MAXNAMLEN */ }; /* @@ -97,5 +98,4 @@ struct ext2fs_direct_2 { #define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1) #define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \ ~EXT2_DIR_ROUND) -#endif /* !_FS_EXT2FS_EXT2_DIR_H_ */ - +#endif /* !_FS_EXT2FS_EXT2_DIR_H_ */ diff --git a/sys/fs/ext2fs/ext2_extents.c b/sys/fs/ext2fs/ext2_extents.c index a66f682788be..14ed4a65c520 100644 --- a/sys/fs/ext2fs/ext2_extents.c +++ b/sys/fs/ext2fs/ext2_extents.c @@ -45,8 +45,7 @@ static bool ext4_ext_binsearch_index(struct inode *ip, struct ext4_extent_path *path, - daddr_t lbn, daddr_t *first_lbn, daddr_t *last_lbn) -{ + daddr_t lbn, daddr_t *first_lbn, daddr_t *last_lbn){ struct ext4_extent_header *ehp = path->ep_header; struct ext4_extent_index *first, *last, *l, *r, *m; @@ -79,7 +78,7 @@ ext4_ext_binsearch_index(struct inode *ip, struct ext4_extent_path *path, static void ext4_ext_binsearch(struct inode *ip, struct ext4_extent_path *path, daddr_t lbn, - daddr_t first_lbn, daddr_t last_lbn) + daddr_t first_lbn, daddr_t last_lbn) { struct ext4_extent_header *ehp = path->ep_header; struct ext4_extent *first, *l, *r, *m; @@ -167,7 +166,7 @@ ext4_ext_put_cache(struct inode *ip, struct ext4_extent *ep, int type) */ struct ext4_extent_path * ext4_ext_find_extent(struct m_ext2fs *fs, struct inode *ip, - daddr_t lbn, struct ext4_extent_path *path) + daddr_t lbn, struct ext4_extent_path *path) { struct ext4_extent_header *ehp; uint16_t i; @@ -200,7 +199,7 @@ ext4_ext_find_extent(struct m_ext2fs *fs, struct inode *ip, path->ep_bp = NULL; } error = bread(ip->i_devvp, fsbtodb(fs, nblk), size, NOCRED, - &path->ep_bp); + &path->ep_bp); if (error) { brelse(path->ep_bp); path->ep_bp = NULL; diff --git a/sys/fs/ext2fs/ext2_extents.h b/sys/fs/ext2fs/ext2_extents.h index b6a7fc2d79cb..91cb0d32346c 100644 --- a/sys/fs/ext2fs/ext2_extents.h +++ b/sys/fs/ext2fs/ext2_extents.h @@ -40,10 +40,10 @@ * Ext4 file system extent on disk. */ struct ext4_extent { - uint32_t e_blk; /* first logical block */ - uint16_t e_len; /* number of blocks */ - uint16_t e_start_hi; /* high 16 bits of physical block */ - uint32_t e_start_lo; /* low 32 bits of physical block */ + uint32_t e_blk; /* first logical block */ + uint16_t e_len; /* number of blocks */ + uint16_t e_start_hi; /* high 16 bits of physical block */ + uint32_t e_start_lo; /* low 32 bits of physical block */ }; /* @@ -61,19 +61,19 @@ struct ext4_extent_index { * Extent tree header. */ struct ext4_extent_header { - uint16_t eh_magic; /* magic number: 0xf30a */ - uint16_t eh_ecount; /* number of valid entries */ - uint16_t eh_max; /* capacity of store in entries */ - uint16_t eh_depth; /* the depth of extent tree */ - uint32_t eh_gen; /* generation of extent tree */ + uint16_t eh_magic; /* magic number: 0xf30a */ + uint16_t eh_ecount; /* number of valid entries */ + uint16_t eh_max; /* capacity of store in entries */ + uint16_t eh_depth; /* the depth of extent tree */ + uint32_t eh_gen; /* generation of extent tree */ }; /* * Save cached extent. */ struct ext4_extent_cache { - daddr_t ec_start; /* extent start */ - uint32_t ec_blk; /* logical block */ + daddr_t ec_start; /* extent start */ + uint32_t ec_blk; /* logical block */ uint32_t ec_len; uint32_t ec_type; }; @@ -84,7 +84,7 @@ struct ext4_extent_cache { struct ext4_extent_path { uint16_t ep_depth; struct buf *ep_bp; - bool ep_is_sparse; + bool ep_is_sparse; union { struct ext4_extent ep_sparse_ext; struct ext4_extent *ep_ext; @@ -97,7 +97,8 @@ struct inode; struct m_ext2fs; int ext4_ext_in_cache(struct inode *, daddr_t, struct ext4_extent *); void ext4_ext_put_cache(struct inode *, struct ext4_extent *, int); -struct ext4_extent_path *ext4_ext_find_extent(struct m_ext2fs *fs, +struct ext4_extent_path * +ext4_ext_find_extent(struct m_ext2fs *fs, struct inode *, daddr_t, struct ext4_extent_path *); -#endif /* !_FS_EXT2FS_EXT2_EXTENTS_H_ */ +#endif /* !_FS_EXT2FS_EXT2_EXTENTS_H_ */ diff --git a/sys/fs/ext2fs/ext2_extern.h b/sys/fs/ext2fs/ext2_extern.h index bffcb38b9969..3f4654f77e7e 100644 --- a/sys/fs/ext2fs/ext2_extern.h +++ b/sys/fs/ext2fs/ext2_extern.h @@ -110,4 +110,4 @@ int ext2_search_dirblock(struct inode *, void *, int *, const char *, int, extern struct vop_vector ext2_vnodeops; extern struct vop_vector ext2_fifoops; -#endif /* !_FS_EXT2FS_EXT2_EXTERN_H_ */ +#endif /* !_FS_EXT2FS_EXT2_EXTERN_H_ */ diff --git a/sys/fs/ext2fs/ext2_hash.c b/sys/fs/ext2fs/ext2_hash.c index 663a2dfc5698..d10c09d02ffa 100644 --- a/sys/fs/ext2fs/ext2_hash.c +++ b/sys/fs/ext2fs/ext2_hash.c @@ -192,7 +192,7 @@ ext2_legacy_hash(const char *name, int len, int unsigned_char) static void ext2_prep_hashbuf(const char *src, int slen, uint32_t *dst, int dlen, - int unsigned_char) + int unsigned_char) { uint32_t padding = slen | (slen << 8) | (slen << 16) | (slen << 24); uint32_t buf_val; @@ -240,8 +240,8 @@ ext2_prep_hashbuf(const char *src, int slen, uint32_t *dst, int dlen, int ext2_htree_hash(const char *name, int len, - uint32_t *hash_seed, int hash_version, - uint32_t *hash_major, uint32_t *hash_minor) + uint32_t *hash_seed, int hash_version, + uint32_t *hash_major, uint32_t *hash_minor) { uint32_t hash[4]; uint32_t data[8]; diff --git a/sys/fs/ext2fs/ext2_htree.c b/sys/fs/ext2fs/ext2_htree.c index 6505e051834e..6d74070853b1 100644 --- a/sys/fs/ext2fs/ext2_htree.c +++ b/sys/fs/ext2fs/ext2_htree.c @@ -98,7 +98,7 @@ ext2_htree_has_idx(struct inode *ip) static int ext2_htree_check_next(struct inode *ip, uint32_t hash, const char *name, - struct ext2fs_htree_lookup_info *info) + struct ext2fs_htree_lookup_info *info) { struct vnode *vp = ITOV(ip); struct ext2fs_htree_lookup_level *level; @@ -195,6 +195,7 @@ ext2_htree_release(struct ext2fs_htree_lookup_info *info) for (i = 0; i < info->h_levels_num; i++) { struct buf *bp = info->h_levels[i].h_bp; + if (bp != NULL) brelse(bp); } @@ -224,8 +225,8 @@ ext2_htree_node_limit(struct inode *ip) static int ext2_htree_find_leaf(struct inode *ip, const char *name, int namelen, - uint32_t *hash, uint8_t *hash_ver, - struct ext2fs_htree_lookup_info *info) + uint32_t *hash, uint8_t *hash_ver, + struct ext2fs_htree_lookup_info *info) { struct vnode *vp; struct ext2fs *fs; @@ -317,9 +318,9 @@ error: */ int ext2_htree_lookup(struct inode *ip, const char *name, int namelen, - struct buf **bpp, int *entryoffp, doff_t *offp, - doff_t *prevoffp, doff_t *endusefulp, - struct ext2fs_searchslot *ss) + struct buf **bpp, int *entryoffp, doff_t *offp, + doff_t *prevoffp, doff_t *endusefulp, + struct ext2fs_searchslot *ss) { struct vnode *vp; struct ext2fs_htree_lookup_info info; @@ -386,7 +387,7 @@ ext2_htree_lookup(struct inode *ip, const char *name, int namelen, static int ext2_htree_append_block(struct vnode *vp, char *data, - struct componentname *cnp, uint32_t blksize) + struct componentname *cnp, uint32_t blksize) { struct iovec aiov; struct uio auio; @@ -419,6 +420,7 @@ ext2_htree_writebuf(struct ext2fs_htree_lookup_info *info) for (i = 0; i < info->h_levels_num; i++) { struct buf *bp = info->h_levels[i].h_bp; + error = bwrite(bp); if (error) return (error); @@ -429,7 +431,7 @@ ext2_htree_writebuf(struct ext2fs_htree_lookup_info *info) static void ext2_htree_insert_entry_to_level(struct ext2fs_htree_lookup_level *level, - uint32_t hash, uint32_t blk) + uint32_t hash, uint32_t blk) { struct ext2fs_htree_entry *target; int entries_num; @@ -449,7 +451,7 @@ ext2_htree_insert_entry_to_level(struct ext2fs_htree_lookup_level *level, */ static void ext2_htree_insert_entry(struct ext2fs_htree_lookup_info *info, - uint32_t hash, uint32_t blk) + uint32_t hash, uint32_t blk) { struct ext2fs_htree_lookup_level *level; @@ -481,8 +483,8 @@ ext2_htree_cmp_sort_entry(const void *e1, const void *e2) */ static void ext2_append_entry(char *block, uint32_t blksize, - struct ext2fs_direct_2 *last_entry, - struct ext2fs_direct_2 *new_entry) + struct ext2fs_direct_2 *last_entry, + struct ext2fs_direct_2 *new_entry) { uint16_t entry_len; @@ -498,8 +500,8 @@ ext2_append_entry(char *block, uint32_t blksize, */ static int ext2_htree_split_dirblock(char *block1, char *block2, uint32_t blksize, - uint32_t *hash_seed, uint8_t hash_version, - uint32_t *split_hash, struct ext2fs_direct_2 *entry) + uint32_t *hash_seed, uint8_t hash_version, + uint32_t *split_hash, struct ext2fs_direct_2 *entry) { int entry_cnt = 0; int size = 0; @@ -585,7 +587,7 @@ ext2_htree_split_dirblock(char *block1, char *block2, uint32_t blksize, offset += ep->e2d_reclen; if (ep->e2d_ino) { last = (struct ext2fs_direct_2 *) - ((char *)last + entry_len); + ((char *)last + entry_len); entry_len = EXT2_DIR_REC_LEN(ep->e2d_namlen); memcpy((void *)last, (void *)ep, entry_len); last->e2d_reclen = entry_len; @@ -616,7 +618,7 @@ ext2_htree_split_dirblock(char *block1, char *block2, uint32_t blksize, */ int ext2_htree_create_index(struct vnode *vp, struct componentname *cnp, - struct ext2fs_direct_2 *new_entry) + struct ext2fs_direct_2 *new_entry) { struct buf *bp = NULL; struct inode *dp; @@ -721,7 +723,7 @@ out1: */ int ext2_htree_add_entry(struct vnode *dvp, struct ext2fs_direct_2 *entry, - struct componentname *cnp) + struct componentname *cnp) { struct ext2fs_htree_entry *entries, *leaf_node; struct ext2fs_htree_lookup_info info; @@ -747,7 +749,7 @@ ext2_htree_add_entry(struct vnode *dvp, struct ext2fs_direct_2 *entry, fs = m_fs->e2fs; blksize = m_fs->e2fs_bsize; - if (ip->i_count != 0) + if (ip->i_count != 0) return ext2_add_entry(dvp, entry); /* Target directory block is full, split it */ @@ -807,6 +809,7 @@ ext2_htree_add_entry(struct vnode *dvp, struct ext2fs_direct_2 *entry, if (info.h_levels[1].h_entry >= entries + src_ent_num) { struct buf *tmp = info.h_levels[1].h_bp; + info.h_levels[1].h_bp = dst_bp; dst_bp = tmp; diff --git a/sys/fs/ext2fs/ext2_inode.c b/sys/fs/ext2fs/ext2_inode.c index 4e79301024e8..914dab97cd3b 100644 --- a/sys/fs/ext2fs/ext2_inode.c +++ b/sys/fs/ext2fs/ext2_inode.c @@ -81,11 +81,11 @@ ext2_update(struct vnode *vp, int waitfor) return (0); ip->i_flag &= ~(IN_LAZYACCESS | IN_LAZYMOD | IN_MODIFIED); fs = ip->i_e2fs; - if(fs->e2fs_ronly) + if (fs->e2fs_ronly) return (0); if ((error = bread(ip->i_devvp, fsbtodb(fs, ino_to_fsba(fs, ip->i_number)), - (int)fs->e2fs_bsize, NOCRED, &bp)) != 0) { + (int)fs->e2fs_bsize, NOCRED, &bp)) != 0) { brelse(bp); return (error); } @@ -130,10 +130,10 @@ ext2_truncate(struct vnode *vp, off_t length, int flags, struct ucred *cred, bo = &ovp->v_bufobj; #endif - ASSERT_VOP_LOCKED(vp, "ext2_truncate"); + ASSERT_VOP_LOCKED(vp, "ext2_truncate"); if (length < 0) - return (EINVAL); + return (EINVAL); if (ovp->v_type == VLNK && oip->i_size < ovp->v_mount->mnt_maxsymlinklen) { @@ -345,7 +345,7 @@ done: bo->bo_clean.bv_cnt != 0)) panic("itrunc3"); BO_UNLOCK(bo); -#endif /* INVARIANTS */ +#endif /* INVARIANTS */ /* * Put back the real size. */ @@ -418,12 +418,11 @@ ext2_indirtrunc(struct inode *ip, daddr_t lbn, daddr_t dbn, *countp = 0; return (error); } - bap = (e2fs_daddr_t *)bp->b_data; copy = malloc(fs->e2fs_bsize, M_TEMP, M_WAITOK); bcopy((caddr_t)bap, (caddr_t)copy, (u_int)fs->e2fs_bsize); bzero((caddr_t)&bap[last + 1], - (NINDIR(fs) - (last + 1)) * sizeof(e2fs_daddr_t)); + (NINDIR(fs) - (last + 1)) * sizeof(e2fs_daddr_t)); if (last == -1) bp->b_flags |= B_INVAL; if (DOINGASYNC(vp)) { diff --git a/sys/fs/ext2fs/ext2_inode_cnv.c b/sys/fs/ext2fs/ext2_inode_cnv.c index d62e9ba0a92e..4ae6b37fc21d 100644 --- a/sys/fs/ext2fs/ext2_inode_cnv.c +++ b/sys/fs/ext2fs/ext2_inode_cnv.c @@ -49,17 +49,17 @@ ext2_print_inode(struct inode *in) struct ext4_extent_header *ehp; struct ext4_extent *ep; - printf( "Inode: %5ju", (uintmax_t)in->i_number); - printf( /* "Inode: %5d" */ - " Type: %10s Mode: 0x%o Flags: 0x%x Version: %d\n", - "n/a", in->i_mode, in->i_flags, in->i_gen); + printf("Inode: %5ju", (uintmax_t)in->i_number); + printf( /* "Inode: %5d" */ + " Type: %10s Mode: 0x%o Flags: 0x%x Version: %d\n", + "n/a", in->i_mode, in->i_flags, in->i_gen); printf("User: %5u Group: %5u Size: %ju\n", in->i_uid, in->i_gid, (uintmax_t)in->i_size); printf("Links: %3d Blockcount: %ju\n", in->i_nlink, (uintmax_t)in->i_blocks); - printf( "ctime: 0x%x", in->i_ctime); - printf( "atime: 0x%x", in->i_atime); - printf( "mtime: 0x%x", in->i_mtime); + printf("ctime: 0x%x", in->i_ctime); + printf("atime: 0x%x", in->i_atime); + printf("mtime: 0x%x", in->i_mtime); if (E2DI_HAS_XTIME(in)) printf("crtime %#x ", in->i_birthtime); printf("BLOCKS:"); @@ -87,11 +87,12 @@ ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip) int i; ip->i_nlink = ei->e2di_nlink; - /* Godmar thinks - if the link count is zero, then the inode is - unused - according to ext2 standards. Ufs marks this fact - by setting i_mode to zero - why ? - I can see that this might lead to problems in an undelete. - */ + /* + * Godmar thinks - if the link count is zero, then the inode is + * unused - according to ext2 standards. Ufs marks this fact by + * setting i_mode to zero - why ? I can see that this might lead to + * problems in an undelete. + */ ip->i_mode = ei->e2di_nlink ? ei->e2di_mode : 0; ip->i_size = ei->e2di_size; if (S_ISREG(ip->i_mode)) @@ -116,15 +117,15 @@ ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip) if (E2DI_HAS_HUGE_FILE(ip)) { ip->i_blocks |= (uint64_t)ei->e2di_nblock_high << 32; if (ei->e2di_flags & EXT4_HUGE_FILE) - ip->i_blocks = fsbtodb(ip->i_e2fs, ip->i_blocks); + ip->i_blocks = fsbtodb(ip->i_e2fs, ip->i_blocks); } ip->i_gen = ei->e2di_gen; ip->i_uid = ei->e2di_uid; ip->i_gid = ei->e2di_gid; /* XXX use memcpy */ - for(i = 0; i < NDADDR; i++) + for (i = 0; i < NDADDR; i++) ip->i_db[i] = ei->e2di_blocks[i]; - for(i = 0; i < NIADDR; i++) + for (i = 0; i < NIADDR; i++) ip->i_ib[i] = ei->e2di_blocks[EXT2_NDIR_BLOCKS + i]; } @@ -138,9 +139,9 @@ ext2_i2ei(struct inode *ip, struct ext2fs_dinode *ei) ei->e2di_mode = ip->i_mode; ei->e2di_nlink = ip->i_nlink; - /* - Godmar thinks: if dtime is nonzero, ext2 says this inode - has been deleted, this would correspond to a zero link count + /* + * Godmar thinks: if dtime is nonzero, ext2 says this inode has been + * deleted, this would correspond to a zero link count */ ei->e2di_dtime = ei->e2di_nlink ? 0 : ip->i_mtime; ei->e2di_size = ip->i_size; @@ -157,19 +158,19 @@ ext2_i2ei(struct inode *ip, struct ext2fs_dinode *ei) ei->e2di_crtime_extra = NSEC_TO_XTIME(ip->i_birthnsec); } ei->e2di_flags = 0; - ei->e2di_flags |= (ip->i_flags & SF_APPEND) ? EXT2_APPEND: 0; - ei->e2di_flags |= (ip->i_flags & SF_IMMUTABLE) ? EXT2_IMMUTABLE: 0; - ei->e2di_flags |= (ip->i_flags & UF_NODUMP) ? EXT2_NODUMP: 0; - ei->e2di_flags |= (ip->i_flag & IN_E3INDEX) ? EXT3_INDEX: 0; - ei->e2di_flags |= (ip->i_flag & IN_E4EXTENTS) ? EXT4_EXTENTS: 0; + ei->e2di_flags |= (ip->i_flags & SF_APPEND) ? EXT2_APPEND : 0; + ei->e2di_flags |= (ip->i_flags & SF_IMMUTABLE) ? EXT2_IMMUTABLE : 0; + ei->e2di_flags |= (ip->i_flags & UF_NODUMP) ? EXT2_NODUMP : 0; + ei->e2di_flags |= (ip->i_flag & IN_E3INDEX) ? EXT3_INDEX : 0; + ei->e2di_flags |= (ip->i_flag & IN_E4EXTENTS) ? EXT4_EXTENTS : 0; ei->e2di_nblock = ip->i_blocks & 0xffffffff; ei->e2di_nblock_high = ip->i_blocks >> 32 & 0xffff; ei->e2di_gen = ip->i_gen; ei->e2di_uid = ip->i_uid; ei->e2di_gid = ip->i_gid; /* XXX use memcpy */ - for(i = 0; i < NDADDR; i++) + for (i = 0; i < NDADDR; i++) ei->e2di_blocks[i] = ip->i_db[i]; - for(i = 0; i < NIADDR; i++) + for (i = 0; i < NIADDR; i++) ei->e2di_blocks[EXT2_NDIR_BLOCKS + i] = ip->i_ib[i]; } diff --git a/sys/fs/ext2fs/ext2_lookup.c b/sys/fs/ext2fs/ext2_lookup.c index 5ad1e09d462e..435c1127555b 100644 --- a/sys/fs/ext2fs/ext2_lookup.c +++ b/sys/fs/ext2fs/ext2_lookup.c @@ -238,7 +238,7 @@ ext2_readdir(struct vop_readdir_args *ap) nextentry: offset += dp->e2d_reclen; dp = (struct ext2fs_direct_2 *)((caddr_t)dp + - dp->e2d_reclen); + dp->e2d_reclen); } bqrelse(bp); uio->uio_offset = offset; @@ -324,7 +324,7 @@ ext2_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp int ltype; int entry_found = 0; - int DIRBLKSIZ = VTOI(vdp)->i_e2fs->e2fs_bsize; + int DIRBLKSIZ = VTOI(vdp)->i_e2fs->e2fs_bsize; if (vpp != NULL) *vpp = NULL; @@ -350,11 +350,11 @@ restart: (flags & ISLASTCN)) { ss.slotstatus = NONE; ss.slotneeded = EXT2_DIR_REC_LEN(cnp->cn_namelen); - /* was - ss.slotneeded = (sizeof(struct direct) - MAXNAMLEN + - cnp->cn_namelen + 3) &~ 3; */ + /* + * was ss.slotneeded = (sizeof(struct direct) - MAXNAMLEN + + * cnp->cn_namelen + 3) &~ 3; + */ } - /* * Try to lookup dir entry using htree directory index. * @@ -365,11 +365,11 @@ restart: numdirpasses = 1; entryoffsetinblock = 0; switch (ext2_htree_lookup(dp, cnp->cn_nameptr, cnp->cn_namelen, - &bp, &entryoffsetinblock, &i_offset, &prevoff, - &enduseful, &ss)) { + &bp, &entryoffsetinblock, &i_offset, &prevoff, + &enduseful, &ss)) { case 0: ep = (struct ext2fs_direct_2 *)((char *)bp->b_data + - (i_offset & bmask)); + (i_offset & bmask)); goto foundentry; case ENOENT: i_offset = roundup2(dp->i_size, DIRBLKSIZ); @@ -433,16 +433,16 @@ searchloop: ss.slotfreespace = 0; } error = ext2_search_dirblock(dp, bp->b_data, &entry_found, - cnp->cn_nameptr, cnp->cn_namelen, - &entryoffsetinblock, &i_offset, &prevoff, - &enduseful, &ss); + cnp->cn_nameptr, cnp->cn_namelen, + &entryoffsetinblock, &i_offset, &prevoff, + &enduseful, &ss); if (error != 0) { brelse(bp); return (error); } if (entry_found) { ep = (struct ext2fs_direct_2 *)((char *)bp->b_data + - (entryoffsetinblock & bmask)); + (entryoffsetinblock & bmask)); foundentry: ino = ep->e2d_ino; goto found; @@ -527,9 +527,9 @@ found: * of this entry. */ if (entryoffsetinblock + EXT2_DIR_REC_LEN(ep->e2d_namlen) - > dp->i_size) { + > dp->i_size) { ext2_dirbad(dp, i_offset, "i_size too small"); - dp->i_size = entryoffsetinblock+EXT2_DIR_REC_LEN(ep->e2d_namlen); + dp->i_size = entryoffsetinblock + EXT2_DIR_REC_LEN(ep->e2d_namlen); dp->i_flag |= IN_CHANGE | IN_UPDATE; } brelse(bp); @@ -678,7 +678,7 @@ found: if (ltype != VOP_ISLOCKED(vdp)) { if (ltype == LK_EXCLUSIVE) vn_lock(vdp, LK_UPGRADE | LK_RETRY); - else /* if (ltype == LK_SHARED) */ + else /* if (ltype == LK_SHARED) */ vn_lock(vdp, LK_DOWNGRADE | LK_RETRY); } *vpp = vdp; @@ -699,9 +699,9 @@ found: int ext2_search_dirblock(struct inode *ip, void *data, int *foundp, - const char *name, int namelen, int *entryoffsetinblockp, - doff_t *offp, doff_t *prevoffp, doff_t *endusefulp, - struct ext2fs_searchslot *ssp) + const char *name, int namelen, int *entryoffsetinblockp, + doff_t *offp, doff_t *prevoffp, doff_t *endusefulp, + struct ext2fs_searchslot *ssp) { struct vnode *vdp; struct ext2fs_direct_2 *ep, *top; @@ -713,7 +713,7 @@ ext2_search_dirblock(struct inode *ip, void *data, int *foundp, ep = (struct ext2fs_direct_2 *)((char *)data + offset); top = (struct ext2fs_direct_2 *)((char *)data + - bsize - EXT2_DIR_REC_LEN(0)); + bsize - EXT2_DIR_REC_LEN(0)); while (ep < top) { /* @@ -725,6 +725,7 @@ ext2_search_dirblock(struct inode *ip, void *data, int *foundp, if (ep->e2d_reclen == 0 || (dirchk && ext2_dirbadentry(vdp, ep, offset))) { int i; + ext2_dirbad(ip, *offp, "mangled entry"); i = bsize - (offset & (bsize - 1)); *offp += i; @@ -755,13 +756,12 @@ ext2_search_dirblock(struct inode *ip, void *data, int *foundp, if (ssp->slotfreespace >= ssp->slotneeded) { ssp->slotstatus = COMPACT; ssp->slotsize = *offp + - ep->e2d_reclen - - ssp->slotoffset; + ep->e2d_reclen - + ssp->slotoffset; } } } } - /* * Check for a name match. */ @@ -825,9 +825,9 @@ static int ext2_dirbadentry(struct vnode *dp, struct ext2fs_direct_2 *de, int entryoffsetinblock) { - int DIRBLKSIZ = VTOI(dp)->i_e2fs->e2fs_bsize; + int DIRBLKSIZ = VTOI(dp)->i_e2fs->e2fs_bsize; - char * error_msg = NULL; + char *error_msg = NULL; if (de->e2d_reclen < EXT2_DIR_REC_LEN(1)) error_msg = "rec_len is smaller than minimal"; @@ -1201,9 +1201,9 @@ ext2_checkpath(struct inode *source, struct inode *target, struct ucred *cred) break; } error = vn_rdwr(UIO_READ, vp, (caddr_t)&dirbuf, - sizeof(struct dirtemplate), (off_t)0, UIO_SYSSPACE, - IO_NODELOCKED | IO_NOMACCHECK, cred, NOCRED, NULL, - NULL); + sizeof(struct dirtemplate), (off_t)0, UIO_SYSSPACE, + IO_NODELOCKED | IO_NOMACCHECK, cred, NOCRED, NULL, + NULL); if (error != 0) break; namlen = dirbuf.dotdot_type; /* like ufs little-endian */ diff --git a/sys/fs/ext2fs/ext2_mount.h b/sys/fs/ext2fs/ext2_mount.h index 83c98e542177..598f3a40bd75 100644 --- a/sys/fs/ext2fs/ext2_mount.h +++ b/sys/fs/ext2fs/ext2_mount.h @@ -73,6 +73,6 @@ struct ext2mount { #define MNINDIR(ump) ((ump)->um_nindir) #define blkptrtodb(ump, b) ((b) << (ump)->um_bptrtodb) #define is_sequential(ump, a, b) ((b) == (a) + ump->um_seqinc) -#endif /* _KERNEL */ +#endif /* _KERNEL */ #endif /* !_FS_EXT2FS_EXT2_MOUNT_H_ */ diff --git a/sys/fs/ext2fs/ext2_subr.c b/sys/fs/ext2fs/ext2_subr.c index f35b9521f3ae..a481b9985b8f 100644 --- a/sys/fs/ext2fs/ext2_subr.c +++ b/sys/fs/ext2fs/ext2_subr.c @@ -141,6 +141,7 @@ ext2_clusteracct(struct m_ext2fs *fs, char *bbp, int cg, daddr_t bno, int cnt) /* Initialize the cluster summary array. */ if (fs->e2fs_clustersum[cg].cs_init == 0) { int run = 0; + bit = 1; loc = 0; diff --git a/sys/fs/ext2fs/ext2_vfsops.c b/sys/fs/ext2fs/ext2_vfsops.c index 809ab3ce18c8..2a77b4367c32 100644 --- a/sys/fs/ext2fs/ext2_vfsops.c +++ b/sys/fs/ext2fs/ext2_vfsops.c @@ -141,7 +141,7 @@ ext2_mount(struct mount *mp) */ if (mp->mnt_flag & MNT_UPDATE) { ump = VFSTOEXT2(mp); - fs = ump->um_e2fs; + fs = ump->um_e2fs; error = 0; if (fs->e2fs_ronly == 0 && vfs_flagopt(opts, "ro", NULL, 0)) { @@ -152,7 +152,7 @@ ext2_mount(struct mount *mp) if (mp->mnt_flag & MNT_FORCE) flags |= FORCECLOSE; error = ext2_flushfiles(mp, flags, td); - if ( error == 0 && fs->e2fs_wasvalid && ext2_cgupdate(ump, MNT_WAIT) == 0) { + if (error == 0 && fs->e2fs_wasvalid && ext2_cgupdate(ump, MNT_WAIT) == 0) { fs->e2fs->e2fs_state |= E2FS_ISCLEAN; ext2_sbupdate(ump, MNT_WAIT); } @@ -328,7 +328,7 @@ compute_sb_data(struct vnode *devvp, struct ext2fs *es, fs->e2fs_fpg = es->e2fs_fpg; fs->e2fs_ipg = es->e2fs_ipg; if (es->e2fs_rev == E2FS_REV0) { - fs->e2fs_isize = E2FS_REV0_INODE_SIZE ; + fs->e2fs_isize = E2FS_REV0_INODE_SIZE; } else { fs->e2fs_isize = es->e2fs_inode_size; @@ -368,12 +368,12 @@ compute_sb_data(struct vnode *devvp, struct ext2fs *es, * Godmar thinks: if the blocksize is greater than 1024, then * the superblock is logically part of block zero. */ - if(fs->e2fs_bsize > SBSIZE) + if (fs->e2fs_bsize > SBSIZE) logic_sb_block = 0; for (i = 0; i < db_count; i++) { - error = bread(devvp , - fsbtodb(fs, logic_sb_block + i + 1 ), - fs->e2fs_bsize, NOCRED, &bp); + error = bread(devvp, + fsbtodb(fs, logic_sb_block + i + 1), + fs->e2fs_bsize, NOCRED, &bp); if (error) { free(fs->e2fs_contigdirs, M_EXT2MNT); free(fs->e2fs_gd, M_EXT2MNT); @@ -382,7 +382,7 @@ compute_sb_data(struct vnode *devvp, struct ext2fs *es, } e2fs_cgload((struct ext2_gd *)bp->b_data, &fs->e2fs_gd[ - i * fs->e2fs_bsize / sizeof(struct ext2_gd)], + i * fs->e2fs_bsize / sizeof(struct ext2_gd)], fs->e2fs_bsize); brelse(bp); bp = NULL; @@ -465,7 +465,7 @@ ext2_reload(struct mount *mp, struct thread *td) fs = VFSTOEXT2(mp)->um_e2fs; bcopy(bp->b_data, fs->e2fs, sizeof(struct ext2fs)); - if((error = compute_sb_data(devvp, es, fs)) != 0) { + if ((error = compute_sb_data(devvp, es, fs)) != 0) { brelse(bp); return (error); } @@ -512,7 +512,7 @@ loop: MNT_VNODE_FOREACH_ALL_ABORT(mp, mvp); return (error); } - ext2_ei2i((struct ext2fs_dinode *) ((char *)bp->b_data + + ext2_ei2i((struct ext2fs_dinode *)((char *)bp->b_data + EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)), ip); brelse(bp); VOP_UNLOCK(vp, 0); @@ -597,9 +597,9 @@ ext2_mountfs(struct vnode *devvp, struct mount *mp) * while Linux keeps the super block in a locked buffer. */ ump->um_e2fs = malloc(sizeof(struct m_ext2fs), - M_EXT2MNT, M_WAITOK | M_ZERO); + M_EXT2MNT, M_WAITOK | M_ZERO); ump->um_e2fs->e2fs = malloc(sizeof(struct ext2fs), - M_EXT2MNT, M_WAITOK); + M_EXT2MNT, M_WAITOK); mtx_init(EXT2_MTX(ump), "EXT2FS", "EXT2FS Lock", MTX_DEF); bcopy(es, ump->um_e2fs->e2fs, (u_int)sizeof(struct ext2fs)); if ((error = compute_sb_data(devvp, ump->um_e2fs->e2fs, ump->um_e2fs))) @@ -607,8 +607,8 @@ ext2_mountfs(struct vnode *devvp, struct mount *mp) /* * Calculate the maximum contiguous blocks and size of cluster summary - * array. In FFS this is done by newfs; however, the superblock - * in ext2fs doesn't have these variables, so we can calculate + * array. In FFS this is done by newfs; however, the superblock + * in ext2fs doesn't have these variables, so we can calculate * them here. */ e2fs_maxcontig = MAX(1, MAXPHYS / ump->um_e2fs->e2fs_bsize); @@ -639,7 +639,7 @@ ext2_mountfs(struct vnode *devvp, struct mount *mp) */ fs->e2fs_wasvalid = fs->e2fs->e2fs_state & E2FS_ISCLEAN ? 1 : 0; if (ronly == 0) { - fs->e2fs_fmod = 1; /* mark it modified */ + fs->e2fs_fmod = 1; /* mark it modified */ fs->e2fs->e2fs_state &= ~E2FS_ISCLEAN; /* set fs invalid */ } mp->mnt_data = ump; @@ -752,6 +752,7 @@ ext2_flushfiles(struct mount *mp, int flags, struct thread *td) error = vflush(mp, 0, flags, td); return (error); } + /* * Get filesystem statistics. */ @@ -914,7 +915,7 @@ ext2_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp) vp->v_data = ip; ip->i_vnode = vp; ip->i_e2fs = fs = ump->um_e2fs; - ip->i_ump = ump; + ip->i_ump = ump; ip->i_number = ino; lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL); @@ -943,8 +944,8 @@ ext2_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp) return (error); } /* convert ext2 inode to dinode */ - ext2_ei2i((struct ext2fs_dinode *) ((char *)bp->b_data + EXT2_INODE_SIZE(fs) * - ino_to_fsbo(fs, ino)), ip); + ext2_ei2i((struct ext2fs_dinode *)((char *)bp->b_data + EXT2_INODE_SIZE(fs) * + ino_to_fsbo(fs, ino)), ip); ip->i_block_group = ino_to_cg(fs, ino); ip->i_next_alloc_block = 0; ip->i_next_alloc_goal = 0; @@ -1078,6 +1079,7 @@ ext2_cgupdate(struct ext2mount *mp, int waitfor) allerror = error; return (allerror); } + /* * Return the root of a filesystem. */ diff --git a/sys/fs/ext2fs/ext2_vnops.c b/sys/fs/ext2fs/ext2_vnops.c index 41c09d590f25..74ab4f053eb9 100644 --- a/sys/fs/ext2fs/ext2_vnops.c +++ b/sys/fs/ext2fs/ext2_vnops.c @@ -192,7 +192,7 @@ ext2_itimes_locked(struct vnode *vp) struct inode *ip; struct timespec ts; - ASSERT_VI_LOCKED(vp, __func__); + ASSERT_VI_LOCKED(vp, __func__); ip = VTOI(vp); if ((ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE)) == 0) @@ -383,7 +383,7 @@ ext2_setattr(struct vop_setattr_args *ap) } if (vap->va_flags != VNOVAL) { /* Disallow flags not supported by ext2fs. */ - if(vap->va_flags & ~(SF_APPEND | SF_IMMUTABLE | UF_NODUMP)) + if (vap->va_flags & ~(SF_APPEND | SF_IMMUTABLE | UF_NODUMP)) return (EOPNOTSUPP); if (vp->v_mount->mnt_flag & MNT_RDONLY) @@ -895,7 +895,7 @@ abortit: vput(tdvp); } else { if (xp->i_devvp != dp->i_devvp || xp->i_devvp != ip->i_devvp) - panic("ext2_rename: EXDEV"); + panic("ext2_rename: EXDEV"); /* * Short circuit rename(foo, foo). */ @@ -918,8 +918,8 @@ abortit: * to it. Also, ensure source and target are compatible * (both directories, or both not directories). */ - if ((xp->i_mode&IFMT) == IFDIR) { - if (! ext2_dirempty(xp, dp->i_number, tcnp->cn_cred) || + if ((xp->i_mode & IFMT) == IFDIR) { + if (!ext2_dirempty(xp, dp->i_number, tcnp->cn_cred) || xp->i_nlink > 2) { error = ENOTEMPTY; goto bad; @@ -1017,9 +1017,9 @@ abortit: dp->i_nlink--; dp->i_flag |= IN_CHANGE; error = vn_rdwr(UIO_READ, fvp, (caddr_t)&dirbuf, - sizeof(struct dirtemplate), (off_t)0, - UIO_SYSSPACE, IO_NODELOCKED | IO_NOMACCHECK, - tcnp->cn_cred, NOCRED, NULL, NULL); + sizeof(struct dirtemplate), (off_t)0, + UIO_SYSSPACE, IO_NODELOCKED | IO_NOMACCHECK, + tcnp->cn_cred, NOCRED, NULL, NULL); if (error == 0) { /* Like ufs little-endian: */ namlen = dirbuf.dotdot_type; @@ -1030,7 +1030,7 @@ abortit: "rename: mangled dir"); } else { dirbuf.dotdot_ino = newparent; - (void) vn_rdwr(UIO_WRITE, fvp, + (void)vn_rdwr(UIO_WRITE, fvp, (caddr_t)&dirbuf, sizeof(struct dirtemplate), (off_t)0, UIO_SYSSPACE, @@ -1113,12 +1113,12 @@ ext2_mkdir(struct vop_mkdir_args *ap) * if we are hacking owners here, (only do this where told to) * and we are not giving it TOO root, (would subvert quotas) * then go ahead and give it to the other user. - * The new directory also inherits the SUID bit. + * The new directory also inherits the SUID bit. * If user's UID and dir UID are the same, * 'give it away' so that the SUID is still forced on. */ - if ( (dvp->v_mount->mnt_flag & MNT_SUIDDIR) && - (dp->i_mode & ISUID) && dp->i_uid) { + if ((dvp->v_mount->mnt_flag & MNT_SUIDDIR) && + (dp->i_mode & ISUID) && dp->i_uid) { dmode |= ISUID; ip->i_uid = dp->i_uid; } else { @@ -1157,10 +1157,11 @@ ext2_mkdir(struct vop_mkdir_args *ap) dirtemplate = *dtp; dirtemplate.dot_ino = ip->i_number; dirtemplate.dotdot_ino = dp->i_number; - /* note that in ext2 DIRBLKSIZ == blocksize, not DEV_BSIZE - * so let's just redefine it - for this function only + /* + * note that in ext2 DIRBLKSIZ == blocksize, not DEV_BSIZE so let's + * just redefine it - for this function only */ -#undef DIRBLKSIZ +#undef DIRBLKSIZ #define DIRBLKSIZ VTOI(dvp)->i_e2fs->e2fs_bsize dirtemplate.dotdot_reclen = DIRBLKSIZ - 12; error = vn_rdwr(UIO_WRITE, tvp, (caddr_t)&dirtemplate, @@ -1394,7 +1395,7 @@ ext2fifo_close(struct vop_close_args *ap) /* * Kqfilter wrapper for fifos. * - * Fall through to ext2 kqfilter routines if needed + * Fall through to ext2 kqfilter routines if needed */ static int ext2fifo_kqfilter(struct vop_kqfilter_args *ap) @@ -1458,7 +1459,7 @@ ext2_pathconf(struct vop_pathconf_args *ap) *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize; break; case _PC_REC_MAX_XFER_SIZE: - *ap->a_retval = -1; /* means ``unlimited'' */ + *ap->a_retval = -1; /* means ``unlimited'' */ break; case _PC_REC_MIN_XFER_SIZE: *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize; @@ -1554,9 +1555,9 @@ ext2_makeinode(int mode, struct vnode *dvp, struct vnode **vpp, * then go ahead and give it to the other user. * Note that this drops off the execute bits for security. */ - if ( (dvp->v_mount->mnt_flag & MNT_SUIDDIR) && - (pdir->i_mode & ISUID) && - (pdir->i_uid != cnp->cn_cred->cr_uid) && pdir->i_uid) { + if ((dvp->v_mount->mnt_flag & MNT_SUIDDIR) && + (pdir->i_mode & ISUID) && + (pdir->i_uid != cnp->cn_cred->cr_uid) && pdir->i_uid) { ip->i_uid = pdir->i_uid; mode &= ~07111; } else { @@ -1615,12 +1616,12 @@ ext2_read(struct vop_read_args *ap) vp = ap->a_vp; ip = VTOI(vp); - /*EXT4_EXT_LOCK(ip);*/ + /* EXT4_EXT_LOCK(ip); */ if (ip->i_flag & IN_E4EXTENTS) error = ext4_ext_read(ap); else error = ext2_ind_read(ap); - /*EXT4_EXT_UNLOCK(ip);*/ + /* EXT4_EXT_UNLOCK(ip); */ return (error); } @@ -1666,7 +1667,7 @@ ext2_ind_read(struct vop_read_args *ap) fs = ip->i_e2fs; if (uio->uio_offset < ip->i_size && uio->uio_offset >= fs->e2fs_maxfilesize) - return (EOVERFLOW); + return (EOVERFLOW); for (error = 0, bp = NULL; uio->uio_resid > 0; bp = NULL) { if ((bytesinfile = ip->i_size - uio->uio_offset) <= 0) @@ -1690,6 +1691,7 @@ ext2_ind_read(struct vop_read_args *ap) 0, &bp); } else if (seqcount > 1) { u_int nextsize = blksize(fs, ip, nextlbn); + error = breadn(vp, lbn, size, &nextlbn, &nextsize, 1, NOCRED, &bp); } else @@ -1714,17 +1716,17 @@ ext2_ind_read(struct vop_read_args *ap) xfersize = size; } error = uiomove((char *)bp->b_data + blkoffset, - (int)xfersize, uio); + (int)xfersize, uio); if (error) break; vfs_bio_brelse(bp, ioflag); } - /* - * This can only happen in the case of an error - * because the loop above resets bp to NULL on each iteration - * and on normal completion has not set a new value into it. - * so it must have come from a 'break' statement + /* + * This can only happen in the case of an error because the loop + * above resets bp to NULL on each iteration and on normal + * completion has not set a new value into it. so it must have come + * from a 'break' statement */ if (bp != NULL) vfs_bio_brelse(bp, ioflag); @@ -1904,7 +1906,7 @@ ext2_write(struct vop_write_args *ap) case VDIR: /* XXX differs from ffs -- this is called from ext2_mkdir(). */ if ((ioflag & IO_SYNC) == 0) - panic("ext2_write: nonsync dir write"); + panic("ext2_write: nonsync dir write"); break; default: panic("ext2_write: type %p %d (%jd,%jd)", (void *)vp, @@ -1955,7 +1957,7 @@ ext2_write(struct vop_write_args *ap) if (error != 0) break; - if ((ioflag & (IO_SYNC|IO_INVAL)) == (IO_SYNC|IO_INVAL)) + if ((ioflag & (IO_SYNC | IO_INVAL)) == (IO_SYNC | IO_INVAL)) bp->b_flags |= B_NOCACHE; if (uio->uio_offset + xfersize > ip->i_size) ip->i_size = uio->uio_offset + xfersize; @@ -1998,7 +2000,7 @@ ext2_write(struct vop_write_args *ap) if (ioflag & IO_SYNC) { (void)bwrite(bp); } else if (vm_page_count_severe() || - buf_dirty_count_severe() || + buf_dirty_count_severe() || (ioflag & IO_ASYNC)) { bp->b_flags |= B_CLUSTEROK; bawrite(bp); diff --git a/sys/fs/ext2fs/ext2fs.h b/sys/fs/ext2fs/ext2fs.h index b0258bd71ba1..0ba8a77a2bd5 100644 --- a/sys/fs/ext2fs/ext2fs.h +++ b/sys/fs/ext2fs/ext2fs.h @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * + * */ #ifndef _FS_EXT2FS_EXT2FS_H_ diff --git a/sys/fs/ext2fs/fs.h b/sys/fs/ext2fs/fs.h index 7a03ba441a82..7f43bcf92085 100644 --- a/sys/fs/ext2fs/fs.h +++ b/sys/fs/ext2fs/fs.h @@ -59,8 +59,8 @@ /* * The path name on which the file system is mounted is maintained - * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in - * the super block for this name. + * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in + * the super block for this name. */ #define MAXMNTLEN 512 @@ -82,8 +82,8 @@ * of files per directory. These defaults are well selected for typical * filesystems, but may need to be tuned for odd cases like filesystems * being used for squid caches or news spools. - * AVFPDIR is the expected number of files per directory. AVGDIRSIZE is - * obtained by multiplying AVFPDIR and AVFILESIZ which is assumed to be + * AVFPDIR is the expected number of files per directory. AVGDIRSIZE is + * obtained by multiplying AVFPDIR and AVFILESIZ which is assumed to be * 16384. */ @@ -159,4 +159,4 @@ */ #define NINDIR(fs) (EXT2_ADDR_PER_BLOCK(fs)) -#endif /* !_FS_EXT2FS_FS_H_ */ +#endif /* !_FS_EXT2FS_FS_H_ */ diff --git a/sys/fs/ext2fs/htree.h b/sys/fs/ext2fs/htree.h index 3489d05702c6..73547ec7f987 100644 --- a/sys/fs/ext2fs/htree.h +++ b/sys/fs/ext2fs/htree.h @@ -42,10 +42,10 @@ #define EXT2_HTREE_EOF 0x7FFFFFFF struct ext2fs_fake_direct { - uint32_t e2d_ino; /* inode number of entry */ - uint16_t e2d_reclen; /* length of this record */ - uint8_t e2d_namlen; /* length of string in d_name */ - uint8_t e2d_type; /* file type */ + uint32_t e2d_ino; /* inode number of entry */ + uint16_t e2d_reclen; /* length of this record */ + uint8_t e2d_namlen; /* length of string in d_name */ + uint8_t e2d_type; /* file type */ }; struct ext2fs_htree_count { @@ -60,17 +60,17 @@ struct ext2fs_htree_entry { struct ext2fs_htree_root_info { uint32_t h_reserved1; - uint8_t h_hash_version; - uint8_t h_info_len; - uint8_t h_ind_levels; - uint8_t h_reserved2; + uint8_t h_hash_version; + uint8_t h_info_len; + uint8_t h_ind_levels; + uint8_t h_reserved2; }; struct ext2fs_htree_root { struct ext2fs_fake_direct h_dot; - char h_dot_name[4]; + char h_dot_name[4]; struct ext2fs_fake_direct h_dotdot; - char h_dotdot_name[4]; + char h_dotdot_name[4]; struct ext2fs_htree_root_info h_info; struct ext2fs_htree_entry h_entries[0]; }; @@ -97,4 +97,4 @@ struct ext2fs_htree_sort_entry { uint32_t h_hash; }; -#endif /* !_FS_EXT2FS_HTREE_H_ */ +#endif /* !_FS_EXT2FS_HTREE_H_ */ diff --git a/sys/fs/ext2fs/inode.h b/sys/fs/ext2fs/inode.h index bfe810df851f..2bc019cd443b 100644 --- a/sys/fs/ext2fs/inode.h +++ b/sys/fs/ext2fs/inode.h @@ -56,10 +56,10 @@ /* * The size of physical and logical block numbers in EXT2FS. */ -typedef uint32_t e2fs_daddr_t; -typedef int64_t e2fs_lbn_t; -typedef int64_t e4fs_daddr_t; - +typedef uint32_t e2fs_daddr_t; +typedef int64_t e2fs_lbn_t; +typedef int64_t e4fs_daddr_t; + /* * The inode is used to describe each active (or recently active) file in the * EXT2FS filesystem. It is composed of two types of information. The first @@ -178,11 +178,11 @@ struct indir { /* This overlays the fid structure (see mount.h). */ struct ufid { - uint16_t ufid_len; /* Length of structure. */ - uint16_t ufid_pad; /* Force 32-bit alignment. */ - ino_t ufid_ino; /* File number (ino). */ - uint32_t ufid_gen; /* Generation number. */ + uint16_t ufid_len; /* Length of structure. */ + uint16_t ufid_pad; /* Force 32-bit alignment. */ + ino_t ufid_ino; /* File number (ino). */ + uint32_t ufid_gen; /* Generation number. */ }; -#endif /* _KERNEL */ +#endif /* _KERNEL */ -#endif /* !_FS_EXT2FS_INODE_H_ */ +#endif /* !_FS_EXT2FS_INODE_H_ */