This fixes several places where callout_stops return is examined. The
new return codes of -1 were mistakenly being considered "true". Callout_stop now returns -1 to indicate the callout had either already completed or was not running and 0 to indicate it could not be stopped. Also update the manual page to make it more consistent no non-zero in the callout_stop or callout_reset descriptions. MFC after: 1 Month with associated callout change.
This commit is contained in:
parent
2224fae179
commit
7c4676ddee
@ -302,7 +302,7 @@ If
|
||||
.Fa c
|
||||
already has a pending callout,
|
||||
it is cancelled before the new invocation is scheduled.
|
||||
These functions return a non-zero value if a pending callout was cancelled
|
||||
These functions return a value of one if a pending callout was cancelled
|
||||
and zero if there was no pending callout.
|
||||
If the callout has an associated lock,
|
||||
then that lock must be held when any of these functions are called.
|
||||
@ -804,16 +804,16 @@ The
|
||||
.Fn callout_reset
|
||||
and
|
||||
.Fn callout_schedule
|
||||
function families return non-zero if the callout was pending before the new
|
||||
function families return a value of one if the callout was pending before the new
|
||||
function invocation was scheduled.
|
||||
.Pp
|
||||
The
|
||||
.Fn callout_stop
|
||||
and
|
||||
.Fn callout_drain
|
||||
functions return non-zero if the callout was still pending when it was
|
||||
called or zero otherwise.
|
||||
The
|
||||
functions return a value of one if the callout was still pending when it was
|
||||
called, a zero if the callout could not be stopped and a negative one is it
|
||||
was either not running or haas already completed. The
|
||||
.Fn timeout
|
||||
function returns a
|
||||
.Ft struct callout_handle
|
||||
|
@ -496,7 +496,7 @@ taskqueue_cancel_timeout(struct taskqueue *queue,
|
||||
int error;
|
||||
|
||||
TQ_LOCK(queue);
|
||||
pending = !!callout_stop(&timeout_task->c);
|
||||
pending = !!(callout_stop(&timeout_task->c) > 0);
|
||||
error = taskqueue_cancel_locked(queue, &timeout_task->t, &pending1);
|
||||
if ((timeout_task->f & DT_CALLOUT_ARMED) != 0) {
|
||||
timeout_task->f &= ~DT_CALLOUT_ARMED;
|
||||
|
@ -394,7 +394,7 @@ lltable_free(struct lltable *llt)
|
||||
IF_AFDATA_WUNLOCK(llt->llt_ifp);
|
||||
|
||||
LIST_FOREACH_SAFE(lle, &dchain, lle_chain, next) {
|
||||
if (callout_stop(&lle->lle_timer))
|
||||
if (callout_stop(&lle->lle_timer) > 0)
|
||||
LLE_REMREF(lle);
|
||||
llentry_free(lle);
|
||||
}
|
||||
|
@ -1093,7 +1093,7 @@ in_lltable_free_entry(struct lltable *llt, struct llentry *lle)
|
||||
}
|
||||
|
||||
/* cancel timer */
|
||||
if (callout_stop(&lle->lle_timer))
|
||||
if (callout_stop(&lle->lle_timer) > 0)
|
||||
LLE_REMREF(lle);
|
||||
|
||||
/* Drop hold queue */
|
||||
|
@ -862,7 +862,7 @@ tcp_timer_activate(struct tcpcb *tp, uint32_t timer_type, u_int delta)
|
||||
}
|
||||
if (delta == 0) {
|
||||
if ((tp->t_timers->tt_flags & timer_type) &&
|
||||
callout_stop(t_callout) &&
|
||||
(callout_stop(t_callout) > 0) &&
|
||||
(tp->t_timers->tt_flags & f_reset)) {
|
||||
tp->t_timers->tt_flags &= ~(timer_type | f_reset);
|
||||
}
|
||||
@ -949,7 +949,7 @@ tcp_timer_stop(struct tcpcb *tp, uint32_t timer_type)
|
||||
}
|
||||
|
||||
if (tp->t_timers->tt_flags & timer_type) {
|
||||
if (callout_stop(t_callout) &&
|
||||
if ((callout_stop(t_callout) > 0) &&
|
||||
(tp->t_timers->tt_flags & f_reset)) {
|
||||
tp->t_timers->tt_flags &= ~(timer_type | f_reset);
|
||||
} else {
|
||||
|
@ -2133,7 +2133,7 @@ in6_lltable_free_entry(struct lltable *llt, struct llentry *lle)
|
||||
lltable_unlink_entry(llt, lle);
|
||||
}
|
||||
|
||||
if (callout_stop(&lle->lle_timer))
|
||||
if (callout_stop(&lle->lle_timer) > 0)
|
||||
LLE_REMREF(lle);
|
||||
|
||||
llentry_free(lle);
|
||||
|
@ -508,7 +508,7 @@ nd6_llinfo_settimer_locked(struct llentry *ln, long tick)
|
||||
nd6_llinfo_timer, ln);
|
||||
}
|
||||
}
|
||||
if (canceled)
|
||||
if (canceled > 0)
|
||||
LLE_REMREF(ln);
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ pfsync_clone_destroy(struct ifnet *ifp)
|
||||
|
||||
TAILQ_REMOVE(&sc->sc_deferrals, pd, pd_entry);
|
||||
sc->sc_deferred--;
|
||||
if (callout_stop(&pd->pd_tmo)) {
|
||||
if (callout_stop(&pd->pd_tmo) > 0) {
|
||||
pf_release_state(pd->pd_st);
|
||||
m_freem(pd->pd_m);
|
||||
free(pd, M_PFSYNC);
|
||||
@ -1775,7 +1775,7 @@ pfsync_undefer_state(struct pf_state *st, int drop)
|
||||
|
||||
TAILQ_FOREACH(pd, &sc->sc_deferrals, pd_entry) {
|
||||
if (pd->pd_st == st) {
|
||||
if (callout_stop(&pd->pd_tmo))
|
||||
if (callout_stop(&pd->pd_tmo) > 0)
|
||||
pfsync_undefer(pd, drop);
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user