Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jun 2009 19:01:54 +0000 (UTC)
From:      Jamie Gritton <jamie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r194252 - in head/sys: compat/linprocfs compat/linux kern net netinet sys
Message-ID:  <200906151901.n5FJ1s82098399@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jamie
Date: Mon Jun 15 19:01:53 2009
New Revision: 194252
URL: http://svn.freebsd.org/changeset/base/194252

Log:
  Get vnets from creds instead of threads where they're available, and from
  passed threads instead of curthread.
  
  Reviewed by:	zec, julian
  Approved by:	bz (mentor)

Modified:
  head/sys/compat/linprocfs/linprocfs.c
  head/sys/compat/linux/linux_ioctl.c
  head/sys/kern/kern_sysctl.c
  head/sys/kern/uipc_socket.c
  head/sys/net/if_tun.c
  head/sys/netinet/tcp_subr.c
  head/sys/sys/sysctl.h

Modified: head/sys/compat/linprocfs/linprocfs.c
==============================================================================
--- head/sys/compat/linprocfs/linprocfs.c	Mon Jun 15 18:59:29 2009	(r194251)
+++ head/sys/compat/linprocfs/linprocfs.c	Mon Jun 15 19:01:53 2009	(r194252)
@@ -1079,7 +1079,7 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
 static int
 linprocfs_donetdev(PFS_FILL_ARGS)
 {
-	INIT_VNET_NET(TD_TO_VNET(curthread));
+	INIT_VNET_NET(TD_TO_VNET(td));
 	char ifname[16]; /* XXX LINUX_IFNAMSIZ */
 	struct ifnet *ifp;
 

Modified: head/sys/compat/linux/linux_ioctl.c
==============================================================================
--- head/sys/compat/linux/linux_ioctl.c	Mon Jun 15 18:59:29 2009	(r194251)
+++ head/sys/compat/linux/linux_ioctl.c	Mon Jun 15 19:01:53 2009	(r194252)
@@ -2091,9 +2091,9 @@ linux_ifname(struct ifnet *ifp, char *bu
  */
 
 static struct ifnet *
-ifname_linux_to_bsd(const char *lxname, char *bsdname)
+ifname_linux_to_bsd(struct thread *td, const char *lxname, char *bsdname)
 {
-	INIT_VNET_NET(TD_TO_VNET(curthread));
+	INIT_VNET_NET(TD_TO_VNET(td));
 	struct ifnet *ifp;
 	int len, unit;
 	char *ep;
@@ -2379,7 +2379,7 @@ linux_ioctl_socket(struct thread *td, st
 		printf("%s(): ioctl %d on %.*s\n", __func__,
 		    args->cmd & 0xffff, LINUX_IFNAMSIZ, lifname);
 #endif
-		ifp = ifname_linux_to_bsd(lifname, ifname);
+		ifp = ifname_linux_to_bsd(td, lifname, ifname);
 		if (ifp == NULL)
 			return (EINVAL);
 		/*

Modified: head/sys/kern/kern_sysctl.c
==============================================================================
--- head/sys/kern/kern_sysctl.c	Mon Jun 15 18:59:29 2009	(r194251)
+++ head/sys/kern/kern_sysctl.c	Mon Jun 15 19:01:53 2009	(r194252)
@@ -1599,7 +1599,7 @@ userland_sysctl(struct thread *td, int *
 		sx_xlock(&sysctlmemlock);
 	} else
 		memlocked = 0;
-	CURVNET_SET(TD_TO_VNET(curthread));
+	CURVNET_SET(TD_TO_VNET(td));
 
 	for (;;) {
 		req.oldidx = 0;

Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c	Mon Jun 15 18:59:29 2009	(r194251)
+++ head/sys/kern/uipc_socket.c	Mon Jun 15 19:01:53 2009	(r194252)
@@ -359,7 +359,7 @@ socreate(int dom, struct socket **aso, i
 
 	if (prp->pr_type != type)
 		return (EPROTOTYPE);
-	so = soalloc(TD_TO_VNET(td));
+	so = soalloc(CRED_TO_VNET(cred));
 	if (so == NULL)
 		return (ENOBUFS);
 

Modified: head/sys/net/if_tun.c
==============================================================================
--- head/sys/net/if_tun.c	Mon Jun 15 18:59:29 2009	(r194251)
+++ head/sys/net/if_tun.c	Mon Jun 15 19:01:53 2009	(r194252)
@@ -226,7 +226,7 @@ tunclone(void *arg, struct ucred *cred, 
 	else
 		append_unit = 0;
 
-	CURVNET_SET(TD_TO_VNET(curthread));
+	CURVNET_SET(CRED_TO_VNET(cred));
 	/* find any existing device, or allocate new unit number */
 	i = clone_create(&tunclones, &tun_cdevsw, &u, dev, 0);
 	if (i) {

Modified: head/sys/netinet/tcp_subr.c
==============================================================================
--- head/sys/netinet/tcp_subr.c	Mon Jun 15 18:59:29 2009	(r194251)
+++ head/sys/netinet/tcp_subr.c	Mon Jun 15 19:01:53 2009	(r194252)
@@ -131,7 +131,7 @@ static int	tcp_inflight_stab;
 static int
 sysctl_net_inet_tcp_mss_check(SYSCTL_HANDLER_ARGS)
 {
-	INIT_VNET_INET(curvnet);
+	INIT_VNET_INET(TD_TO_VNET(req->td));
 	int error, new;
 
 	new = V_tcp_mssdflt;
@@ -154,7 +154,7 @@ SYSCTL_V_PROC(V_NET, vnet_inet, _net_ine
 static int
 sysctl_net_inet_tcp_mss_v6_check(SYSCTL_HANDLER_ARGS)
 {
-	INIT_VNET_INET(curvnet);
+	INIT_VNET_INET(TD_TO_VNET(req->td));
 	int error, new;
 
 	new = V_tcp_v6mssdflt;

Modified: head/sys/sys/sysctl.h
==============================================================================
--- head/sys/sys/sysctl.h	Mon Jun 15 18:59:29 2009	(r194251)
+++ head/sys/sys/sysctl.h	Mon Jun 15 19:01:53 2009	(r194252)
@@ -456,7 +456,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 		break;							\
 	case V_NET:							\
 		cp = (char *)						\
-		    TD_TO_VNET(curthread)->mod_data[oidp->oid_v_mod];	\
+		    TD_TO_VNET(req->td)->mod_data[oidp->oid_v_mod];	\
 		arg1 = cp + (size_t) arg1;				\
 		break;							\
 	case V_PROCG:							\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906151901.n5FJ1s82098399>