FreeBSD/sys/netgraph/atm/ng_atm.c
/*
 * ATM interface attached - create a node and name it like the interface.
 */
ATM interface attached - create a node and name it like the interface.
ATM interface attached - create a node and name it like the interface .
static void
ng_atm_attach(struct ifnet *ifp)
{
	node_p node;
	struct priv *priv;
	KASSERT(IFP2NG(ifp) == 0, ("%s: node alreay exists?", __func__));
	if (ng_make_node_common(&ng_atm_typestruct, &node) != 0) {
		log(LOG_ERR, "%s: can't create node for %s\n",
		    __func__, ifp->if_xname);
		return;
	}
	priv = malloc(sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO);
	if (priv == NULL) {
		log(LOG_ERR, "%s: can't allocate memory for %s\n",
		    __func__, ifp->if_xname);
		NG_NODE_UNREF(node);
		return;
	}
	NG_NODE_SET_PRIVATE(node, priv);
	priv->ifp = ifp;
	LIST_INIT(&priv->vccs);
	IFP2NG_SET(ifp, node);
	if (ng_name_node(node, ifp->if_xname) != 0) {
		log(LOG_WARNING, "%s: can't name node %s\n",
		    __func__, ifp->if_xname);
	}
}
static void ng_atm_attach ( struct ifnet * ifp ) { node_p node ; struct priv * priv ; KASSERT ( IFP2NG ( ifp ) == 0 , ( " " , __func__ ) ) ; if ( ng_make_node_common ( & ng_atm_typestruct , & node ) != 0 ) { log ( LOG_ERR , " \n " , __func__ , ifp -> if_xname ) ; return ; } priv = malloc ( sizeof ( * priv ) , M_NETGRAPH , M_NOWAIT | M_ZERO ) ; if ( priv == NULL ) { log ( LOG_ERR , " \n " , __func__ , ifp -> if_xname ) ; NG_NODE_UNREF ( node ) ; return ; } NG_NODE_SET_PRIVATE ( node , priv ) ; priv -> ifp = ifp ; LIST_INIT ( & priv -> vccs ) ; IFP2NG_SET ( ifp , node ) ; if ( ng_name_node ( node , ifp -> if_xname ) != 0 ) { log ( LOG_WARNING , " \n " , __func__ , ifp -> if_xname ) ; } }
ATM interface attached - create a node and name it like the interface.
ATM interface attached - create a node and name it like the interface .