diff --git a/sys/fs/ext2fs/ext2_alloc.c b/sys/fs/ext2fs/ext2_alloc.c index 3d07af55477e..5720c72a74a6 100644 --- a/sys/fs/ext2fs/ext2_alloc.c +++ b/sys/fs/ext2fs/ext2_alloc.c @@ -364,7 +364,7 @@ ext2_valloc(pvp, mode, cred, vpp) * ext2_dirpref else obtain it using ino_to_cg. The preferred inode is * always the next inode. */ - if((mode & IFMT) == IFDIR) { + if ((mode & IFMT) == IFDIR) { cg = ext2_dirpref(pip); if (fs->e2fs_contigdirs[cg] < 255) fs->e2fs_contigdirs[cg]++; @@ -557,13 +557,13 @@ ext2_blkpref(ip, lbn, indx, bap, blocknr) /* 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) + 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 */ - if(bap) + if (bap) for (tmp = indx - 1; tmp >= 0; tmp--) if (bap[tmp]) return bap[tmp]; diff --git a/sys/fs/ext2fs/ext2_balloc.c b/sys/fs/ext2fs/ext2_balloc.c index 3fb19763d530..6e60c6e299b9 100644 --- a/sys/fs/ext2fs/ext2_balloc.c +++ b/sys/fs/ext2fs/ext2_balloc.c @@ -156,7 +156,7 @@ ext2_balloc(ip, lbn, size, cred, bpp, flags) */ pref = 0; if ((error = ext2_getlbns(vp, lbn, indirs, &num)) != 0) - return(error); + return (error); #ifdef DIAGNOSTIC if (num < 1) panic ("ext2_balloc: ext2_getlbns returned indirect block"); diff --git a/sys/fs/ext2fs/ext2_bmap.c b/sys/fs/ext2fs/ext2_bmap.c index c742188d479b..ba8eb632101d 100644 --- a/sys/fs/ext2fs/ext2_bmap.c +++ b/sys/fs/ext2fs/ext2_bmap.c @@ -215,7 +215,7 @@ ext2_bmaparray(vp, bn, bnp, runp, runb) ++bn, ++*runp); bn = ap->in_off; if (runb && bn) { - for(--bn; bn >= 0 && *runb < maxrun && + for (--bn; bn >= 0 && *runb < maxrun && is_sequential(ump, ((int32_t *)bp->b_data)[bn], ((int32_t *)bp->b_data)[bn+1]); --bn, ++*runb); diff --git a/sys/fs/ext2fs/ext2_inode.c b/sys/fs/ext2fs/ext2_inode.c index 2768c521c904..8d477b2a3547 100644 --- a/sys/fs/ext2fs/ext2_inode.c +++ b/sys/fs/ext2fs/ext2_inode.c @@ -229,7 +229,7 @@ ext2_truncate(vp, length, flags, cred, td) * will be returned to the free list. lastiblock values are also * normalized to -1 for calls to ext2_indirtrunc below. */ - bcopy((caddr_t)&oip->i_db[0], (caddr_t)oldblks, sizeof oldblks); + bcopy((caddr_t)&oip->i_db[0], (caddr_t)oldblks, sizeof(oldblks)); for (level = TRIPLE; level >= SINGLE; level--) if (lastiblock[level] < 0) { oip->i_ib[level] = 0; @@ -246,8 +246,8 @@ ext2_truncate(vp, length, flags, cred, td) * Note that we save the new block configuration so we can check it * when we are done. */ - bcopy((caddr_t)&oip->i_db[0], (caddr_t)newblks, sizeof newblks); - bcopy((caddr_t)oldblks, (caddr_t)&oip->i_db[0], sizeof oldblks); + bcopy((caddr_t)&oip->i_db[0], (caddr_t)newblks, sizeof(newblks)); + bcopy((caddr_t)oldblks, (caddr_t)&oip->i_db[0], sizeof(oldblks)); oip->i_size = osize; error = vtruncbuf(ovp, cred, td, length, (int)fs->e2fs_bsize); if (error && (allerror == 0)) @@ -418,7 +418,7 @@ ext2_indirtrunc(ip, lbn, dbn, lastbn, level, countp) 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], - (u_int)(NINDIR(fs) - (last + 1)) * sizeof (int32_t)); + (u_int)(NINDIR(fs) - (last + 1)) * sizeof(int32_t)); if (last == -1) bp->b_flags |= B_INVAL; error = bwrite(bp); diff --git a/sys/fs/ext2fs/ext2_lookup.c b/sys/fs/ext2fs/ext2_lookup.c index b293d7ff8bab..194cd3589e12 100644 --- a/sys/fs/ext2fs/ext2_lookup.c +++ b/sys/fs/ext2fs/ext2_lookup.c @@ -1002,7 +1002,7 @@ ext2_dirempty(ip, parentino, cred) struct dirtemplate dbuf; struct ext2fs_direct_2 *dp = (struct ext2fs_direct_2 *)&dbuf; int error, count, namlen; -#define MINDIRSIZ (sizeof (struct dirtemplate) / 2) +#define MINDIRSIZ (sizeof(struct dirtemplate) / 2) for (off = 0; off < ip->i_size; off += dp->e2d_reclen) { error = vn_rdwr(UIO_READ, ITOV(ip), (caddr_t)dp, MINDIRSIZ, @@ -1070,7 +1070,7 @@ ext2_checkpath(source, target, cred) break; } error = vn_rdwr(UIO_READ, vp, (caddr_t)&dirbuf, - sizeof (struct dirtemplate), (off_t)0, UIO_SYSSPACE, + sizeof(struct dirtemplate), (off_t)0, UIO_SYSSPACE, IO_NODELOCKED | IO_NOMACCHECK, cred, NOCRED, NULL, NULL); if (error != 0) diff --git a/sys/fs/ext2fs/ext2_vfsops.c b/sys/fs/ext2fs/ext2_vfsops.c index 9395f987ba13..8f7e8b8bb683 100644 --- a/sys/fs/ext2fs/ext2_vfsops.c +++ b/sys/fs/ext2fs/ext2_vfsops.c @@ -349,7 +349,7 @@ compute_sb_data(struct vnode *devvp, struct ext2fs *es, } fs->e2fs_ipb = fs->e2fs_bsize / EXT2_INODE_SIZE(fs); fs->e2fs_itpg = fs->e2fs_ipg /fs->e2fs_ipb; - fs->e2fs_descpb = fs->e2fs_bsize / sizeof (struct ext2_gd); + fs->e2fs_descpb = fs->e2fs_bsize / sizeof(struct ext2_gd); /* s_resuid / s_resgid ? */ fs->e2fs_gcount = (es->e2fs_bcount - es->e2fs_first_dblock + EXT2_BLOCKS_PER_GROUP(fs) - 1) / EXT2_BLOCKS_PER_GROUP(fs); @@ -583,8 +583,7 @@ ext2_mountfs(struct vnode *devvp, struct mount *mp) goto out; } } - ump = malloc(sizeof *ump, M_EXT2MNT, M_WAITOK); - bzero((caddr_t)ump, sizeof *ump); + ump = malloc(sizeof(*ump), M_EXT2MNT, M_WAITOK | M_ZERO); /* * I don't know whether this is the right strategy. Note that @@ -602,8 +601,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 just 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. */ ump->um_e2fs->e2fs_maxcontig = MAX(1, MAXPHYS / ump->um_e2fs->e2fs_bsize); @@ -978,7 +977,7 @@ ext2_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp) */ if(S_ISDIR(ip->i_mode) || S_ISREG(ip->i_mode)) { used_blocks = (ip->i_size+fs->e2fs_bsize-1) / fs->e2fs_bsize; - for(i = used_blocks; i < EXT2_NDIR_BLOCKS; i++) + for (i = used_blocks; i < EXT2_NDIR_BLOCKS; i++) ip->i_db[i] = 0; } /* diff --git a/sys/fs/ext2fs/ext2_vnops.c b/sys/fs/ext2fs/ext2_vnops.c index 7ec3e9d7a792..c357a2a85a52 100644 --- a/sys/fs/ext2fs/ext2_vnops.c +++ b/sys/fs/ext2fs/ext2_vnops.c @@ -1080,7 +1080,7 @@ ext2_rename(ap) dp->i_nlink--; dp->i_flag |= IN_CHANGE; error = vn_rdwr(UIO_READ, fvp, (caddr_t)&dirbuf, - sizeof (struct dirtemplate), (off_t)0, + sizeof(struct dirtemplate), (off_t)0, UIO_SYSSPACE, IO_NODELOCKED | IO_NOMACCHECK, tcnp->cn_cred, NOCRED, NULL, NULL); if (error == 0) { @@ -1095,7 +1095,7 @@ ext2_rename(ap) dirbuf.dotdot_ino = newparent; (void) vn_rdwr(UIO_WRITE, fvp, (caddr_t)&dirbuf, - sizeof (struct dirtemplate), + sizeof(struct dirtemplate), (off_t)0, UIO_SYSSPACE, IO_NODELOCKED | IO_SYNC | IO_NOMACCHECK, tcnp->cn_cred, @@ -1233,7 +1233,7 @@ ext2_mkdir(ap) #define DIRBLKSIZ VTOI(dvp)->i_e2fs->e2fs_bsize dirtemplate.dotdot_reclen = DIRBLKSIZ - 12; error = vn_rdwr(UIO_WRITE, tvp, (caddr_t)&dirtemplate, - sizeof (dirtemplate), (off_t)0, UIO_SYSSPACE, + sizeof(dirtemplate), (off_t)0, UIO_SYSSPACE, IO_NODELOCKED | IO_SYNC | IO_NOMACCHECK, cnp->cn_cred, NOCRED, NULL, NULL); if (error) { diff --git a/sys/fs/ext2fs/ext2fs.h b/sys/fs/ext2fs/ext2fs.h index 7dc93dcc5e7b..b57d515d3537 100755 --- a/sys/fs/ext2fs/ext2fs.h +++ b/sys/fs/ext2fs/ext2fs.h @@ -34,8 +34,8 @@ * */ -#ifndef _FS_EXT2FS_EXT2_FS_H_ -#define _FS_EXT2FS_EXT2_FS_H_ +#ifndef _FS_EXT2FS_EXT2FS_H_ +#define _FS_EXT2FS_EXT2FS_H_ #include @@ -62,7 +62,7 @@ #define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1) #define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1) #define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1) -#define EXT2_MAXSYMLINKLEN (EXT2_N_BLOCKS * sizeof (uint32_t)) +#define EXT2_MAXSYMLINKLEN (EXT2_N_BLOCKS * sizeof(uint32_t)) /* * The path name on which the file system is mounted is maintained @@ -292,7 +292,7 @@ struct csum { #else # define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->e2fs_log_bsize) #endif -#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (uint32_t)) +#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof(uint32_t)) #if defined(_KERNEL) # define EXT2_BLOCK_SIZE_BITS(s) ((s)->e2fs_blocksize_bits) #else @@ -332,7 +332,7 @@ struct csum { # define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits) #else # define EXT2_BLOCKS_PER_GROUP(s) ((s)->e2fs_bpg) -# define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_gd)) +# define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof(struct ext2_gd)) #endif diff --git a/sys/fs/ext2fs/fs.h b/sys/fs/ext2fs/fs.h index 54c6b4408db5..880c500f5bc8 100644 --- a/sys/fs/ext2fs/fs.h +++ b/sys/fs/ext2fs/fs.h @@ -36,6 +36,9 @@ * $FreeBSD$ */ +#ifndef _FS_EXT2FS_FS_H_ +#define _FS_EXT2FS_FS_H_ + /* * Each disk drive contains some number of file systems. * A file system consists of a number of cylinder groups. @@ -149,4 +152,4 @@ extern int inside[], around[]; extern u_char *fragtbl[]; - +#endif /* !_FS_EXT2FS_FS_H_ */