sys/net/if_vlan.c
/* Handle a reference counted flag that should be set on the parent as well */
Handle a reference counted flag that should be set on the parent as well
Handle a reference counted flag that should be set on the parent as well
static int
vlan_setflag(struct ifnet *ifp, int flag, int status,
	     int (*func)(struct ifnet *, int))
{
	struct ifvlan *ifv;
	int error;
	ifv = ifp->if_softc;
	status = status ? (ifp->if_flags & flag) : 0;
	if (status != (ifv->ifv_pflags & flag)) {
		error = (*func)(PARENT(ifv), status);
		if (error)
			return (error);
		ifv->ifv_pflags &= ~flag;
		ifv->ifv_pflags |= status;
	}
	return (0);
}
static int vlan_setflag ( struct ifnet * ifp , int flag , int status , int ( * func ) ( struct ifnet * , int ) ) { struct ifvlan * ifv ; int error ; ifv = ifp -> if_softc ; status = status ? ( ifp -> if_flags & flag ) : 0 ; if ( status != ( ifv -> ifv_pflags & flag ) ) { error = ( * func ) ( PARENT ( ifv ) , status ) ; if ( error ) return ( error ) ; ifv -> ifv_pflags &= ~ flag ; ifv -> ifv_pflags |= status ; } return ( 0 ) ; }
Handle a reference counted flag that should be set on the parent as well
Handle a reference counted flag that should be set on the parent as well
/* XXX VLAN_LOCK_ASSERT(); */ /* Now "status" contains the flag value or 0 */ /*
	 * See if recorded parent's status is different from what
	 * we want it to be.  If it is, flip it.  We record parent's
	 * status in ifv_pflags so that we won't clear parent's flag
	 * we haven't set.  In fact, we don't clear or set parent's
	 * flags directly, but get or release references to them.
	 * That's why we can be sure that recorded flags still are
	 * in accord with actual parent's flags.
	 */