Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Jan 2011 21:42:12 +0200
From:      Mikolaj Golub <to.my.trociny@gmail.com>
To:        freebsd-virtualization@FreeBSD.org
Subject:   smbfs on VIMAGE kernel
Message-ID:  <86ei8j6xd7.fsf@kopusha.home.net>

next in thread | raw e-mail | index | archive | help
--=-=-=

Hi,

With the attached patch I can mount and use samba fs on current built with
VIMAGE option.

-- 
Mikolaj Golub


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=smb_trantcp.c.VNET.patch

Index: sys/netsmb/smb_trantcp.c
===================================================================
--- sys/netsmb/smb_trantcp.c	(revision 217275)
+++ sys/netsmb/smb_trantcp.c	(working copy)
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/route.h>
+#include <net/vnet.h>
 
 #include <netinet/in.h>
 #include <netinet/tcp.h>
@@ -79,13 +80,17 @@ static int
 nb_setsockopt_int(struct socket *so, int level, int name, int val)
 {
 	struct sockopt sopt;
+	int error;
 
 	bzero(&sopt, sizeof(sopt));
 	sopt.sopt_level = level;
 	sopt.sopt_name = name;
 	sopt.sopt_val = &val;
 	sopt.sopt_valsize = sizeof(val);
-	return sosetopt(so, &sopt);
+	CURVNET_SET(so->so_vnet);
+	error = sosetopt(so, &sopt);
+	CURVNET_RESTORE();
+	return error;
 }
 
 static int
@@ -286,8 +291,10 @@ nbssn_recvhdr(struct nbpcb *nbp, int *lenp,
 	auio.uio_offset = 0;
 	auio.uio_resid = sizeof(len);
 	auio.uio_td = td;
+	CURVNET_SET(so->so_vnet);
 	error = soreceive(so, (struct sockaddr **)NULL, &auio,
 	    (struct mbuf **)NULL, (struct mbuf **)NULL, &flags);
+	CURVNET_RESTORE();
 	if (error)
 		return error;
 	if (auio.uio_resid > 0) {
@@ -371,8 +378,10 @@ nbssn_recv(struct nbpcb *nbp, struct mbuf **mpp, i
 			 */
 			do {
 				rcvflg = MSG_WAITALL;
+				CURVNET_SET(so->so_vnet);
 				error = soreceive(so, (struct sockaddr **)NULL,
 				    &auio, &tm, (struct mbuf **)NULL, &rcvflg);
+				CURVNET_RESTORE();
 			} while (error == EWOULDBLOCK || error == EINTR ||
 				 error == ERESTART);
 			if (error)

--=-=-=--



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