From owner-svn-src-all@FreeBSD.ORG Thu Oct 1 17:22:04 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97C9A106566B; Thu, 1 Oct 2009 17:22:04 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 859108FC18; Thu, 1 Oct 2009 17:22:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n91HM41Y058825; Thu, 1 Oct 2009 17:22:04 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n91HM4Kg058819; Thu, 1 Oct 2009 17:22:04 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200910011722.n91HM4Kg058819@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 1 Oct 2009 17:22:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197680 - in head/sys: fs/fifofs kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2009 17:22:04 -0000 Author: trasz Date: Thu Oct 1 17:22:03 2009 New Revision: 197680 URL: http://svn.freebsd.org/changeset/base/197680 Log: Provide default implementation for VOP_ACCESS(9), so that filesystems which want to provide VOP_ACCESSX(9) don't have to implement both. Note that this commit makes implementation of either of these two mandatory. Reviewed by: kib Modified: head/sys/fs/fifofs/fifo_vnops.c head/sys/kern/subr_acl_posix1e.c head/sys/kern/vfs_default.c head/sys/kern/vfs_subr.c head/sys/sys/vnode.h Modified: head/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- head/sys/fs/fifofs/fifo_vnops.c Thu Oct 1 17:12:52 2009 (r197679) +++ head/sys/fs/fifofs/fifo_vnops.c Thu Oct 1 17:22:03 2009 (r197680) @@ -119,7 +119,6 @@ static struct filterops fifo_notsup_filt struct vop_vector fifo_specops = { .vop_default = &default_vnodeops, - .vop_access = VOP_EBADF, .vop_advlock = fifo_advlock, .vop_close = fifo_close, .vop_create = VOP_PANIC, Modified: head/sys/kern/subr_acl_posix1e.c ============================================================================== --- head/sys/kern/subr_acl_posix1e.c Thu Oct 1 17:12:52 2009 (r197679) +++ head/sys/kern/subr_acl_posix1e.c Thu Oct 1 17:22:03 2009 (r197680) @@ -61,6 +61,9 @@ vaccess_acl_posix1e(enum vtype type, uid accmode_t acl_mask_granted; int group_matched, i; + KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND)) == 0, + ("invalid bit in accmode")); + /* * Look for a normal, non-privileged way to access the file/directory * as requested. If it exists, go with that. Otherwise, attempt to Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Thu Oct 1 17:12:52 2009 (r197679) +++ head/sys/kern/vfs_default.c Thu Oct 1 17:22:03 2009 (r197680) @@ -83,12 +83,17 @@ static int dirent_exists(struct vnode *v * * If there is no specific entry here, we will return EOPNOTSUPP. * + * Note that every filesystem has to implement either vop_access + * or vop_accessx; failing to do so will result in immediate crash + * due to stack overflow, as vop_stdaccess() calls vop_stdaccessx(), + * which calls vop_stdaccess() etc. */ struct vop_vector default_vnodeops = { .vop_default = NULL, .vop_bypass = VOP_EOPNOTSUPP, + .vop_access = vop_stdaccess, .vop_accessx = vop_stdaccessx, .vop_advlock = vop_stdadvlock, .vop_advlockasync = vop_stdadvlockasync, @@ -326,6 +331,16 @@ out: } int +vop_stdaccess(struct vop_access_args *ap) +{ + + KASSERT((ap->a_accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | + VAPPEND)) == 0, ("invalid bit in accmode")); + + return (VOP_ACCESSX(ap->a_vp, ap->a_accmode, ap->a_cred, ap->a_td)); +} + +int vop_stdaccessx(struct vop_accessx_args *ap) { int error; Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Thu Oct 1 17:12:52 2009 (r197679) +++ head/sys/kern/vfs_subr.c Thu Oct 1 17:22:03 2009 (r197680) @@ -3520,6 +3520,9 @@ vaccess(enum vtype type, mode_t file_mod accmode_t dac_granted; accmode_t priv_granted; + KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND)) == 0, + ("invalid bit in accmode")); + /* * Look for a normal, non-privileged way to access the file/directory * as requested. If it exists, go with that. Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Thu Oct 1 17:12:52 2009 (r197679) +++ head/sys/sys/vnode.h Thu Oct 1 17:22:03 2009 (r197680) @@ -685,6 +685,7 @@ int vop_stdlock(struct vop_lock1_args *) int vop_stdputpages(struct vop_putpages_args *); int vop_stdunlock(struct vop_unlock_args *); int vop_nopoll(struct vop_poll_args *); +int vop_stdaccess(struct vop_access_args *ap); int vop_stdaccessx(struct vop_accessx_args *ap); int vop_stdadvlock(struct vop_advlock_args *ap); int vop_stdadvlockasync(struct vop_advlockasync_args *ap);