From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 20:43:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B23D2851; Thu, 23 Oct 2014 20:43:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 848D1E10; Thu, 23 Oct 2014 20:43:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NKhHdO050194; Thu, 23 Oct 2014 20:43:17 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NKhHxI050192; Thu, 23 Oct 2014 20:43:17 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410232043.s9NKhHxI050192@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 23 Oct 2014 20:43:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273557 - head/sys/netipsec X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 20:43:17 -0000 Author: jhb Date: Thu Oct 23 20:43:16 2014 New Revision: 273557 URL: https://svnweb.freebsd.org/changeset/base/273557 Log: Use a static callout to drive key_timehandler() instead of timeout(). While here, make key_timehandler() private to key.c. Submitted by: bz (2) Tested by: bz Modified: head/sys/netipsec/key.c head/sys/netipsec/key.h Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Thu Oct 23 20:01:55 2014 (r273556) +++ head/sys/netipsec/key.c Thu Oct 23 20:43:16 2014 (r273557) @@ -410,6 +410,10 @@ struct sadb_msghdr { int extlen[SADB_EXT_MAX + 1]; }; +#ifndef IPSEC_DEBUG2 +static struct callout key_timer; +#endif + static struct secasvar *key_allocsa_policy __P((const struct secasindex *)); static void key_freesp_so __P((struct secpolicy **)); static struct secasvar *key_do_allocsa_policy __P((struct secashead *, u_int)); @@ -4525,8 +4529,8 @@ key_flush_spacq(time_t now) * and do to remove or to expire. * XXX: year 2038 problem may remain. */ -void -key_timehandler(void) +static void +key_timehandler(void *arg) { VNET_ITERATOR_DECL(vnet_iter); time_t now = time_second; @@ -4544,7 +4548,7 @@ key_timehandler(void) #ifndef IPSEC_DEBUG2 /* do exchange to tick time !! */ - (void)timeout((void *)key_timehandler, (void *)0, hz); + callout_schedule(&key_timer, hz); #endif /* IPSEC_DEBUG2 */ } @@ -7769,7 +7773,8 @@ key_init(void) SPACQ_LOCK_INIT(); #ifndef IPSEC_DEBUG2 - timeout((void *)key_timehandler, (void *)0, hz); + callout_init(&key_timer, CALLOUT_MPSAFE); + callout_reset(&key_timer, hz, key_timehandler, NULL); #endif /*IPSEC_DEBUG2*/ /* initialize key statistics */ Modified: head/sys/netipsec/key.h ============================================================================== --- head/sys/netipsec/key.h Thu Oct 23 20:01:55 2014 (r273556) +++ head/sys/netipsec/key.h Thu Oct 23 20:43:16 2014 (r273557) @@ -97,7 +97,6 @@ extern struct secpolicy *key_msg2sp __P( extern struct mbuf *key_sp2msg __P((struct secpolicy *)); extern int key_ismyaddr __P((struct sockaddr *)); extern int key_spdacquire __P((struct secpolicy *)); -extern void key_timehandler __P((void)); extern u_long key_random __P((void)); extern void key_randomfill __P((void *, size_t)); extern void key_freereg __P((struct socket *));