summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2005-11-09 13:34:43 +0000
committerru <ru@FreeBSD.org>2005-11-09 13:34:43 +0000
commit862d9807dd32df55901c71382c54c1537618119e (patch)
tree7eba387e3a1ea1d50ba07cff931ea06670d7c467
parentdcace5669d81e83aea7a22539593b0f158eb224c (diff)
downloadFreeBSD-src-862d9807dd32df55901c71382c54c1537618119e.zip
FreeBSD-src-862d9807dd32df55901c71382c54c1537618119e.tar.gz
Make IFP2NG() usable as an lvalue.
-rw-r--r--sys/netgraph/ng_ether.c7
-rw-r--r--sys/netgraph/ng_fec.c8
2 files changed, 6 insertions, 9 deletions
diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c
index 2b70230..484f2a9 100644
--- a/sys/netgraph/ng_ether.c
+++ b/sys/netgraph/ng_ether.c
@@ -68,8 +68,7 @@
#include <netgraph/ng_parse.h>
#include <netgraph/ng_ether.h>
-#define IFP2NG(ifp) ((struct ng_node *)IFP2AC((ifp))->ac_netgraph)
-#define IFP2NG_SET(ifp, val) (IFP2AC((ifp))->ac_netgraph = (val))
+#define IFP2NG(ifp) (IFP2AC((ifp))->ac_netgraph)
/* Per-node private data */
struct private {
@@ -303,7 +302,7 @@ ng_ether_attach(struct ifnet *ifp)
}
NG_NODE_SET_PRIVATE(node, priv);
priv->ifp = ifp;
- IFP2NG_SET(ifp, node);
+ IFP2NG(ifp) = node;
priv->autoSrcAddr = 1;
priv->hwassist = ifp->if_hwassist;
@@ -330,7 +329,7 @@ ng_ether_detach(struct ifnet *ifp)
* So zap it now. XXX We HOPE that anything running at this time
* handles it (as it should in the non netgraph case).
*/
- IFP2NG_SET(ifp, NULL);
+ IFP2NG(ifp) = NULL;
priv->ifp = NULL; /* XXX race if interrupted an output packet */
ng_rmnode_self(node); /* remove all netgraph parts */
}
diff --git a/sys/netgraph/ng_fec.c b/sys/netgraph/ng_fec.c
index a4ee15d..85e2f77 100644
--- a/sys/netgraph/ng_fec.c
+++ b/sys/netgraph/ng_fec.c
@@ -134,9 +134,7 @@
* family domain. This means the AF_NETGRAPH entry in ifp->if_afdata
* should be unused, so we can use to hold our node context.
*/
-#define IFP2NG(ifp) (struct ng_node *)(ifp->if_afdata[AF_NETGRAPH])
-#define IFP2NG_SET(ifp, val) ifp->if_afdata[AF_NETGRAPH] = (val);
-#define FEC_INC(x, y) (x) = (x + 1) % y
+#define IFP2NG(ifp) ((ifp)->if_afdata[AF_NETGRAPH])
/*
* Current fast etherchannel implementations use either 2 or 4
@@ -404,7 +402,7 @@ ng_fec_addport(struct ng_fec_private *priv, char *iface)
return(ENOMEM);
IF_AFDATA_LOCK(bifp);
- bifp->if_afdata[AF_NETGRAPH] = priv->node;
+ IFP2NG(bifp) = priv->node;
IF_AFDATA_UNLOCK(bifp);
/*
@@ -495,7 +493,7 @@ ng_fec_delport(struct ng_fec_private *priv, char *iface)
/* Remove our node context pointer. */
IF_AFDATA_LOCK(bifp);
- bifp->if_afdata[AF_NETGRAPH] = NULL;
+ IFP2NG(bifp) = NULL;
IF_AFDATA_UNLOCK(bifp);
/* Delete port */
OpenPOWER on IntegriCloud