From 7f1fe4e81f69d2b9dc8d3d738cc87410e654f786 Mon Sep 17 00:00:00 2001 From: mycroft Date: Tue, 11 Jan 2005 00:19:36 +0000 Subject: [PATCH] Rearrange some code slightly to avoid uninitialized variable warnings. --- 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(-) diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c index 528d90a96bc2..e4ea37f162cc 100644 --- a/sys/ufs/ext2fs/ext2fs_vfsops.c +++ b/sys/ufs/ext2fs/ext2fs_vfsops.c @@ -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 -__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 @@ ext2fs_mount(mp, path, data, ndp, p) 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 @@ ext2fs_mount(mp, path, data, ndp, p) * 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 @@ ext2fs_mount(mp, path, data, ndp, p) */ vrele(devvp); + ump = VFSTOUFS(mp); fs = ump->um_e2fs; if (fs->e2fs_ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) { /* diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index a47dc85d56e5..88aed843e7c0 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -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 -__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 @@ ffs_mount(mp, path, data, ndp, p) 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 @@ ffs_mount(mp, path, data, ndp, p) * 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 @@ ffs_mount(mp, path, data, ndp, p) */ vrele(devvp); + ump = VFSTOUFS(mp); fs = ump->um_fs; if (fs->fs_ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) { /* diff --git a/sys/ufs/lfs/lfs_vfsops.c b/sys/ufs/lfs/lfs_vfsops.c index 3f11a4fffa96..735e41b361bf 100644 --- a/sys/ufs/lfs/lfs_vfsops.c +++ b/sys/ufs/lfs/lfs_vfsops.c @@ -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 -__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 @@ lfs_mount(struct mount *mp, const char *path, void *data, struct nameidata *ndp, 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 @@ lfs_mount(struct mount *mp, const char *path, void *data, struct nameidata *ndp, * 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 @@ lfs_mount(struct mount *mp, const char *path, void *data, struct nameidata *ndp, */ vrele(devvp); + ump = VFSTOUFS(mp); fs = ump->um_lfs; if (fs->lfs_ronly && (mp->mnt_iflag & IMNT_WANTRDWR)) { /*