From a448425842938ffbd5c979639b47bb6c303238bc Mon Sep 17 00:00:00 2001 From: mlaier Date: Mon, 21 Feb 2005 17:11:09 +0000 Subject: Don't use the static CALLOUT_INITIALIZER for __FreeBSD_version >= 600000. It was a bad idea, but since it is done like this in the vendor source we keep it around for older versions. As a safe guard against future misuse we don't even define CALLOUT_INITIALIZER anymore. This fixes ALTQ after callout_init_mtx() and takes altq_var.h off the vendor branch. Submitted by: Divacky Roman (w/ changes) --- sys/contrib/altq/altq/altq_subr.c | 7 +++++++ sys/contrib/altq/altq/altq_var.h | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/contrib/altq/altq/altq_subr.c b/sys/contrib/altq/altq/altq_subr.c index 31fe133..4f9ca6d 100644 --- a/sys/contrib/altq/altq/altq_subr.c +++ b/sys/contrib/altq/altq/altq_subr.c @@ -93,7 +93,11 @@ static void tbr_timeout(void *); int (*altq_input)(struct mbuf *, int) = NULL; static struct mbuf *tbr_dequeue(struct ifaltq *, int); static int tbr_timer = 0; /* token bucket regulator timer */ +#if !defined(__FreeBSD__) || (__FreeBSD_version < 600000) static struct callout tbr_callout = CALLOUT_INITIALIZER; +#else +static struct callout tbr_callout; +#endif #ifdef ALTQ3_CLFIER_COMPAT static int extract_ports4(struct mbuf *, struct ip *, struct flowinfo_in *); @@ -932,6 +936,9 @@ init_machclk(void) #ifdef __FreeBSD__ #if (__FreeBSD_version > 300000) machclk_freq = tsc_freq; +#if (__FreeBSD_version >= 600000) + callout_init(&tbr_callout, 0); +#endif #else machclk_freq = i586_ctr_freq; #endif diff --git a/sys/contrib/altq/altq/altq_var.h b/sys/contrib/altq/altq/altq_var.h index dff9e5c..4c4fc29 100644 --- a/sys/contrib/altq/altq/altq_var.h +++ b/sys/contrib/altq/altq/altq_var.h @@ -1,3 +1,4 @@ +/* $FreeBSD$ */ /* $KAME: altq_var.h,v 1.16 2003/10/03 05:05:15 kjc Exp $ */ /* @@ -175,7 +176,7 @@ typedef u_long ioctlcmd_t; #endif #define CALLOUT_RESET(c,t,f,a) callout_reset((c),(t),(f),(a)) #define CALLOUT_STOP(c) callout_stop((c)) -#ifndef CALLOUT_INITIALIZER +#if !defined(CALLOUT_INITIALIZER) && (__FreeBSD_version < 600000) #define CALLOUT_INITIALIZER { { { NULL } }, 0, NULL, NULL, 0 } #endif #elif defined(__OpenBSD__) -- cgit v1.1