diff --git a/share/man/man9/callout.9 b/share/man/man9/callout.9 index d0326ee6a6d7..4fe4a3a0aca3 100644 --- a/share/man/man9/callout.9 +++ b/share/man/man9/callout.9 @@ -1,4 +1,4 @@ -.\" $NetBSD: callout.9,v 1.12 2003/10/19 14:37:12 he Exp $ +.\" $NetBSD: callout.9,v 1.13 2003/10/27 16:52:01 thorpej Exp $ .\" .\" Copyright (c) 2000, 2003 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -34,7 +34,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd July 20, 2003 +.Dd October 26, 2003 .Dt CALLOUT 9 .Os .Sh NAME @@ -134,21 +134,20 @@ status is cleared. .Pp The .Fn callout_setfunc -function initializes the callout handle +function sets the function and argument of the callout handle .Fa c -for use and sets the function and argument to +to .Fa func and .Fa arg respectively. +The callout handle must already be initialized. If a callout will always be used with the same function and argument, then .Fn callout_setfunc used in conjunction with .Fn callout_schedule is slightly more efficient than using -.Fn callout_init -and .Fn callout_reset . If it is inconvenient to call .Fn callout_setfunc , diff --git a/sys/dev/pci/if_txp.c b/sys/dev/pci/if_txp.c index 173f0bc80f9a..87789db52b3b 100644 --- a/sys/dev/pci/if_txp.c +++ b/sys/dev/pci/if_txp.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_txp.c,v 1.4 2003/08/20 17:41:38 drochner Exp $ */ +/* $NetBSD: if_txp.c,v 1.5 2003/10/27 16:52:01 thorpej Exp $ */ /* * Copyright (c) 2001 @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.4 2003/08/20 17:41:38 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.5 2003/10/27 16:52:01 thorpej Exp $"); #include "bpfilter.h" #include "opt_inet.h" @@ -342,6 +342,7 @@ txp_attach(parent, self, aux) txp_capabilities(sc); + callout_init(&sc->sc_tick); callout_setfunc(&sc->sc_tick, txp_tick, sc); /* diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index 796e95ca8760..73e0f270f7b2 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_timeout.c,v 1.11 2003/09/25 10:44:11 scw Exp $ */ +/* $NetBSD: kern_timeout.c,v 1.12 2003/10/27 16:52:01 thorpej Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.11 2003/09/25 10:44:11 scw Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.12 2003/10/27 16:52:01 thorpej Exp $"); /* * Adapted from OpenBSD: kern_timeout.c,v 1.15 2002/12/08 04:21:07 art Exp, @@ -231,12 +231,13 @@ callout_init(struct callout *c) * * Initialize a callout structure and set the function and * argument. + * + * NOTE: THE CALLOUT STRUCTURE MUST ALREADY BE INITIALIZED! */ void callout_setfunc(struct callout *c, void (*func)(void *), void *arg) { - memset(c, 0, sizeof(*c)); c->c_func = func; c->c_arg = arg; } diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 89b30685aa12..0e2e1a8ad9dd 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_subr.c,v 1.158 2003/10/25 08:13:28 christos Exp $ */ +/* $NetBSD: tcp_subr.c,v 1.159 2003/10/27 16:52:01 thorpej Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -98,7 +98,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.158 2003/10/25 08:13:28 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.159 2003/10/27 16:52:01 thorpej Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -894,6 +894,16 @@ tcp_respond(tp, template, m, th0, ack, seq, flags) * the new TCPCB instead. */ static struct tcpcb tcpcb_template = { + /* + * If TCP_NTIMERS ever changes, we'll need to update this + * initializer. + */ + .t_timer = { + CALLOUT_INITIALIZER, + CALLOUT_INITIALIZER, + CALLOUT_INITIALIZER, + CALLOUT_INITIALIZER, + }, .t_delack_ch = CALLOUT_INITIALIZER, .t_srtt = TCPTV_SRTTBASE, @@ -962,7 +972,7 @@ tcp_newtcpcb(family, aux) tp->t_family = family; /* may be overridden later on */ LIST_INIT(&tp->t_sc); /* XXX can template this */ - /* XXX Figure out a way to make this a bit less painful. */ + /* Don't sweat this loop; hopefully the compiler will unroll it. */ for (i = 0; i < TCPT_NTIMERS; i++) TCP_TIMER_INIT(tp, i);