Use genfs_can_mount().

This commit is contained in:
elad 2009-05-07 20:32:23 +00:00
parent df369aba80
commit 88003af1dc

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vfsops.c,v 1.272 2009/04/04 10:33:59 ad Exp $ */
/* $NetBSD: lfs_vfsops.c,v 1.273 2009/05/07 20:32:23 elad Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.272 2009/04/04 10:33:59 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.273 2009/05/07 20:32:23 elad Exp $");
#if defined(_KERNEL_OPT)
#include "opt_lfs.h"
@ -619,15 +619,14 @@ lfs_mount(struct mount *mp, const char *path, void *data, size_t *data_len)
* If mount by non-root, then verify that user has necessary
* permissions on the device.
*/
if (error == 0 && kauth_authorize_generic(l->l_cred,
KAUTH_GENERIC_ISSUSER, NULL) != 0) {
if (error == 0) {
accessmode = VREAD;
if (update ?
(mp->mnt_iflag & IMNT_WANTRDWR) != 0 :
(mp->mnt_flag & MNT_RDONLY) == 0)
accessmode |= VWRITE;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
error = VOP_ACCESS(devvp, accessmode, l->l_cred);
error = genfs_can_mount(devvp, accessmode, l->l_cred);
VOP_UNLOCK(devvp, 0);
}