PERFORCE change 177632 for review
Marko Zec
zec at FreeBSD.org
Sun May 2 23:19:59 UTC 2010
http://p4web.freebsd.org/@@177632?ac=10
Change 177632 by zec at zec_tpx32 on 2010/05/02 23:19:17
Prune random (mostly IMUNES related) changes from this branch.
vimage == head now.
Affected files ...
.. //depot/projects/vimage/src/sys/i386/conf/.cvsignore#4 edit
.. //depot/projects/vimage/src/sys/kern/vfs_export.c#26 edit
.. //depot/projects/vimage/src/sys/kern/vfs_lookup.c#34 edit
.. //depot/projects/vimage/src/sys/net/if.c#98 edit
.. //depot/projects/vimage/src/sys/net/if_vlan.c#27 edit
.. //depot/projects/vimage/src/sys/net/vnet.c#9 edit
.. //depot/projects/vimage/src/sys/net/vnet.h#36 edit
.. //depot/projects/vimage/src/sys/netgraph/ng_bridge.c#12 edit
.. //depot/projects/vimage/src/sys/netgraph/ng_eiface.c#37 edit
.. //depot/projects/vimage/src/sys/netgraph/ng_hub.c#4 edit
.. //depot/projects/vimage/src/sys/netgraph/ng_iface.c#34 edit
Differences ...
==== //depot/projects/vimage/src/sys/i386/conf/.cvsignore#4 (text+ko) ====
@@ -1,0 +1,1 @@
+[A-Za-z0-9]*
==== //depot/projects/vimage/src/sys/kern/vfs_export.c#26 (text+ko) ====
@@ -54,7 +54,6 @@
#include <sys/vnode.h>
#include <net/radix.h>
-#include <net/vnet.h>
static MALLOC_DEFINE(M_NETADDR, "export_host", "Export host address structure");
@@ -143,7 +142,6 @@
}
#endif
- CURVNET_SET(TD_TO_VNET(curthread)); /* XXX MARKO */
i = sizeof(struct netcred) + argp->ex_addrlen + argp->ex_masklen;
np = (struct netcred *) malloc(i, M_NETADDR, M_WAITOK | M_ZERO);
saddr = (struct sockaddr *) (np + 1);
@@ -216,10 +214,8 @@
np->netc_numsecflavors = argp->ex_numsecflavors;
bcopy(argp->ex_secflavors, np->netc_secflavors,
sizeof(np->netc_secflavors));
- CURVNET_RESTORE();
return (0);
out:
- CURVNET_RESTORE();
free(np, M_NETADDR);
return (error);
}
==== //depot/projects/vimage/src/sys/kern/vfs_lookup.c#34 (text+ko) ====
@@ -59,8 +59,6 @@
#include <sys/ktrace.h>
#endif
-#include <net/vnet.h>
-
#include <security/audit/audit.h>
#include <security/mac/mac_framework.h>
@@ -74,19 +72,6 @@
"unsigned long");
SDT_PROBE_DEFINE2(vfs, namei, lookup, return, "int", "struct vnode *");
-#ifdef VIMAGE
-#define IMUNES_SYMLINK_HACK
-#endif
-
-#ifdef IMUNES_SYMLINK_HACK
-static VNET_DEFINE(int, morphing_symlinks);
-#define V_morphing_symlinks VNET(morphing_symlinks)
-
-SYSCTL_VNET_INT(_vfs, OID_AUTO, morphing_symlinks, CTLFLAG_RW,
- &VNET_NAME(morphing_symlinks), 0,
- "Resolve @ to vimage name in symlinks");
-#endif
-
/*
* Allocation zone for namei
*/
@@ -353,44 +338,6 @@
error = ENOENT;
break;
}
-#ifdef IMUNES_SYMLINK_HACK
- /*
- * If the symbolic link includes a special character '@',
- * and V_morphing_symlinks is set, substitute the first
- * occurence of '@' with full path to jail / vimage name.
- * If the full path includes subhierarchies, s/./\// when
- * expanding '@' to jail / vimage name.
- *
- * XXX revisit buffer length checking.
- */
- CURVNET_SET_QUIET(TD_TO_VNET(curthread));
- if (V_morphing_symlinks) {
- char *sp = strchr(cp, '@');
-
- if (sp) {
- char *vname = td->td_ucred->cr_prison->pr_name;
- int vnamelen = strlen(vname);
- int i;
-
- if (vnamelen >= auio.uio_resid) {
- if (ndp->ni_pathlen > 1)
- uma_zfree(namei_zone, cp);
- error = ENAMETOOLONG;
- CURVNET_RESTORE();
- break;
- }
- bcopy(sp + 1, sp + vnamelen,
- linklen - (sp - cp));
- bcopy(td->td_ucred->cr_prison->pr_name,
- sp, vnamelen);
- linklen += (vnamelen - 1);
- for (i = 0; i < vnamelen; i++)
- if (sp[i] == '.')
- sp[i] = '/';
- }
- }
- CURVNET_RESTORE();
-#endif
if (linklen + ndp->ni_pathlen >= MAXPATHLEN) {
if (ndp->ni_pathlen > 1)
uma_zfree(namei_zone, cp);
==== //depot/projects/vimage/src/sys/net/if.c#98 (text+ko) ====
@@ -800,14 +800,6 @@
struct ifnet *iter;
int found = 0;
- /*
- * Detach from any vlan, bridge or lagg ifnets linked to us.
- * A small though unlikely window for a race from here to ifp
- * unlinking from ifnet list is possible, hence we repeat the
- * procedure once again further bellow. XXX.
- */
- EVENTHANDLER_INVOKE(ifnet_departure_event, ifp);
-
IFNET_WLOCK();
TAILQ_FOREACH(iter, &V_ifnet, if_link)
if (iter == ifp) {
==== //depot/projects/vimage/src/sys/net/if_vlan.c#27 (text+ko) ====
@@ -1429,12 +1429,6 @@
error = copyin(ifr->ifr_data, &vlr, sizeof(vlr));
if (error)
break;
-#ifdef VIMAGE
- if (ifp->if_home_vnet != ifp->if_vnet) {
- error = EPERM;
- break;
- }
-#endif
if (vlr.vlr_parent[0] == '\0') {
vlan_unconfig(ifp);
break;
@@ -1462,12 +1456,6 @@
case SIOCGETVLAN:
bzero(&vlr, sizeof(vlr));
-#ifdef VIMAGE
- if (ifp->if_home_vnet != ifp->if_vnet) {
- error = EPERM;
- break;
- }
-#endif
VLAN_LOCK();
if (TRUNK(ifv) != NULL) {
strlcpy(vlr.vlr_parent, PARENT(ifv)->if_xname,
==== //depot/projects/vimage/src/sys/net/vnet.c#9 (text+ko) ====
@@ -473,15 +473,6 @@
}
int
-vnet_sysctl_handle_long(SYSCTL_HANDLER_ARGS)
-{
-
- if (arg1 != NULL)
- arg1 = (void *)(curvnet->vnet_data_base + (uintptr_t)arg1);
- return (sysctl_handle_long(oidp, arg1, arg2, req));
-}
-
-int
vnet_sysctl_handle_opaque(SYSCTL_HANDLER_ARGS)
{
@@ -508,15 +499,6 @@
return (sysctl_handle_int(oidp, arg1, arg2, req));
}
-int
-vnet_sysctl_handle_ulong(SYSCTL_HANDLER_ARGS)
-{
-
- if (arg1 != NULL)
- arg1 = (void *)(curvnet->vnet_data_base + (uintptr_t)arg1);
- return (sysctl_handle_long(oidp, arg1, arg2, req));
-}
-
/*
* Support for special SYSINIT handlers registered via VNET_SYSINIT()
* and VNET_SYSUNINIT().
==== //depot/projects/vimage/src/sys/net/vnet.h#36 (text+ko) ====
@@ -236,8 +236,6 @@
int vnet_sysctl_handle_opaque(SYSCTL_HANDLER_ARGS);
int vnet_sysctl_handle_string(SYSCTL_HANDLER_ARGS);
int vnet_sysctl_handle_uint(SYSCTL_HANDLER_ARGS);
-int vnet_sysctl_handle_long(SYSCTL_HANDLER_ARGS);
-int vnet_sysctl_handle_ulong(SYSCTL_HANDLER_ARGS);
#define SYSCTL_VNET_INT(parent, nbr, name, access, ptr, val, descr) \
SYSCTL_OID(parent, nbr, name, \
@@ -260,14 +258,6 @@
SYSCTL_OID(parent, nbr, name, \
CTLTYPE_UINT|CTLFLAG_MPSAFE|CTLFLAG_VNET|(access), \
ptr, val, vnet_sysctl_handle_uint, "IU", descr)
-#define SYSCTL_VNET_LONG(parent, nbr, name, access, ptr, val, descr) \
- SYSCTL_OID(parent, nbr, name, \
- CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_VNET|(access), \
- ptr, val, vnet_sysctl_handle_long, "L", descr)
-#define SYSCTL_VNET_ULONG(parent, nbr, name, access, ptr, val, descr) \
- SYSCTL_OID(parent, nbr, name, \
- CTLTYPE_ULONG|CTLFLAG_MPSAFE|CTLFLAG_VNET|(access), \
- ptr, val, vnet_sysctl_handle_ulong, "LU", descr)
#define VNET_SYSCTL_ARG(req, arg1) do { \
if (arg1 != NULL) \
arg1 = (void *)(TD_TO_VNET((req)->td)->vnet_data_base + \
==== //depot/projects/vimage/src/sys/netgraph/ng_bridge.c#12 (text+ko) ====
@@ -106,7 +106,6 @@
u_int numBuckets; /* num buckets in table */
u_int hashMask; /* numBuckets - 1 */
int numLinks; /* num connected links */
- int persistent; /* can exist w/o any hooks */
struct callout timer; /* one second periodic timer */
};
typedef struct ng_bridge_private *priv_p;
@@ -347,13 +346,13 @@
ng_bridge_newhook(node_p node, hook_p hook, const char *name)
{
const priv_p priv = NG_NODE_PRIVATE(node);
- int linkNum = -1;
/* Check for a link hook */
if (strncmp(name, NG_BRIDGE_HOOK_LINK_PREFIX,
strlen(NG_BRIDGE_HOOK_LINK_PREFIX)) == 0) {
const char *cp;
char *eptr;
+ u_long linkNum;
cp = name + strlen(NG_BRIDGE_HOOK_LINK_PREFIX);
if (!isdigit(*cp) || (cp[0] == '0' && cp[1] != '\0'))
@@ -361,12 +360,6 @@
linkNum = strtoul(cp, &eptr, 10);
if (*eptr != '\0' || linkNum >= NG_BRIDGE_MAX_LINKS)
return (EINVAL);
- } else if (strcmp(name, "anchor") == 0) {
- linkNum = 0;
- priv->persistent = 1;
- }
-
- if (linkNum >= 0 ) {
if (priv->links[linkNum] != NULL)
return (EISCONN);
priv->links[linkNum] = malloc(sizeof(*priv->links[linkNum]),
@@ -374,7 +367,7 @@
if (priv->links[linkNum] == NULL)
return (ENOMEM);
priv->links[linkNum]->hook = hook;
- NG_HOOK_SET_PRIVATE(hook, (void *)(intptr_t)linkNum);
+ NG_HOOK_SET_PRIVATE(hook, (void *)linkNum);
priv->numLinks++;
return (0);
}
@@ -807,8 +800,7 @@
/* If no more hooks, go away */
if ((NG_NODE_NUMHOOKS(NG_HOOK_NODE(hook)) == 0)
- && (NG_NODE_IS_VALID(NG_HOOK_NODE(hook)))
- && !priv->persistent) {
+ && (NG_NODE_IS_VALID(NG_HOOK_NODE(hook)))) {
ng_rmnode_self(NG_HOOK_NODE(hook));
}
return (0);
==== //depot/projects/vimage/src/sys/netgraph/ng_eiface.c#37 (text+ko) ====
@@ -79,20 +79,9 @@
int unit; /* Interface unit number */
node_p node; /* Our netgraph node */
hook_p ether; /* Hook for ethernet stream */
- LIST_ENTRY(ng_eiface_private) le; /* All eiface nodes in a vnet */
};
typedef struct ng_eiface_private *priv_p;
-#ifdef VIMAGE
-/* Per-vnet list of eiface nodes */
-static VNET_DEFINE(LIST_HEAD(, ng_eiface_private), ng_eiface_list);
-#define V_ng_eiface_list VNET(ng_eiface_list)
-
-static struct sx ng_eiface_list_sxlock;
-#define NG_EIFACE_LIST_WLOCK() sx_xlock(&ng_eiface_list_sxlock);
-#define NG_EIFACE_LIST_WUNLOCK() sx_xunlock(&ng_eiface_list_sxlock);
-#endif
-
/* Interface methods */
static void ng_eiface_init(void *xsc);
static void ng_eiface_start(struct ifnet *ifp);
@@ -373,11 +362,6 @@
/* Link together node and private info */
NG_NODE_SET_PRIVATE(node, priv);
priv->node = node;
-#ifdef VIMAGE
- NG_EIFACE_LIST_WLOCK();
- LIST_INSERT_HEAD(&V_ng_eiface_list, priv, le);
- NG_EIFACE_LIST_WUNLOCK();
-#endif
/* Initialize interface structure */
if_initname(ifp, NG_EIFACE_EIFACE_NAME, priv->unit);
@@ -576,11 +560,6 @@
ether_ifdetach(ifp);
if_free(ifp);
CURVNET_RESTORE();
-#ifdef VIMAGE
- NG_EIFACE_LIST_WLOCK();
- LIST_REMOVE(priv, le);
- NG_EIFACE_LIST_WUNLOCK();
-#endif
free_unr(V_ng_eiface_unit, priv->unit);
free(priv, M_NETGRAPH);
NG_NODE_SET_PRIVATE(node, NULL);
@@ -610,15 +589,7 @@
switch (event) {
case MOD_LOAD:
-#ifdef VIMAGE
- sx_init_flags(&ng_eiface_list_sxlock, "ng_eiface_sxlock",
- SX_RECURSE);
-#endif
- break;
case MOD_UNLOAD:
-#ifdef VIMAGE
- sx_destroy(&ng_eiface_list_sxlock);
-#endif
break;
default:
error = EOPNOTSUPP;
@@ -631,9 +602,6 @@
vnet_ng_eiface_init(const void *unused)
{
-#ifdef VIMAGE
- LIST_INIT(&V_ng_eiface_list);
-#endif
V_ng_eiface_unit = new_unrhdr(0, 0xffff, NULL);
}
VNET_SYSINIT(vnet_ng_eiface_init, SI_SUB_PSEUDO, SI_ORDER_ANY,
@@ -642,18 +610,8 @@
static void
vnet_ng_eiface_uninit(const void *unused)
{
-#ifdef VIMAGE
- priv_p node_p, nnode_p;
- NG_EIFACE_LIST_WLOCK();
- LIST_FOREACH_SAFE(node_p, &V_ng_eiface_list, le, nnode_p) {
- if (node_p->node->nd_type == &typestruct)
- ng_rmnode_self(node_p->node);
- }
- NG_EIFACE_LIST_WUNLOCK();
-#endif
-
delete_unrhdr(V_ng_eiface_unit);
}
-VNET_SYSUNINIT(vnet_ng_eiface_uninit, SI_SUB_PSEUDO, SI_ORDER_FIRST,
+VNET_SYSUNINIT(vnet_ng_eiface_uninit, SI_SUB_PSEUDO, SI_ORDER_ANY,
vnet_ng_eiface_uninit, NULL);
==== //depot/projects/vimage/src/sys/netgraph/ng_hub.c#4 (text+ko) ====
@@ -37,7 +37,6 @@
#include <netgraph/netgraph.h>
static ng_constructor_t ng_hub_constructor;
-static ng_newhook_t ng_hub_newhook;
static ng_rcvdata_t ng_hub_rcvdata;
static ng_disconnect_t ng_hub_disconnect;
@@ -45,7 +44,6 @@
.version = NG_ABI_VERSION,
.name = NG_HUB_NODE_TYPE,
.constructor = ng_hub_constructor,
- .newhook = ng_hub_newhook,
.rcvdata = ng_hub_rcvdata,
.disconnect = ng_hub_disconnect,
};
@@ -59,14 +57,6 @@
return (0);
}
-static int
-ng_hub_newhook(node_p node, hook_p hook, const char *name)
-{
- if (strcmp(name, "anchor") == 0)
- node->nd_private = (void *) 1;
- return (0);
-}
-
static int
ng_hub_rcvdata(hook_p hook, item_p item)
{
@@ -104,7 +94,7 @@
{
if (NG_NODE_NUMHOOKS(NG_HOOK_NODE(hook)) == 0 &&
- NG_NODE_IS_VALID(NG_HOOK_NODE(hook)) && !hook->hk_node->nd_private)
+ NG_NODE_IS_VALID(NG_HOOK_NODE(hook)))
ng_rmnode_self(NG_HOOK_NODE(hook));
return (0);
}
==== //depot/projects/vimage/src/sys/netgraph/ng_iface.c#34 (text+ko) ====
@@ -857,17 +857,6 @@
static void
vnet_ng_iface_uninit(const void *unused)
{
-#ifdef VIMAGE_NOTYET
- node_p node;
-
- do {
- LIST_FOREACH(node, &V_ng_nodelist, nd_nodes)
- if (node->nd_type == &typestruct)
- break;
- if (node != NULL)
- ng_rmnode_self(node);
- } while (node != NULL);
-#endif
delete_unrhdr(V_ng_iface_unit);
}
More information about the p4-projects
mailing list