Author: pfg
Date: Fri Dec 16 15:47:43 2011
New Revision: 228583
URL: http://svn.freebsd.org/changeset/base/228583

Log:
  Style cleanups by jh@.
  Fix a comment from the previous commit.
  Use M_ZERO instead of bzero() in ext2_vfsops.c
  Add include guards from PR.
  
  PR:           162564
  Approved by:  jhb (mentor)
  MFC after:    2 weeks

Modified:
  head/sys/fs/ext2fs/ext2_alloc.c
  head/sys/fs/ext2fs/ext2_balloc.c
  head/sys/fs/ext2fs/ext2_bmap.c
  head/sys/fs/ext2fs/ext2_inode.c
  head/sys/fs/ext2fs/ext2_lookup.c
  head/sys/fs/ext2fs/ext2_vfsops.c
  head/sys/fs/ext2fs/ext2_vnops.c
  head/sys/fs/ext2fs/ext2fs.h
  head/sys/fs/ext2fs/fs.h

Modified: head/sys/fs/ext2fs/ext2_alloc.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_alloc.c     Fri Dec 16 15:44:12 2011        
(r228582)
+++ head/sys/fs/ext2fs/ext2_alloc.c     Fri Dec 16 15:47:43 2011        
(r228583)
@@ -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];

Modified: head/sys/fs/ext2fs/ext2_balloc.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_balloc.c    Fri Dec 16 15:44:12 2011        
(r228582)
+++ head/sys/fs/ext2fs/ext2_balloc.c    Fri Dec 16 15:47:43 2011        
(r228583)
@@ -156,7 +156,7 @@ ext2_balloc(ip, lbn, size, cred, bpp, fl
         */
        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");

Modified: head/sys/fs/ext2fs/ext2_bmap.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_bmap.c      Fri Dec 16 15:44:12 2011        
(r228582)
+++ head/sys/fs/ext2fs/ext2_bmap.c      Fri Dec 16 15:47:43 2011        
(r228583)
@@ -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);

Modified: head/sys/fs/ext2fs/ext2_inode.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_inode.c     Fri Dec 16 15:44:12 2011        
(r228582)
+++ head/sys/fs/ext2fs/ext2_inode.c     Fri Dec 16 15:47:43 2011        
(r228583)
@@ -229,7 +229,7 @@ ext2_truncate(vp, length, flags, cred, t
         * 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, t
         * 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, le
        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);

Modified: head/sys/fs/ext2fs/ext2_lookup.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_lookup.c    Fri Dec 16 15:44:12 2011        
(r228582)
+++ head/sys/fs/ext2fs/ext2_lookup.c    Fri Dec 16 15:47:43 2011        
(r228583)
@@ -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)

Modified: head/sys/fs/ext2fs/ext2_vfsops.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_vfsops.c    Fri Dec 16 15:44:12 2011        
(r228582)
+++ head/sys/fs/ext2fs/ext2_vfsops.c    Fri Dec 16 15:47:43 2011        
(r228583)
@@ -349,7 +349,7 @@ compute_sb_data(struct vnode *devvp, str
        }
        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
                        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
 
        /*
         * 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, i
         */
        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;
        }
 /*

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_vnops.c     Fri Dec 16 15:44:12 2011        
(r228582)
+++ head/sys/fs/ext2fs/ext2_vnops.c     Fri Dec 16 15:47:43 2011        
(r228583)
@@ -1080,7 +1080,7 @@ abortit:
                        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 @@ abortit:
                                        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) {

Modified: head/sys/fs/ext2fs/ext2fs.h
==============================================================================
--- head/sys/fs/ext2fs/ext2fs.h Fri Dec 16 15:44:12 2011        (r228582)
+++ head/sys/fs/ext2fs/ext2fs.h Fri Dec 16 15:47:43 2011        (r228583)
@@ -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 <sys/types.h>
 
@@ -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
 

Modified: head/sys/fs/ext2fs/fs.h
==============================================================================
--- head/sys/fs/ext2fs/fs.h     Fri Dec 16 15:44:12 2011        (r228582)
+++ head/sys/fs/ext2fs/fs.h     Fri Dec 16 15:47:43 2011        (r228583)
@@ -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_ */
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to