Make IFP2NG() usable as an lvalue.

This commit is contained in:
Ruslan Ermilov 2005-11-09 13:34:43 +00:00
parent 303989a2f3
commit 5240dcdb07
2 changed files with 6 additions and 9 deletions

View File

@ -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 */
}

View File

@ -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 */