From owner-svn-src-stable@freebsd.org Mon May 4 16:30:37 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 332062D42EF; Mon, 4 May 2020 16:30:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49G7d90W0bz4Pql; Mon, 4 May 2020 16:30:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C963271B0; Mon, 4 May 2020 16:30:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 044GUacH099682; Mon, 4 May 2020 16:30:36 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 044GUapl099679; Mon, 4 May 2020 16:30:36 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202005041630.044GUapl099679@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 4 May 2020 16:30:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r360633 - in stable: 11/share/man/man9 11/sys/kern 11/sys/sys 12/share/man/man9 12/sys/kern 12/sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/share/man/man9 11/sys/kern 11/sys/sys 12/share/man/man9 12/sys/kern 12/sys/sys X-SVN-Commit-Revision: 360633 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 May 2020 16:30:37 -0000 Author: jhb Date: Mon May 4 16:30:36 2020 New Revision: 360633 URL: https://svnweb.freebsd.org/changeset/base/360633 Log: MFC 355600: Add a callout_func_t typedef for functions used with callout_*(). This typedef is the same as timeout_t except that it is in the callout namespace and header. Use this typedef in various places of the callout implementation that were either using the raw type or timeout_t. While here, add to the manpage. Modified: stable/12/share/man/man9/timeout.9 stable/12/sys/kern/kern_timeout.c stable/12/sys/sys/_callout.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/share/man/man9/timeout.9 stable/11/sys/kern/kern_timeout.c stable/11/sys/sys/_callout.h Directory Properties: stable/11/ (props changed) Modified: stable/12/share/man/man9/timeout.9 ============================================================================== --- stable/12/share/man/man9/timeout.9 Mon May 4 15:57:13 2020 (r360632) +++ stable/12/share/man/man9/timeout.9 Mon May 4 16:30:36 2020 (r360633) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 27, 2016 +.Dd December 10, 2019 .Dt TIMEOUT 9 .Os .Sh NAME @@ -62,8 +62,10 @@ .Nd execute a function after a specified length of time .Sh SYNOPSIS .In sys/types.h +.In sys/callout.h .In sys/systm.h .Bd -literal +typedef void callout_func_t (void *); typedef void timeout_t (void *); .Ed .Ft int @@ -71,7 +73,7 @@ typedef void timeout_t (void *); .Ft void .Fn callout_deactivate "struct callout *c" .Ft int -.Fn callout_async_drain "struct callout *c" "timeout_t *drain" +.Fn callout_async_drain "struct callout *c" "callout_func_t *drain" .Ft int .Fn callout_drain "struct callout *c" .Ft void @@ -90,19 +92,24 @@ struct callout_handle handle = CALLOUT_HANDLE_INITIALI .Ft int .Fn callout_pending "struct callout *c" .Ft int -.Fn callout_reset "struct callout *c" "int ticks" "timeout_t *func" "void *arg" +.Fo callout_reset +.Fa "struct callout *c" +.Fa "int ticks" +.Fa "callout_func_t *func" +.Fa "void *arg" +.Fc .Ft int .Fo callout_reset_curcpu .Fa "struct callout *c" .Fa "int ticks" -.Fa "timeout_t *func" +.Fa "callout_func_t *func" .Fa "void *arg" .Fc .Ft int .Fo callout_reset_on .Fa "struct callout *c" .Fa "int ticks" -.Fa "timeout_t *func" +.Fa "callout_func_t *func" .Fa "void *arg" .Fa "int cpu" .Fc @@ -111,7 +118,7 @@ struct callout_handle handle = CALLOUT_HANDLE_INITIALI .Fa "struct callout *c" .Fa "sbintime_t sbt" .Fa "sbintime_t pr" -.Fa "timeout_t *func" +.Fa "callout_func_t *func" .Fa "void *arg" .Fa "int flags" .Fc @@ -120,7 +127,7 @@ struct callout_handle handle = CALLOUT_HANDLE_INITIALI .Fa "struct callout *c" .Fa "sbintime_t sbt" .Fa "sbintime_t pr" -.Fa "timeout_t *func" +.Fa "callout_func_t *func" .Fa "void *arg" .Fa "int flags" .Fc @@ -129,7 +136,7 @@ struct callout_handle handle = CALLOUT_HANDLE_INITIALI .Fa "struct callout *c" .Fa "sbintime_t sbt" .Fa "sbintime_t pr" -.Fa "timeout_t *func" +.Fa "callout_func_t *func" .Fa "void *arg" .Fa "int cpu" .Fa "int flags" Modified: stable/12/sys/kern/kern_timeout.c ============================================================================== --- stable/12/sys/kern/kern_timeout.c Mon May 4 15:57:13 2020 (r360632) +++ stable/12/sys/kern/kern_timeout.c Mon May 4 16:30:36 2020 (r360633) @@ -144,9 +144,9 @@ static u_int __read_mostly callwheelmask; */ struct cc_exec { struct callout *cc_curr; - void (*cc_drain)(void *); + callout_func_t *cc_drain; #ifdef SMP - void (*ce_migration_func)(void *); + callout_func_t *ce_migration_func; void *ce_migration_arg; int ce_migration_cpu; sbintime_t ce_migration_time; @@ -647,7 +647,7 @@ softclock_call_cc(struct callout *c, struct callout_cp int direct) { struct rm_priotracker tracker; - void (*c_func)(void *); + callout_func_t *c_func, *drain; void *c_arg; struct lock_class *class; struct lock_object *c_lock; @@ -655,7 +655,7 @@ softclock_call_cc(struct callout *c, struct callout_cp int c_iflags; #ifdef SMP struct callout_cpu *new_cc; - void (*new_func)(void *); + callout_func_t *new_func; void *new_arg; int flags, new_cpu; sbintime_t new_prec, new_time; @@ -664,7 +664,7 @@ softclock_call_cc(struct callout *c, struct callout_cp sbintime_t sbt1, sbt2; struct timespec ts2; static sbintime_t maxdt = 2 * SBT_1MS; /* 2 msec */ - static timeout_t *lastfunc; + static callout_func_t *lastfunc; #endif KASSERT((c->c_iflags & CALLOUT_PENDING) == CALLOUT_PENDING, @@ -757,8 +757,6 @@ skip: KASSERT(cc_exec_curr(cc, direct) == c, ("mishandled cc_curr")); cc_exec_curr(cc, direct) = NULL; if (cc_exec_drain(cc, direct)) { - void (*drain)(void *); - drain = cc_exec_drain(cc, direct); cc_exec_drain(cc, direct) = NULL; CC_UNLOCK(cc); @@ -1020,7 +1018,7 @@ callout_when(sbintime_t sbt, sbintime_t precision, int */ int callout_reset_sbt_on(struct callout *c, sbintime_t sbt, sbintime_t prec, - void (*ftn)(void *), void *arg, int cpu, int flags) + callout_func_t *ftn, void *arg, int cpu, int flags) { sbintime_t to_sbt, precision; struct callout_cpu *cc; @@ -1179,7 +1177,7 @@ callout_schedule(struct callout *c, int to_ticks) } int -_callout_stop_safe(struct callout *c, int flags, void (*drain)(void *)) +_callout_stop_safe(struct callout *c, int flags, callout_func_t *drain) { struct callout_cpu *cc, *old_cc; struct lock_class *class; Modified: stable/12/sys/sys/_callout.h ============================================================================== --- stable/12/sys/sys/_callout.h Mon May 4 15:57:13 2020 (r360632) +++ stable/12/sys/sys/_callout.h Mon May 4 16:30:36 2020 (r360633) @@ -48,6 +48,8 @@ LIST_HEAD(callout_list, callout); SLIST_HEAD(callout_slist, callout); TAILQ_HEAD(callout_tailq, callout); +typedef void callout_func_t(void *); + struct callout { union { LIST_ENTRY(callout) le; @@ -57,7 +59,7 @@ struct callout { sbintime_t c_time; /* ticks to the event */ sbintime_t c_precision; /* delta allowed wrt opt */ void *c_arg; /* function argument */ - void (*c_func)(void *); /* function to call */ + callout_func_t *c_func; /* function to call */ struct lock_object *c_lock; /* lock to handle */ short c_flags; /* User State */ short c_iflags; /* Internal State */