CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sun Jan 27 02:37:07 UTC 2019 Modified Files: src/sys/sys [pgoyette-compat]: param.h Log Message: Update version on the branch, too To generate a diff of this commit: cvs rdiff -u -r1.557.2.11 -r1.557.2.12 src/sys/sys/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/param.h diff -u src/sys/sys/param.h:1.557.2.11 src/sys/sys/param.h:1.557.2.12 --- src/sys/sys/param.h:1.557.2.11 Sat Jan 26 22:00:37 2019 +++ src/sys/sys/param.h Sun Jan 27 02:37:07 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.557.2.11 2019/01/26 22:00:37 pgoyette Exp $ */ +/* $NetBSD: param.h,v 1.557.2.12 2019/01/27 02:37:07 pgoyette Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -67,7 +67,7 @@ * 2.99.9 (299000900) */ -#define __NetBSD_Version__ 899003100 /* NetBSD 8.99.31 */ +#define __NetBSD_Version__ 899003200 /* NetBSD 8.99.32 */ #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \ (m) * 100) + (p) * 100) <= __NetBSD_Version__)
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sun Jan 27 02:37:07 UTC 2019 Modified Files: src/sys/sys [pgoyette-compat]: param.h Log Message: Update version on the branch, too To generate a diff of this commit: cvs rdiff -u -r1.557.2.11 -r1.557.2.12 src/sys/sys/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Wed Jan 23 03:40:08 UTC 2019 Modified Files: src/sys/sys [pgoyette-compat]: module_hook.h Log Message: Improve a comment To generate a diff of this commit: cvs rdiff -u -r1.1.2.15 -r1.1.2.16 src/sys/sys/module_hook.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Wed Jan 23 03:40:08 UTC 2019 Modified Files: src/sys/sys [pgoyette-compat]: module_hook.h Log Message: Improve a comment To generate a diff of this commit: cvs rdiff -u -r1.1.2.15 -r1.1.2.16 src/sys/sys/module_hook.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/module_hook.h diff -u src/sys/sys/module_hook.h:1.1.2.15 src/sys/sys/module_hook.h:1.1.2.16 --- src/sys/sys/module_hook.h:1.1.2.15 Wed Jan 23 03:34:15 2019 +++ src/sys/sys/module_hook.h Wed Jan 23 03:40:08 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: module_hook.h,v 1.1.2.15 2019/01/23 03:34:15 pgoyette Exp $ */ +/* $NetBSD: module_hook.h,v 1.1.2.16 2019/01/23 03:40:08 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -86,7 +86,10 @@ do {\ /* Prevent new localcount_acquire calls. */ \ hook.hooked = false; \ \ - /* Wait for existing localcount_acquire calls to finish. */ \ + /* \ + * Wait for localcount_acquire calls already under way \ + * to finish. \ + */ \ pserialize_perform(hook.psz);\ \ /* Wait for existing localcount references to drain. */\
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Thu Jan 17 21:32:42 UTC 2019 Modified Files: src/sys/sys [pgoyette-compat]: module_hook.h Log Message: The return value of a hook is not necessarily an error code, so rename the variable appropriately. NFCI To generate a diff of this commit: cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/sys/sys/module_hook.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/module_hook.h diff -u src/sys/sys/module_hook.h:1.1.2.10 src/sys/sys/module_hook.h:1.1.2.11 --- src/sys/sys/module_hook.h:1.1.2.10 Mon Jan 14 13:34:28 2019 +++ src/sys/sys/module_hook.h Thu Jan 17 21:32:42 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: module_hook.h,v 1.1.2.10 2019/01/14 13:34:28 pgoyette Exp $ */ +/* $NetBSD: module_hook.h,v 1.1.2.11 2019/01/17 21:32:42 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -117,7 +117,7 @@ int\ hook ## _call decl \ {\ bool __hooked; \ - int __hook_error, __hook_s;\ + int __hook_retval, __hook_s;\ \ __hook_s = pserialize_read_enter(); \ __hooked = hook.hooked; \ @@ -128,13 +128,13 @@ hook ## _call decl \ pserialize_read_exit(__hook_s);\ \ if (__hooked) { \ - __hook_error = (*hook.f)args; \ + __hook_retval = (*hook.f)args; \ localcount_release(, , \ ); \ } else { \ - __hook_error = default;\ + __hook_retval = default; \ } \ - return __hook_error; \ + return __hook_retval; \ } #define MODULE_CALL_VOID_HOOK(hook, decl, args, default) \
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Thu Jan 17 21:32:42 UTC 2019 Modified Files: src/sys/sys [pgoyette-compat]: module_hook.h Log Message: The return value of a hook is not necessarily an error code, so rename the variable appropriately. NFCI To generate a diff of this commit: cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/sys/sys/module_hook.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Tue Jan 15 12:42:12 UTC 2019 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Log Message: Fix a copy/pasto in a comment To generate a diff of this commit: cvs rdiff -u -r1.1.2.49 -r1.1.2.50 src/sys/sys/compat_stub.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Tue Jan 15 12:42:12 UTC 2019 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Log Message: Fix a copy/pasto in a comment To generate a diff of this commit: cvs rdiff -u -r1.1.2.49 -r1.1.2.50 src/sys/sys/compat_stub.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/compat_stub.h diff -u src/sys/sys/compat_stub.h:1.1.2.49 src/sys/sys/compat_stub.h:1.1.2.50 --- src/sys/sys/compat_stub.h:1.1.2.49 Tue Jan 15 04:10:35 2019 +++ src/sys/sys/compat_stub.h Tue Jan 15 12:42:12 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_stub.h,v 1.1.2.49 2019/01/15 04:10:35 pgoyette Exp $ */ +/* $NetBSD: compat_stub.h,v 1.1.2.50 2019/01/15 12:42:12 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ MODULE_HOOK(ntp_adjtime1_hook, int, (str /* * Routine hooks for SCTP code - used by rtsock * - * MP-hooks not needed since the NTP code is not modular + * MP-hooks not needed since the SCTP code is not modular */ struct ifaddr; extern void (*vec_sctp_add_ip_address)(struct ifaddr *);
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Fri Jan 11 06:18:17 UTC 2019 Modified Files: src/sys/sys [pgoyette-compat]: module_hook.h Log Message: Separate macro arguments with for readability. To generate a diff of this commit: cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/sys/module_hook.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Fri Jan 11 06:18:17 UTC 2019 Modified Files: src/sys/sys [pgoyette-compat]: module_hook.h Log Message: Separate macro arguments with for readability. To generate a diff of this commit: cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/sys/module_hook.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/module_hook.h diff -u src/sys/sys/module_hook.h:1.1.2.7 src/sys/sys/module_hook.h:1.1.2.8 --- src/sys/sys/module_hook.h:1.1.2.7 Fri Oct 12 10:28:29 2018 +++ src/sys/sys/module_hook.h Fri Jan 11 06:18:17 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: module_hook.h,v 1.1.2.7 2018/10/12 10:28:29 pgoyette Exp $ */ +/* $NetBSD: module_hook.h,v 1.1.2.8 2019/01/11 06:18:17 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -45,7 +45,7 @@ * unloaded. */ -#define MODULE_HOOK(hook,args) \ +#define MODULE_HOOK(hook, args) \ extern struct hook ## _t { \ kmutex_t mtx;\ kcondvar_t cv;\ @@ -55,7 +55,7 @@ extern struct hook ## _t { \ int (*f)args; \ } hook __cacheline_aligned; -#define MODULE_HOOK2(hook,args1,args2)\ +#define MODULE_HOOK2(hook, args1, args2) \ extern struct hook ## _t { \ kmutex_t mtx;\ kcondvar_t cv;\
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Fri Oct 12 10:28:29 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module_hook.h Log Message: Use private-namespace variable ``__hooked'' instead of ``hooked'' To generate a diff of this commit: cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/sys/module_hook.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/module_hook.h diff -u src/sys/sys/module_hook.h:1.1.2.6 src/sys/sys/module_hook.h:1.1.2.7 --- src/sys/sys/module_hook.h:1.1.2.6 Thu Oct 4 02:24:26 2018 +++ src/sys/sys/module_hook.h Fri Oct 12 10:28:29 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: module_hook.h,v 1.1.2.6 2018/10/04 02:24:26 pgoyette Exp $ */ +/* $NetBSD: module_hook.h,v 1.1.2.7 2018/10/12 10:28:29 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -173,18 +173,18 @@ hook ## _ ## which ## _call decl; int\ hook ## _ ## which ## _call decl\ {\ - bool hooked; \ + bool __hooked; \ int __hook_error, __hook_s;\ \ __hook_s = pserialize_read_enter(); \ - hooked = hook.hooked; \ - if (hooked) { \ + __hooked = hook.hooked; \ + if (__hooked) { \ membar_consumer();\ localcount_acquire(); \ } \ pserialize_read_exit(__hook_s);\ \ - if (hooked) { \ + if (__hooked) { \ __hook_error = (*hook.which)args; \ localcount_release(, , \ ); \
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Fri Oct 12 10:28:29 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module_hook.h Log Message: Use private-namespace variable ``__hooked'' instead of ``hooked'' To generate a diff of this commit: cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/sys/module_hook.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Thu Oct 4 02:24:26 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module_hook.h Log Message: Also in the UNSET_HOOK2 case, release the mutex before destroying it. To generate a diff of this commit: cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/sys/module_hook.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/module_hook.h diff -u src/sys/sys/module_hook.h:1.1.2.5 src/sys/sys/module_hook.h:1.1.2.6 --- src/sys/sys/module_hook.h:1.1.2.5 Thu Oct 4 01:56:03 2018 +++ src/sys/sys/module_hook.h Thu Oct 4 02:24:26 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: module_hook.h,v 1.1.2.5 2018/10/04 01:56:03 pgoyette Exp $ */ +/* $NetBSD: module_hook.h,v 1.1.2.6 2018/10/04 02:24:26 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -158,6 +158,8 @@ static void (hook ## _unset)(void)\ /* Wait for existing localcount references to drain. */\ localcount_drain(, , ); \ \ + /* Release the mutex and clean up all resources */ \ + mutex_exit(); \ localcount_fini();\ cv_destroy(); \ mutex_destroy();\
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Thu Oct 4 02:24:26 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module_hook.h Log Message: Also in the UNSET_HOOK2 case, release the mutex before destroying it. To generate a diff of this commit: cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/sys/module_hook.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Thu Oct 4 01:56:03 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module_hook.h Log Message: Grab the mutex for UNSET_HOOK2 (fixed previously for UNSET_HOOK) To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/sys/module_hook.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Thu Oct 4 01:56:03 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module_hook.h Log Message: Grab the mutex for UNSET_HOOK2 (fixed previously for UNSET_HOOK) To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/sys/module_hook.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/module_hook.h diff -u src/sys/sys/module_hook.h:1.1.2.4 src/sys/sys/module_hook.h:1.1.2.5 --- src/sys/sys/module_hook.h:1.1.2.4 Sat Sep 29 21:36:15 2018 +++ src/sys/sys/module_hook.h Thu Oct 4 01:56:03 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: module_hook.h,v 1.1.2.4 2018/09/29 21:36:15 pgoyette Exp $ */ +/* $NetBSD: module_hook.h,v 1.1.2.5 2018/10/04 01:56:03 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -146,6 +146,9 @@ static void (hook ## _unset)(void)\ KASSERT(hook.f1); \ KASSERT(hook.f2); \ \ + /* Grab the mutex */ \ + mutex_enter(); \ +\ /* Prevent new localcount_acquire calls. */ \ hook.hooked = false; \ \
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sun Sep 23 10:41:01 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module_hook.h Log Message: Use restricted namespace identifiers for variables within the code generated by macro expansion. To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/sys/module_hook.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/module_hook.h diff -u src/sys/sys/module_hook.h:1.1.2.2 src/sys/sys/module_hook.h:1.1.2.3 --- src/sys/sys/module_hook.h:1.1.2.2 Wed Sep 19 06:26:13 2018 +++ src/sys/sys/module_hook.h Sun Sep 23 10:41:01 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: module_hook.h,v 1.1.2.2 2018/09/19 06:26:13 pgoyette Exp $ */ +/* $NetBSD: module_hook.h,v 1.1.2.3 2018/09/23 10:41:01 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -169,24 +169,24 @@ int\ hook ## _ ## which ## _call decl\ {\ bool hooked; \ - int error, s; \ + int __hook_error, __hook_s;\ \ - s = pserialize_read_enter();\ + __hook_s = pserialize_read_enter(); \ hooked = hook.hooked; \ if (hooked) { \ membar_consumer();\ localcount_acquire(); \ } \ - pserialize_read_exit(s);\ + pserialize_read_exit(__hook_s);\ \ if (hooked) { \ - error = (*hook.which)args; \ + __hook_error = (*hook.which)args; \ localcount_release(, , \ ); \ } else { \ - error = default;\ + __hook_error = default;\ } \ - return error; \ + return __hook_error; \ } #endif /* _SYS_MODULE_HOOK_H */
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sun Sep 23 10:41:01 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module_hook.h Log Message: Use restricted namespace identifiers for variables within the code generated by macro expansion. To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/sys/module_hook.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Wed Sep 19 06:26:13 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module_hook.h Log Message: Ooops - we need to grab the mutex before we can drain the localcount! To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/sys/module_hook.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/module_hook.h diff -u src/sys/sys/module_hook.h:1.1.2.1 src/sys/sys/module_hook.h:1.1.2.2 --- src/sys/sys/module_hook.h:1.1.2.1 Tue Sep 18 21:38:08 2018 +++ src/sys/sys/module_hook.h Wed Sep 19 06:26:13 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: module_hook.h,v 1.1.2.1 2018/09/18 21:38:08 pgoyette Exp $ */ +/* $NetBSD: module_hook.h,v 1.1.2.2 2018/09/19 06:26:13 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -116,6 +116,9 @@ static void (hook ## _unset)(void)\ KASSERT(hook.hooked); \ KASSERT(hook.f); \ \ + /* Grab the mutex */ \ + mutex_enter(); \ +\ /* Prevent new localcount_acquire calls. */ \ hook.hooked = false; \ \ @@ -125,6 +128,8 @@ static void (hook ## _unset)(void)\ /* Wait for existing localcount references to drain. */\ localcount_drain(, , ); \ \ + /* Release the mutex and clean up all resources */ \ + mutex_exit(); \ localcount_fini();\ cv_destroy(); \ mutex_destroy();\
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Wed Sep 19 06:26:13 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module_hook.h Log Message: Ooops - we need to grab the mutex before we can drain the localcount! To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/sys/module_hook.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Tue Sep 18 21:38:08 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Added Files: src/sys/sys [pgoyette-compat]: module_hook.h Removed Files: src/sys/sys [pgoyette-compat]: compat_hook.h Log Message: Rename sys/compat_hook.h --> sys/module_hook.h to more accurately state its intended usage To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r0 src/sys/sys/compat_hook.h cvs rdiff -u -r1.1.2.26 -r1.1.2.27 src/sys/sys/compat_stub.h cvs rdiff -u -r0 -r1.1.2.1 src/sys/sys/module_hook.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/compat_stub.h diff -u src/sys/sys/compat_stub.h:1.1.2.26 src/sys/sys/compat_stub.h:1.1.2.27 --- src/sys/sys/compat_stub.h:1.1.2.26 Tue Sep 18 10:34:08 2018 +++ src/sys/sys/compat_stub.h Tue Sep 18 21:38:08 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_stub.h,v 1.1.2.26 2018/09/18 10:34:08 pgoyette Exp $ */ +/* $NetBSD: compat_stub.h,v 1.1.2.27 2018/09/18 21:38:08 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #ifndef _SYS_COMPAT_STUB_H #define _SYS_COMPAT_STUB_H -#include +#include /* * Routine hooks for compat_50___sys_ntp_gettime Added files: Index: src/sys/sys/module_hook.h diff -u /dev/null src/sys/sys/module_hook.h:1.1.2.1 --- /dev/null Tue Sep 18 21:38:08 2018 +++ src/sys/sys/module_hook.h Tue Sep 18 21:38:08 2018 @@ -0,0 +1,187 @@ +/* $NetBSD: module_hook.h,v 1.1.2.1 2018/09/18 21:38:08 pgoyette Exp $ */ + +/*- + * Copyright (c) 2018 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Paul Goyette + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _SYS_MODULE_HOOK_H +#define _SYS_MODULE_HOOK_H + +#include /* for COHERENCY_UNIT, for __cacheline_aligned */ +#include +#include +#include +#include +#include + +/* + * Macros for creating MP-safe vectored function calls, where + * the function implementations are in modules which could be + * unloaded. + */ + +#define MODULE_HOOK(hook,args) \ +extern struct hook ## _t { \ + kmutex_t mtx;\ + kcondvar_t cv;\ + struct localcount lc;\ + pserialize_t psz;\ +bool hooked;\ + int (*f)args; \ +} hook __cacheline_aligned; + +#define MODULE_HOOK2(hook,args1,args2)\ +extern struct hook ## _t { \ + kmutex_t mtx;\ + kcondvar_t cv;\ + struct localcount lc;\ + pserialize_t psz;\ +bool hooked;\ + int (*f1)args1; \ + int (*f2)args2; \ +} hook __cacheline_aligned; + +#define MODULE_SET_HOOK(hook, waitchan, func) \ +static void hook ## _set(void); \ +static void hook ## _set(void) \ +{\ +\ + KASSERT(!hook.hooked); \ +\ + hook.psz = pserialize_create();\ + mutex_init(, MUTEX_DEFAULT, IPL_NONE); \ + cv_init(, waitchan);\ + localcount_init();\ + hook.f = func; \ +\ + /* Make sure it's initialized before anyone uses it */ \ + membar_producer(); \ +\ + /* Let them use it */ \ + hook.hooked = true; \ +} + +#define MODULE_SET_HOOK2(hook, waitchan, func1, func2) \ +static void hook ## _set(void); \ +static void hook ## _set(void) \ +{\ +\ + KASSERT(!hook.hooked); \ +\ + hook.psz = pserialize_create();\ + mutex_init(, MUTEX_DEFAULT, IPL_NONE); \ + cv_init(, waitchan);\ + localcount_init();\ + hook.f1 = func1; \ + hook.f2 = func2; \ +\ + /* Make sure it's initialized before anyone uses it */
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Tue Sep 18 21:38:08 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Added Files: src/sys/sys [pgoyette-compat]: module_hook.h Removed Files: src/sys/sys [pgoyette-compat]: compat_hook.h Log Message: Rename sys/compat_hook.h --> sys/module_hook.h to more accurately state its intended usage To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r0 src/sys/sys/compat_hook.h cvs rdiff -u -r1.1.2.26 -r1.1.2.27 src/sys/sys/compat_stub.h cvs rdiff -u -r0 -r1.1.2.1 src/sys/sys/module_hook.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Tue Sep 18 10:34:08 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Log Message: Add some XXX comments to remind me to finish the work in these areas To generate a diff of this commit: cvs rdiff -u -r1.1.2.25 -r1.1.2.26 src/sys/sys/compat_stub.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/compat_stub.h diff -u src/sys/sys/compat_stub.h:1.1.2.25 src/sys/sys/compat_stub.h:1.1.2.26 --- src/sys/sys/compat_stub.h:1.1.2.25 Tue Sep 18 03:32:35 2018 +++ src/sys/sys/compat_stub.h Tue Sep 18 10:34:08 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_stub.h,v 1.1.2.25 2018/09/18 03:32:35 pgoyette Exp $ */ +/* $NetBSD: compat_stub.h,v 1.1.2.26 2018/09/18 10:34:08 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -135,6 +135,7 @@ COMPAT_HOOK(compat_bio_30_hook, (void *, /* * vnd_30 ioctl compatability + * XXX there's some _50 code mixed in */ struct vattr; COMPAT_HOOK(compat_vndioctl_30_hook, (u_long, struct lwp *, void *, int, @@ -142,6 +143,7 @@ COMPAT_HOOK(compat_vndioctl_30_hook, (u_ /* * ieee80211 ioctl compatability + * XXX need to review this */ struct ieee80211_ostats; struct ieee80211_stats;
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Tue Sep 18 10:34:08 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Log Message: Add some XXX comments to remind me to finish the work in these areas To generate a diff of this commit: cvs rdiff -u -r1.1.2.25 -r1.1.2.26 src/sys/sys/compat_stub.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Tue Sep 18 03:32:35 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Added Files: src/sys/sys [pgoyette-compat]: compat_hook.h Log Message: Split the HOOK-related macros out from the declarations. We'll need the macros for compat32, but won't want the declarations. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1.2.1 src/sys/sys/compat_hook.h cvs rdiff -u -r1.1.2.24 -r1.1.2.25 src/sys/sys/compat_stub.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/compat_stub.h diff -u src/sys/sys/compat_stub.h:1.1.2.24 src/sys/sys/compat_stub.h:1.1.2.25 --- src/sys/sys/compat_stub.h:1.1.2.24 Tue Sep 18 01:15:58 2018 +++ src/sys/sys/compat_stub.h Tue Sep 18 03:32:35 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_stub.h,v 1.1.2.24 2018/09/18 01:15:58 pgoyette Exp $ */ +/* $NetBSD: compat_stub.h,v 1.1.2.25 2018/09/18 03:32:35 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,157 +32,7 @@ #ifndef _SYS_COMPAT_STUB_H #define _SYS_COMPAT_STUB_H -#include /* for COHERENCY_UNIT, for __cacheline_aligned */ -#include -#include -#include -#include -#include - -/* - * Macros for creating MP-safe vectored function calls, where - * the function implementations are in modules which could be - * unloaded. - */ - -#define COMPAT_HOOK(hook,args) \ -extern struct hook ## _t { \ - kmutex_t mtx;\ - kcondvar_t cv;\ - struct localcount lc;\ - pserialize_t psz;\ -bool hooked;\ - int (*f)args; \ -} hook __cacheline_aligned; - -#define COMPAT_HOOK2(hook,args1,args2)\ -extern struct hook ## _t { \ - kmutex_t mtx;\ - kcondvar_t cv;\ - struct localcount lc;\ - pserialize_t psz;\ -bool hooked;\ - int (*f1)args1; \ - int (*f2)args2; \ -} hook __cacheline_aligned; - -#define COMPAT_SET_HOOK(hook, waitchan, func) \ -static void hook ## _set(void); \ -static void hook ## _set(void) \ -{\ -\ - KASSERT(!hook.hooked); \ -\ - hook.psz = pserialize_create();\ - mutex_init(, MUTEX_DEFAULT, IPL_NONE); \ - cv_init(, waitchan);\ - localcount_init();\ - hook.f = func; \ -\ - /* Make sure it's initialized before anyone uses it */ \ - membar_producer(); \ -\ - /* Let them use it */ \ - hook.hooked = true; \ -} - -#define COMPAT_SET_HOOK2(hook, waitchan, func1, func2) \ -static void hook ## _set(void); \ -static void hook ## _set(void) \ -{\ -\ - KASSERT(!hook.hooked); \ -\ - hook.psz = pserialize_create();\ - mutex_init(, MUTEX_DEFAULT, IPL_NONE); \ - cv_init(, waitchan);\ - localcount_init();\ - hook.f1 = func1; \ - hook.f2 = func2; \ -\ - /* Make sure it's initialized before anyone uses it */ \ - membar_producer(); \ -\ - /* Let them use it */ \ - hook.hooked = true; \ -} - -#define COMPAT_UNSET_HOOK(hook) \ -static void (hook ## _unset)(void);\ -static void (hook ## _unset)(void)\ -{\ -\ - KASSERT(kernconfig_is_held());\ - KASSERT(hook.hooked); \ - KASSERT(hook.f); \ -\ - /* Prevent new localcount_acquire calls. */ \ - hook.hooked = false; \ -\ - /* Wait for existing localcount_acquire calls to drain. */ \ - pserialize_perform(hook.psz);\ -\ - /* Wait for existing localcount references to drain. */\ - localcount_drain(, , ); \ -\ - localcount_fini();\ - cv_destroy(); \ - mutex_destroy();\ - pserialize_destroy(hook.psz);\ -} - -#define COMPAT_UNSET_HOOK2(hook)\ -static void (hook ## _unset)(void);\ -static void (hook ## _unset)(void)\ -{\ -\ - KASSERT(kernconfig_is_held());\ - KASSERT(hook.hooked); \ - KASSERT(hook.f1); \ - KASSERT(hook.f2); \ -\ - /* Prevent new localcount_acquire calls. */ \ - hook.hooked = false; \ -\ - /* Wait for existing localcount_acquire calls to drain. */ \ - pserialize_perform(hook.psz);\ -\ - /* Wait for existing localcount references to drain. */\ - localcount_drain(, , ); \ -\ - localcount_fini();\ - cv_destroy(); \ - mutex_destroy();\ - pserialize_destroy(hook.psz);\ -} - -#define COMPAT_CALL_HOOK_DECL(hook, which, decl, args, default) \ -int\ -hook ## _ ## which ## _call decl; -#define COMPAT_CALL_HOOK(hook, which, decl, args, default) \ -int\ -hook ## _ ## which ## _call decl\ -{\ - bool hooked; \ - int error, s; \ -\ - s = pserialize_read_enter();\ - hooked = hook.hooked; \ - if (hooked) { \ - membar_consumer();\ - localcount_acquire(); \ - } \ - pserialize_read_exit(s);\ -\ - if (hooked) { \ - error = (*hook.which)args; \ -
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Tue Sep 18 03:32:35 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Added Files: src/sys/sys [pgoyette-compat]: compat_hook.h Log Message: Split the HOOK-related macros out from the declarations. We'll need the macros for compat32, but won't want the declarations. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1.2.1 src/sys/sys/compat_hook.h cvs rdiff -u -r1.1.2.24 -r1.1.2.25 src/sys/sys/compat_stub.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sun Sep 16 04:56:27 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Log Message: Lots of typos, rearranging, renaming, etc. To generate a diff of this commit: cvs rdiff -u -r1.1.2.21 -r1.1.2.22 src/sys/sys/compat_stub.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/compat_stub.h diff -u src/sys/sys/compat_stub.h:1.1.2.21 src/sys/sys/compat_stub.h:1.1.2.22 --- src/sys/sys/compat_stub.h:1.1.2.21 Sun Sep 16 02:16:21 2018 +++ src/sys/sys/compat_stub.h Sun Sep 16 04:56:26 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_stub.h,v 1.1.2.21 2018/09/16 02:16:21 pgoyette Exp $ */ +/* $NetBSD: compat_stub.h,v 1.1.2.22 2018/09/16 04:56:26 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -37,6 +37,7 @@ #include #include #include +#include /* * Macros for creating MP-safe vectored function calls, where @@ -45,8 +46,8 @@ */ #define COMPAT_HOOK(hook,args) \ -extern struct __CONCAT(hook,_t) {\ - kmutex_t lock;\ +extern struct hook ## _t { \ + kmutex_t mtx;\ kcondvar_t cv;\ struct localcount lc;\ pserialize_t psz;\ @@ -55,8 +56,8 @@ extern struct __CONCAT(hook,_t) {\ } hook __cacheline_aligned; #define COMPAT_HOOK2(hook,args1,args2)\ -extern struct __CONCAT(hook,_t) {\ - kmutex_t lock;\ +extern struct hook ## _t { \ + kmutex_t mtx;\ kcondvar_t cv;\ struct localcount lc;\ pserialize_t psz;\ @@ -66,7 +67,8 @@ extern struct __CONCAT(hook,_t) {\ } hook __cacheline_aligned; #define COMPAT_SET_HOOK(hook, waitchan, func) \ -static void __CONCAT(hook,sethook)(void) \ +static void hook ## _set(void); \ +static void hook ## _set(void) \ {\ \ KASSERT(!hook.hooked); \ @@ -85,7 +87,8 @@ static void __CONCAT(hook,sethook)(void) } #define COMPAT_SET_HOOK2(hook, waitchan, func1, func2) \ -static void __CONCAT(hook,sethook)(void) \ +static void hook ## _set(void); \ +static void hook ## _set(void) \ {\ \ KASSERT(!hook.hooked); \ @@ -105,7 +108,8 @@ static void __CONCAT(hook,sethook)(void) } #define COMPAT_UNSET_HOOK(hook) \ -static void __CONCAT(hook,unsethook)(void) \ +static void (hook ## _unset)(void);\ +static void (hook ## _unset)(void)\ {\ \ KASSERT(kernconfig_is_held());\ @@ -128,7 +132,8 @@ static void __CONCAT(hook,unsethook)(voi } #define COMPAT_UNSET_HOOK2(hook)\ -static void __CONCAT(hook,unsethook)(void) \ +static void (hook ## _unset)(void);\ +static void (hook ## _unset)(void)\ {\ \ KASSERT(kernconfig_is_held());\ @@ -151,9 +156,11 @@ static void __CONCAT(hook,unsethook)(voi pserialize_destroy(hook.psz);\ } -#define COMPAT_CALL_HOOK(hook, which, decl, args, no_hook) \ +#define COMPAT_CALL_HOOK(hook, which, decl, args, default) \ int\ -__CONCAT(call_,hook_which)(decl)\ +hook ## _ ## which ## _call decl;\ +int\ +hook ## _ ## which ## _call decl\ {\ bool hooked; \ int error, s; \ @@ -161,20 +168,20 @@ __CONCAT(call_,hook_which)(decl)\ s = pserialize_read_enter();\ hooked = hook.hooked; \ if (hooked) { \ - membar_consumer():\ + membar_consumer();\ localcount_acquire(); \ } \ - pserialize_read_exit(); \ + pserialize_read_exit(s);\ \ if (hooked) { \ - error = (*hook.which)(args); \ + error = (*hook.which)args; \ localcount_release(, , \ ); \ } else { \ - error = no_hook(args);\ + error = default;\ } \ return error; \ -; +} /* * Routine hooks for compat_50___sys_ntp_gettime @@ -185,7 +192,7 @@ struct ntptimeval; extern void (*vec_ntp_gettime)(struct ntptimeval *); extern int (*vec_ntp_timestatus)(void); -COMPAT_HOOK2(ntp_gettime_hooks, void, (struct ntptimeval *), int, (void)) +COMPAT_HOOK2(ntp_gettime_hooks, (struct ntptimeval *), (void)) /* * Routine vector for dev/ccd ioctl()
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sun Sep 16 04:56:27 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Log Message: Lots of typos, rearranging, renaming, etc. To generate a diff of this commit: cvs rdiff -u -r1.1.2.21 -r1.1.2.22 src/sys/sys/compat_stub.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sun Sep 16 02:16:21 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Log Message: Enable CALL_HOOKS for each/all of the possible hook functions To generate a diff of this commit: cvs rdiff -u -r1.1.2.20 -r1.1.2.21 src/sys/sys/compat_stub.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/compat_stub.h diff -u src/sys/sys/compat_stub.h:1.1.2.20 src/sys/sys/compat_stub.h:1.1.2.21 --- src/sys/sys/compat_stub.h:1.1.2.20 Sun Sep 16 01:51:58 2018 +++ src/sys/sys/compat_stub.h Sun Sep 16 02:16:21 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_stub.h,v 1.1.2.20 2018/09/16 01:51:58 pgoyette Exp $ */ +/* $NetBSD: compat_stub.h,v 1.1.2.21 2018/09/16 02:16:21 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -51,7 +51,7 @@ extern struct __CONCAT(hook,_t) {\ struct localcount lc;\ pserialize_t psz;\ bool hooked;\ - int (*func)args; \ + int (*f)args; \ } hook __cacheline_aligned; #define COMPAT_HOOK2(hook,args1,args2)\ @@ -61,11 +61,11 @@ extern struct __CONCAT(hook,_t) {\ struct localcount lc;\ pserialize_t psz;\ bool hooked;\ - int (*func1)args1; \ - int (*func2)args2; \ + int (*f1)args1; \ + int (*f2)args2; \ } hook __cacheline_aligned; -#define COMPAT_SET_HOOK(hook, waitchan, f) \ +#define COMPAT_SET_HOOK(hook, waitchan, func) \ static void __CONCAT(hook,sethook)(void) \ {\ \ @@ -75,7 +75,7 @@ static void __CONCAT(hook,sethook)(void) mutex_init(, MUTEX_DEFAULT, IPL_NONE); \ cv_init(, waitchan);\ localcount_init();\ - hook.func = f; \ + hook.f = func; \ \ /* Make sure it's initialized before anyone uses it */ \ membar_producer(); \ @@ -84,7 +84,7 @@ static void __CONCAT(hook,sethook)(void) hook.hooked = true; \ } -#define COMPAT_SET_HOOK2(hook, waitchan, f1, f2) \ +#define COMPAT_SET_HOOK2(hook, waitchan, func1, func2) \ static void __CONCAT(hook,sethook)(void) \ {\ \ @@ -94,8 +94,8 @@ static void __CONCAT(hook,sethook)(void) mutex_init(, MUTEX_DEFAULT, IPL_NONE); \ cv_init(, waitchan);\ localcount_init();\ - hook.func1 = f1; \ - hook.func2 = f2; \ + hook.f1 = func1; \ + hook.f2 = func2; \ \ /* Make sure it's initialized before anyone uses it */ \ membar_producer(); \ @@ -110,7 +110,7 @@ static void __CONCAT(hook,unsethook)(voi \ KASSERT(kernconfig_is_held());\ KASSERT(hook.hooked); \ - KASSERT(hook.func); \ + KASSERT(hook.f); \ \ /* Prevent new localcount_acquire calls. */ \ hook.hooked = false; \ @@ -133,8 +133,8 @@ static void __CONCAT(hook,unsethook)(voi \ KASSERT(kernconfig_is_held());\ KASSERT(hook.hooked); \ - KASSERT(hook.func1); \ - KASSERT(hook.func2); \ + KASSERT(hook.f1); \ + KASSERT(hook.f2); \ \ /* Prevent new localcount_acquire calls. */ \ hook.hooked = false; \ @@ -151,9 +151,9 @@ static void __CONCAT(hook,unsethook)(voi pserialize_destroy(hook.psz);\ } -#define COMPAT_CALL_HOOK(hook, which, args, no_hook) \ +#define COMPAT_CALL_HOOK(hook, which, decl, args, no_hook) \ int\ -__CONCAT(call_,hook)(args) \ +__CONCAT(call_,hook_which)(decl)\ {\ bool hooked; \ int error, s; \
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sun Sep 16 02:16:21 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Log Message: Enable CALL_HOOKS for each/all of the possible hook functions To generate a diff of this commit: cvs rdiff -u -r1.1.2.20 -r1.1.2.21 src/sys/sys/compat_stub.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sun Sep 16 01:51:58 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Log Message: Insist that all hooks are of type int To generate a diff of this commit: cvs rdiff -u -r1.1.2.19 -r1.1.2.20 src/sys/sys/compat_stub.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/compat_stub.h diff -u src/sys/sys/compat_stub.h:1.1.2.19 src/sys/sys/compat_stub.h:1.1.2.20 --- src/sys/sys/compat_stub.h:1.1.2.19 Sun Sep 16 00:40:27 2018 +++ src/sys/sys/compat_stub.h Sun Sep 16 01:51:58 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_stub.h,v 1.1.2.19 2018/09/16 00:40:27 pgoyette Exp $ */ +/* $NetBSD: compat_stub.h,v 1.1.2.20 2018/09/16 01:51:58 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -44,25 +44,25 @@ * unloaded. */ -#define COMPAT_HOOK(hook,type,args)\ +#define COMPAT_HOOK(hook,args) \ extern struct __CONCAT(hook,_t) {\ kmutex_t lock;\ kcondvar_t cv;\ struct localcount lc;\ pserialize_t psz;\ bool hooked;\ - type (*func)args; \ + int (*func)args; \ } hook __cacheline_aligned; -#define COMPAT_HOOK2(hook,type1,args1,type2,args2) \ +#define COMPAT_HOOK2(hook,args1,args2)\ extern struct __CONCAT(hook,_t) {\ kmutex_t lock;\ kcondvar_t cv;\ struct localcount lc;\ pserialize_t psz;\ bool hooked;\ - type1 (*func1)args1; \ - type2 (*func2)args2; \ + int (*func1)args1; \ + int (*func2)args2; \ } hook __cacheline_aligned; #define COMPAT_SET_HOOK(hook, waitchan, f) \ @@ -152,7 +152,7 @@ static void __CONCAT(hook,unsethook)(voi } #define COMPAT_CALL_HOOK(hook, which, args, no_hook) \ -type\ +int\ __CONCAT(call_,hook)(args) \ {\ bool hooked; \ @@ -191,10 +191,7 @@ COMPAT_HOOK2(ntp_gettime_hooks, void, (s * Routine vector for dev/ccd ioctl() */ -extern int (*compat_ccd_ioctl_60)(dev_t, u_long, void *, int, struct lwp *, -int (*f)(dev_t, u_long, void *, int, struct lwp *)); - -COMPAT_HOOK(ccd_ioctl_hook, int, (dev_t, u_long, void *, int, struct lwp *, +COMPAT_HOOK(ccd_ioctl_60_hook, (dev_t, u_long, void *, int, struct lwp *, int (*f)(dev_t, u_long, void *, int, struct lwp *))) /*
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sun Sep 16 01:51:58 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Log Message: Insist that all hooks are of type int To generate a diff of this commit: cvs rdiff -u -r1.1.2.19 -r1.1.2.20 src/sys/sys/compat_stub.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sun Sep 16 00:40:27 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Log Message: Finish the macros for MP-safe COMPAT_HOOKS To generate a diff of this commit: cvs rdiff -u -r1.1.2.18 -r1.1.2.19 src/sys/sys/compat_stub.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/compat_stub.h diff -u src/sys/sys/compat_stub.h:1.1.2.18 src/sys/sys/compat_stub.h:1.1.2.19 --- src/sys/sys/compat_stub.h:1.1.2.18 Sat Sep 15 06:37:48 2018 +++ src/sys/sys/compat_stub.h Sun Sep 16 00:40:27 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_stub.h,v 1.1.2.18 2018/09/15 06:37:48 pgoyette Exp $ */ +/* $NetBSD: compat_stub.h,v 1.1.2.19 2018/09/16 00:40:27 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,34 +32,152 @@ #ifndef _SYS_COMPAT_STUB_H #define _SYS_COMPAT_STUB_H +#include /* for COHERENCY_UNIT, for __cacheline_aligned */ #include #include #include #include /* - * Macro for creating MP-safe vectored function calls - */ -#if defined(MODULAR) -#define COMPAT_HOOK(name,type,args) \ -struct __CONCAT(name,_t) { \ - kmutex_t lock; \ - kcondvar_t cv; \ - struct localcount lc; \ - pserialize_t psz; \ -bool hooked; \ - type (*func)(args); \ -} name __cacheline_aligned; -#else /* defined(MODULAR) */ -#define COMPAT_HOOK(name,type,args) \ -struct __CONCAT(name,_t) { \ -bool hooked; \ - type (*func)(args); \ -} name __cacheline_aligned; -#endif /* defined(MODULAR) */ + * Macros for creating MP-safe vectored function calls, where + * the function implementations are in modules which could be + * unloaded. + */ + +#define COMPAT_HOOK(hook,type,args)\ +extern struct __CONCAT(hook,_t) {\ + kmutex_t lock;\ + kcondvar_t cv;\ + struct localcount lc;\ + pserialize_t psz;\ +bool hooked;\ + type (*func)args; \ +} hook __cacheline_aligned; + +#define COMPAT_HOOK2(hook,type1,args1,type2,args2) \ +extern struct __CONCAT(hook,_t) {\ + kmutex_t lock;\ + kcondvar_t cv;\ + struct localcount lc;\ + pserialize_t psz;\ +bool hooked;\ + type1 (*func1)args1; \ + type2 (*func2)args2; \ +} hook __cacheline_aligned; + +#define COMPAT_SET_HOOK(hook, waitchan, f) \ +static void __CONCAT(hook,sethook)(void) \ +{\ +\ + KASSERT(!hook.hooked); \ +\ + hook.psz = pserialize_create();\ + mutex_init(, MUTEX_DEFAULT, IPL_NONE); \ + cv_init(, waitchan);\ + localcount_init();\ + hook.func = f; \ +\ + /* Make sure it's initialized before anyone uses it */ \ + membar_producer(); \ +\ + /* Let them use it */ \ + hook.hooked = true; \ +} + +#define COMPAT_SET_HOOK2(hook, waitchan, f1, f2) \ +static void __CONCAT(hook,sethook)(void) \ +{\ +\ + KASSERT(!hook.hooked); \ +\ + hook.psz = pserialize_create();\ + mutex_init(, MUTEX_DEFAULT, IPL_NONE); \ + cv_init(, waitchan);\ + localcount_init();\ + hook.func1 = f1; \ + hook.func2 = f2; \ +\ + /* Make sure it's initialized before anyone uses it */ \ + membar_producer(); \ +\ + /* Let them use it */ \ + hook.hooked = true; \ +} + +#define COMPAT_UNSET_HOOK(hook) \ +static void __CONCAT(hook,unsethook)(void) \ +{\ +\ + KASSERT(kernconfig_is_held());\ + KASSERT(hook.hooked); \ + KASSERT(hook.func); \ +\ + /* Prevent new localcount_acquire calls. */ \ + hook.hooked = false; \ +\ + /* Wait for existing localcount_acquire calls to drain. */ \ + pserialize_perform(hook.psz);\ +\ + /* Wait for existing localcount references to drain. */\ + localcount_drain(, , ); \ +\ + localcount_fini();\ + cv_destroy(); \ + mutex_destroy();\ + pserialize_destroy(hook.psz);\ +} + +#define COMPAT_UNSET_HOOK2(hook)\ +static void __CONCAT(hook,unsethook)(void) \ +{\ +\ + KASSERT(kernconfig_is_held());\ + KASSERT(hook.hooked); \ + KASSERT(hook.func1); \ + KASSERT(hook.func2); \ +\ + /* Prevent new localcount_acquire calls. */ \ + hook.hooked = false; \ +\ + /* Wait for existing localcount_acquire calls to drain. */ \ + pserialize_perform(hook.psz);\ +\ + /* Wait for existing localcount references to drain. */\ + localcount_drain(, , ); \ +\ + localcount_fini();\ + cv_destroy(); \ + mutex_destroy();\ + pserialize_destroy(hook.psz);\ +} + +#define COMPAT_CALL_HOOK(hook, which, args, no_hook) \ +type\ +__CONCAT(call_,hook)(args) \ +{\ + bool hooked; \ + int error, s; \ +\ + s = pserialize_read_enter();\ + hooked = hook.hooked; \ + if (hooked) { \ + membar_consumer():\ + localcount_acquire(); \ + }
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sun Sep 16 00:40:27 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Log Message: Finish the macros for MP-safe COMPAT_HOOKS To generate a diff of this commit: cvs rdiff -u -r1.1.2.18 -r1.1.2.19 src/sys/sys/compat_stub.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sat Sep 15 06:37:48 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Log Message: Typo: s/./,/ To generate a diff of this commit: cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/sys/sys/compat_stub.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/compat_stub.h diff -u src/sys/sys/compat_stub.h:1.1.2.17 src/sys/sys/compat_stub.h:1.1.2.18 --- src/sys/sys/compat_stub.h:1.1.2.17 Sat Sep 15 05:57:51 2018 +++ src/sys/sys/compat_stub.h Sat Sep 15 06:37:48 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_stub.h,v 1.1.2.17 2018/09/15 05:57:51 pgoyette Exp $ */ +/* $NetBSD: compat_stub.h,v 1.1.2.18 2018/09/15 06:37:48 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -51,7 +51,7 @@ struct __CONCAT(name,_t) { \ type (*func)(args); \ } name __cacheline_aligned; #else /* defined(MODULAR) */ -#define COMPAT_HOOK(name,type.args) \ +#define COMPAT_HOOK(name,type,args) \ struct __CONCAT(name,_t) { \ bool hooked; \ type (*func)(args); \
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sat Sep 15 06:37:48 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Log Message: Typo: s/./,/ To generate a diff of this commit: cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/sys/sys/compat_stub.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sat Sep 15 05:57:51 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Log Message: Remove stray '-' To generate a diff of this commit: cvs rdiff -u -r1.1.2.16 -r1.1.2.17 src/sys/sys/compat_stub.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sat Sep 15 05:57:51 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: compat_stub.h Log Message: Remove stray '-' To generate a diff of this commit: cvs rdiff -u -r1.1.2.16 -r1.1.2.17 src/sys/sys/compat_stub.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/compat_stub.h diff -u src/sys/sys/compat_stub.h:1.1.2.16 src/sys/sys/compat_stub.h:1.1.2.17 --- src/sys/sys/compat_stub.h:1.1.2.16 Sat Sep 15 05:56:50 2018 +++ src/sys/sys/compat_stub.h Sat Sep 15 05:57:51 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_stub.h,v 1.1.2.16 2018/09/15 05:56:50 pgoyette Exp $ */ +/* $NetBSD: compat_stub.h,v 1.1.2.17 2018/09/15 05:57:51 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -72,7 +72,7 @@ extern int (*vec_ntp_timestatus)(void); */ extern int (*compat_ccd_ioctl_60)(dev_t, u_long, void *, int, struct lwp *, --int (*f)(dev_t, u_long, void *, int, struct lwp *)); +int (*f)(dev_t, u_long, void *, int, struct lwp *)); /* * Routine vector for dev/clockctl ioctl()
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Tue Sep 11 08:25:44 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module.h Log Message: Define vector for compat_netbsd32 version of sys_modctl() To generate a diff of this commit: cvs rdiff -u -r1.41.14.12 -r1.41.14.13 src/sys/sys/module.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Tue Sep 11 08:25:44 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module.h Log Message: Define vector for compat_netbsd32 version of sys_modctl() To generate a diff of this commit: cvs rdiff -u -r1.41.14.12 -r1.41.14.13 src/sys/sys/module.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/module.h diff -u src/sys/sys/module.h:1.41.14.12 src/sys/sys/module.h:1.41.14.13 --- src/sys/sys/module.h:1.41.14.12 Mon Sep 10 22:50:52 2018 +++ src/sys/sys/module.h Tue Sep 11 08:25:43 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: module.h,v 1.41.14.12 2018/09/10 22:50:52 pgoyette Exp $ */ +/* $NetBSD: module.h,v 1.41.14.13 2018/09/11 08:25:43 pgoyette Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -218,7 +218,8 @@ void module_print(const char *, ...) __p extern char module_base[MODULE_BASE_SIZE]; extern const char *module_machine; -extern int (*vec_compat32_80_modctl)(struct lwp *, +struct netbsd32_modctl_args; +extern int (*vec_compat32_80_modctl)(struct lwp *, const struct netbsd32_modctl_args *, register_t *); extern int compat32_80_modctl_compat_stub(struct lwp *, const struct netbsd32_modctl_args *, register_t *);
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Mon Jun 25 10:11:21 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module.h Log Message: Resolve conflict correctly! To generate a diff of this commit: cvs rdiff -u -r1.41.14.9 -r1.41.14.10 src/sys/sys/module.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/module.h diff -u src/sys/sys/module.h:1.41.14.9 src/sys/sys/module.h:1.41.14.10 --- src/sys/sys/module.h:1.41.14.9 Mon Jun 25 07:22:54 2018 +++ src/sys/sys/module.h Mon Jun 25 10:11:21 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: module.h,v 1.41.14.9 2018/06/25 07:22:54 pgoyette Exp $ */ +/* $NetBSD: module.h,v 1.41.14.10 2018/06/25 10:11:21 pgoyette Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -250,8 +250,9 @@ typedef struct modctl_load { enum modctl { MODCTL_LOAD, /* modctl_load_t *ml */ MODCTL_UNLOAD, /* char *name */ - MODCTL_STAT, /* struct iovec *buffer */ - MODCTL_EXISTS /* enum: 0: load, 1: autoload */ + MODCTL_OSTAT, /* struct iovec *buffer */ + MODCTL_EXISTS, /* enum: 0: load, 1: autoload */ + MODCTL_STAT /* struct iovec *buffer */ }; /*
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Mon Jun 25 10:11:21 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module.h Log Message: Resolve conflict correctly! To generate a diff of this commit: cvs rdiff -u -r1.41.14.9 -r1.41.14.10 src/sys/sys/module.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sat Mar 17 00:11:13 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: cpu.h Log Message: Declare the function pointers as external To generate a diff of this commit: cvs rdiff -u -r1.42.2.1 -r1.42.2.2 src/sys/sys/cpu.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sat Mar 17 00:11:13 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: cpu.h Log Message: Declare the function pointers as external To generate a diff of this commit: cvs rdiff -u -r1.42.2.1 -r1.42.2.2 src/sys/sys/cpu.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/cpu.h diff -u src/sys/sys/cpu.h:1.42.2.1 src/sys/sys/cpu.h:1.42.2.2 --- src/sys/sys/cpu.h:1.42.2.1 Fri Mar 16 08:10:27 2018 +++ src/sys/sys/cpu.h Sat Mar 17 00:11:13 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.42.2.1 2018/03/16 08:10:27 pgoyette Exp $ */ +/* $NetBSD: cpu.h,v 1.42.2.2 2018/03/17 00:11:13 pgoyette Exp $ */ /*- * Copyright (c) 2007 YAMAMOTO Takashi, @@ -130,9 +130,8 @@ struct cpu_ucode_softc { int cpu_ucode_get_version(struct cpu_ucode_version *); int cpu_ucode_apply(const struct cpu_ucode *); -int (*vec_compat6_cpu_ucode_get_version)(struct compat6_cpu_ucode *); -int (*vec_compat6_cpu_ucode_apply(const struct compat6_cpu_ucode *); -stub_compat_6_cpu_ucode; +extern int (*vec_compat6_cpu_ucode_get_version)(struct compat6_cpu_ucode *); +extern int (*vec_compat6_cpu_ucode_apply)(const struct compat6_cpu_ucode *); #ifdef COMPAT_60 int compat6_cpu_ucode_get_version(struct compat6_cpu_ucode *);
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Thu Mar 15 11:57:14 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: param.h Log Message: Typo in comment - no functional change, no version bump To generate a diff of this commit: cvs rdiff -u -r1.557.2.1 -r1.557.2.2 src/sys/sys/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/param.h diff -u src/sys/sys/param.h:1.557.2.1 src/sys/sys/param.h:1.557.2.2 --- src/sys/sys/param.h:1.557.2.1 Thu Mar 15 09:12:07 2018 +++ src/sys/sys/param.h Thu Mar 15 11:57:14 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.557.2.1 2018/03/15 09:12:07 pgoyette Exp $ */ +/* $NetBSD: param.h,v 1.557.2.2 2018/03/15 11:57:14 pgoyette Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -87,7 +87,7 @@ #define NetBSD 199905 /* NetBSD version (year & month). */ /* - * There macros determine if we are running in protected mode or not. + * These macros determine if we are running in protected mode or not. * _HARDKERNEL: code uses kernel namespace and runs in hw priviledged mode * _SOFTKERNEL: code uses kernel namespace but runs without hw priviledges */
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Thu Mar 15 11:57:14 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: param.h Log Message: Typo in comment - no functional change, no version bump To generate a diff of this commit: cvs rdiff -u -r1.557.2.1 -r1.557.2.2 src/sys/sys/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sun Mar 11 00:58:12 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module.h Log Message: Don't use () around __CONCAT as the expression is no longer constant To generate a diff of this commit: cvs rdiff -u -r1.41.14.4 -r1.41.14.5 src/sys/sys/module.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/module.h diff -u src/sys/sys/module.h:1.41.14.4 src/sys/sys/module.h:1.41.14.5 --- src/sys/sys/module.h:1.41.14.4 Sun Mar 11 00:53:13 2018 +++ src/sys/sys/module.h Sun Mar 11 00:58:12 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: module.h,v 1.41.14.4 2018/03/11 00:53:13 pgoyette Exp $ */ +/* $NetBSD: module.h,v 1.41.14.5 2018/03/11 00:58:12 pgoyette Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -153,9 +153,9 @@ static void __CONCAT(moddtor_,name)(void #endif /* RUMP_USE_CTOR */ #define MODULE(class, name, required)\ - MODULE_ALIAS(class, name, required, NULL) + MODULE_WITH_ALIAS(class, name, required, NULL) -#define MODULE_ALIAS(class, name, required, aliases) \ +#define MODULE_WITH_ALIAS(class, name, required, aliases) \ static int __CONCAT(name,_modcmd)(modcmd_t, void *); \ static const char * const * __CONCAT(name,_aliases) = { aliases }; \ static const modinfo_t __CONCAT(name,_modinfo) = { \ @@ -163,7 +163,7 @@ static const modinfo_t __CONCAT(name,_mo .mi_class = (class), \ .mi_modcmd = __CONCAT(name,_modcmd), \ .mi_name = __STRING(name),\ - .mi_aliases = (__CONCAT(name,_aliases)), \ + .mi_aliases = __CONCAT(name,_aliases), \ .mi_required = (required)\ }; \ _MODULE_REGISTER(name)
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sun Mar 11 00:58:12 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module.h Log Message: Don't use () around __CONCAT as the expression is no longer constant To generate a diff of this commit: cvs rdiff -u -r1.41.14.4 -r1.41.14.5 src/sys/sys/module.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sun Mar 11 00:53:13 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module.h Log Message: Actually allocate the list of aliases. To generate a diff of this commit: cvs rdiff -u -r1.41.14.3 -r1.41.14.4 src/sys/sys/module.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sun Mar 11 00:53:13 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module.h Log Message: Actually allocate the list of aliases. To generate a diff of this commit: cvs rdiff -u -r1.41.14.3 -r1.41.14.4 src/sys/sys/module.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/module.h diff -u src/sys/sys/module.h:1.41.14.3 src/sys/sys/module.h:1.41.14.4 --- src/sys/sys/module.h:1.41.14.3 Sun Mar 11 00:44:32 2018 +++ src/sys/sys/module.h Sun Mar 11 00:53:13 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: module.h,v 1.41.14.3 2018/03/11 00:44:32 pgoyette Exp $ */ +/* $NetBSD: module.h,v 1.41.14.4 2018/03/11 00:53:13 pgoyette Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -157,12 +157,13 @@ static void __CONCAT(moddtor_,name)(void #define MODULE_ALIAS(class, name, required, aliases) \ static int __CONCAT(name,_modcmd)(modcmd_t, void *); \ +static const char * const * __CONCAT(name,_aliases) = { aliases }; \ static const modinfo_t __CONCAT(name,_modinfo) = { \ .mi_version = __NetBSD_Version__, \ .mi_class = (class), \ .mi_modcmd = __CONCAT(name,_modcmd), \ .mi_name = __STRING(name),\ - .mi_aliases = (required),\ + .mi_aliases = (__CONCAT(name,_aliases)), \ .mi_required = (required)\ }; \ _MODULE_REGISTER(name)
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sat Mar 10 11:35:44 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module.h Log Message: Use an array of alias names, rather than a comma-separated list. To generate a diff of this commit: cvs rdiff -u -r1.41.14.1 -r1.41.14.2 src/sys/sys/module.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sat Mar 10 11:35:44 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module.h Log Message: Use an array of alias names, rather than a comma-separated list. To generate a diff of this commit: cvs rdiff -u -r1.41.14.1 -r1.41.14.2 src/sys/sys/module.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/module.h diff -u src/sys/sys/module.h:1.41.14.1 src/sys/sys/module.h:1.41.14.2 --- src/sys/sys/module.h:1.41.14.1 Sat Mar 10 10:33:02 2018 +++ src/sys/sys/module.h Sat Mar 10 11:35:44 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: module.h,v 1.41.14.1 2018/03/10 10:33:02 pgoyette Exp $ */ +/* $NetBSD: module.h,v 1.41.14.2 2018/03/10 11:35:44 pgoyette Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -79,7 +79,7 @@ typedef struct modinfo { int (*mi_modcmd)(modcmd_t, void *); const char *mi_name; const char *mi_required; - const char *mi_aliases; + const char *mi_alias[]; } const modinfo_t; /* Per module information, maintained by kern_module.c */
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sat Mar 10 10:33:02 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module.h Log Message: Add new fields and flags needed to support module aliases To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.41.14.1 src/sys/sys/module.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/module.h diff -u src/sys/sys/module.h:1.41 src/sys/sys/module.h:1.41.14.1 --- src/sys/sys/module.h:1.41 Wed Nov 16 10:42:14 2016 +++ src/sys/sys/module.h Sat Mar 10 10:33:02 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: module.h,v 1.41 2016/11/16 10:42:14 pgoyette Exp $ */ +/* $NetBSD: module.h,v 1.41.14.1 2018/03/10 10:33:02 pgoyette Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -62,6 +62,7 @@ typedef enum modcmd { MODULE_CMD_FINI, /* mandatory */ MODULE_CMD_STAT, /* optional */ MODULE_CMD_AUTOUNLOAD, /* optional */ + MODULE_CMD_GETALIASES, /* optional */ } modcmd_t; #ifdef _KERNEL @@ -78,6 +79,7 @@ typedef struct modinfo { int (*mi_modcmd)(modcmd_t, void *); const char *mi_name; const char *mi_required; + const char *mi_aliases; } const modinfo_t; /* Per module information, maintained by kern_module.c */ @@ -95,6 +97,7 @@ typedef struct module { int mod_flags; #define MODFLG_MUST_FORCE 0x01 #define MODFLG_AUTO_LOADED 0x02 +#define MODFLG_IS_ALIAS 0x04 /* only for export via modstat_t */ } module_t;
CVS commit: [pgoyette-compat] src/sys/sys
Module Name:src Committed By: pgoyette Date: Sat Mar 10 10:33:02 UTC 2018 Modified Files: src/sys/sys [pgoyette-compat]: module.h Log Message: Add new fields and flags needed to support module aliases To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.41.14.1 src/sys/sys/module.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.