Rearrange some code slightly to avoid uninitialized variable warnings.

This commit is contained in:
mycroft 2005-01-11 00:19:36 +00:00
parent 81b53d0cfa
commit 7f1fe4e81f
3 changed files with 44 additions and 49 deletions

View File

@ -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 * Copyright (c) 1989, 1991, 1993, 1994
@ -65,7 +65,7 @@
*/ */
#include <sys/cdefs.h> #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) #if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h" #include "opt_compat_netbsd.h"
@ -271,22 +271,7 @@ ext2fs_mount(mp, path, data, ndp, p)
update = mp->mnt_flag & MNT_UPDATE; update = mp->mnt_flag & MNT_UPDATE;
/* /* Check arguments */
* 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);
}
if (args.fspec != NULL) { if (args.fspec != NULL) {
/* /*
* Look up the name and verify that it's sane. * 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 * Be sure we're still naming the same device
* used for our initial mount * used for our initial mount
*/ */
ump = VFSTOUFS(mp);
if (devvp != ump->um_devvp) if (devvp != ump->um_devvp)
error = EINVAL; 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); vrele(devvp);
ump = VFSTOUFS(mp);
fs = ump->um_e2fs; fs = ump->um_e2fs;
if (fs->e2fs_ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) { if (fs->e2fs_ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) {
/* /*

View File

@ -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 * Copyright (c) 1989, 1991, 1993, 1994
@ -32,7 +32,7 @@
*/ */
#include <sys/cdefs.h> #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) #if defined(_KERNEL_OPT)
#include "opt_ffs.h" #include "opt_ffs.h"
@ -206,18 +206,6 @@ ffs_mount(mp, path, data, ndp, p)
update = mp->mnt_flag & MNT_UPDATE; update = mp->mnt_flag & MNT_UPDATE;
/* Check arguments */ /* 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) { if (args.fspec != NULL) {
/* /*
* Look up the name and verify that it's sane. * 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 * Be sure we're still naming the same device
* used for our initial mount * used for our initial mount
*/ */
ump = VFSTOUFS(mp);
if (devvp != ump->um_devvp) if (devvp != ump->um_devvp)
error = EINVAL; 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); vrele(devvp);
ump = VFSTOUFS(mp);
fs = ump->um_fs; fs = ump->um_fs;
if (fs->fs_ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) { if (fs->fs_ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) {
/* /*

View File

@ -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. * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/ */
#include <sys/cdefs.h> #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) #if defined(_KERNEL_OPT)
#include "opt_quota.h" #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; update = mp->mnt_flag & MNT_UPDATE;
/* /* Check arguments */
* 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);
}
if (args.fspec != NULL) { if (args.fspec != NULL) {
/* /*
* Look up the name and verify that it's sane. * 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 * Be sure we're still naming the same device
* used for our initial mount * used for our initial mount
*/ */
ump = VFSTOUFS(mp);
if (devvp != ump->um_devvp) if (devvp != ump->um_devvp)
error = EINVAL; 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 * If mount by non-root, then verify that user has necessary
* permissions on the device. * permissions on the device.
@ -463,6 +461,7 @@ lfs_mount(struct mount *mp, const char *path, void *data, struct nameidata *ndp,
*/ */
vrele(devvp); vrele(devvp);
ump = VFSTOUFS(mp);
fs = ump->um_lfs; fs = ump->um_lfs;
if (fs->lfs_ronly && (mp->mnt_iflag & IMNT_WANTRDWR)) { if (fs->lfs_ronly && (mp->mnt_iflag & IMNT_WANTRDWR)) {
/* /*