Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/ffs Small changes:



details:   https://anonhg.NetBSD.org/src/rev/7b591a5dd3fa
branches:  trunk
changeset: 336276:7b591a5dd3fa
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Feb 23 13:38:54 2015 +0000

description:
Small changes:
 - instead of always calling DPRINTF with __func__, put __func__ directly
   in the macro
 - ffs_mountfs(): rename fsblockloc -> fs_sblockloc, initialize fs_sbsize
   to zero
No real functional change

diffstat:

 sys/ufs/ffs/ffs_vfsops.c |  133 ++++++++++++++++++++--------------------------
 1 files changed, 59 insertions(+), 74 deletions(-)

diffs (truncated from 442 to 300 lines):

diff -r a05dd26e992b -r 7b591a5dd3fa sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Mon Feb 23 13:12:37 2015 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Mon Feb 23 13:38:54 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vfsops.c,v 1.318 2015/02/22 14:22:34 maxv Exp $    */
+/*     $NetBSD: ffs_vfsops.c,v 1.319 2015/02/23 13:38:54 maxv Exp $    */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.318 2015/02/22 14:22:34 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.319 2015/02/23 13:38:54 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -122,9 +122,9 @@
 int ffs_initcount = 0;
 
 #ifdef DEBUG_FFS_MOUNT
-#define DPRINTF(a)     printf a
+#define DPRINTF(_fmt, args...) printf("%s: " _fmt "\n", __func__, ##args)
 #else
-#define DPRINTF(a)     do {} while (/*CONSTCOND*/0)
+#define DPRINTF(_fmt, args...) do {} while (/*CONSTCOND*/0)
 #endif
 
 extern const struct vnodeopv_desc ffs_vnodeop_opv_desc;
@@ -354,19 +354,18 @@
        mode_t accessmode;
 
        if (args == NULL) {
-               DPRINTF(("%s: NULL args\n", __func__));
+               DPRINTF("NULL args");
                return EINVAL;
        }
        if (*data_len < sizeof(*args)) {
-               DPRINTF(("%s: bad size args %zu != %zu\n",
-                   __func__, *data_len, sizeof(*args)));
+               DPRINTF("bad size args %zu != %zu", *data_len, sizeof(*args));
                return EINVAL;
        }
 
        if (mp->mnt_flag & MNT_GETARGS) {
                ump = VFSTOUFS(mp);
                if (ump == NULL) {
-                       DPRINTF(("%s: no ump\n", __func__));
+                       DPRINTF("no ump");
                        return EIO;
                }
                args->fspec = NULL;
@@ -384,8 +383,7 @@
                error = namei_simple_user(args->fspec,
                    NSM_FOLLOW_NOEMULROOT, &devvp);
                if (error != 0) {
-                       DPRINTF(("%s: namei_simple_user %d\n", __func__,
-                           error));
+                       DPRINTF("namei_simple_user returned %d", error);
                        return error;
                }
 
@@ -394,12 +392,11 @@
                         * Be sure this is a valid block device
                         */
                        if (devvp->v_type != VBLK) {
-                               DPRINTF(("%s: non block device %d\n",
-                                   __func__, devvp->v_type));
+                               DPRINTF("non block device %d", devvp->v_type);
                                error = ENOTBLK;
                        } else if (bdevsw_lookup(devvp->v_rdev) == NULL) {
-                               DPRINTF(("%s: can't find block device 0x%jx\n",
-                                   __func__, devvp->v_rdev));
+                               DPRINTF("can't find block device 0x%jx",
+                                   devvp->v_rdev);
                                error = ENXIO;
                        }
                } else {
@@ -410,10 +407,9 @@
                        ump = VFSTOUFS(mp);
                        if (devvp != ump->um_devvp) {
                                if (devvp->v_rdev != ump->um_devvp->v_rdev) {
-                                       DPRINTF(("%s: wrong device 0x%jx"
-                                           " != 0x%jx\n", __func__,
+                                       DPRINTF("wrong device 0x%jx != 0x%jx",
                                            (uintmax_t)devvp->v_rdev,
-                                           (uintmax_t)ump->um_devvp->v_rdev));
+                                           (uintmax_t)ump->um_devvp->v_rdev);
                                        error = EINVAL;
                                } else {
                                        vrele(devvp);
@@ -425,7 +421,7 @@
        } else {
                if (!update) {
                        /* New mounts must have a filename for the device */
-                       DPRINTF(("%s: no filename for mount\n", __func__));
+                       DPRINTF("no filename for mount");
                        return EINVAL;
                } else {
                        /* Use the extant mount */
@@ -454,7 +450,7 @@
                    KAUTH_REQ_SYSTEM_MOUNT_DEVICE, mp, devvp,
                    KAUTH_ARG(accessmode));
                if (error) {
-                       DPRINTF(("%s: kauth %d\n", __func__, error));
+                       DPRINTF("kauth returned %d", error);
                }
                VOP_UNLOCK(devvp);
        }
@@ -484,12 +480,12 @@
                error = VOP_OPEN(devvp, xflags, FSCRED);
                VOP_UNLOCK(devvp);
                if (error) {    
-                       DPRINTF(("%s: VOP_OPEN %d\n", __func__, error));
+                       DPRINTF("VOP_OPEN returned %d", error);
                        goto fail;
                }
                error = ffs_mountfs(devvp, mp, l);
                if (error) {
-                       DPRINTF(("%s: ffs_mountfs %d\n", __func__, error));
+                       DPRINTF("ffs_mountfs returned %d", error);
                        vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
                        (void)VOP_CLOSE(devvp, xflags, NOCRED);
                        VOP_UNLOCK(devvp);
@@ -531,7 +527,7 @@
                                (void) ffs_sbupdate(ump, MNT_WAIT);
                        }
                        if (error) {
-                               DPRINTF(("%s: wapbl %d\n", __func__, error));
+                               DPRINTF("wapbl %d", error);
                                return error;
                        }
                        UFS_WAPBL_END(mp);
@@ -541,8 +537,7 @@
                if ((mp->mnt_flag & MNT_LOG) == 0) {
                        error = ffs_wapbl_stop(mp, mp->mnt_flag & MNT_FORCE);
                        if (error) {
-                               DPRINTF(("%s: ffs_wapbl_stop %d\n",
-                                   __func__, error));
+                               DPRINTF("ffs_wapbl_stop returned %d", error);
                                return error;
                        }
                }
@@ -559,8 +554,7 @@
                if (mp->mnt_flag & MNT_RELOAD) {
                        error = ffs_reload(mp, l->l_cred, l);
                        if (error) {
-                               DPRINTF(("%s: ffs_reload %d\n",
-                                   __func__, error));
+                               DPRINTF("ffs_reload returned %d", error);
                                return error;
                        }
                }
@@ -576,8 +570,7 @@
                                    mp->mnt_stat.f_mntonname,
                                    (mp->mnt_flag & MNT_FORCE) ? "" :
                                    ", not mounting");
-                               DPRINTF(("%s: ffs_quota2 %d\n",
-                                   __func__, EINVAL));
+                               DPRINTF("ffs_quota2 %d", EINVAL);
                                return EINVAL;
                        }
 #endif
@@ -596,9 +589,8 @@
                                error = wapbl_replay_write(mp->mnt_wapbl_replay,
                                    devvp);
                                if (error) {
-                                       DPRINTF((
-                                           "%s: %s: wapbl_replay_write %d\n",
-                                           __func__, nm, error));
+                                       DPRINTF("%s: wapbl_replay_write %d",
+                                           nm, error);
                                        return error;
                                }
                                wapbl_replay_stop(mp->mnt_wapbl_replay);
@@ -612,8 +604,7 @@
 #ifdef WAPBL
                error = ffs_wapbl_start(mp);
                if (error) {
-                       DPRINTF(("%s: ffs_wapbl_start %d\n",
-                           __func__, error));
+                       DPRINTF("ffs_wapbl_start returned %d", error);
                        return error;
                }
 #endif /* WAPBL */
@@ -622,8 +613,7 @@
                if (!fs->fs_ronly) {
                        error = ffs_quota2_mount(mp);
                        if (error) {
-                               DPRINTF(("%s: ffs_quota2_mount %d\n",
-                                   __func__, error));
+                               DPRINTF("ffs_quota2_mount returned %d", error);
                                return error;
                        }
                }
@@ -642,7 +632,7 @@
                (void)strncpy(fs->fs_fsmnt, mp->mnt_stat.f_mntonname,
                    sizeof(fs->fs_fsmnt));
        else {
-           DPRINTF(("%s: set_statvfs_info %d\n", __func__, error));
+           DPRINTF("set_statvfs_info returned %d", error);
        }
        fs->fs_flags &= ~FS_DOSOFTDEP;
        if (fs->fs_fmod != 0) { /* XXX */
@@ -1006,8 +996,7 @@
 #endif
        int32_t *lp;
        kauth_cred_t cred;
-       u_int32_t fs_sbsize = 8192;     /* keep gcc happy*/
-       u_int32_t allocsbsize;
+       u_int32_t allocsbsize, fs_sbsize = 0;
 
        dev = devvp->v_rdev;
        cred = l ? l->l_cred : NOCRED;
@@ -1017,7 +1006,7 @@
        error = vinvalbuf(devvp, V_SAVE, cred, l, 0, 0);
        VOP_UNLOCK(devvp);
        if (error) {
-               DPRINTF(("%s: vinvalbuf %d\n", __func__, error));
+               DPRINTF("vinvalbuf returned %d", error);
                return error;
        }
 
@@ -1025,7 +1014,7 @@
 
        error = fstrans_mount(mp);
        if (error) {
-               DPRINTF(("%s: fstrans_mount %d\n", __func__, error));
+               DPRINTF("fstrans_mount returned %d", error);
                return error;
        }
 
@@ -1033,7 +1022,7 @@
        mutex_init(&ump->um_lock, MUTEX_DEFAULT, IPL_NONE);
        error = ffs_snapshot_init(ump);
        if (error) {
-               DPRINTF(("%s: ffs_snapshot_init %d\n", __func__, error));
+               DPRINTF("ffs_snapshot_init returned %d", error);
                goto out;
        }
        ump->um_ops = &ffs_ufsops;
@@ -1045,14 +1034,14 @@
         * Try reading the superblock in each of its possible locations.
         */
        for (i = 0; ; i++) {
-               daddr_t fsblockloc;
+               daddr_t fs_sblockloc;
 
                if (bp != NULL) {
                        brelse(bp, BC_NOCACHE);
                        bp = NULL;
                }
                if (sblock_try[i] == -1) {
-                       DPRINTF(("%s: no superblock found\n", __func__));
+                       DPRINTF("no superblock found");
                        error = EINVAL;
                        fs = NULL;
                        goto out;
@@ -1061,15 +1050,15 @@
                error = bread(devvp, sblock_try[i] / DEV_BSIZE, SBLOCKSIZE,
                    cred, 0, &bp);
                if (error) {
-                       DPRINTF(("%s: bread@0x%x %d\n", __func__,
-                           sblock_try[i] / DEV_BSIZE, error));
+                       DPRINTF("bread@0x%x returned %d",
+                           sblock_try[i] / DEV_BSIZE, error);
                        fs = NULL;
                        goto out;
                }
-               fs = (struct fs*)bp->b_data;
+               fs = (struct fs *)bp->b_data;
 
-               fsblockloc = sblockloc = sblock_try[i];
-               DPRINTF(("%s: fs_magic 0x%x\n", __func__, fs->fs_magic));
+               sblockloc = sblock_try[i];
+               DPRINTF("fs_magic 0x%x", fs->fs_magic);
 
                /*
                 * Swap: here, we swap fs->fs_sbsize in order to get the correct
@@ -1108,17 +1097,17 @@
                                 * Don't use it.
                                 */
                                continue;
-                       fsblockloc = sblockloc;
+                       fs_sblockloc = sblockloc;
                } else {
-                       fsblockloc = fs->fs_sblockloc;
+                       fs_sblockloc = fs->fs_sblockloc;
 #ifdef FFS_EI
                        if (needswap)
-                               fsblockloc = bswap64(fsblockloc);
+                               fs_sblockloc = bswap64(fs_sblockloc);
 #endif
                }
 
                /* Check we haven't found an alternate superblock */
-               if (fsblockloc != sblockloc)
+               if (fs_sblockloc != sblockloc)
                        continue;



Home | Main Index | Thread Index | Old Index