Date: Mon, 30 Mar 2009 15:12:11 GMT From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 160011 for review Message-ID: <200903301512.n2UFCBvT005267@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=160011 Change 160011 by trasz@trasz_victim7 on 2009/03/30 15:11:35 Simplify vfs_unixify_accmode() usage. Completely untested. Affected files ... .. //depot/projects/soc2008/trasz_nfs4acl/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c#16 edit .. //depot/projects/soc2008/trasz_nfs4acl/sys/kern/subr_acl_posix1e.c#12 edit .. //depot/projects/soc2008/trasz_nfs4acl/sys/kern/vfs_subr.c#28 edit .. //depot/projects/soc2008/trasz_nfs4acl/sys/sys/vnode.h#24 edit Differences ... ==== //depot/projects/soc2008/trasz_nfs4acl/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c#16 (text+ko) ==== @@ -3969,7 +3969,8 @@ int error; accmode_t accmode = ap->a_accmode; - if (vfs_unixify_accmode(&accmode, &error)) + error = vfs_unixify_accmode(&accmode); + if (error != 0) return (error); /* ==== //depot/projects/soc2008/trasz_nfs4acl/sys/kern/subr_acl_posix1e.c#12 (text+ko) ==== @@ -71,7 +71,8 @@ if (privused != NULL) *privused = 0; - if (vfs_unixify_accmode(&accmode, &error)) + error = vfs_unixify_accmode(&accmode); + if (error != 0) return (error); /* ==== //depot/projects/soc2008/trasz_nfs4acl/sys/kern/vfs_subr.c#28 (text+ko) ==== @@ -3548,7 +3548,8 @@ dac_granted = 0; - if (vfs_unixify_accmode(&accmode, &error)) + error = vfs_unixify_accmode(&accmode); + if (error != 0) return (error); /* Check the owner. */ @@ -4278,26 +4279,28 @@ * reducing it into standard unix access bits - VEXEC, VREAD, VWRITE * and VADMIN. * - * This routine is supposed to be called from the beginning of vaccess + * This routine is supposed to be called at the beginning of vaccess * implementations that don't know anything about granularity. If it - * returns 1, then the caller is supposed to return whatever this routine - * puts into variable pointed to by "error". + * returns 0, then the caller is supposed to continue with the usual + * access checks using 'accmode' as modified by this routine. If it + * returns nonzero value, the caller is supposed to return that value + * as errno. + * + * Note that after this routine runs, accmode may be zero. */ int -vfs_unixify_accmode(accmode_t *accmode, int *error) +vfs_unixify_accmode(accmode_t *accmode) { /* * Unix does not provide any explicit "deny" access rules. */ if (*accmode & VEXPLICIT_DENY) { - *error = 0; - return (1); + *accmode = 0; + return (0); } - if (*accmode & (VDELETE_CHILD | VDELETE)) { - *error = EPERM; - return (1); - } + if (*accmode & (VDELETE_CHILD | VDELETE)) + return (EPERM); if (*accmode & VADMIN_PERMS) { *accmode &= ~VADMIN_PERMS; @@ -4306,11 +4309,5 @@ *accmode &= ~(VSTAT_PERMS | VSYNCHRONIZE); - if (*accmode == 0) { - *error = 0; - return (1); - } - return (0); } - ==== //depot/projects/soc2008/trasz_nfs4acl/sys/sys/vnode.h#24 (text+ko) ==== @@ -625,7 +625,7 @@ int vaccess_acl_nfs4(enum vtype type, uid_t file_uid, gid_t file_gid, struct acl *acl, accmode_t accmode, struct ucred *cred, int *privused); -int vfs_unixify_accmode(accmode_t *accmode, int *error); +int vfs_unixify_accmode(accmode_t *accmode); void vattr_null(struct vattr *vap); int vcount(struct vnode *vp); void vdrop(struct vnode *);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903301512.n2UFCBvT005267>
