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)
This commit is contained in:
Jamie Gritton 2009-06-15 19:01:53 +00:00
parent 679e13901c
commit 9ed47d01eb
7 changed files with 10 additions and 10 deletions

View file

@ -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;

View file

@ -2091,9 +2091,9 @@ linux_ifname(struct ifnet *ifp, char *buffer, size_t buflen)
*/
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, struct linux_ioctl_args *args)
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);
/*

View file

@ -1599,7 +1599,7 @@ userland_sysctl(struct thread *td, int *name, u_int namelen, void *old,
sx_xlock(&sysctlmemlock);
} else
memlocked = 0;
CURVNET_SET(TD_TO_VNET(curthread));
CURVNET_SET(TD_TO_VNET(td));
for (;;) {
req.oldidx = 0;

View file

@ -359,7 +359,7 @@ socreate(int dom, struct socket **aso, int type, int proto,
if (prp->pr_type != type)
return (EPROTOTYPE);
so = soalloc(TD_TO_VNET(td));
so = soalloc(CRED_TO_VNET(cred));
if (so == NULL)
return (ENOBUFS);

View file

@ -226,7 +226,7 @@ tunclone(void *arg, struct ucred *cred, char *name, int namelen,
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) {

View file

@ -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_inet_tcp, TCPCTL_MSSDFLT, mssdflt,
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;

View file

@ -456,7 +456,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
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: \