lib/stp.c
/* Finds a port whose state has changed.  If successful, stores the port whose
 * state changed in '*portp' and returns true.  If no port has changed, stores
 * NULL in '*portp' and returns false. */
Finds a port whose state has changed.  If successful, stores the port whose
state changed in '*portp' and returns true.  If no port has changed, stores
NULL in '*portp' and returns false.
Finds a port whose state has changed . If successful stores the port whose state changed in ' * portp ' and returns true . If no port has changed stores NULL in ' * portp ' and returns false .
bool
stp_get_changed_port(struct stp *stp, struct stp_port **portp)
{
    struct stp_port *end, *p;
    bool changed = false;
    ovs_mutex_lock(&mutex);
    end = &stp->ports[ARRAY_SIZE(stp->ports)];
    for (p = stp->first_changed_port; p < end; p++) {
        if (p->state_changed) {
            p->state_changed = false;
            stp->first_changed_port = p + 1;
            *portp = p;
            changed = true;
            goto out;
        }
    }
    stp->first_changed_port = end;
    *portp = NULL;
out:
    ovs_mutex_unlock(&mutex);
    return changed;
}
bool stp_get_changed_port ( struct stp * stp , struct stp_port * * portp ) { struct stp_port * end , * p ; bool changed = false ; ovs_mutex_lock ( & mutex ) ; end = & stp -> ports [ ARRAY_SIZE ( stp -> ports ) ] ; for ( p = stp -> first_changed_port ; p < end ; p ++ ) { if ( p -> state_changed ) { p -> state_changed = false ; stp -> first_changed_port = p + 1 ; * portp = p ; changed = true ; goto out ; } } stp -> first_changed_port = end ; * portp = NULL ; out : ovs_mutex_unlock ( & mutex ) ; return changed ; }
Finds a port whose state has changed.
Finds a port whose state has changed .