Date: Fri, 29 Apr 2011 17:57:36 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r221212 - in stable/8/sys/fs: nfs nfsclient Message-ID: <201104291757.p3THva0n009126@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rmacklem Date: Fri Apr 29 17:57:35 2011 New Revision: 221212 URL: http://svn.freebsd.org/changeset/base/221212 Log: MFC: r200069 Remove unneeded ifdefs. MFC'd with trasz@'s permission. Modified: stable/8/sys/fs/nfs/nfs_commonacl.c stable/8/sys/fs/nfs/nfs_commonport.c stable/8/sys/fs/nfs/nfs_commonsubs.c stable/8/sys/fs/nfs/nfs_var.h stable/8/sys/fs/nfs/nfsport.h stable/8/sys/fs/nfsclient/nfs_clrpcops.c stable/8/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfs/nfs_commonacl.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonacl.c Fri Apr 29 17:04:52 2011 (r221211) +++ stable/8/sys/fs/nfs/nfs_commonacl.c Fri Apr 29 17:57:35 2011 (r221212) @@ -37,7 +37,6 @@ extern int nfsrv_useacl; static int nfsrv_acemasktoperm(u_int32_t acetype, u_int32_t mask, int owner, enum vtype type, acl_perm_t *permp); -#if defined(NFS4_ACL_EXTATTR_NAME) /* * Handle xdr for an ace. */ @@ -263,189 +262,7 @@ nfsrv_acemasktoperm(u_int32_t acetype, u *permp = perm; return (0); } -#else -/* - * Handle xdr for an ace. - */ -APPLESTATIC int -nfsrv_dissectace(struct nfsrv_descript *nd, struct acl_entry *acep, - int *aceerrp, int *acesizep, NFSPROC_T *p) -{ - u_int32_t *tl; - int len, gotid = 0, owner = 0, error = 0, aceerr = 0; - u_char *name, namestr[NFSV4_SMALLSTR + 1]; - u_int32_t flag, mask, acetype; - gid_t gid; - uid_t uid; - - *aceerrp = 0; - NFSM_DISSECT(tl, u_int32_t *, 4 * NFSX_UNSIGNED); - acetype = fxdr_unsigned(u_int32_t, *tl++); - flag = fxdr_unsigned(u_int32_t, *tl++); - mask = fxdr_unsigned(u_int32_t, *tl++); - len = fxdr_unsigned(int, *tl); - if (len < 0) { - return (NFSERR_BADXDR); - } else if (len == 0) { - /* Netapp filers return a 0 length who for nil users */ - acep->ae_tag = ACL_UNDEFINED_TAG; - acep->ae_id = ACL_UNDEFINED_ID; - acep->ae_perm = (acl_perm_t)0; - if (acesizep) - *acesizep = 4 * NFSX_UNSIGNED; - return (0); - } - if (len > NFSV4_SMALLSTR) - name = malloc(len + 1, M_NFSSTRING, M_WAITOK); - else - name = namestr; - error = nfsrv_mtostr(nd, name, len); - if (error) { - if (len > NFSV4_SMALLSTR) - free(name, M_NFSSTRING); - return (error); - } - if (len == 6) { - if (!NFSBCMP(name, "OWNER@", 6)) { - acep->ae_tag = ACL_USER_OBJ; - acep->ae_id = ACL_UNDEFINED_ID; - owner = 1; - gotid = 1; - } else if (!NFSBCMP(name, "GROUP@", 6)) { - acep->ae_tag = ACL_GROUP_OBJ; - acep->ae_id = ACL_UNDEFINED_ID; - gotid = 1; - flag &= ~NFSV4ACE_IDENTIFIERGROUP; - } - } else if (len == 9 && !NFSBCMP(name, "EVERYONE@", 9)) { - acep->ae_tag = ACL_OTHER; - acep->ae_id = ACL_UNDEFINED_ID; - gotid = 1; - } - if (!gotid) { - if (flag & NFSV4ACE_IDENTIFIERGROUP) { - flag &= ~NFSV4ACE_IDENTIFIERGROUP; - acep->ae_tag = ACL_GROUP; - aceerr = nfsv4_strtogid(name, len, &gid, p); - if (!aceerr) - acep->ae_id = (uid_t)gid; - } else { - acep->ae_tag = ACL_USER; - aceerr = nfsv4_strtouid(name, len, &uid, p); - if (!aceerr) - acep->ae_id = uid; - } - } - if (len > NFSV4_SMALLSTR) - free(name, M_NFSSTRING); - - /* - * Now, check for unsupported types or flag bits. - */ - if (!aceerr && ((acetype != NFSV4ACE_ALLOWEDTYPE && - acetype != NFSV4ACE_AUDITTYPE && acetype != NFSV4ACE_ALARMTYPE - && acetype != NFSV4ACE_DENIEDTYPE) || flag)) - aceerr = NFSERR_ATTRNOTSUPP; - - /* - * And turn the mask into perm bits. - */ - if (!aceerr) - aceerr = nfsrv_acemasktoperm(acetype, mask, owner, VREG, - &acep->ae_perm); - *aceerrp = aceerr; - if (acesizep) - *acesizep = NFSM_RNDUP(len) + (4 * NFSX_UNSIGNED); - return (0); -nfsmout: - return (error); -} - -/* - * Turn an NFSv4 ace mask into R/W/X flag bits. - */ -static int -nfsrv_acemasktoperm(u_int32_t acetype, u_int32_t mask, int owner, - enum vtype type, acl_perm_t *permp) -{ - acl_perm_t perm = 0x0; - - if (acetype != NFSV4ACE_ALLOWEDTYPE && acetype != NFSV4ACE_DENIEDTYPE){ - if (mask & ~NFSV4ACE_AUDITMASK) - return (NFSERR_ATTRNOTSUPP); - } - if (mask & NFSV4ACE_DELETE) { - return (NFSERR_ATTRNOTSUPP); - } - if (acetype == NFSV4ACE_DENIEDTYPE) { - if (mask & NFSV4ACE_ALLFILESMASK) { - return (NFSERR_ATTRNOTSUPP); - } - if (owner) { - if (mask & NFSV4ACE_OWNERMASK) { - return (NFSERR_ATTRNOTSUPP); - } - } else { - if ((mask & NFSV4ACE_OWNERMASK) != NFSV4ACE_OWNERMASK) { - return (NFSERR_ATTRNOTSUPP); - } - mask &= ~NFSV4ACE_OWNERMASK; - } - } else if (acetype == NFSV4ACE_ALLOWEDTYPE) { - if ((mask & NFSV4ACE_ALLFILESMASK) != NFSV4ACE_ALLFILESMASK) { - return (NFSERR_ATTRNOTSUPP); - } - mask &= ~NFSV4ACE_ALLFILESMASK; - if (owner) { - if ((mask & NFSV4ACE_OWNERMASK) != NFSV4ACE_OWNERMASK) { - return (NFSERR_ATTRNOTSUPP); - } - mask &= ~NFSV4ACE_OWNERMASK; - } else if (mask & NFSV4ACE_OWNERMASK) { - return (NFSERR_ATTRNOTSUPP); - } - } - if (type == VDIR) { - if ((mask & NFSV4ACE_DIRREADMASK) == NFSV4ACE_DIRREADMASK) { - perm |= ACL_READ; - mask &= ~NFSV4ACE_DIRREADMASK; - } - if ((mask & NFSV4ACE_DIRWRITEMASK) == NFSV4ACE_DIRWRITEMASK) { - perm |= ACL_WRITE; - mask &= ~NFSV4ACE_DIRWRITEMASK; - } - if ((mask & NFSV4ACE_DIREXECUTEMASK)==NFSV4ACE_DIREXECUTEMASK){ - perm |= ACL_EXECUTE; - mask &= ~NFSV4ACE_DIREXECUTEMASK; - } - } else { - if (acetype == NFSV4ACE_DENIEDTYPE && - (mask & NFSV4ACE_SYNCHRONIZE)) { - return (NFSERR_ATTRNOTSUPP); - } - mask &= ~(NFSV4ACE_SYNCHRONIZE | NFSV4ACE_DELETECHILD); - if ((mask & NFSV4ACE_READMASK) == NFSV4ACE_READMASK) { - perm |= ACL_READ; - mask &= ~NFSV4ACE_READMASK; - } - if ((mask & NFSV4ACE_WRITEMASK) == NFSV4ACE_WRITEMASK) { - perm |= ACL_WRITE; - mask &= ~NFSV4ACE_WRITEMASK; - } - if ((mask & NFSV4ACE_EXECUTEMASK) == NFSV4ACE_EXECUTEMASK) { - perm |= ACL_EXECUTE; - mask &= ~NFSV4ACE_EXECUTEMASK; - } - } - if (mask) { - return (NFSERR_ATTRNOTSUPP); - } - *permp = perm; - return (0); -} -#endif /* !NFS4_ACL_EXTATTR_NAME */ -#ifdef NFS4_ACL_EXTATTR_NAME /* local functions */ static int nfsrv_buildace(struct nfsrv_descript *, u_char *, int, enum vtype, int, int, struct acl_entry *); @@ -678,5 +495,3 @@ nfsrv_compareacl(NFSACL_T *aclp1, NFSACL } return (0); } - -#endif /* NFS4_ACL_EXTATTR_NAME */ Modified: stable/8/sys/fs/nfs/nfs_commonport.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonport.c Fri Apr 29 17:04:52 2011 (r221211) +++ stable/8/sys/fs/nfs/nfs_commonport.c Fri Apr 29 17:57:35 2011 (r221212) @@ -432,7 +432,6 @@ newnfs_portinit(void) mtx_init(&nfs_state_mutex, "nfs_state_mutex", NULL, MTX_DEF); } -#ifdef NFS4_ACL_EXTATTR_NAME /* * Determine if the file system supports NFSv4 ACLs. * Return 1 if it does, 0 otherwise. @@ -452,7 +451,6 @@ nfs_supportsnfsv4acls(struct mount *mp) } return (0); } -#endif /* NFS4_ACL_EXTATTR_NAME */ extern int (*nfsd_call_nfscommon)(struct thread *, struct nfssvc_args *); Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonsubs.c Fri Apr 29 17:04:52 2011 (r221211) +++ stable/8/sys/fs/nfs/nfs_commonsubs.c Fri Apr 29 17:57:35 2011 (r221212) @@ -650,10 +650,8 @@ nfsrv_dissectacl(struct nfsrv_descript * int acecnt, error = 0, aceerr = 0, acesize; *aclerrp = 0; -#ifdef NFS4_ACL_EXTATTR_NAME if (aclp) aclp->acl_cnt = 0; -#endif /* * Parse out the ace entries and expect them to conform to * what can be supported by R/W/X bits. @@ -661,28 +659,22 @@ nfsrv_dissectacl(struct nfsrv_descript * NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); aclsize = NFSX_UNSIGNED; acecnt = fxdr_unsigned(int, *tl); -#ifdef NFS4_ACL_EXTATTR_NAME if (acecnt > ACL_MAX_ENTRIES) aceerr = 1; -#endif if (nfsrv_useacl == 0) aceerr = 1; for (i = 0; i < acecnt; i++) { -#ifdef NFS4_ACL_EXTATTR_NAME if (aclp && !aceerr) error = nfsrv_dissectace(nd, &aclp->acl_entry[i], &aceerr, &acesize, p); else -#endif error = nfsrv_skipace(nd, &acesize); if (error) return (error); aclsize += acesize; } -#ifdef NFS4_ACL_EXTATTR_NAME if (aclp && !aceerr) aclp->acl_cnt = acecnt; -#endif if (aceerr) *aclerrp = aceerr; if (aclsizep) @@ -1014,7 +1006,6 @@ nfsv4_loadattr(struct nfsrv_descript *nd case NFSATTRBIT_ACL: if (compare) { if (!(*retcmpp)) { -#ifdef NFS4_ACL_EXTATTR_NAME if (nfsrv_useacl) { NFSACL_T *naclp; @@ -1028,9 +1019,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd if (aceerr || nfsrv_compareacl(aclp, naclp)) *retcmpp = NFSERR_NOTSAME; acl_free(naclp); - } else -#endif - { + } else { error = nfsrv_dissectacl(nd, NULL, &aceerr, &cnt, p); *retcmpp = NFSERR_ATTRNOTSUPP; @@ -1960,9 +1949,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd aclp = saclp; } else { NFSCLRNOTFILLABLE_ATTRBIT(retbitp); -#ifdef NFS4_ACL_EXTATTR_NAME naclp = acl_alloc(M_WAITOK); -#endif aclp = naclp; } nfsvno_getfs(&fsinf, isdgram); @@ -1985,21 +1972,15 @@ nfsv4_fillattr(struct nfsrv_descript *nd /* * And the NFSv4 ACL... */ - if (NFSISSET_ATTRBIT(retbitp, NFSATTRBIT_ACLSUPPORT) -#ifdef NFS4_ACL_EXTATTR_NAME - && (nfsrv_useacl == 0 || ((cred != NULL || p != NULL) && - !NFSHASNFS4ACL(vnode_mount(vp)))) -#endif - ) { + if (NFSISSET_ATTRBIT(retbitp, NFSATTRBIT_ACLSUPPORT) && + (nfsrv_useacl == 0 || ((cred != NULL || p != NULL) && + !NFSHASNFS4ACL(vnode_mount(vp))))) { NFSCLRBIT_ATTRBIT(retbitp, NFSATTRBIT_ACLSUPPORT); } if (NFSISSET_ATTRBIT(retbitp, NFSATTRBIT_ACL)) { -#ifdef NFS4_ACL_EXTATTR_NAME if (nfsrv_useacl == 0 || ((cred != NULL || p != NULL) && !NFSHASNFS4ACL(vnode_mount(vp)))) { -#endif NFSCLRBIT_ATTRBIT(retbitp, NFSATTRBIT_ACL); -#ifdef NFS4_ACL_EXTATTR_NAME } else if (naclp != NULL) { if (vn_lock(vp, LK_SHARED) == 0) { error = VOP_ACCESSX(vp, VREAD_ACL, cred, p); @@ -2017,7 +1998,6 @@ nfsv4_fillattr(struct nfsrv_descript *nd NFSCLRBIT_ATTRBIT(retbitp, NFSATTRBIT_ACL); } } -#endif } /* * Put out the attribute bitmap for the ones being filled in @@ -2035,11 +2015,8 @@ nfsv4_fillattr(struct nfsrv_descript *nd switch (bitpos) { case NFSATTRBIT_SUPPORTEDATTRS: NFSSETSUPP_ATTRBIT(&attrbits); -#ifdef NFS4_ACL_EXTATTR_NAME if (nfsrv_useacl == 0 || ((cred != NULL || p != NULL) - && !NFSHASNFS4ACL(vnode_mount(vp)))) -#endif - { + && !NFSHASNFS4ACL(vnode_mount(vp)))) { NFSCLRBIT_ATTRBIT(&attrbits,NFSATTRBIT_ACLSUPPORT); NFSCLRBIT_ATTRBIT(&attrbits,NFSATTRBIT_ACL); } @@ -2112,7 +2089,6 @@ nfsv4_fillattr(struct nfsrv_descript *nd /* * Recommended Attributes. (Only the supported ones.) */ -#ifdef NFS4_ACL_EXTATTR_NAME case NFSATTRBIT_ACL: retnum += nfsrv_buildacl(nd, aclp, vnode_vtype(vp), p); break; @@ -2121,7 +2097,6 @@ nfsv4_fillattr(struct nfsrv_descript *nd *tl = txdr_unsigned(NFSV4ACE_SUPTYPES); retnum += NFSX_UNSIGNED; break; -#endif case NFSATTRBIT_CANSETTIME: NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); if (fsinf.fs_properties & NFSV3FSINFO_CANSETTIME) @@ -2427,10 +2402,8 @@ nfsv4_fillattr(struct nfsrv_descript *nd }; } } -#ifdef NFS4_ACL_EXTATTR_NAME if (naclp != NULL) acl_free(naclp); -#endif *retnump = txdr_unsigned(retnum); return (retnum + prefixnum); } Modified: stable/8/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/8/sys/fs/nfs/nfs_var.h Fri Apr 29 17:04:52 2011 (r221211) +++ stable/8/sys/fs/nfs/nfs_var.h Fri Apr 29 17:57:35 2011 (r221212) @@ -332,13 +332,11 @@ void newnfs_timer(void *); /* nfs_commonacl.c */ int nfsrv_dissectace(struct nfsrv_descript *, struct acl_entry *, int *, int *, NFSPROC_T *); -#ifdef NFS4_ACL_EXTATTR_NAME int nfsrv_buildacl(struct nfsrv_descript *, NFSACL_T *, enum vtype, NFSPROC_T *); int nfsrv_setacl(vnode_t, NFSACL_T *, struct ucred *, NFSPROC_T *); int nfsrv_compareacl(NFSACL_T *, NFSACL_T *); -#endif /* nfs_clrpcops.c */ int nfsrpc_null(vnode_t, struct ucred *, NFSPROC_T *); Modified: stable/8/sys/fs/nfs/nfsport.h ============================================================================== --- stable/8/sys/fs/nfs/nfsport.h Fri Apr 29 17:04:52 2011 (r221211) +++ stable/8/sys/fs/nfs/nfsport.h Fri Apr 29 17:57:35 2011 (r221212) @@ -125,11 +125,7 @@ #define NFSPROC_T struct thread #define NFSDEV_T dev_t #define NFSSVCARGS nfssvc_args -#ifdef NFS4_ACL_EXTATTR_NAME #define NFSACL_T struct acl -#else -#define NFSACL_T void -#endif /* * These should be defined as the types used for the corresponding VOP's Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clrpcops.c Fri Apr 29 17:04:52 2011 (r221211) +++ stable/8/sys/fs/nfsclient/nfs_clrpcops.c Fri Apr 29 17:57:35 2011 (r221212) @@ -81,10 +81,8 @@ static int nfsrpc_createv4(vnode_t , cha static int nfsrpc_locku(struct nfsrv_descript *, struct nfsmount *, struct nfscllockowner *, u_int64_t, u_int64_t, u_int32_t, struct ucred *, NFSPROC_T *, int); -#ifdef NFS4_ACL_EXTATTR_NAME static int nfsrpc_setaclrpc(vnode_t, struct ucred *, NFSPROC_T *, struct acl *, nfsv4stateid_t *, void *); -#endif /* * nfs null call from vfs. @@ -998,14 +996,9 @@ nfsrpc_setattr(vnode_t vp, struct vattr if (vap != NULL) error = nfsrpc_setattrrpc(vp, vap, &stateid, cred, p, rnap, attrflagp, stuff); -#ifdef NFS4_ACL_EXTATTR_NAME else error = nfsrpc_setaclrpc(vp, cred, p, aclp, &stateid, stuff); -#else - else - error = EOPNOTSUPP; -#endif if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(nmp->nm_clp); if (lckp != NULL) @@ -4119,7 +4112,6 @@ nfsrpc_delegreturn(struct nfscldeleg *dp return (error); } -#ifdef NFS4_ACL_EXTATTR_NAME /* * nfs getacl call. */ @@ -4193,5 +4185,3 @@ nfsrpc_setaclrpc(vnode_t vp, struct ucre mbuf_freem(nd->nd_mrep); return (nd->nd_repstat); } - -#endif /* NFS4_ACL_EXTATTR_NAME */ Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Fri Apr 29 17:04:52 2011 (r221211) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Fri Apr 29 17:57:35 2011 (r221212) @@ -129,10 +129,8 @@ static vop_readlink_t nfs_readlink; static vop_print_t nfs_print; static vop_advlock_t nfs_advlock; static vop_advlockasync_t nfs_advlockasync; -#ifdef NFS4_ACL_EXTATTR_NAME static vop_getacl_t nfs_getacl; static vop_setacl_t nfs_setacl; -#endif /* * Global vfs data structures for nfs @@ -168,10 +166,8 @@ struct vop_vector newnfs_vnodeops = { .vop_strategy = nfs_strategy, .vop_symlink = nfs_symlink, .vop_write = ncl_write, -#ifdef NFS4_ACL_EXTATTR_NAME .vop_getacl = nfs_getacl, .vop_setacl = nfs_setacl, -#endif }; struct vop_vector newnfs_fifoops = { @@ -329,12 +325,9 @@ nfs_access(struct vop_access_args *ap) * unless the file is a socket, fifo, or a block or character * device resident on the filesystem. */ - if ((ap->a_accmode & (VWRITE | VAPPEND -#ifdef NFS4_ACL_EXTATTR_NAME - | VWRITE_NAMED_ATTRS | VDELETE_CHILD | VWRITE_ATTRIBUTES | - VDELETE | VWRITE_ACL | VWRITE_OWNER -#endif - )) != 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) != 0) { + if ((ap->a_accmode & (VWRITE | VAPPEND | VWRITE_NAMED_ATTRS | + VDELETE_CHILD | VWRITE_ATTRIBUTES | VDELETE | VWRITE_ACL | + VWRITE_OWNER)) != 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) != 0) { switch (vp->v_type) { case VREG: case VDIR: @@ -364,10 +357,8 @@ nfs_access(struct vop_access_args *ap) mode |= NFSACCESS_EXTEND; if (ap->a_accmode & VEXEC) mode |= NFSACCESS_EXECUTE; -#ifdef NFS4_ACL_EXTATTR_NAME if (ap->a_accmode & VDELETE) mode |= NFSACCESS_DELETE; -#endif } else { if (ap->a_accmode & VWRITE) mode |= (NFSACCESS_MODIFY | NFSACCESS_EXTEND); @@ -375,12 +366,10 @@ nfs_access(struct vop_access_args *ap) mode |= NFSACCESS_EXTEND; if (ap->a_accmode & VEXEC) mode |= NFSACCESS_LOOKUP; -#ifdef NFS4_ACL_EXTATTR_NAME if (ap->a_accmode & VDELETE) mode |= NFSACCESS_DELETE; if (ap->a_accmode & VDELETE_CHILD) mode |= NFSACCESS_MODIFY; -#endif } /* XXX safety belt, only make blanket request if caching */ if (nfsaccess_cache_timeout > 0) { @@ -3216,7 +3205,6 @@ nfs_lock1(struct vop_lock1_args *ap) ap->a_line)); } -#ifdef NFS4_ACL_EXTATTR_NAME static int nfs_getacl(struct vop_getacl_args *ap) { @@ -3249,8 +3237,6 @@ nfs_setacl(struct vop_setacl_args *ap) return (error); } -#endif /* NFS4_ACL_EXTATTR_NAME */ - /* * Return POSIX pathconf information applicable to nfs filesystems. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104291757.p3THva0n009126>