PERFORCE change 163244 for review

Marko Zec zec at FreeBSD.org
Mon Jun 1 10:42:50 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=163244

Change 163244 by zec at zec_amdx4 on 2009/06/01 10:42:40

	Fix misintegrations and reduce diff against head.

Affected files ...

.. //depot/projects/vimage/src/sys/kern/uipc_socket.c#35 edit
.. //depot/projects/vimage/src/sys/net/if_clone.c#16 edit

Differences ...

==== //depot/projects/vimage/src/sys/kern/uipc_socket.c#35 (text+ko) ====

@@ -288,7 +288,6 @@
 #ifdef VIMAGE
 	++vnet->sockcnt;	/* Locked with so_global_mtx. */
 	so->so_vnet = vnet;
-	vnet->sockcnt++;
 #endif
 	mtx_unlock(&so_global_mtx);
 	return (so);
@@ -361,11 +360,7 @@
 
 	if (prp->pr_type != type)
 		return (EPROTOTYPE);
-#ifdef VIMAGE
 	so = soalloc(TD_TO_VNET(td));
-#else
-	so = soalloc(NULL);
-#endif
 	if (so == NULL)
 		return (ENOBUFS);
 
@@ -435,12 +430,8 @@
 	if (over)
 #endif
 		return (NULL);
-#ifdef VIMAGE
 	VNET_ASSERT(head->so_vnet);
 	so = soalloc(head->so_vnet);
-#else
-	so = soalloc(NULL);
-#endif
 	if (so == NULL)
 		return (NULL);
 	if ((head->so_options & SO_ACCEPTFILTER) != 0)
@@ -2065,7 +2056,7 @@
 soshutdown(struct socket *so, int how)
 {
 	struct protosw *pr = so->so_proto;
-	int error = 0;
+	int error;
 
 	if (!(how == SHUT_RD || how == SHUT_WR || how == SHUT_RDWR))
 		return (EINVAL);
@@ -2078,8 +2069,9 @@
 		CURVNET_SET(so->so_vnet);
 		error = (*pr->pr_usrreqs->pru_shutdown)(so);
 		CURVNET_RESTORE();
+		return (error);
 	}
-	return (error);
+	return (0);
 }
 
 void

==== //depot/projects/vimage/src/sys/net/if_clone.c#16 (text+ko) ====

@@ -459,24 +459,6 @@
 	 * Find a free unit if none was given.
 	 */
 	if (wildcard) {
-#ifdef VIMAGE
-		INIT_VNET_NET(curvnet);
-		char name[IFNAMSIZ];
-		struct ifnet *ifp;
-		int i = 0;
-
-		IFNET_RLOCK();
-again:
-		TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
-			sprintf(name, "%s%d", ifc->ifc_name, i);
-			if (strcmp(name, ifp->if_xname) == 0) {
-				i++;
-				goto again;
-			}
-		}
-		IFNET_RUNLOCK();
-		*unit = i;
-#else
 		while ((bytoff < ifc->ifc_bmlen)
 		    && (ifc->ifc_units[bytoff] == 0xff))
 			bytoff++;
@@ -487,7 +469,6 @@
 		while ((ifc->ifc_units[bytoff] & (1 << bitoff)) != 0)
 			bitoff++;
 		*unit = (bytoff << 3) + bitoff;
-#endif
 	}
 
 	if (*unit > ifc->ifc_maxunit) {
@@ -495,7 +476,6 @@
 		goto done;
 	}
 
-#ifndef VIMAGE
 	if (!wildcard) {
 		bytoff = *unit >> 3;
 		bitoff = *unit - (bytoff << 3);
@@ -511,7 +491,6 @@
 	KASSERT((ifc->ifc_units[bytoff] & (1 << bitoff)) == 0,
 	    ("%s: bit is already set", __func__));
 	ifc->ifc_units[bytoff] |= (1 << bitoff);
-#endif
 	IF_CLONE_ADDREF_LOCKED(ifc);
 
 done:
@@ -522,7 +501,6 @@
 void
 ifc_free_unit(struct if_clone *ifc, int unit)
 {
-#ifndef VIMAGE
 	int bytoff, bitoff;
 
 
@@ -537,7 +515,6 @@
 	    ("%s: bit is already cleared", __func__));
 	ifc->ifc_units[bytoff] &= ~(1 << bitoff);
 	IF_CLONE_REMREF_LOCKED(ifc);	/* releases lock */
-#endif
 }
 
 void


More information about the p4-projects mailing list