Revert the last commit to the callout interface, and add a flag to

callout_init() indicating whether the callout is safe or not.  Update
the callers of callout_init() to reflect the new interface.

Okayed by: Jake
This commit is contained in:
Jonathan Lemon 2000-11-25 06:22:16 +00:00
parent 6e47e42f8d
commit e82ac18e52
6 changed files with 21 additions and 27 deletions

View file

@ -400,7 +400,7 @@ again:
*/
SLIST_INIT(&callfree);
for (i = 0; i < ncallout; i++) {
callout_init(&callout[i]);
callout_init(&callout[i], 0);
callout[i].c_flags = CALLOUT_LOCAL_ALLOC;
SLIST_INSERT_HEAD(&callfree, &callout[i], c_links.sle);
}

View file

@ -400,7 +400,7 @@ again:
*/
SLIST_INIT(&callfree);
for (i = 0; i < ncallout; i++) {
callout_init(&callout[i]);
callout_init(&callout[i], 0);
callout[i].c_flags = CALLOUT_LOCAL_ALLOC;
SLIST_INSERT_HEAD(&callfree, &callout[i], c_links.sle);
}

View file

@ -173,7 +173,7 @@ struct callout_handle
timeout(ftn, arg, to_ticks)
timeout_t *ftn;
void *arg;
register int to_ticks;
int to_ticks;
{
int s;
struct callout *new;
@ -242,12 +242,11 @@ callout_handle_init(struct callout_handle *handle)
* callout_deactivate() - marks the callout as having been serviced
*/
void
_callout_reset(c, to_ticks, ftn, arg, flags)
callout_reset(c, to_ticks, ftn, arg)
struct callout *c;
int to_ticks;
void (*ftn) __P((void *));
void *arg;
int flags;
{
int s;
@ -265,8 +264,7 @@ _callout_reset(c, to_ticks, ftn, arg, flags)
to_ticks = 1;
c->c_arg = arg;
c->c_flags |= (CALLOUT_ACTIVE | CALLOUT_PENDING |
(flags & CALLOUT_MPSAFE));
c->c_flags |= (CALLOUT_ACTIVE | CALLOUT_PENDING);
c->c_func = ftn;
c->c_time = ticks + to_ticks;
TAILQ_INSERT_TAIL(&callwheel[c->c_time & callwheelmask],
@ -308,10 +306,13 @@ callout_stop(c)
}
void
callout_init(c)
callout_init(c, mpsafe)
struct callout *c;
int mpsafe;
{
bzero(c, sizeof *c);
if (mpsafe)
c->c_flags |= CALLOUT_MPSAFE;
}
#ifdef APM_FIXUP_CALLTODO

View file

@ -490,11 +490,11 @@ tcp_newtcpcb(inp)
tcp_mssdflt;
/* Set up our timeouts. */
callout_init(tp->tt_rexmt = &it->inp_tp_rexmt);
callout_init(tp->tt_persist = &it->inp_tp_persist);
callout_init(tp->tt_keep = &it->inp_tp_keep);
callout_init(tp->tt_2msl = &it->inp_tp_2msl);
callout_init(tp->tt_delack = &it->inp_tp_delack);
callout_init(tp->tt_rexmt = &it->inp_tp_rexmt, 0);
callout_init(tp->tt_persist = &it->inp_tp_persist, 0);
callout_init(tp->tt_keep = &it->inp_tp_keep, 0);
callout_init(tp->tt_2msl = &it->inp_tp_2msl, 0);
callout_init(tp->tt_delack = &it->inp_tp_delack, 0);
if (tcp_do_rfc1323)
tp->t_flags = (TF_REQ_SCALE|TF_REQ_TSTMP);

View file

@ -490,11 +490,11 @@ tcp_newtcpcb(inp)
tcp_mssdflt;
/* Set up our timeouts. */
callout_init(tp->tt_rexmt = &it->inp_tp_rexmt);
callout_init(tp->tt_persist = &it->inp_tp_persist);
callout_init(tp->tt_keep = &it->inp_tp_keep);
callout_init(tp->tt_2msl = &it->inp_tp_2msl);
callout_init(tp->tt_delack = &it->inp_tp_delack);
callout_init(tp->tt_rexmt = &it->inp_tp_rexmt, 0);
callout_init(tp->tt_persist = &it->inp_tp_persist, 0);
callout_init(tp->tt_keep = &it->inp_tp_keep, 0);
callout_init(tp->tt_2msl = &it->inp_tp_2msl, 0);
callout_init(tp->tt_delack = &it->inp_tp_delack, 0);
if (tcp_do_rfc1323)
tp->t_flags = (TF_REQ_SCALE|TF_REQ_TSTMP);

View file

@ -77,18 +77,11 @@ extern struct mtx callout_lock;
#define callout_active(c) ((c)->c_flags & CALLOUT_ACTIVE)
#define callout_deactivate(c) ((c)->c_flags &= ~CALLOUT_ACTIVE)
void callout_init __P((struct callout *));
void callout_init __P((struct callout *, int));
#define callout_pending(c) ((c)->c_flags & CALLOUT_PENDING)
void _callout_reset __P((struct callout *, int, void (*)(void *), void *,
int));
void callout_reset __P((struct callout *, int, void (*)(void *), void *));
void callout_stop __P((struct callout *));
#define callout_reset(c, ticks, func, arg) \
_callout_reset((c), (ticks), (func), (arg), 0)
#define mp_callout_reset(c, ticks, func, arg) \
_callout_reset((c), (ticks), (func), (arg), CALLOUT_MPSAFE)
#endif
#endif /* _SYS_CALLOUT_H_ */