Module Name:    src
Committed By:   pgoyette
Date:           Tue Dec 13 22:52:46 UTC 2016

Modified Files:
        src/sys/fs/nfs/common: bootp_subr.c krpc.h nfs.h nfs_mountcommon.h
            nfs_var.h nfsclstate.h nfsm_subs.h nfsport.h nfsrvcache.h
            nfsrvstate.h

Log Message:
Mostly mechanical updates for caddr_t, thread, mutex, and credentials


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/nfs/common/bootp_subr.c \
    src/sys/fs/nfs/common/nfsport.h
cvs rdiff -u -r1.1.1.1 -r1.2 src/sys/fs/nfs/common/krpc.h \
    src/sys/fs/nfs/common/nfs_mountcommon.h
cvs rdiff -u -r1.1.1.2 -r1.2 src/sys/fs/nfs/common/nfs.h \
    src/sys/fs/nfs/common/nfs_var.h src/sys/fs/nfs/common/nfsclstate.h \
    src/sys/fs/nfs/common/nfsrvcache.h src/sys/fs/nfs/common/nfsrvstate.h
cvs rdiff -u -r1.3 -r1.4 src/sys/fs/nfs/common/nfsm_subs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/nfs/common/bootp_subr.c
diff -u src/sys/fs/nfs/common/bootp_subr.c:1.2 src/sys/fs/nfs/common/bootp_subr.c:1.3
--- src/sys/fs/nfs/common/bootp_subr.c:1.2	Fri Nov 18 22:37:50 2016
+++ src/sys/fs/nfs/common/bootp_subr.c	Tue Dec 13 22:52:46 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootp_subr.c,v 1.2 2016/11/18 22:37:50 pgoyette Exp $	*/
+/*	$NetBSD: bootp_subr.c,v 1.3 2016/12/13 22:52:46 pgoyette Exp $	*/
 /*-
  * Copyright (c) 1995 Gordon Ross, Adam Glass
  * Copyright (c) 1992 Regents of the University of California.
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 /* __FBSDID("FreeBSD: head/sys/nfs/bootp_subr.c 297326 2016-03-27 23:16:37Z ian "); */
-__RCSID("$NetBSD: bootp_subr.c,v 1.2 2016/11/18 22:37:50 pgoyette Exp $");
+__RCSID("$NetBSD: bootp_subr.c,v 1.3 2016/12/13 22:52:46 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_newnfs.h"
@@ -63,6 +63,14 @@ __RCSID("$NetBSD: bootp_subr.c,v 1.2 201
 #include <sys/socketvar.h>
 #include <sys/sysctl.h>
 #include <sys/uio.h>
+#include <sys/kauth.h>
+#include <sys/lwp.h>
+#include <sys/vnode.h>
+#include <sys/mutex.h>
+
+#if 0
+#include <src/include/rpc/auth.h>
+#endif
 
 #include <net/if.h>
 #include <net/route.h>
@@ -76,6 +84,10 @@ __RCSID("$NetBSD: bootp_subr.c,v 1.2 201
 #include <net/if_dl.h>
 
 #include <fs/nfs/common/nfsproto.h>
+#include <fs/nfs/common/nfsport.h>
+#include <fs/nfs/common/nfs.h>
+#include <fs/nfs/client/nfsmount.h>
+#include <fs/nfs/client/nfsnode.h>
 #include <fs/nfs/client/nfs.h>
 #include <fs/nfs/common/nfsdiskless.h>
 #include <fs/nfs/common/krpc.h>
@@ -236,13 +248,16 @@ struct bootpc_globalcontext {
 
 static char bootp_cookie[128];
 static struct socket *bootp_so;
+
+#if 0	/* Need to init sysctl variables in the module initialization code */
 SYSCTL_STRING(_kern, OID_AUTO, bootp_cookie, CTLFLAG_RD,
 	bootp_cookie, 0, "Cookie (T134) supplied by bootp server");
+#endif
 
 /* mountd RPC */
 static int	md_mount(struct sockaddr_in *mdsin, char *path, u_char *fhp,
-		    int *fhsizep, struct nfs_args *args, struct thread *td);
-static int	setfs(struct sockaddr_in *addr, char *path, char *p,
+		    int *fhsizep, struct nfs_args *args, struct lwp *td);
+static int	setmyfs(struct sockaddr_in *addr, char *path, char *p,
 		    const struct in_addr *siaddr);
 static int	getdec(char **ptr);
 static int	getip(char **ptr, struct in_addr *ip);
@@ -254,7 +269,7 @@ static void	print_sin_addr(struct sockad
 static void	clear_sinaddr(struct sockaddr_in *sin);
 static void	allocifctx(struct bootpc_globalcontext *gctx);
 static void	bootpc_compose_query(struct bootpc_ifcontext *ifctx,
-		    struct thread *td);
+		    struct lwp *td);
 static unsigned char *bootpc_tag(struct bootpc_tagcontext *tctx,
 		    struct bootp_packet *bp, int len, int tag);
 static void bootpc_tag_helper(struct bootpc_tagcontext *tctx,
@@ -270,13 +285,13 @@ void bootpboot_p_iflist(void);
 #endif
 
 static int	bootpc_call(struct bootpc_globalcontext *gctx,
-		    struct thread *td);
+		    struct lwp *td);
 
 static void	bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx,
-		    struct thread *td);
+		    struct lwp *td);
 
 static void	bootpc_adjust_interface(struct bootpc_ifcontext *ifctx,
-		    struct bootpc_globalcontext *gctx, struct thread *td);
+		    struct bootpc_globalcontext *gctx, struct lwp *td);
 
 static void	bootpc_decode_reply(struct nfsv3_diskless *nd,
 		    struct bootpc_ifcontext *ifctx,
@@ -577,7 +592,7 @@ bootpc_received(struct bootpc_globalcont
 }
 
 static int
-bootpc_call(struct bootpc_globalcontext *gctx, struct thread *td)
+bootpc_call(struct bootpc_globalcontext *gctx, struct lwp *td)
 {
 	struct sockaddr_in *sin, dst;
 	struct uio auio;
@@ -595,14 +610,10 @@ bootpc_call(struct bootpc_globalcontext 
 
 	tv.tv_sec = 1;
 	tv.tv_usec = 0;
-	bzero(&sopt, sizeof(sopt));
-	sopt.sopt_dir = SOPT_SET;
-	sopt.sopt_level = SOL_SOCKET;
-	sopt.sopt_name = SO_RCVTIMEO;
-	sopt.sopt_val = &tv;
-	sopt.sopt_valsize = sizeof tv;
+	sockopt_init(&sopt, SOL_SOCKET, SO_RCVTIMEO, sizeof(tv));
+	error = sockopt_set(&sopt, &tv, sizeof(tv));
+	sockopt_destroy(&sopt);
 
-	error = sosetopt(bootp_so, &sopt);
 	if (error != 0)
 		goto out;
 
@@ -610,11 +621,10 @@ bootpc_call(struct bootpc_globalcontext 
 	 * Enable broadcast.
 	 */
 	on = 1;
-	sopt.sopt_name = SO_BROADCAST;
-	sopt.sopt_val = &on;
-	sopt.sopt_valsize = sizeof on;
+	sockopt_init(&sopt, SOL_SOCKET, SO_BROADCAST, sizeof(on));
+	error = sockopt_set(&sopt, &on, sizeof(on));
+	sockopt_destroy(&sopt);
 
-	error = sosetopt(bootp_so, &sopt);
 	if (error != 0)
 		goto out;
 
@@ -623,11 +633,10 @@ bootpc_call(struct bootpc_globalcontext 
 	 */
 
 	on = 1;
-	sopt.sopt_name = SO_DONTROUTE;
-	sopt.sopt_val = &on;
-	sopt.sopt_valsize = sizeof on;
+	sockopt_init(&sopt, SOL_SOCKET, SO_DONTROUTE, sizeof(on));
+	error = sockopt_set(&sopt, &on, sizeof(on));
+	sockopt_destroy(&sopt);
 
-	error = sosetopt(bootp_so, &sopt);
 	if (error != 0)
 		goto out;
 
@@ -713,16 +722,15 @@ bootpc_call(struct bootpc_globalcontext 
 					break;
 				}
 				printf("Sending %s packet from "
-				       "interface %s (%*D)\n",
+				       "interface %s (%*ld):\n",
 				       s,
 				       ifctx->ireq.ifr_name,
 				       ifctx->sdl->sdl_alen,
-				       (unsigned char *) LLADDR(ifctx->sdl),
-				       ":");
+				       (unsigned char *) LLADDR(ifctx->sdl) );
 				ifctx->sentmsg = 1;
 			}
 
-			aio.iov_base = (caddr_t) &ifctx->call;
+			aio.iov_base = (void *) &ifctx->call;
 			aio.iov_len = sizeof(ifctx->call);
 
 			auio.uio_iov = &aio;
@@ -735,7 +743,7 @@ bootpc_call(struct bootpc_globalcontext 
 
 			/* Set netmask to 0.0.0.0 */
 			clear_sinaddr(sin);
-			error = ifioctl(bootp_so, SIOCAIFADDR, (caddr_t)ifra,
+			error = ifioctl(bootp_so, SIOCAIFADDR, (void *)ifra,
 			    td);
 			if (error != 0)
 				panic("%s: SIOCAIFADDR, error=%d", __func__,
@@ -749,7 +757,7 @@ bootpc_call(struct bootpc_globalcontext 
 
 			/* Set netmask to 255.0.0.0 */
 			sin->sin_addr.s_addr = htonl(IN_CLASSA_NET);
-			error = ifioctl(bootp_so, SIOCAIFADDR, (caddr_t)ifra,
+			error = ifioctl(bootp_so, SIOCAIFADDR, (void *)ifra,
 			    td);
 			if (error != 0)
 				panic("%s: SIOCAIFADDR, error=%d", __func__,
@@ -777,7 +785,7 @@ bootpc_call(struct bootpc_globalcontext 
 		 */
 		atimo = timo + time_second;
 		while (time_second < atimo) {
-			aio.iov_base = (caddr_t) &gctx->reply;
+			aio.iov_base = (void *) &gctx->reply;
 			aio.iov_len = sizeof(gctx->reply);
 
 			auio.uio_iov = &aio;
@@ -943,7 +951,7 @@ out:
 }
 
 static void
-bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, struct thread *td)
+bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, struct lwp *td)
 {
 	struct ifreq *ifr;
 	struct in_aliasreq *ifra;
@@ -959,11 +967,11 @@ bootpc_fakeup_interface(struct bootpc_if
 	 * Get the old interface flags and or IFF_UP into them; if
 	 * IFF_UP set blindly, interface selection can be clobbered.
 	 */
-	error = ifioctl(bootp_so, SIOCGIFFLAGS, (caddr_t)ifr, td);
+	error = ifioctl(bootp_so, SIOCGIFFLAGS, (void *)ifr, td);
 	if (error != 0)
 		panic("%s: SIOCGIFFLAGS, error=%d", __func__, error);
 	ifr->ifr_flags |= IFF_UP;
-	error = ifioctl(bootp_so, SIOCSIFFLAGS, (caddr_t)ifr, td);
+	error = ifioctl(bootp_so, SIOCSIFFLAGS, (void *)ifr, td);
 	if (error != 0)
 		panic("%s: SIOCSIFFLAGS, error=%d", __func__, error);
 
@@ -980,13 +988,13 @@ bootpc_fakeup_interface(struct bootpc_if
 	sin = (struct sockaddr_in *)&ifra->ifra_broadaddr;
 	clear_sinaddr(sin);
 	sin->sin_addr.s_addr = htonl(INADDR_BROADCAST);
-	error = ifioctl(bootp_so, SIOCAIFADDR, (caddr_t)ifra, td);
+	error = ifioctl(bootp_so, SIOCAIFADDR, (void *)ifra, td);
 	if (error != 0)
 		panic("%s: SIOCAIFADDR, error=%d", __func__, error);
 }
 
 static void
-bootpc_shutdown_interface(struct bootpc_ifcontext *ifctx, struct thread *td)
+bootpc_shutdown_interface(struct bootpc_ifcontext *ifctx, struct lwp *td)
 {
 	struct ifreq *ifr;
 	struct sockaddr_in *sin;
@@ -995,24 +1003,24 @@ bootpc_shutdown_interface(struct bootpc_
 	ifr = &ifctx->ireq;
 
 	printf("Shutdown interface %s\n", ifctx->ireq.ifr_name);
-	error = ifioctl(bootp_so, SIOCGIFFLAGS, (caddr_t)ifr, td);
+	error = ifioctl(bootp_so, SIOCGIFFLAGS, (void *)ifr, td);
 	if (error != 0)
 		panic("%s: SIOCGIFFLAGS, error=%d", __func__, error);
 	ifr->ifr_flags &= ~IFF_UP;
-	error = ifioctl(bootp_so, SIOCSIFFLAGS, (caddr_t)ifr, td);
+	error = ifioctl(bootp_so, SIOCSIFFLAGS, (void *)ifr, td);
 	if (error != 0)
 		panic("%s: SIOCSIFFLAGS, error=%d", __func__, error);
 
 	sin = (struct sockaddr_in *) &ifr->ifr_addr;
 	clear_sinaddr(sin);
-	error = ifioctl(bootp_so, SIOCDIFADDR, (caddr_t) ifr, td);
+	error = ifioctl(bootp_so, SIOCDIFADDR, (void *) ifr, td);
 	if (error != 0)
 		panic("%s: SIOCDIFADDR, error=%d", __func__, error);
 }
 
 static void
 bootpc_adjust_interface(struct bootpc_ifcontext *ifctx,
-    struct bootpc_globalcontext *gctx, struct thread *td)
+    struct bootpc_globalcontext *gctx, struct lwp *td)
 {
 	int error;
 	struct sockaddr_in *sin;
@@ -1039,7 +1047,7 @@ bootpc_adjust_interface(struct bootpc_if
 		printf(" (MTU=%d%s)", ifctx->mtu, 
 		    (ifctx->mtu > 1514) ? "/JUMBO" : "");
 		ifr->ifr_mtu = ifctx->mtu;
-		error = ifioctl(bootp_so, SIOCSIFMTU, (caddr_t) ifr, td);
+		error = ifioctl(bootp_so, SIOCSIFMTU, (void *) ifr, td);
 		if (error != 0)
 			panic("%s: SIOCSIFMTU, error=%d", __func__, error);
 	}
@@ -1051,7 +1059,7 @@ bootpc_adjust_interface(struct bootpc_if
 	 */
 	sin = (struct sockaddr_in *) &ifr->ifr_addr;
 	clear_sinaddr(sin);
-	error = ifioctl(bootp_so, SIOCDIFADDR, (caddr_t) ifr, td);
+	error = ifioctl(bootp_so, SIOCDIFADDR, (void *) ifr, td);
 	if (error != 0)
 		panic("%s: SIOCDIFADDR, error=%d", __func__, error);
 
@@ -1061,7 +1069,7 @@ bootpc_adjust_interface(struct bootpc_if
 	ifra->ifra_broadaddr.sin_addr.s_addr = myaddr->sin_addr.s_addr |
 	    ~netmask->sin_addr.s_addr;
 
-	error = ifioctl(bootp_so, SIOCAIFADDR, (caddr_t)ifra, td);
+	error = ifioctl(bootp_so, SIOCAIFADDR, (void *)ifra, td);
 	if (error != 0)
 		panic("%s: SIOCAIFADDR, error=%d", __func__, error);
 }
@@ -1109,7 +1117,7 @@ bootpc_remove_default_route(struct bootp
 }
 
 static int
-setfs(struct sockaddr_in *addr, char *path, char *p,
+setmyfs(struct sockaddr_in *addr, char *path, char *p,
     const struct in_addr *siaddr)
 {
 
@@ -1248,7 +1256,7 @@ print_in_addr(struct in_addr addr)
 }
 
 static void
-bootpc_compose_query(struct bootpc_ifcontext *ifctx, struct thread *td)
+bootpc_compose_query(struct bootpc_ifcontext *ifctx, struct lwp *td)
 {
 	unsigned char *vendp;
 	unsigned char vendor_client[64];
@@ -1257,7 +1265,7 @@ bootpc_compose_query(struct bootpc_ifcon
 
 	ifctx->gotrootpath = 0;
 
-	bzero((caddr_t) &ifctx->call, sizeof(ifctx->call));
+	bzero((void *) &ifctx->call, sizeof(ifctx->call));
 
 	/* bootpc part */
 	ifctx->call.op = BOOTP_REQUEST; 	/* BOOTREQUEST */
@@ -1414,7 +1422,6 @@ bootpc_decode_reply(struct nfsv3_diskles
     struct bootpc_globalcontext *gctx)
 {
 	char *p, *s;
-	unsigned int ip;
 
 	ifctx->gotgw = 0;
 	ifctx->gotnetmask = 0;
@@ -1425,8 +1432,6 @@ bootpc_decode_reply(struct nfsv3_diskles
 
 	ifctx->myaddr.sin_addr = ifctx->reply.yiaddr;
 
-	ip = ntohl(ifctx->myaddr.sin_addr.s_addr);
-
 	printf("%s at ", ifctx->ireq.ifr_name);
 	print_sin_addr(&ifctx->myaddr);
 	printf(" server ");
@@ -1509,7 +1514,7 @@ bootpc_decode_reply(struct nfsv3_diskles
 	if (p != NULL) {
 		if (gctx->setrootfs != NULL) {
 			printf("rootfs %s (ignored) ", p);
-		} else 	if (setfs(&nd->root_saddr,
+		} else 	if (setmyfs(&nd->root_saddr,
 				  nd->root_hostnam, p, &ifctx->reply.siaddr)) {
 			if (*p == '/') {
 				printf("root_server ");
@@ -1541,9 +1546,9 @@ bootpc_decode_reply(struct nfsv3_diskles
 			printf("hostname %s (ignored) ", p);
 		} else {
 			strcpy(nd->my_hostnam, p);
-			mtx_lock(&prison0.pr_mtx);
+			mutex_enter(&prison0.pr_mtx);
 			strcpy(prison0.pr_hostname, p);
-			mtx_unlock(&prison0.pr_mtx);
+			mutex_exit(&prison0.pr_mtx);
 			printf("hostname %s ", p);
 			gctx->sethostname = ifctx;
 		}
@@ -1588,7 +1593,7 @@ bootpc_init(void)
 	int ifcnt;
 #endif
 	struct nfsv3_diskless *nd;
-	struct thread *td;
+	struct lwp *td;
 	int timeout;
 	int delay;
 
@@ -1596,7 +1601,7 @@ bootpc_init(void)
 	delay = hz / 10;
 
 	nd = &nfsv3_diskless;
-	td = curthread;
+	td = curlwp;
 
 	/*
 	 * If already filled in, don't touch it here
@@ -1635,12 +1640,12 @@ bootpc_init(void)
 	 */
 	ifcnt = 0;
 	IFNET_RLOCK();
-	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
+	TAILQ_FOREACH(ifp, &V_ifnet, if_list) {
 		if ((ifp->if_flags &
 		     (IFF_LOOPBACK | IFF_POINTOPOINT | IFF_BROADCAST)) !=
 		    IFF_BROADCAST)
 			continue;
-		switch (ifp->if_alloctype) {
+		switch (ifp->if_type) {
 			case IFT_ETHER:
 			case IFT_FDDI:
 			case IFT_ISO88025:
@@ -1660,7 +1665,7 @@ bootpc_init(void)
 retry:
 	ifctx = STAILQ_FIRST(&gctx->interfaces);
 	IFNET_RLOCK();
-	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
+	TAILQ_FOREACH(ifp, &V_ifnet, if_list) {
 		if (ifctx == NULL)
 			break;
 #ifdef BOOTP_WIRED_TO
@@ -1671,7 +1676,7 @@ retry:
 		     (IFF_LOOPBACK | IFF_POINTOPOINT | IFF_BROADCAST)) !=
 		    IFF_BROADCAST)
 			continue;
-		switch (ifp->if_alloctype) {
+		switch (ifp->if_type) {
 			case IFT_ETHER:
 			case IFT_FDDI:
 			case IFT_ISO88025:
@@ -1686,7 +1691,7 @@ retry:
 
 		/* Get HW address */
 		sdl = NULL;
-		TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
+		TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list)
 			if (ifa->ifa_addr->sa_family == AF_LINK) {
 				sdl = (struct sockaddr_dl *)ifa->ifa_addr;
 				if (sdl->sdl_type == IFT_ETHER)
@@ -1718,7 +1723,7 @@ retry:
 #endif
 	}
 
-	error = socreate(AF_INET, &bootp_so, SOCK_DGRAM, 0, td->td_ucred, td);
+	error = socreate(AF_INET, &bootp_so, SOCK_DGRAM, 0, td, NULL);
 	if (error != 0)
 		panic("%s: socreate, error=%d", __func__, error);
 
@@ -1803,7 +1808,7 @@ out:
  */
 static int
 md_mount(struct sockaddr_in *mdsin, char *path, u_char *fhp, int *fhsizep,
-    struct nfs_args *args, struct thread *td)
+    struct nfs_args *args, struct lwp *td)
 {
 	struct mbuf *m;
 	int error;
@@ -1902,4 +1907,6 @@ out:
 	return error;
 }
 
+#if 0	/* Need to call bootpc_init from module initialization routine */
 SYSINIT(bootp_rootconf, SI_SUB_ROOT_CONF, SI_ORDER_FIRST, bootpc_init, NULL);
+#endif
Index: src/sys/fs/nfs/common/nfsport.h
diff -u src/sys/fs/nfs/common/nfsport.h:1.2 src/sys/fs/nfs/common/nfsport.h:1.3
--- src/sys/fs/nfs/common/nfsport.h:1.2	Fri Nov 18 22:37:50 2016
+++ src/sys/fs/nfs/common/nfsport.h	Tue Dec 13 22:52:46 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfsport.h,v 1.2 2016/11/18 22:37:50 pgoyette Exp $	*/
+/*	$NetBSD: nfsport.h,v 1.3 2016/12/13 22:52:46 pgoyette Exp $	*/
 /*-
  * Copyright (c) 1989, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  * FreeBSD: head/sys/fs/nfs/nfsport.h 304026 2016-08-12 22:44:59Z rmacklem 
- * $NetBSD: nfsport.h,v 1.2 2016/11/18 22:37:50 pgoyette Exp $
+ * $NetBSD: nfsport.h,v 1.3 2016/12/13 22:52:46 pgoyette Exp $
  */
 
 #ifndef _NFS_NFSPORT_H_
@@ -74,6 +74,7 @@
 #include <sys/module.h>
 #include <sys/syscall.h>
 #include <sys/kthread.h>
+#include <sys/lwp.h>
 
 #include <net/if.h>
 #include <net/radix.h>
@@ -117,7 +118,7 @@
  * These types must be defined before the nfs includes.
  */
 #define	NFSSOCKADDR_T	struct sockaddr *
-#define	NFSPROC_T	struct thread
+#define	NFSPROC_T	struct lwp
 #define	NFSDEV_T	dev_t
 #define	NFSSVCARGS	nfssvc_args
 #define	NFSACL_T	struct acl
@@ -174,7 +175,7 @@
 /*
  * Type for a mutex lock.
  */
-#define	NFSMUTEX_T		struct mtx
+#define	NFSMUTEX_T		kmutex_t
 
 #endif	/* _KERNEL */
 
@@ -639,16 +640,20 @@ void nfsrvd_rcv(struct socket *, void *,
  * for signal handling, etc.
  */
 #define	NFSNEWCRED(c)		(crdup(c))
-#define	NFSPROCCRED(p)		((p)->td_ucred)
+#define	NFSPROCCRED(p)		((p)->l_ucred)
 #define	NFSFREECRED(c)		(crfree(c))
 #define	NFSUIOPROC(u, p)	((u)->uio_td = NULL)
-#define	NFSPROCP(p)		((p)->td_proc)
+#define	NFSPROCP(p)		((p)->l_proc)
 
 /*
  * Define these so that cn_hash and its length is ignored.
  */
 #define	NFSCNHASHZERO(c)
 #define	NFSCNHASH(c, v)
+
+#ifdef NCHNAMLEN
+#undef NCHNAMLEN	/* defined in sys/namei.h */
+#endif
 #define	NCHNAMLEN	9999999
 
 /*
@@ -660,56 +665,56 @@ void nfsrvd_rcv(struct socket *, void *,
 /*
  * Handle SMP stuff:
  */
-#define	NFSSTATESPINLOCK	extern struct mtx nfs_state_mutex
-#define	NFSLOCKSTATE()		mtx_lock(&nfs_state_mutex)
-#define	NFSUNLOCKSTATE()	mtx_unlock(&nfs_state_mutex)
+#define	NFSSTATESPINLOCK	extern struct kmutex nfs_state_mutex
+#define	NFSLOCKSTATE()		mutex_enter(&nfs_state_mutex)
+#define	NFSUNLOCKSTATE()	mutex_exit(&nfs_state_mutex)
 #define	NFSSTATEMUTEXPTR	(&nfs_state_mutex)
-#define	NFSREQSPINLOCK		extern struct mtx nfs_req_mutex
-#define	NFSLOCKREQ()		mtx_lock(&nfs_req_mutex)
-#define	NFSUNLOCKREQ()		mtx_unlock(&nfs_req_mutex)
-#define	NFSSOCKMUTEX		extern struct mtx nfs_slock_mutex
+#define	NFSREQSPINLOCK		extern struct kmutex nfs_req_mutex
+#define	NFSLOCKREQ()		mutex_enter(&nfs_req_mutex)
+#define	NFSUNLOCKREQ()		mutex_exit(&nfs_req_mutex)
+#define	NFSSOCKMUTEX		extern struct kmutex nfs_slock_mutex
 #define	NFSSOCKMUTEXPTR		(&nfs_slock_mutex)
-#define	NFSLOCKSOCK()		mtx_lock(&nfs_slock_mutex)
-#define	NFSUNLOCKSOCK()		mtx_unlock(&nfs_slock_mutex)
-#define	NFSNAMEIDMUTEX		extern struct mtx nfs_nameid_mutex
-#define	NFSLOCKNAMEID()		mtx_lock(&nfs_nameid_mutex)
-#define	NFSUNLOCKNAMEID()	mtx_unlock(&nfs_nameid_mutex)
-#define	NFSNAMEIDREQUIRED()	mtx_assert(&nfs_nameid_mutex, MA_OWNED)
-#define	NFSCLSTATEMUTEX		extern struct mtx nfs_clstate_mutex
+#define	NFSLOCKSOCK()		mutex_enter(&nfs_slock_mutex)
+#define	NFSUNLOCKSOCK()		mutex_exit(&nfs_slock_mutex)
+#define	NFSNAMEIDMUTEX		extern struct kmutex nfs_nameid_mutex
+#define	NFSLOCKNAMEID()		mutex_enter(&nfs_nameid_mutex)
+#define	NFSUNLOCKNAMEID()	mutex_exit(&nfs_nameid_mutex)
+#define	NFSNAMEIDREQUIRED()	mutex_owned(&nfs_nameid_mutex)
+#define	NFSCLSTATEMUTEX		extern struct kmutex nfs_clstate_mutex
 #define	NFSCLSTATEMUTEXPTR	(&nfs_clstate_mutex)
-#define	NFSLOCKCLSTATE()	mtx_lock(&nfs_clstate_mutex)
-#define	NFSUNLOCKCLSTATE()	mtx_unlock(&nfs_clstate_mutex)
-#define	NFSDLOCKMUTEX		extern struct mtx newnfsd_mtx
+#define	NFSLOCKCLSTATE()	mutex_enter(&nfs_clstate_mutex)
+#define	NFSUNLOCKCLSTATE()	mutex_exit(&nfs_clstate_mutex)
+#define	NFSDLOCKMUTEX		extern struct kmutex newnfsd_mtx
 #define	NFSDLOCKMUTEXPTR	(&newnfsd_mtx)
-#define	NFSD_LOCK()		mtx_lock(&newnfsd_mtx)
-#define	NFSD_UNLOCK()		mtx_unlock(&newnfsd_mtx)
-#define	NFSD_LOCK_ASSERT()	mtx_assert(&newnfsd_mtx, MA_OWNED)
-#define	NFSD_UNLOCK_ASSERT()	mtx_assert(&newnfsd_mtx, MA_NOTOWNED)
+#define	NFSD_LOCK()		mutex_enter(&newnfsd_mtx)
+#define	NFSD_UNLOCK()		mutex_exit(&newnfsd_mtx)
+#define	NFSD_LOCK_ASSERT()	mutex_owned(&newnfsd_mtx)
+#define	NFSD_UNLOCK_ASSERT()	!mutex_owned(&newnfsd_mtx)
 #define	NFSV4ROOTLOCKMUTEX	extern struct mtx nfs_v4root_mutex
 #define	NFSV4ROOTLOCKMUTEXPTR	(&nfs_v4root_mutex)
-#define	NFSLOCKV4ROOTMUTEX()	mtx_lock(&nfs_v4root_mutex)
-#define	NFSUNLOCKV4ROOTMUTEX()	mtx_unlock(&nfs_v4root_mutex)
-#define	NFSLOCKNODE(n)		mtx_lock(&((n)->n_mtx))
-#define	NFSUNLOCKNODE(n)	mtx_unlock(&((n)->n_mtx))
-#define	NFSLOCKMNT(m)		mtx_lock(&((m)->nm_mtx))
-#define	NFSUNLOCKMNT(m)		mtx_unlock(&((m)->nm_mtx))
-#define	NFSLOCKREQUEST(r)	mtx_lock(&((r)->r_mtx))
-#define	NFSUNLOCKREQUEST(r)	mtx_unlock(&((r)->r_mtx))
+#define	NFSLOCKV4ROOTMUTEX()	mutex_enter(&nfs_v4root_mutex)
+#define	NFSUNLOCKV4ROOTMUTEX()	mutex_exit(&nfs_v4root_mutex)
+#define	NFSLOCKNODE(n)		mutex_enter(&((n)->n_mtx))
+#define	NFSUNLOCKNODE(n)	mutex_exit(&((n)->n_mtx))
+#define	NFSLOCKMNT(m)		mutex_enter(&((m)->nm_mtx))
+#define	NFSUNLOCKMNT(m)		mutex_exit(&((m)->nm_mtx))
+#define	NFSLOCKREQUEST(r)	mutex_enter(&((r)->r_mtx))
+#define	NFSUNLOCKREQUEST(r)	mutex_exit(&((r)->r_mtx))
 #define	NFSPROCLISTLOCK()	sx_slock(&allproc_lock)
 #define	NFSPROCLISTUNLOCK()	sx_sunlock(&allproc_lock)
-#define	NFSLOCKSOCKREQ(r)	mtx_lock(&((r)->nr_mtx))
-#define	NFSUNLOCKSOCKREQ(r)	mtx_unlock(&((r)->nr_mtx))
-#define	NFSLOCKDS(d)		mtx_lock(&((d)->nfsclds_mtx))
-#define	NFSUNLOCKDS(d)		mtx_unlock(&((d)->nfsclds_mtx))
+#define	NFSLOCKSOCKREQ(r)	mutex_enter(&((r)->nr_mtx))
+#define	NFSUNLOCKSOCKREQ(r)	mutex_exit(&((r)->nr_mtx))
+#define	NFSLOCKDS(d)		mutex_enter(&((d)->nfsclds_mtx))
+#define	NFSUNLOCKDS(d)		mutex_exit(&((d)->nfsclds_mtx))
 #define	NFSSESSIONMUTEXPTR(s)	(&((s)->mtx))
-#define	NFSLOCKSESSION(s)	mtx_lock(&((s)->mtx))
-#define	NFSUNLOCKSESSION(s)	mtx_unlock(&((s)->mtx))
+#define	NFSLOCKSESSION(s)	mutex_enter(&((s)->mtx))
+#define	NFSUNLOCKSESSION(s)	mutex_exit(&((s)->mtx))
 
 /*
  * Use these macros to initialize/free a mutex.
  */
-#define	NFSINITSOCKMUTEX(m)	mtx_init((m), "nfssock", NULL, MTX_DEF)
-#define	NFSFREEMUTEX(m)		mtx_destroy((m))
+#define	NFSINITSOCKMUTEX(m)	mutex_init((m), MUTEX_DEFAULT, IPL_NONE)
+#define	NFSFREEMUTEX(m)		mutex_destroy((m))
 
 int nfsmsleep(void *, void *, int, const char *, struct timespec *);
 
@@ -758,9 +763,11 @@ int nfsmsleep(void *, void *, int, const
 /*
  * Some queue.h files don't have these dfined in them.
  */
+#if 0	/* NetBSD has these, and redefining them here is an error */
 #define	LIST_END(head)		NULL
 #define	SLIST_END(head)		NULL
 #define	TAILQ_END(head)		NULL
+#endif
 
 /*
  * This must be defined to be a global variable that increments once
@@ -854,11 +861,11 @@ MALLOC_DECLARE(M_NEWNFSDSESSION);
 #define	NFSWRITERPC_SETTIME(w, n, a, v4)				\
 	do {								\
 		if (w) {						\
-			mtx_lock(&((n)->n_mtx));			\
+			mutex_enter(&((n)->n_mtx));			\
 			(n)->n_mtime = (a)->na_mtime;			\
 			if (v4)						\
 				(n)->n_change = (a)->na_filerev;	\
-			mtx_unlock(&((n)->n_mtx));			\
+			mutex_exit(&((n)->n_mtx));			\
 		}							\
 	} while (0)
 
@@ -1011,7 +1018,7 @@ struct nfsreq {
 	TAILQ_ENTRY(nfsreq) r_chain;
 	u_int32_t	r_flags;	/* flags on request, see below */
 	struct nfsmount *r_nmp;		/* Client mnt ptr */
-	struct mtx	r_mtx;		/* Mutex lock for this structure */
+	kmutex_t	r_mtx;		/* Mutex lock for this structure */
 };
 
 #ifndef NFS_MAXBSIZE

Index: src/sys/fs/nfs/common/krpc.h
diff -u src/sys/fs/nfs/common/krpc.h:1.1.1.1 src/sys/fs/nfs/common/krpc.h:1.2
--- src/sys/fs/nfs/common/krpc.h:1.1.1.1	Mon Sep 30 07:19:31 2013
+++ src/sys/fs/nfs/common/krpc.h	Tue Dec 13 22:52:46 2016
@@ -1,6 +1,6 @@
 /*	NetBSD: krpc.h,v 1.4 1995/12/19 23:07:11 cgd Exp 	*/
 /* FreeBSD: head/sys/nfs/krpc.h 221032 2011-04-25 22:22:51Z rmacklem 	*/
-/* $NetBSD: krpc.h,v 1.1.1.1 2013/09/30 07:19:31 dholland Exp $	*/
+/* $NetBSD: krpc.h,v 1.2 2016/12/13 22:52:46 pgoyette Exp $	*/
 
 #include <sys/cdefs.h>
 
@@ -11,10 +11,10 @@ struct sockaddr_in;
 
 int krpc_call(struct sockaddr_in *_sin,
 	u_int prog, u_int vers, u_int func,
-	struct mbuf **data, struct sockaddr **from, struct thread *td);
+	struct mbuf **data, struct sockaddr **from, struct lwp *td);
 
 int krpc_portmap(struct sockaddr_in *_sin,
-	u_int prog, u_int vers, u_int16_t *portp, struct thread *td);
+	u_int prog, u_int vers, u_int16_t *portp, struct lwp *td);
 
 struct mbuf *xdr_string_encode(char *str, int len);
 
Index: src/sys/fs/nfs/common/nfs_mountcommon.h
diff -u src/sys/fs/nfs/common/nfs_mountcommon.h:1.1.1.1 src/sys/fs/nfs/common/nfs_mountcommon.h:1.2
--- src/sys/fs/nfs/common/nfs_mountcommon.h:1.1.1.1	Mon Sep 30 07:19:33 2013
+++ src/sys/fs/nfs/common/nfs_mountcommon.h	Tue Dec 13 22:52:46 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_mountcommon.h,v 1.1.1.1 2013/09/30 07:19:33 dholland Exp $	*/
+/*	$NetBSD: nfs_mountcommon.h,v 1.2 2016/12/13 22:52:46 pgoyette Exp $	*/
 /*-
  * Copyright (c) 2009 Rick Macklem, University of Guelph
  * All rights reserved.
@@ -25,7 +25,7 @@
  * SUCH DAMAGE.
  *
  * FreeBSD: head/sys/nfs/nfs_mountcommon.h 216931 2011-01-03 20:37:31Z rmacklem 
- * $NetBSD: nfs_mountcommon.h,v 1.1.1.1 2013/09/30 07:19:33 dholland Exp $
+ * $NetBSD: nfs_mountcommon.h,v 1.2 2016/12/13 22:52:46 pgoyette Exp $
  */
 
 #ifndef _NFS_MOUNTCOMMON_H_
@@ -39,10 +39,10 @@
 typedef void	nfs_getinfofromvp_ftype(struct vnode *, uint8_t *, size_t *,
 		    struct sockaddr_storage *, int *, off_t *,
 		    struct timeval *);
-typedef int	nfs_vinvalbuf_ftype(struct vnode *, int, struct thread *, int);
+typedef int	nfs_vinvalbuf_ftype(struct vnode *, int, struct lwp *, int);
 
 struct	nfsmount_common {
-	struct mtx	nmcom_mtx;
+	kmutex_t	nmcom_mtx;
 	int	nmcom_flag;		/* Flags for soft/hard... */
 	int	nmcom_state;		/* Internal state flags */
 	struct	mount *nmcom_mountp;	/* Vfs structure for this filesystem */

Index: src/sys/fs/nfs/common/nfs.h
diff -u src/sys/fs/nfs/common/nfs.h:1.1.1.2 src/sys/fs/nfs/common/nfs.h:1.2
--- src/sys/fs/nfs/common/nfs.h:1.1.1.2	Fri Nov 18 07:49:12 2016
+++ src/sys/fs/nfs/common/nfs.h	Tue Dec 13 22:52:46 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs.h,v 1.1.1.2 2016/11/18 07:49:12 pgoyette Exp $	*/
+/*	$NetBSD: nfs.h,v 1.2 2016/12/13 22:52:46 pgoyette Exp $	*/
 /*-
  * Copyright (c) 1989, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  * FreeBSD: head/sys/fs/nfs/nfs.h 291527 2015-11-30 21:54:27Z rmacklem 
- * $NetBSD: nfs.h,v 1.1.1.2 2016/11/18 07:49:12 pgoyette Exp $
+ * $NetBSD: nfs.h,v 1.2 2016/12/13 22:52:46 pgoyette Exp $
  */
 
 #ifndef _NFS_NFS_H_
@@ -72,8 +72,10 @@
 #ifndef NFS_MAXATTRTIMO
 #define	NFS_MAXATTRTIMO 60
 #endif
+#if 0	/* Defined in NetBSD in machine/param.h */
 #define	NFS_WSIZE	8192		/* Def. write data size <= 8192 */
 #define	NFS_RSIZE	8192		/* Def. read data size <= 8192 */
+#endif
 #define	NFS_READDIRSIZE	8192		/* Def. readdir size */
 #define	NFS_DEFRAHEAD	1		/* Def. read ahead # blocks */
 #define	NFS_MAXRAHEAD	16		/* Max. read ahead # blocks */
@@ -146,9 +148,9 @@
  * Oddballs
  */
 #define	NFS_CMPFH(n, f, s) 						\
-    ((n)->n_fhp->nfh_len == (s) && !NFSBCMP((n)->n_fhp->nfh_fh, (caddr_t)(f), (s)))
+    ((n)->n_fhp->nfh_len == (s) && !NFSBCMP((n)->n_fhp->nfh_fh, (void *)(f), (s)))
 #define	NFSRV_CMPFH(nf, ns, f, s) 					\
-	((ns) == (s) && !NFSBCMP((caddr_t)(nf), (caddr_t)(f), (s)))
+	((ns) == (s) && !NFSBCMP((void *)(nf), (void *)(f), (s)))
 #define	NFS_CMPTIME(t1, t2) 						\
 	((t1).tv_sec == (t2).tv_sec && (t1).tv_nsec == (t2).tv_nsec)
 #define	NFS_SETTIME(t) do { 						\
@@ -165,7 +167,7 @@
  */
 struct nfsd_addsock_args {
 	int	sock;		/* Socket to serve */
-	caddr_t	name;		/* Client addr for connection based sockets */
+	char	*name;		/* Client addr for connection based sockets */
 	int	namelen;	/* Length of name */
 };
 
@@ -187,7 +189,7 @@ struct nfsd_nfscbd_args {
 
 struct nfscbd_args {
 	int	sock;		/* Socket to serve */
-	caddr_t	name;		/* Client addr for connection based sockets */
+	char	*name;		/* Client addr for connection based sockets */
 	int	namelen;	/* Length of name */
 	u_short	port;		/* Port# for callbacks */
 };
@@ -582,8 +584,8 @@ struct nfsrv_descript {
 	mbuf_t			nd_mb;		/* Current build mbuf */
 	NFSSOCKADDR_T		nd_nam;		/* and socket addr */
 	NFSSOCKADDR_T		nd_nam2;	/* return socket addr */
-	caddr_t			nd_dpos;	/* Current dissect pos */
-	caddr_t			nd_bpos;	/* Current build pos */
+	char			*nd_dpos;	/* Current dissect pos */
+	char			*nd_bpos;	/* Current build pos */
 	u_int16_t		nd_procnum;	/* RPC # */
 	u_int32_t		nd_flag;	/* nd_flag */
 	u_int32_t		nd_repstat;	/* Reply status */
Index: src/sys/fs/nfs/common/nfs_var.h
diff -u src/sys/fs/nfs/common/nfs_var.h:1.1.1.2 src/sys/fs/nfs/common/nfs_var.h:1.2
--- src/sys/fs/nfs/common/nfs_var.h:1.1.1.2	Fri Nov 18 07:49:12 2016
+++ src/sys/fs/nfs/common/nfs_var.h	Tue Dec 13 22:52:46 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_var.h,v 1.1.1.2 2016/11/18 07:49:12 pgoyette Exp $	*/
+/*	$NetBSD: nfs_var.h,v 1.2 2016/12/13 22:52:46 pgoyette Exp $	*/
 /*-
  * Copyright (c) 1989, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  * FreeBSD: head/sys/fs/nfs/nfs_var.h 294084 2016-01-15 09:05:14Z melifaro 
- * $NetBSD: nfs_var.h,v 1.1.1.2 2016/11/18 07:49:12 pgoyette Exp $
+ * $NetBSD: nfs_var.h,v 1.2 2016/12/13 22:52:46 pgoyette Exp $
  */
 
 /*
@@ -39,7 +39,7 @@
  */
 
 struct uio;
-struct ucred;
+struct kauth_cred;
 struct nfscred;
 NFSPROC_T;
 struct buf;
@@ -112,7 +112,7 @@ int nfsrv_opencheck(nfsquad_t, nfsv4stat
 int nfsrv_openupdate(vnode_t, struct nfsstate *, nfsquad_t,
     nfsv4stateid_t *, struct nfsrv_descript *, NFSPROC_T *);
 int nfsrv_delegupdate(struct nfsrv_descript *, nfsquad_t, nfsv4stateid_t *,
-    vnode_t, int, struct ucred *, NFSPROC_T *);
+    vnode_t, int, struct kauth_cred *, NFSPROC_T *);
 int nfsrv_releaselckown(struct nfsstate *, nfsquad_t, NFSPROC_T *);
 void nfsrv_zapclient(struct nfsclient *, NFSPROC_T *);
 int nfssvc_idname(struct nfsd_idargs *);
@@ -129,7 +129,7 @@ int nfsrv_checksetattr(vnode_t, struct n
     nfsv4stateid_t *, struct nfsvattr *, nfsattrbit_t *, struct nfsexstuff *,
     NFSPROC_T *);
 int nfsrv_checkgetattr(struct nfsrv_descript *, vnode_t,
-    struct nfsvattr *, nfsattrbit_t *, struct ucred *, NFSPROC_T *);
+    struct nfsvattr *, nfsattrbit_t *, struct kauth_cred *, NFSPROC_T *);
 int nfsrv_nfsuserdport(u_short, NFSPROC_T *);
 void nfsrv_nfsuserddelport(void);
 void nfsrv_throwawayallstate(NFSPROC_T *);
@@ -265,10 +265,9 @@ int nfsm_fhtom(struct nfsrv_descript *, 
 int nfsm_advance(struct nfsrv_descript *, int, int);
 void *nfsm_dissct(struct nfsrv_descript *, int, int);
 void newnfs_trimleading(struct nfsrv_descript *);
-void newnfs_trimtrailing(struct nfsrv_descript *, mbuf_t,
-    caddr_t);
-void newnfs_copycred(struct nfscred *, struct ucred *);
-void newnfs_copyincred(struct ucred *, struct nfscred *);
+void newnfs_trimtrailing(struct nfsrv_descript *, mbuf_t, char *);
+void newnfs_copycred(struct nfscred *, struct kauth_cred *);
+void newnfs_copyincred(struct kauth_cred *, struct nfscred *);
 int nfsrv_dissectacl(struct nfsrv_descript *, NFSACL_T *, int *,
     int *, NFSPROC_T *);
 int nfsrv_getattrbits(struct nfsrv_descript *, nfsattrbit_t *, int *,
@@ -277,7 +276,7 @@ int nfsv4_loadattr(struct nfsrv_descript
     struct nfsvattr *, struct nfsfh **, fhandle_t *, int,
     struct nfsv3_pathconf *, struct statfs *, struct nfsstatfs *,
     struct nfsfsinfo *, NFSACL_T *,
-    int, int *, u_int32_t *, u_int32_t *, NFSPROC_T *, struct ucred *);
+    int, int *, u_int32_t *, u_int32_t *, NFSPROC_T *, struct kauth_cred *);
 int nfsv4_lock(struct nfsv4lock *, int, int *, void *, struct mount *);
 void nfsv4_unlock(struct nfsv4lock *, int);
 void nfsv4_relref(struct nfsv4lock *);
@@ -299,7 +298,7 @@ void nfsv4_setsequence(struct nfsmount *
 int nfsv4_sequencelookup(struct nfsmount *, struct nfsclsession *, int *,
     int *, uint32_t *, uint8_t *);
 void nfsv4_freeslot(struct nfsclsession *, int);
-struct ucred *nfsrv_getgrpscred(struct ucred *);
+struct kauth_cred *nfsrv_getgrpscred(struct kauth_cred *);
 
 /* nfs_clcomsubs.c */
 void nfsm_uiombuf(struct nfsrv_descript *, struct uio *, int);
@@ -318,21 +317,21 @@ int nfscl_wcc_data(struct nfsrv_descript
     struct nfsvattr *, int *, int *, void *);
 int nfsm_loadattr(struct nfsrv_descript *, struct nfsvattr *);
 int nfscl_request(struct nfsrv_descript *, vnode_t,
-         NFSPROC_T *, struct ucred *, void *);
+         NFSPROC_T *, struct kauth_cred *, void *);
 void nfsm_stateidtom(struct nfsrv_descript *, nfsv4stateid_t *, int);
 
 /* nfs_nfsdsubs.c */
 void nfsd_fhtovp(struct nfsrv_descript *, struct nfsrvfh *, int,
     vnode_t *, struct nfsexstuff *,
     mount_t *, int, NFSPROC_T *);
-int nfsd_excred(struct nfsrv_descript *, struct nfsexstuff *, struct ucred *);
+int nfsd_excred(struct nfsrv_descript *, struct nfsexstuff *, struct kauth_cred *);
 int nfsrv_mtofh(struct nfsrv_descript *, struct nfsrvfh *);
 int nfsrv_putattrbit(struct nfsrv_descript *, nfsattrbit_t *);
 void nfsrv_wcc(struct nfsrv_descript *, int, struct nfsvattr *, int,
     struct nfsvattr *);
 int nfsv4_fillattr(struct nfsrv_descript *, struct mount *, vnode_t, NFSACL_T *,
     struct vattr *, fhandle_t *, int, nfsattrbit_t *,
-    struct ucred *, NFSPROC_T *, int, int, int, int, uint64_t);
+    struct kauth_cred *, NFSPROC_T *, int, int, int, int, uint64_t);
 void nfsrv_fillattr(struct nfsrv_descript *, struct nfsvattr *);
 void nfsrv_adj(mbuf_t, int, int);
 void nfsrv_postopattr(struct nfsrv_descript *, int, struct nfsvattr *);
@@ -366,11 +365,11 @@ void nfsrv_object_create(vnode_t, NFSPRO
 int nfsrv_mallocmget_limit(void);
 int nfsvno_v4rootexport(struct nfsrv_descript *);
 void newnfs_portinit(void);
-struct ucred *newnfs_getcred(void);
-void newnfs_setroot(struct ucred *);
+struct kauth_cred *newnfs_getcred(void);
+void newnfs_setroot(struct kauth_cred *);
 int nfs_catnap(int, int, const char *);
 struct nfsreferral *nfsv4root_getreferral(vnode_t, vnode_t, u_int32_t);
-int nfsvno_pathconf(vnode_t, int, register_t *, struct ucred *,
+int nfsvno_pathconf(vnode_t, int, register_t *, struct kauth_cred *,
     NFSPROC_T *);
 int nfsrv_atroot(vnode_t, long *);
 void newnfs_timer(void *);
@@ -381,145 +380,145 @@ int nfsrv_dissectace(struct nfsrv_descri
     int *, int *, NFSPROC_T *);
 int nfsrv_buildacl(struct nfsrv_descript *, NFSACL_T *, enum vtype,
     NFSPROC_T *);
-int nfsrv_setacl(vnode_t, NFSACL_T *, struct ucred *,
+int nfsrv_setacl(vnode_t, NFSACL_T *, struct kauth_cred *,
     NFSPROC_T *);
 int nfsrv_compareacl(NFSACL_T *, NFSACL_T *);
 
 /* nfs_clrpcops.c */
-int nfsrpc_null(vnode_t, struct ucred *, NFSPROC_T *);
-int nfsrpc_access(vnode_t, int, struct ucred *, NFSPROC_T *,
+int nfsrpc_null(vnode_t, struct kauth_cred *, NFSPROC_T *);
+int nfsrpc_access(vnode_t, int, struct kauth_cred *, NFSPROC_T *,
     struct nfsvattr *, int *);
-int nfsrpc_accessrpc(vnode_t, u_int32_t, struct ucred *,
+int nfsrpc_accessrpc(vnode_t, u_int32_t, struct kauth_cred *,
     NFSPROC_T *, struct nfsvattr *, int *, u_int32_t *, void *);
-int nfsrpc_open(vnode_t, int, struct ucred *, NFSPROC_T *);
+int nfsrpc_open(vnode_t, int, struct kauth_cred *, NFSPROC_T *);
 int nfsrpc_openrpc(struct nfsmount *, vnode_t, u_int8_t *, int, u_int8_t *, int,
     u_int32_t, struct nfsclopen *, u_int8_t *, int, struct nfscldeleg **, int,
-    u_int32_t, struct ucred *, NFSPROC_T *, int, int);
+    u_int32_t, struct kauth_cred *, NFSPROC_T *, int, int);
 int nfsrpc_opendowngrade(vnode_t, u_int32_t, struct nfsclopen *,
-    struct ucred *, NFSPROC_T *);
+    struct kauth_cred *, NFSPROC_T *);
 int nfsrpc_close(vnode_t, int, NFSPROC_T *);
 int nfsrpc_closerpc(struct nfsrv_descript *, struct nfsmount *,
-    struct nfsclopen *, struct ucred *, NFSPROC_T *, int);
+    struct nfsclopen *, struct kauth_cred *, NFSPROC_T *, int);
 int nfsrpc_openconfirm(vnode_t, u_int8_t *, int, struct nfsclopen *,
-    struct ucred *, NFSPROC_T *);
+    struct kauth_cred *, NFSPROC_T *);
 int nfsrpc_setclient(struct nfsmount *, struct nfsclclient *, int,
-    struct ucred *, NFSPROC_T *);
-int nfsrpc_getattr(vnode_t, struct ucred *, NFSPROC_T *,
+    struct kauth_cred *, NFSPROC_T *);
+int nfsrpc_getattr(vnode_t, struct kauth_cred *, NFSPROC_T *,
     struct nfsvattr *, void *);
 int nfsrpc_getattrnovp(struct nfsmount *, u_int8_t *, int, int,
-    struct ucred *, NFSPROC_T *, struct nfsvattr *, u_int64_t *, uint32_t *);
-int nfsrpc_setattr(vnode_t, struct vattr *, NFSACL_T *, struct ucred *,
+    struct kauth_cred *, NFSPROC_T *, struct nfsvattr *, u_int64_t *, uint32_t *);
+int nfsrpc_setattr(vnode_t, struct vattr *, NFSACL_T *, struct kauth_cred *,
     NFSPROC_T *, struct nfsvattr *, int *, void *);
-int nfsrpc_lookup(vnode_t, char *, int, struct ucred *, NFSPROC_T *,
+int nfsrpc_lookup(vnode_t, char *, int, struct kauth_cred *, NFSPROC_T *,
     struct nfsvattr *, struct nfsvattr *, struct nfsfh **, int *, int *,
     void *);
-int nfsrpc_readlink(vnode_t, struct uio *, struct ucred *,
+int nfsrpc_readlink(vnode_t, struct uio *, struct kauth_cred *,
     NFSPROC_T *, struct nfsvattr *, int *, void *);
-int nfsrpc_read(vnode_t, struct uio *, struct ucred *, NFSPROC_T *,
+int nfsrpc_read(vnode_t, struct uio *, struct kauth_cred *, NFSPROC_T *,
     struct nfsvattr *, int *, void *);
 int nfsrpc_write(vnode_t, struct uio *, int *, int *,
-    struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, void *, int);
+    struct kauth_cred *, NFSPROC_T *, struct nfsvattr *, int *, void *, int);
 int nfsrpc_mknod(vnode_t, char *, int, struct vattr *, u_int32_t,
-    enum vtype, struct ucred *, NFSPROC_T *, struct nfsvattr *,
+    enum vtype, struct kauth_cred *, NFSPROC_T *, struct nfsvattr *,
     struct nfsvattr *, struct nfsfh **, int *, int *, void *);
 int nfsrpc_create(vnode_t, char *, int, struct vattr *, nfsquad_t,
-    int, struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
+    int, struct kauth_cred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
     struct nfsfh **, int *, int *, void *);
-int nfsrpc_remove(vnode_t, char *, int, vnode_t, struct ucred *, NFSPROC_T *,
+int nfsrpc_remove(vnode_t, char *, int, vnode_t, struct kauth_cred *, NFSPROC_T *,
     struct nfsvattr *, int *, void *);
 int nfsrpc_rename(vnode_t, vnode_t, char *, int, vnode_t, vnode_t, char *, int,
-    struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
+    struct kauth_cred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
     int *, int *, void *, void *);
 int nfsrpc_link(vnode_t, vnode_t, char *, int,
-    struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
+    struct kauth_cred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
     int *, int *, void *);
 int nfsrpc_symlink(vnode_t, char *, int, char *, struct vattr *,
-    struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
+    struct kauth_cred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
     struct nfsfh **, int *, int *, void *);
 int nfsrpc_mkdir(vnode_t, char *, int, struct vattr *,
-    struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
+    struct kauth_cred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
     struct nfsfh **, int *, int *, void *);
-int nfsrpc_rmdir(vnode_t, char *, int, struct ucred *, NFSPROC_T *,
+int nfsrpc_rmdir(vnode_t, char *, int, struct kauth_cred *, NFSPROC_T *,
     struct nfsvattr *, int *, void *);
-int nfsrpc_readdir(vnode_t, struct uio *, nfsuint64 *, struct ucred *,
+int nfsrpc_readdir(vnode_t, struct uio *, nfsuint64 *, struct kauth_cred *,
     NFSPROC_T *, struct nfsvattr *, int *, int *, void *);
 int nfsrpc_readdirplus(vnode_t, struct uio *, nfsuint64 *, 
-    struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, int *, void *);
-int nfsrpc_commit(vnode_t, u_quad_t, int, struct ucred *,
+    struct kauth_cred *, NFSPROC_T *, struct nfsvattr *, int *, int *, void *);
+int nfsrpc_commit(vnode_t, u_quad_t, int, struct kauth_cred *,
     NFSPROC_T *, struct nfsvattr *, int *, void *);
 int nfsrpc_advlock(vnode_t, off_t, int, struct flock *, int,
-    struct ucred *, NFSPROC_T *, void *, int);
+    struct kauth_cred *, NFSPROC_T *, void *, int);
 int nfsrpc_lockt(struct nfsrv_descript *, vnode_t,
     struct nfsclclient *, u_int64_t, u_int64_t, struct flock *,
-    struct ucred *, NFSPROC_T *, void *, int);
+    struct kauth_cred *, NFSPROC_T *, void *, int);
 int nfsrpc_lock(struct nfsrv_descript *, struct nfsmount *, vnode_t,
     u_int8_t *, int, struct nfscllockowner *, int, int, u_int64_t,
-    u_int64_t, short, struct ucred *, NFSPROC_T *, int);
+    u_int64_t, short, struct kauth_cred *, NFSPROC_T *, int);
 int nfsrpc_statfs(vnode_t, struct nfsstatfs *, struct nfsfsinfo *,
-    struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, void *);
-int nfsrpc_fsinfo(vnode_t, struct nfsfsinfo *, struct ucred *,
+    struct kauth_cred *, NFSPROC_T *, struct nfsvattr *, int *, void *);
+int nfsrpc_fsinfo(vnode_t, struct nfsfsinfo *, struct kauth_cred *,
     NFSPROC_T *, struct nfsvattr *, int *, void *);
 int nfsrpc_pathconf(vnode_t, struct nfsv3_pathconf *,
-    struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, void *);
-int nfsrpc_renew(struct nfsclclient *, struct nfsclds *, struct ucred *,
+    struct kauth_cred *, NFSPROC_T *, struct nfsvattr *, int *, void *);
+int nfsrpc_renew(struct nfsclclient *, struct nfsclds *, struct kauth_cred *,
     NFSPROC_T *);
 int nfsrpc_rellockown(struct nfsmount *, struct nfscllockowner *, uint8_t *,
-    int, struct ucred *, NFSPROC_T *);
-int nfsrpc_getdirpath(struct nfsmount *, u_char *, struct ucred *,
+    int, struct kauth_cred *, NFSPROC_T *);
+int nfsrpc_getdirpath(struct nfsmount *, u_char *, struct kauth_cred *,
     NFSPROC_T *);
-int nfsrpc_delegreturn(struct nfscldeleg *, struct ucred *,
+int nfsrpc_delegreturn(struct nfscldeleg *, struct kauth_cred *,
     struct nfsmount *, NFSPROC_T *, int);
-int nfsrpc_getacl(vnode_t, struct ucred *, NFSPROC_T *, NFSACL_T *, void *);
-int nfsrpc_setacl(vnode_t, struct ucred *, NFSPROC_T *, NFSACL_T *, void *);
+int nfsrpc_getacl(vnode_t, struct kauth_cred *, NFSPROC_T *, NFSACL_T *, void *);
+int nfsrpc_setacl(vnode_t, struct kauth_cred *, NFSPROC_T *, NFSACL_T *, void *);
 int nfsrpc_exchangeid(struct nfsmount *, struct nfsclclient *,
-    struct nfssockreq *, uint32_t, struct nfsclds **, struct ucred *,
+    struct nfssockreq *, uint32_t, struct nfsclds **, struct kauth_cred *,
     NFSPROC_T *);
 int nfsrpc_createsession(struct nfsmount *, struct nfsclsession *,
-    struct nfssockreq *, uint32_t, int, struct ucred *, NFSPROC_T *);
+    struct nfssockreq *, uint32_t, int, struct kauth_cred *, NFSPROC_T *);
 int nfsrpc_destroysession(struct nfsmount *, struct nfsclclient *,
-    struct ucred *, NFSPROC_T *);
+    struct kauth_cred *, NFSPROC_T *);
 int nfsrpc_destroyclient(struct nfsmount *, struct nfsclclient *,
-    struct ucred *, NFSPROC_T *);
+    struct kauth_cred *, NFSPROC_T *);
 int nfsrpc_layoutget(struct nfsmount *, uint8_t *, int, int, uint64_t, uint64_t,
     uint64_t, int, nfsv4stateid_t *, int *, struct nfsclflayouthead *,
-    struct ucred *, NFSPROC_T *, void *);
+    struct kauth_cred *, NFSPROC_T *, void *);
 int nfsrpc_getdeviceinfo(struct nfsmount *, uint8_t *, int, uint32_t *,
-    struct nfscldevinfo **, struct ucred *, NFSPROC_T *);
+    struct nfscldevinfo **, struct kauth_cred *, NFSPROC_T *);
 int nfsrpc_layoutcommit(struct nfsmount *, uint8_t *, int, int,
     uint64_t, uint64_t, uint64_t, nfsv4stateid_t *, int, int, uint8_t *,
-    struct ucred *, NFSPROC_T *, void *);
+    struct kauth_cred *, NFSPROC_T *, void *);
 int nfsrpc_layoutreturn(struct nfsmount *, uint8_t *, int, int, int, uint32_t,
-    int, uint64_t, uint64_t, nfsv4stateid_t *, int, uint32_t *, struct ucred *,
+    int, uint64_t, uint64_t, nfsv4stateid_t *, int, uint32_t *, struct kauth_cred *,
     NFSPROC_T *, void *);
-int nfsrpc_reclaimcomplete(struct nfsmount *, struct ucred *, NFSPROC_T *);
+int nfsrpc_reclaimcomplete(struct nfsmount *, struct kauth_cred *, NFSPROC_T *);
 int nfscl_doiods(vnode_t, struct uio *, int *, int *, uint32_t,
-    struct ucred *, NFSPROC_T *);
+    struct kauth_cred *, NFSPROC_T *);
 int nfscl_findlayoutforio(struct nfscllayout *, uint64_t, uint32_t,
     struct nfsclflayout **);
 void nfscl_freenfsclds(struct nfsclds *);
 
 /* nfs_clstate.c */
 int nfscl_open(vnode_t, u_int8_t *, int, u_int32_t, int,
-    struct ucred *, NFSPROC_T *, struct nfsclowner **, struct nfsclopen **,
+    struct kauth_cred *, NFSPROC_T *, struct nfsclowner **, struct nfsclopen **,
     int *, int *, int);
-int nfscl_getstateid(vnode_t, u_int8_t *, int, u_int32_t, int, struct ucred *,
+int nfscl_getstateid(vnode_t, u_int8_t *, int, u_int32_t, int, struct kauth_cred *,
     NFSPROC_T *, nfsv4stateid_t *, void **);
 void nfscl_ownerrelease(struct nfsclowner *, int, int, int);
 void nfscl_openrelease(struct nfsclopen *, int, int);
-int nfscl_getcl(struct mount *, struct ucred *, NFSPROC_T *, int,
+int nfscl_getcl(struct mount *, struct kauth_cred *, NFSPROC_T *, int,
     struct nfsclclient **);
 struct nfsclclient *nfscl_findcl(struct nfsmount *);
 void nfscl_clientrelease(struct nfsclclient *);
 void nfscl_freelock(struct nfscllock *, int);
 void nfscl_freelockowner(struct nfscllockowner *, int);
 int nfscl_getbytelock(vnode_t, u_int64_t, u_int64_t, short,
-    struct ucred *, NFSPROC_T *, struct nfsclclient *, int, void *, int,
+    struct kauth_cred *, NFSPROC_T *, struct nfsclclient *, int, void *, int,
     u_int8_t *, u_int8_t *, struct nfscllockowner **, int *, int *);
 int nfscl_relbytelock(vnode_t, u_int64_t, u_int64_t,
-    struct ucred *, NFSPROC_T *, int, struct nfsclclient *,
+    struct kauth_cred *, NFSPROC_T *, int, struct nfsclclient *,
     void *, int, struct nfscllockowner **, int *);
 int nfscl_checkwritelocked(vnode_t, struct flock *,
-    struct ucred *, NFSPROC_T *, void *, int);
+    struct kauth_cred *, NFSPROC_T *, void *, int);
 void nfscl_lockrelease(struct nfscllockowner *, int, int);
 void nfscl_fillclid(u_int64_t, char *, u_int8_t *, u_int16_t);
 void nfscl_filllockowner(void *, u_int8_t *, int);
@@ -534,7 +533,7 @@ int nfscl_getclose(vnode_t, struct nfscl
 int nfscl_doclose(vnode_t, struct nfsclclient **, NFSPROC_T *);
 void nfsrpc_doclose(struct nfsmount *, struct nfsclopen *, NFSPROC_T *);
 int nfscl_deleg(mount_t, struct nfsclclient *, u_int8_t *, int,
-    struct ucred *, NFSPROC_T *, struct nfscldeleg **);
+    struct kauth_cred *, NFSPROC_T *, struct nfscldeleg **);
 void nfscl_lockinit(struct nfsv4lock *);
 void nfscl_lockexcl(struct nfsv4lock *, void *);
 void nfscl_lockunlock(struct nfsv4lock *);
@@ -555,11 +554,11 @@ void nfscl_reclaimnode(vnode_t);
 void nfscl_newnode(vnode_t);
 void nfscl_delegmodtime(vnode_t);
 void nfscl_deleggetmodtime(vnode_t, struct timespec *);
-int nfscl_tryclose(struct nfsclopen *, struct ucred *,
+int nfscl_tryclose(struct nfsclopen *, struct kauth_cred *,
     struct nfsmount *, NFSPROC_T *);
 void nfscl_cleanup(NFSPROC_T *);
 int nfscl_layout(struct nfsmount *, vnode_t, u_int8_t *, int, nfsv4stateid_t *,
-    int, struct nfsclflayouthead *, struct nfscllayout **, struct ucred *,
+    int, struct nfsclflayouthead *, struct nfscllayout **, struct kauth_cred *,
     NFSPROC_T *);
 struct nfscllayout *nfscl_getlayout(struct nfsclclient *, uint8_t *, int,
     uint64_t, struct nfsclflayout **, int *);
@@ -582,7 +581,7 @@ void nfscl_start_renewthread(struct nfsc
 void nfscl_loadsbinfo(struct nfsmount *, struct nfsstatfs *, void *);
 void nfscl_loadfsinfo (struct nfsmount *, struct nfsfsinfo *);
 void nfscl_delegreturn(struct nfscldeleg *, int, struct nfsmount *,
-    struct ucred *, NFSPROC_T *);
+    struct kauth_cred *, NFSPROC_T *);
 void nfsrvd_cbinit(int);
 int nfscl_checksattr(struct vattr *, struct nfsvattr *);
 int nfscl_ngetreopen(mount_t, u_int8_t *, int, NFSPROC_T *,
@@ -594,72 +593,72 @@ int nfscl_maperr(NFSPROC_T *, int, uid_t
 void nfscl_init(void);
 
 /* nfs_clbio.c */
-int ncl_flush(vnode_t, int, struct ucred *, NFSPROC_T *, int, int);
+int ncl_flush(vnode_t, int, struct kauth_cred *, NFSPROC_T *, int, int);
 
 /* nfs_clnode.c */
 void ncl_invalcaches(vnode_t);
 
 /* nfs_nfsdport.c */
-int nfsvno_getattr(vnode_t, struct nfsvattr *, struct ucred *,
+int nfsvno_getattr(vnode_t, struct nfsvattr *, struct kauth_cred *,
     NFSPROC_T *, int);
-int nfsvno_setattr(vnode_t, struct nfsvattr *, struct ucred *,
+int nfsvno_setattr(vnode_t, struct nfsvattr *, struct kauth_cred *,
     NFSPROC_T *, struct nfsexstuff *);
 int nfsvno_getfh(vnode_t, fhandle_t *, NFSPROC_T *);
-int nfsvno_accchk(vnode_t, accmode_t, struct ucred *,
+int nfsvno_accchk(vnode_t, accmode_t, struct kauth_cred *,
     struct nfsexstuff *, NFSPROC_T *, int, int, u_int32_t *);
 int nfsvno_namei(struct nfsrv_descript *, struct nameidata *,
     vnode_t, int, struct nfsexstuff *, NFSPROC_T *, vnode_t *);
 void nfsvno_setpathbuf(struct nameidata *, char **, u_long **);
 void nfsvno_relpathbuf(struct nameidata *);
-int nfsvno_readlink(vnode_t, struct ucred *, NFSPROC_T *, mbuf_t *,
+int nfsvno_readlink(vnode_t, struct kauth_cred *, NFSPROC_T *, mbuf_t *,
     mbuf_t *, int *);
-int nfsvno_read(vnode_t, off_t, int, struct ucred *, NFSPROC_T *,
+int nfsvno_read(vnode_t, off_t, int, struct kauth_cred *, NFSPROC_T *,
     mbuf_t *, mbuf_t *);
 int nfsvno_write(vnode_t, off_t, int, int, int, mbuf_t,
-    char *, struct ucred *, NFSPROC_T *);
+    char *, struct kauth_cred *, NFSPROC_T *);
 int nfsvno_createsub(struct nfsrv_descript *, struct nameidata *,
     vnode_t *, struct nfsvattr *, int *, int32_t *, NFSDEV_T, NFSPROC_T *,
     struct nfsexstuff *);
-int nfsvno_mknod(struct nameidata *, struct nfsvattr *, struct ucred *,
+int nfsvno_mknod(struct nameidata *, struct nfsvattr *, struct kauth_cred *,
     NFSPROC_T *);
 int nfsvno_mkdir(struct nameidata *,
-    struct nfsvattr *, uid_t, struct ucred *, NFSPROC_T *,
+    struct nfsvattr *, uid_t, struct kauth_cred *, NFSPROC_T *,
     struct nfsexstuff *);
 int nfsvno_symlink(struct nameidata *, struct nfsvattr *, char *, int, int,
-    uid_t, struct ucred *, NFSPROC_T *, struct nfsexstuff *);
+    uid_t, struct kauth_cred *, NFSPROC_T *, struct nfsexstuff *);
 int nfsvno_getsymlink(struct nfsrv_descript *, struct nfsvattr *,
     NFSPROC_T *, char **, int *);
-int nfsvno_removesub(struct nameidata *, int, struct ucred *, NFSPROC_T *,
+int nfsvno_removesub(struct nameidata *, int, struct kauth_cred *, NFSPROC_T *,
     struct nfsexstuff *);
-int nfsvno_rmdirsub(struct nameidata *, int, struct ucred *, NFSPROC_T *,
+int nfsvno_rmdirsub(struct nameidata *, int, struct kauth_cred *, NFSPROC_T *,
     struct nfsexstuff *);
 int nfsvno_rename(struct nameidata *, struct nameidata *, u_int32_t,
-    u_int32_t, struct ucred *, NFSPROC_T *);
-int nfsvno_link(struct nameidata *, vnode_t, struct ucred *,
+    u_int32_t, struct kauth_cred *, NFSPROC_T *);
+int nfsvno_link(struct nameidata *, vnode_t, struct kauth_cred *,
     NFSPROC_T *, struct nfsexstuff *);
-int nfsvno_fsync(vnode_t, u_int64_t, int, struct ucred *, NFSPROC_T *);
+int nfsvno_fsync(vnode_t, u_int64_t, int, struct kauth_cred *, NFSPROC_T *);
 int nfsvno_statfs(vnode_t, struct statfs *);
 void nfsvno_getfs(struct nfsfsinfo *, int);
 void nfsvno_open(struct nfsrv_descript *, struct nameidata *, nfsquad_t,
     nfsv4stateid_t *, struct nfsstate *, int *, struct nfsvattr *, int32_t *,
-    int, NFSACL_T *, nfsattrbit_t *, struct ucred *, NFSPROC_T *,
+    int, NFSACL_T *, nfsattrbit_t *, struct kauth_cred *, NFSPROC_T *,
     struct nfsexstuff *, vnode_t *);
-int nfsvno_updfilerev(vnode_t, struct nfsvattr *, struct ucred *,
+int nfsvno_updfilerev(vnode_t, struct nfsvattr *, struct kauth_cred *,
     NFSPROC_T *);
 int nfsvno_fillattr(struct nfsrv_descript *, struct mount *, vnode_t,
     struct nfsvattr *, fhandle_t *, int, nfsattrbit_t *,
-    struct ucred *, NFSPROC_T *, int, int, int, int, uint64_t);
+    struct kauth_cred *, NFSPROC_T *, int, int, int, int, uint64_t);
 int nfsrv_sattr(struct nfsrv_descript *, vnode_t, struct nfsvattr *, nfsattrbit_t *,
     NFSACL_T *, NFSPROC_T *);
 int nfsv4_sattr(struct nfsrv_descript *, vnode_t, struct nfsvattr *, nfsattrbit_t *,
     NFSACL_T *, NFSPROC_T *);
 int nfsvno_checkexp(mount_t, NFSSOCKADDR_T, struct nfsexstuff *,
-    struct ucred **);
+    struct kauth_cred **);
 int nfsvno_fhtovp(mount_t, fhandle_t *, NFSSOCKADDR_T, int,
-    vnode_t *, struct nfsexstuff *, struct ucred **);
+    vnode_t *, struct nfsexstuff *, struct kauth_cred **);
 vnode_t nfsvno_getvp(fhandle_t *);
 int nfsvno_advlock(vnode_t, int, u_int64_t, u_int64_t, NFSPROC_T *);
-int nfsrv_v4rootexport(void *, struct ucred *, NFSPROC_T *);
+int nfsrv_v4rootexport(void *, struct kauth_cred *, NFSPROC_T *);
 int nfsvno_testexp(struct nfsrv_descript *, struct nfsexstuff *);
 uint32_t nfsrv_hashfh(fhandle_t *);
 uint32_t nfsrv_hashsessionid(uint8_t *);
@@ -667,15 +666,15 @@ void nfsrv_backupstable(void);
 
 /* nfs_commonkrpc.c */
 int newnfs_nmcancelreqs(struct nfsmount *);
-void newnfs_set_sigmask(struct thread *, sigset_t *);
-void newnfs_restore_sigmask(struct thread *, sigset_t *);
-int newnfs_msleep(struct thread *, void *, struct mtx *, int, char *, int);
+void newnfs_set_sigmask(struct lwp *, sigset_t *);
+void newnfs_restore_sigmask(struct lwp *, sigset_t *);
+int newnfs_msleep(struct lwp *, void *, struct kmutex *, int, char *, int);
 int newnfs_request(struct nfsrv_descript *, struct nfsmount *,
     struct nfsclient *, struct nfssockreq *, vnode_t, NFSPROC_T *,
-    struct ucred *, u_int32_t, u_int32_t, u_char *, int, u_int64_t *,
+    struct kauth_cred *, u_int32_t, u_int32_t, u_char *, int, u_int64_t *,
     struct nfsclsession *);
 int newnfs_connect(struct nfsmount *, struct nfssockreq *,
-    struct ucred *, NFSPROC_T *, int);
+    struct kauth_cred *, NFSPROC_T *, int);
 void newnfs_disconnect(struct nfssockreq *);
 int newnfs_sigintr(struct nfsmount *, NFSPROC_T *);
 
Index: src/sys/fs/nfs/common/nfsclstate.h
diff -u src/sys/fs/nfs/common/nfsclstate.h:1.1.1.2 src/sys/fs/nfs/common/nfsclstate.h:1.2
--- src/sys/fs/nfs/common/nfsclstate.h:1.1.1.2	Fri Nov 18 07:49:12 2016
+++ src/sys/fs/nfs/common/nfsclstate.h	Tue Dec 13 22:52:46 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfsclstate.h,v 1.1.1.2 2016/11/18 07:49:12 pgoyette Exp $	*/
+/*	$NetBSD: nfsclstate.h,v 1.2 2016/12/13 22:52:46 pgoyette Exp $	*/
 /*-
  * Copyright (c) 2009 Rick Macklem, University of Guelph
  * All rights reserved.
@@ -25,7 +25,7 @@
  * SUCH DAMAGE.
  *
  * FreeBSD: head/sys/fs/nfs/nfsclstate.h 268115 2014-07-01 20:47:16Z rmacklem 
- * $NetBSD: nfsclstate.h,v 1.1.1.2 2016/11/18 07:49:12 pgoyette Exp $
+ * $NetBSD: nfsclstate.h,v 1.2 2016/12/13 22:52:46 pgoyette Exp $
  */
 
 #ifndef _NFS_NFSCLSTATE_H_
@@ -56,7 +56,7 @@ LIST_HEAD(nfsclrecalllayouthead, nfsclre
 
 /* Structure for NFSv4.1 session stuff. */
 struct nfsclsession {
-	struct mtx	nfsess_mtx;
+	kmutex_t	nfsess_mtx;
 	struct nfsslot	nfsess_cbslots[NFSV4_CBSLOTS];
 	nfsquad_t	nfsess_clientid;
 	SVCXPRT		*nfsess_xprt;		/* For backchannel callback */
@@ -77,7 +77,7 @@ struct nfsclsession {
 struct nfsclds {
 	TAILQ_ENTRY(nfsclds)	nfsclds_list;
 	struct nfsclsession	nfsclds_sess;
-	struct mtx		nfsclds_mtx;
+	kmutex_t		nfsclds_mtx;
 	struct nfssockreq	*nfsclds_sockp;
 	time_t			nfsclds_expire;
 	uint16_t		nfsclds_flags;
Index: src/sys/fs/nfs/common/nfsrvcache.h
diff -u src/sys/fs/nfs/common/nfsrvcache.h:1.1.1.2 src/sys/fs/nfs/common/nfsrvcache.h:1.2
--- src/sys/fs/nfs/common/nfsrvcache.h:1.1.1.2	Fri Nov 18 07:49:13 2016
+++ src/sys/fs/nfs/common/nfsrvcache.h	Tue Dec 13 22:52:46 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfsrvcache.h,v 1.1.1.2 2016/11/18 07:49:13 pgoyette Exp $	*/
+/*	$NetBSD: nfsrvcache.h,v 1.2 2016/12/13 22:52:46 pgoyette Exp $	*/
 /*-
  * Copyright (c) 1989, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  * FreeBSD: head/sys/fs/nfs/nfsrvcache.h 269347 2014-07-31 19:24:44Z kib 
- * $NetBSD: nfsrvcache.h,v 1.1.1.2 2016/11/18 07:49:13 pgoyette Exp $
+ * $NetBSD: nfsrvcache.h,v 1.2 2016/12/13 22:52:46 pgoyette Exp $
  */
 
 #ifndef _NFS_NFSRVCACHE_H_
@@ -117,7 +117,7 @@ LIST_HEAD(nfsrvhashhead, nfsrvcache);
 
 /* The fine-grained locked cache hash table for TCP. */
 struct nfsrchash_bucket {
-	struct mtx		mtx;
+	struct kmutex		mtx;
 	struct nfsrvhashhead	tbl;
 };
 
Index: src/sys/fs/nfs/common/nfsrvstate.h
diff -u src/sys/fs/nfs/common/nfsrvstate.h:1.1.1.2 src/sys/fs/nfs/common/nfsrvstate.h:1.2
--- src/sys/fs/nfs/common/nfsrvstate.h:1.1.1.2	Fri Nov 18 07:49:13 2016
+++ src/sys/fs/nfs/common/nfsrvstate.h	Tue Dec 13 22:52:46 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfsrvstate.h,v 1.1.1.2 2016/11/18 07:49:13 pgoyette Exp $	*/
+/*	$NetBSD: nfsrvstate.h,v 1.2 2016/12/13 22:52:46 pgoyette Exp $	*/
 /*-
  * Copyright (c) 2009 Rick Macklem, University of Guelph
  * All rights reserved.
@@ -25,7 +25,7 @@
  * SUCH DAMAGE.
  *
  * FreeBSD: head/sys/fs/nfs/nfsrvstate.h 298788 2016-04-29 16:07:25Z pfg 
- * $NetBSD: nfsrvstate.h,v 1.1.1.2 2016/11/18 07:49:13 pgoyette Exp $
+ * $NetBSD: nfsrvstate.h,v 1.2 2016/12/13 22:52:46 pgoyette Exp $
  */
 
 #ifndef _NFS_NFSRVSTATE_H_
@@ -68,7 +68,7 @@ TAILQ_HEAD(nfsuserhashhead, nfsusrgrp);
 		% nfsrv_lughashsize])
 
 struct nfssessionhash {
-	struct mtx			mtx;
+	struct kmutex			mtx;
 	struct nfssessionhashhead	list;
 };
 #define	NFSSESSIONHASH(f) 						\

Index: src/sys/fs/nfs/common/nfsm_subs.h
diff -u src/sys/fs/nfs/common/nfsm_subs.h:1.3 src/sys/fs/nfs/common/nfsm_subs.h:1.4
--- src/sys/fs/nfs/common/nfsm_subs.h:1.3	Fri Nov 18 08:31:30 2016
+++ src/sys/fs/nfs/common/nfsm_subs.h	Tue Dec 13 22:52:46 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfsm_subs.h,v 1.3 2016/11/18 08:31:30 pgoyette Exp $	*/
+/*	$NetBSD: nfsm_subs.h,v 1.4 2016/12/13 22:52:46 pgoyette Exp $	*/
 /*-
  * Copyright (c) 1989, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  * FreeBSD: head/sys/fs/nfs/nfsm_subs.h 276780 2015-01-07 17:22:56Z rwatson 
- * $NetBSD: nfsm_subs.h,v 1.3 2016/11/18 08:31:30 pgoyette Exp $
+ * $NetBSD: nfsm_subs.h,v 1.4 2016/12/13 22:52:46 pgoyette Exp $
  */
 
 #ifndef _NFS_NFSM_SUBS_H_
@@ -69,7 +69,7 @@ nfsm_build(struct nfsrv_descript *nd, in
 		if (siz > MLEN)
 			panic("build > MLEN");
 		mbuf_setlen(mb2, 0);
-		nd->nd_bpos = NFSMTOD(mb2, caddr_t);
+		nd->nd_bpos = NFSMTOD(mb2, char *);
 		nd->nd_mb->m_next = mb2;
 		nd->nd_mb = mb2;
 	}
@@ -87,7 +87,7 @@ nfsm_dissect(struct nfsrv_descript *nd, 
 	int tt1;
 	void *retp;
 
-	tt1 = NFSMTOD(nd->nd_md, caddr_t) + nd->nd_md->m_len - nd->nd_dpos;
+	tt1 = NFSMTOD(nd->nd_md, char *) + nd->nd_md->m_len - nd->nd_dpos;
 	if (tt1 >= siz) { 
 		retp = (void *)nd->nd_dpos;
 		nd->nd_dpos += siz;
@@ -103,7 +103,7 @@ nfsm_dissect_nonblock(struct nfsrv_descr
 	int tt1;
 	void *retp;
 
-	tt1 = NFSMTOD(nd->nd_md, caddr_t) + nd->nd_md->m_len - nd->nd_dpos;
+	tt1 = NFSMTOD(nd->nd_md, char *) + nd->nd_md->m_len - nd->nd_dpos;
 	if (tt1 >= siz) { 
 		retp = (void *)nd->nd_dpos;
 		nd->nd_dpos += siz;

Reply via email to