PERFORCE change 142751 for review
Marko Zec
zec at FreeBSD.org
Mon Jun 2 12:51:42 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=142751
Change 142751 by zec at zec_tca51 on 2008/06/02 12:51:04
Unbreak netgraph compilation.
Affected files ...
.. //depot/projects/vimage/src/sys/netgraph/ng_base.c#27 edit
.. //depot/projects/vimage/src/sys/netgraph/vnetgraph.h#7 edit
Differences ...
==== //depot/projects/vimage/src/sys/netgraph/ng_base.c#27 (text+ko) ====
@@ -170,11 +170,12 @@
/* Hash related definitions */
/* XXX Don't need to initialise them because it's a LIST */
-#define NG_ID_HASH_SIZE 128 /* most systems wont need even this many */
#ifndef VIMAGE
static LIST_HEAD(, ng_node) ng_ID_hash[NG_ID_HASH_SIZE];
+static LIST_HEAD(, ng_node) ng_name_hash[NG_NAME_HASH_SIZE];
#endif
static struct mtx ng_idhash_mtx;
+static struct mtx ng_namehash_mtx;
/* Method to find a node.. used twice so do it here */
#define NG_IDHASH_FN(ID) ((ID) % (NG_ID_HASH_SIZE))
#define NG_IDHASH_FIND(ID, node) \
@@ -189,9 +190,6 @@
} \
} while (0)
-#define NG_NAME_HASH_SIZE 128 /* most systems wont need even this many */
-static LIST_HEAD(, ng_node) ng_name_hash[NG_NAME_HASH_SIZE];
-static struct mtx ng_namehash_mtx;
#define NG_NAMEHASH(NAME, HASH) \
do { \
u_char h = 0; \
@@ -838,6 +836,7 @@
int
ng_name_node(node_p node, const char *name)
{
+ INIT_VNET_NETGRAPH(curvnet);
int i, hash;
node_p node2;
@@ -869,7 +868,7 @@
NG_NAMEHASH(name, hash);
mtx_lock(&ng_namehash_mtx);
LIST_REMOVE(node, nd_nodes);
- LIST_INSERT_HEAD(&ng_name_hash[hash], node, nd_nodes);
+ LIST_INSERT_HEAD(&V_ng_name_hash[hash], node, nd_nodes);
mtx_unlock(&ng_namehash_mtx);
return (0);
@@ -3113,7 +3112,7 @@
{
INIT_VNET_NETGRAPH(curvnet);
- LIST_INIT(&V_ng_nodelist);
+ LIST_INIT(&V_ng_nodelist); /* XXX should go away */
V_nextID = 1;
return 0;
==== //depot/projects/vimage/src/sys/netgraph/vnetgraph.h#7 (text+ko) ====
@@ -42,10 +42,12 @@
#define VNET_NETGRAPH(sym) VSYM(vnet_netgraph, sym)
#define NG_ID_HASH_SIZE 32 /* most systems wont need even this many */
+#define NG_NAME_HASH_SIZE 128 /* most systems wont need even this many */
#ifdef VIMAGE
struct vnet_netgraph {
LIST_HEAD(, ng_node) _ng_ID_hash[NG_ID_HASH_SIZE];
+ LIST_HEAD(, ng_node) _ng_name_hash[NG_ID_HASH_SIZE];
LIST_HEAD(, ng_node) _ng_nodelist;
ng_ID_t _nextID;
struct unrhdr *_ng_iface_unit;
@@ -56,6 +58,7 @@
/* Symbol translation macros */
#define V_ng_ID_hash VNET_NETGRAPH(ng_ID_hash)
+#define V_ng_name_hash VNET_NETGRAPH(ng_name_hash)
#define V_ng_nodelist VNET_NETGRAPH(ng_nodelist)
#define V_nextID VNET_NETGRAPH(nextID)
#define V_ng_iface_unit VNET_NETGRAPH(ng_iface_unit)
More information about the p4-projects
mailing list