lib/rstp.c
/* Finds a port whose state has changed, and returns the aux pointer set for
 * the port.  A NULL pointer is returned when no changed port is found.  On
 * return '*portp' contains the pointer to the rstp port that changed, or NULL
 * if no changed port can be found.
 *
 * If '*portp' is passed as non-NULL, it must be the value set by the last
 * invocation of this function.
 *
 * This function may only be called by the thread that creates and deletes
 * ports.  Otherwise this function is not thread safe, as the returned
 * '*portp' could become stale before it is used in the next invocation. */
Finds a port whose state has changed, and returns the aux pointer set for
the port.  A NULL pointer is returned when no changed port is found.  On
return '*portp' contains the pointer to the rstp port that changed, or NULL
if no changed port can be found.

If '*portp' is passed as non-NULL, it must be the value set by the last
invocation of this function.

This function may only be called by the thread that creates and deletes
ports.  Otherwise this function is not thread safe, as the returned
'*portp' could become stale before it is used in the next invocation.
Finds a port whose state has changed and returns the aux pointer set for the port . A NULL pointer is returned when no changed port is found . On return ' * portp ' contains the pointer to the rstp port that changed or NULL if no changed port can be found . If ' * portp ' is passed as non - NULL it must be the value set by the last invocation of this function . This function may only be called by the thread that creates and deletes ports . Otherwise this function is not thread safe as the returned ' * portp ' could become stale before it is used in the next invocation .
void *
rstp_get_next_changed_port_aux(struct rstp *rstp, struct rstp_port **portp)
{
    void *aux = NULL;
    ovs_mutex_lock(&rstp_mutex);
    if (*portp == NULL) {
        struct rstp_port *p;
        HMAP_FOR_EACH (p, node, &rstp->ports) {
            if (p->state_changed) {
                p->state_changed = false;
                aux = p->aux;
                *portp = p;
                goto out;
            }
        }
    } else { 
        struct rstp_port *p = *portp;
        HMAP_FOR_EACH_CONTINUE (p, node, &rstp->ports) {
            if (p->state_changed) {
                p->state_changed = false;
                aux = p->aux;
                *portp = p;
                goto out;
            }
        }
    }
    *portp = NULL;
out:
    ovs_mutex_unlock(&rstp_mutex);
    return aux;
}
void * rstp_get_next_changed_port_aux ( struct rstp * rstp , struct rstp_port * * portp ) { void * aux = NULL ; ovs_mutex_lock ( & rstp_mutex ) ; if ( * portp == NULL ) { struct rstp_port * p ; HMAP_FOR_EACH ( p , node , & rstp -> ports ) { if ( p -> state_changed ) { p -> state_changed = false ; aux = p -> aux ; * portp = p ; goto out ; } } } else { struct rstp_port * p = * portp ; HMAP_FOR_EACH_CONTINUE ( p , node , & rstp -> ports ) { if ( p -> state_changed ) { p -> state_changed = false ; aux = p -> aux ; * portp = p ; goto out ; } } } * portp = NULL ; out : ovs_mutex_unlock ( & rstp_mutex ) ; return aux ; }
Finds a port whose state has changed, and returns the aux pointer set for
 the port.
Finds a port whose state has changed and returns the aux pointer set for the port .
/* continue */ /* No changed port found. */