Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs Rearrange some code slightly to avoid uninitialized ...



details:   https://anonhg.NetBSD.org/src/rev/0101470ea1d9
branches:  trunk
changeset: 572716:0101470ea1d9
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Tue Jan 11 00:19:36 2005 +0000

description:
Rearrange some code slightly to avoid uninitialized variable warnings.

diffstat:

 sys/ufs/ext2fs/ext2fs_vfsops.c |  32 ++++++++++++++------------------
 sys/ufs/ffs/ffs_vfsops.c       |  28 ++++++++++++++--------------
 sys/ufs/lfs/lfs_vfsops.c       |  33 ++++++++++++++++-----------------
 3 files changed, 44 insertions(+), 49 deletions(-)

diffs (209 lines):

diff -r 91399972bec6 -r 0101470ea1d9 sys/ufs/ext2fs/ext2fs_vfsops.c
--- a/sys/ufs/ext2fs/ext2fs_vfsops.c    Mon Jan 10 23:33:53 2005 +0000
+++ b/sys/ufs/ext2fs/ext2fs_vfsops.c    Tue Jan 11 00:19:36 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ext2fs_vfsops.c,v 1.80 2005/01/09 09:27:17 mycroft Exp $       */
+/*     $NetBSD: ext2fs_vfsops.c,v 1.81 2005/01/11 00:19:36 mycroft Exp $       */
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1994
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.80 2005/01/09 09:27:17 mycroft Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.81 2005/01/11 00:19:36 mycroft Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -271,22 +271,7 @@
 
        update = mp->mnt_flag & MNT_UPDATE;
 
-       /*
-        * If updating, check whether changing from read-only to
-        * read/write; if there is no device name, that's all we do.
-        */
-       if (update) {
-               /* Use the extant mount */
-               ump = VFSTOUFS(mp);
-               devvp = ump->um_devvp;
-               if (args.fspec == NULL)
-                       vref(devvp);
-       } else {
-               /* New mounts must have a filename for the device */
-               if (args.fspec == NULL)
-                       return (EINVAL);
-       }
-
+       /* Check arguments */
        if (args.fspec != NULL) {
                /*
                 * Look up the name and verify that it's sane.
@@ -309,9 +294,19 @@
                         * Be sure we're still naming the same device
                         * used for our initial mount
                         */
+                       ump = VFSTOUFS(mp);
                        if (devvp != ump->um_devvp)
                                error = EINVAL;
                }
+       } else {
+               if (!update) {
+                       /* New mounts must have a filename for the device */
+                       return (EINVAL);
+               } else {
+                       ump = VFSTOUFS(mp);
+                       devvp = ump->um_devvp;
+                       vref(devvp);
+               }
        }
 
        /*
@@ -379,6 +374,7 @@
                 */
                vrele(devvp);
 
+               ump = VFSTOUFS(mp);
                fs = ump->um_e2fs;
                if (fs->e2fs_ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) {
                        /*
diff -r 91399972bec6 -r 0101470ea1d9 sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Mon Jan 10 23:33:53 2005 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Tue Jan 11 00:19:36 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vfsops.c,v 1.159 2005/01/09 03:11:48 mycroft Exp $ */
+/*     $NetBSD: ffs_vfsops.c,v 1.160 2005/01/11 00:19:36 mycroft Exp $ */
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1994
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.159 2005/01/09 03:11:48 mycroft Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.160 2005/01/11 00:19:36 mycroft Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -206,18 +206,6 @@
        update = mp->mnt_flag & MNT_UPDATE;
 
        /* Check arguments */
-       if (update) {
-               /* Use the extant mount */
-               ump = VFSTOUFS(mp);
-               devvp = ump->um_devvp;
-               if (args.fspec == NULL)
-                       vref(devvp);
-       } else {
-               /* New mounts must have a filename for the device */
-               if (args.fspec == NULL)
-                       return (EINVAL);
-       }
-
        if (args.fspec != NULL) {
                /*
                 * Look up the name and verify that it's sane.
@@ -240,9 +228,20 @@
                         * Be sure we're still naming the same device
                         * used for our initial mount
                         */
+                       ump = VFSTOUFS(mp);
                        if (devvp != ump->um_devvp)
                                error = EINVAL;
                }
+       } else {
+               if (!update) {
+                       /* New mounts must have a filename for the device */
+                       return (EINVAL);
+               } else {
+                       /* Use the extant mount */
+                       ump = VFSTOUFS(mp);
+                       devvp = ump->um_devvp;
+                       vref(devvp);
+               }
        }
 
        /*
@@ -317,6 +316,7 @@
                 */
                vrele(devvp);
 
+               ump = VFSTOUFS(mp);
                fs = ump->um_fs;
                if (fs->fs_ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) {
                        /*
diff -r 91399972bec6 -r 0101470ea1d9 sys/ufs/lfs/lfs_vfsops.c
--- a/sys/ufs/lfs/lfs_vfsops.c  Mon Jan 10 23:33:53 2005 +0000
+++ b/sys/ufs/lfs/lfs_vfsops.c  Tue Jan 11 00:19:36 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_vfsops.c,v 1.161 2005/01/09 09:27:17 mycroft Exp $ */
+/*     $NetBSD: lfs_vfsops.c,v 1.162 2005/01/11 00:19:36 mycroft Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.161 2005/01/09 09:27:17 mycroft Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.162 2005/01/11 00:19:36 mycroft Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -356,21 +356,7 @@
 
        update = mp->mnt_flag & MNT_UPDATE;
 
-       /*
-        * If updating, check whether changing from read-only to
-        * read/write; if there is no device name, that's all we do.
-        */
-       if (update) {
-               ump = VFSTOUFS(mp);
-               devvp = ump->um_devvp;
-               if (args.fspec == NULL)
-                       vref(devvp);
-       } else {
-               /* New mounts must have a filename for the device */
-               if (args.fspec == NULL)
-                       return (EINVAL);
-       }
-
+       /* Check arguments */
        if (args.fspec != NULL) {
                /*
                 * Look up the name and verify that it's sane.
@@ -393,11 +379,23 @@
                         * Be sure we're still naming the same device
                         * used for our initial mount
                         */
+                       ump = VFSTOUFS(mp);
                        if (devvp != ump->um_devvp)
                                error = EINVAL;
                }
+       } else {
+               if (!update) {
+                       /* New mounts must have a filename for the device */
+                       return (EINVAL);
+               } else {
+                       /* Use the extant mount */
+                       ump = VFSTOUFS(mp);
+                       devvp = ump->um_devvp;
+                       vref(devvp);
+               }
        }
 
+
        /*
         * If mount by non-root, then verify that user has necessary
         * permissions on the device.
@@ -463,6 +461,7 @@
                 */
                vrele(devvp);
 
+               ump = VFSTOUFS(mp);
                fs = ump->um_lfs;
                if (fs->lfs_ronly && (mp->mnt_iflag & IMNT_WANTRDWR)) {
                        /*



Home | Main Index | Thread Index | Old Index