From owner-svn-src-stable-8@FreeBSD.ORG Wed Apr 27 03:16:01 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A2091065670; Wed, 27 Apr 2011 03:16:01 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7E3A68FC0A; Wed, 27 Apr 2011 03:16:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3R3G10D051505; Wed, 27 Apr 2011 03:16:01 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3R3G1ii051503; Wed, 27 Apr 2011 03:16:01 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201104270316.p3R3G1ii051503@svn.freebsd.org> From: Rick Macklem Date: Wed, 27 Apr 2011 03:16:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221111 - stable/8/sys/fs/nfsclient X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2011 03:16:01 -0000 Author: rmacklem Date: Wed Apr 27 03:16:01 2011 New Revision: 221111 URL: http://svn.freebsd.org/changeset/base/221111 Log: MFC: r220611 Add VOP_PATHCONF() support to the experimental NFS client so that it can, along with other things, report whether or not NFS4 ACLs are supported. Modified: 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/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Wed Apr 27 02:55:03 2011 (r221110) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Wed Apr 27 03:16:01 2011 (r221111) @@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$"); #define FALSE 0 extern struct nfsstats newnfsstats; +extern int nfsrv_useacl; MALLOC_DECLARE(M_NEWNFSREQ); /* @@ -103,6 +104,7 @@ static vop_lookup_t nfs_lookup; static vop_create_t nfs_create; static vop_mknod_t nfs_mknod; static vop_open_t nfs_open; +static vop_pathconf_t nfs_pathconf; static vop_close_t nfs_close; static vop_access_t nfs_access; static vop_getattr_t nfs_getattr; @@ -153,6 +155,7 @@ struct vop_vector newnfs_vnodeops = { .vop_mkdir = nfs_mkdir, .vop_mknod = nfs_mknod, .vop_open = nfs_open, + .vop_pathconf = nfs_pathconf, .vop_print = nfs_print, .vop_read = nfs_read, .vop_readdir = nfs_readdir, @@ -3247,3 +3250,115 @@ nfs_setacl(struct vop_setacl_args *ap) } #endif /* NFS4_ACL_EXTATTR_NAME */ + +/* + * Return POSIX pathconf information applicable to nfs filesystems. + */ +static int +nfs_pathconf(struct vop_pathconf_args *ap) +{ + struct nfsv3_pathconf pc; + struct nfsvattr nfsva; + struct vnode *vp = ap->a_vp; + struct thread *td = curthread; + int attrflag, error; + + if (NFS_ISV34(vp)) { + error = nfsrpc_pathconf(vp, &pc, td->td_ucred, td, &nfsva, + &attrflag, NULL); + if (attrflag != 0) + (void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, + 1); + if (error != 0) + return (error); + } else { + /* For NFSv2, just fake them. */ + pc.pc_linkmax = LINK_MAX; + pc.pc_namemax = NFS_MAXNAMLEN; + pc.pc_notrunc = 1; + pc.pc_chownrestricted = 1; + pc.pc_caseinsensitive = 0; + pc.pc_casepreserving = 1; + error = 0; + } + switch (ap->a_name) { + case _PC_LINK_MAX: + *ap->a_retval = pc.pc_linkmax; + break; + case _PC_NAME_MAX: + *ap->a_retval = pc.pc_namemax; + break; + case _PC_PATH_MAX: + *ap->a_retval = PATH_MAX; + break; + case _PC_PIPE_BUF: + *ap->a_retval = PIPE_BUF; + break; + case _PC_CHOWN_RESTRICTED: + *ap->a_retval = pc.pc_chownrestricted; + break; + case _PC_NO_TRUNC: + *ap->a_retval = pc.pc_notrunc; + break; + case _PC_ACL_EXTENDED: + *ap->a_retval = 0; + break; + case _PC_ACL_NFS4: + if (NFS_ISV4(vp) && nfsrv_useacl != 0 && attrflag != 0 && + NFSISSET_ATTRBIT(&nfsva.na_suppattr, NFSATTRBIT_ACL)) + *ap->a_retval = 1; + else + *ap->a_retval = 0; + break; + case _PC_ACL_PATH_MAX: + if (NFS_ISV4(vp)) + *ap->a_retval = ACL_MAX_ENTRIES; + else + *ap->a_retval = 3; + break; + case _PC_MAC_PRESENT: + *ap->a_retval = 0; + break; + case _PC_ASYNC_IO: + /* _PC_ASYNC_IO should have been handled by upper layers. */ + KASSERT(0, ("_PC_ASYNC_IO should not get here")); + error = EINVAL; + break; + case _PC_PRIO_IO: + *ap->a_retval = 0; + break; + case _PC_SYNC_IO: + *ap->a_retval = 0; + break; + case _PC_ALLOC_SIZE_MIN: + *ap->a_retval = vp->v_mount->mnt_stat.f_bsize; + break; + case _PC_FILESIZEBITS: + if (NFS_ISV34(vp)) + *ap->a_retval = 64; + else + *ap->a_retval = 32; + break; + case _PC_REC_INCR_XFER_SIZE: + *ap->a_retval = vp->v_mount->mnt_stat.f_iosize; + break; + case _PC_REC_MAX_XFER_SIZE: + *ap->a_retval = -1; /* means ``unlimited'' */ + break; + case _PC_REC_MIN_XFER_SIZE: + *ap->a_retval = vp->v_mount->mnt_stat.f_iosize; + break; + case _PC_REC_XFER_ALIGN: + *ap->a_retval = PAGE_SIZE; + break; + case _PC_SYMLINK_MAX: + *ap->a_retval = NFS_MAXPATHLEN; + break; + + default: + error = EINVAL; + break; + } + return (error); +} +