diff options
author | pjd <pjd@FreeBSD.org> | 2005-12-20 00:43:51 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2005-12-20 00:43:51 +0000 |
commit | d4461845a54318cfac55de9e62d38e082ad44f70 (patch) | |
tree | 25528df300b4adb13fca6214727260c7ee3b54cd /sys/kern | |
parent | db7366efc14fc08abfd3a2c2ad5b267e8aebca6e (diff) | |
download | FreeBSD-src-d4461845a54318cfac55de9e62d38e082ad44f70.zip FreeBSD-src-d4461845a54318cfac55de9e62d38e082ad44f70.tar.gz |
vfs_mount_alloc() always returns 0, but what we really want is newly
allocated 'struct mount *' pointer, so simplify code a bit and return
the pointer directly.
Reviewed by: ssouhlal
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_mount.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 3615d82..ee8c1dc 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -75,8 +75,8 @@ __FBSDID("$FreeBSD$"); static int vfs_domount(struct thread *td, const char *fstype, char *fspath, int fsflags, void *fsdata); -static int vfs_mount_alloc(struct vnode *dvp, struct vfsconf *vfsp, - const char *fspath, struct thread *td, struct mount **mpp); +static struct mount *vfs_mount_alloc(struct vnode *dvp, struct vfsconf *vfsp, + const char *fspath, struct thread *td); static int vfs_mountroot_ask(void); static int vfs_mountroot_try(const char *mountfrom); static int vfs_donmount(struct thread *td, int fsflags, @@ -407,9 +407,9 @@ nmount(td, uap) /* * Allocate and initialize the mount point struct. */ -static int +static struct mount * vfs_mount_alloc(struct vnode *vp, struct vfsconf *vfsp, - const char *fspath, struct thread *td, struct mount **mpp) + const char *fspath, struct thread *td) { struct mount *mp; @@ -435,8 +435,7 @@ vfs_mount_alloc(struct vnode *vp, struct vfsconf *vfsp, mac_create_mount(td->td_ucred, mp); #endif arc4rand(&mp->mnt_hashseed, sizeof mp->mnt_hashseed, 0); - *mpp = mp; - return (0); + return (mp); } /* @@ -808,11 +807,7 @@ vfs_domount( /* * Allocate and initialize the filesystem. */ - error = vfs_mount_alloc(vp, vfsp, fspath, td, &mp); - if (error) { - vput(vp); - return (error); - } + mp = vfs_mount_alloc(vp, vfsp, fspath, td); VOP_UNLOCK(vp, 0, td); /* XXXMAC: pass to vfs_mount_alloc? */ @@ -1199,10 +1194,7 @@ devfs_first(void) if (vfsp == NULL) return; - error = vfs_mount_alloc(NULLVP, vfsp, "/dev", td, &mp); - KASSERT(error == 0, ("vfs_mount_alloc failed %d", error)); - if (error) - return; + mp = vfs_mount_alloc(NULLVP, vfsp, "/dev", td); error = VFS_MOUNT(mp, td); KASSERT(error == 0, ("VFS_MOUNT(devfs) failed %d", error)); |