Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/pgoyette-compat]: src/sys Convert the MODULE_{, VOID_}HOOK_CALL macros to...
details: https://anonhg.NetBSD.org/src/rev/888bb063fa40
branches: pgoyette-compat
changeset: 447718:888bb063fa40
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Tue Jan 22 07:42:40 2019 +0000
description:
Convert the MODULE_{,VOID_}HOOK_CALL macros to do everything in-line
rather than defining an intermediate hook##call function. Almost
all of the hooks are called only once, and although we lose the
ability of doing things like
if (MODULE_HOOK_CALL(...) == 0) ...
we simplify things quite a bit. With this change, we no longer need
to have both declaration and definition macros, and the definition
no longer needs to have both prototype argument list and a "real"
argument list.
FWIW, the above if now needs to written as
int ret;
MODULE_HOOK_CALL(..., ret);
if (ret == 0) ...
with appropriate use of braces {}.
diffstat:
sys/arch/amd64/amd64/netbsd32_machdep.c | 13 +--
sys/arch/mips/mips/netbsd32_machdep.c | 13 +--
sys/arch/sparc/fpu/fpu.c | 16 +---
sys/arch/sparc64/sparc64/netbsd32_machdep.c | 13 +--
sys/compat/common/if_43.c | 15 +---
sys/compat/netbsd32/netbsd32_kern_proc.c | 10 +-
sys/compat/netbsd32/netbsd32_module.c | 17 +----
sys/dev/bio.c | 16 +---
sys/dev/ccd.c | 29 +++------
sys/dev/clockctl.c | 14 +---
sys/dev/raidframe/rf_netbsdkintf.c | 33 ++-------
sys/dev/sysmon/sysmon_power.c | 16 +---
sys/dev/usb/ugen.c | 20 +++---
sys/dev/usb/uhid.c | 17 ++---
sys/dev/usb/usb.c | 32 ++-------
sys/dev/vnd.c | 32 ++-------
sys/dev/wscons/wsevent.c | 13 +--
sys/fs/puffs/puffs_msgif.c | 44 +++++--------
sys/kern/kern_proc.c | 32 +++------
sys/kern/kern_rndq.c | 19 +----
sys/kern/sys_module.c | 15 +---
sys/kern/sysv_ipc.c | 11 +--
sys/kern/tty.c | 21 +----
sys/kern/tty_ptm.c | 25 +------
sys/kern/uipc_usrreq.c | 17 ++---
sys/kern/vfs_syscalls.c | 22 +-----
sys/net/if.c | 48 ++++----------
sys/net/if_spppsubr.c | 13 +--
sys/net/rtsock.c | 91 ++--------------------------
sys/net/rtsock_shared.c | 55 ++--------------
sys/net80211/ieee80211_ioctl.c | 13 +---
sys/opencrypto/cryptodev.c | 21 +-----
sys/sys/compat_stub.h | 4 +-
sys/sys/module_hook.h | 28 ++------
sys/sys/tty.h | 4 +-
35 files changed, 216 insertions(+), 586 deletions(-)
diffs (truncated from 1874 to 300 lines):
diff -r 6e5850345feb -r 888bb063fa40 sys/arch/amd64/amd64/netbsd32_machdep.c
--- a/sys/arch/amd64/amd64/netbsd32_machdep.c Mon Jan 21 06:49:27 2019 +0000
+++ b/sys/arch/amd64/amd64/netbsd32_machdep.c Tue Jan 22 07:42:40 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.c,v 1.115.2.15 2019/01/21 06:49:27 pgoyette Exp $ */
+/* $NetBSD: netbsd32_machdep.c,v 1.115.2.16 2019/01/22 07:42:40 pgoyette Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.115.2.15 2019/01/21 06:49:27 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.115.2.16 2019/01/22 07:42:40 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -275,17 +275,12 @@
struct netbsd32_sendsig_hook_t netbsd32_sendsig_hook;
-MODULE_CALL_HOOK_DECL(netbsd32_sendsig_hook, void,
- (const ksiginfo_t *ksi, const sigset_t *mask));
-MODULE_CALL_VOID_HOOK(netbsd32_sendsig_hook,
- (const ksiginfo_t *ksi, const sigset_t *mask), (ksi, mask),
- netbsd32_sendsig_siginfo(ksi, mask));
-
void
netbsd32_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
{
- netbsd32_sendsig_hook_call(ksi, mask);
+ MODULE_CALL_VOID_HOOK(netbsd32_sendsig_hook, (ksi, mask),
+ netbsd32_sendsig_siginfo(ksi, mask));
}
#ifdef COREDUMP
diff -r 6e5850345feb -r 888bb063fa40 sys/arch/mips/mips/netbsd32_machdep.c
--- a/sys/arch/mips/mips/netbsd32_machdep.c Mon Jan 21 06:49:27 2019 +0000
+++ b/sys/arch/mips/mips/netbsd32_machdep.c Tue Jan 22 07:42:40 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.c,v 1.15.2.11 2019/01/21 06:49:27 pgoyette Exp $ */
+/* $NetBSD: netbsd32_machdep.c,v 1.15.2.12 2019/01/22 07:42:40 pgoyette Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.15.2.11 2019/01/21 06:49:27 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.15.2.12 2019/01/22 07:42:40 pgoyette Exp $");
#include "opt_compat_netbsd.h"
#include "opt_coredump.h"
@@ -309,17 +309,12 @@
struct netbsd32_sendsig_hook_t netbsd32_sendsig_hook;
-MODULE_CALL_HOOK_DECL(netbsd32_sendsig_hook, void,
- (const ksiginfo_t *ksi, const sigset_t *mask));
-MODULE_CALL_VOID_HOOK(netbsd32_sendsig_hook,
- (const ksiginfo_t *ksi, const sigset_t *mask), (ksi, mask),
- netbsd32_sendsig_siginfo(ksi, mask));
-
void
netbsd32_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
{
- netbsd32_sendsig_hook_call(ksi, mask);
+ MODULE_CALL_VOID_HOOK(netbsd32_sendsig_hook, (ksi, mask),
+ netbsd32_sendsig_siginfo(ksi, mask));
}
void
diff -r 6e5850345feb -r 888bb063fa40 sys/arch/sparc/fpu/fpu.c
--- a/sys/arch/sparc/fpu/fpu.c Mon Jan 21 06:49:27 2019 +0000
+++ b/sys/arch/sparc/fpu/fpu.c Tue Jan 22 07:42:40 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpu.c,v 1.27.46.4 2019/01/18 00:01:00 pgoyette Exp $ */
+/* $NetBSD: fpu.c,v 1.27.46.5 2019/01/22 07:42:40 pgoyette Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.27.46.4 2019/01/18 00:01:00 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.27.46.5 2019/01/22 07:42:40 pgoyette Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -120,13 +120,6 @@
/* Note: SVR4(Solaris) FPE_* codes happen to be compatible with ours */
/*
- * HOOK for checking if the lwp's emul matches sunos
- */
-MODULE_CALL_HOOK_DECL(get_emul_sunos_hook, int, (const struct emul **emul));
-MODULE_CALL_HOOK(get_emul_sunos_hook, int, (const struct emul ** emul), (emul),
- enosys());
-
-/*
* The FPU gave us an exception. Clean up the mess. Note that the
* fp queue can only have FPops in it, never load/store FP registers
* nor FBfcc instructions. Experiments with `crashme' prove that
@@ -150,8 +143,9 @@
int code = 0;
const struct emul *sunos_emul;
- if (get_emul_sunos_hook_call(&sunos_emul) == 0 &&
- p->p_emul == sunos_emul)
+ MODULE_CALL_HOOK(get_emul_sunos_hook, (&sunos_emul), enosys(), ret);
+
+ if (ret == 0 && p->p_emul == sunos_emul)
fpu_codes = fpu_codes_sunos;
else
fpu_codes = fpu_codes_native;
diff -r 6e5850345feb -r 888bb063fa40 sys/arch/sparc64/sparc64/netbsd32_machdep.c
--- a/sys/arch/sparc64/sparc64/netbsd32_machdep.c Mon Jan 21 06:49:27 2019 +0000
+++ b/sys/arch/sparc64/sparc64/netbsd32_machdep.c Tue Jan 22 07:42:40 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.c,v 1.110.14.4 2019/01/21 06:49:27 pgoyette Exp $ */
+/* $NetBSD: netbsd32_machdep.c,v 1.110.14.5 2019/01/22 07:42:40 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.110.14.4 2019/01/21 06:49:27 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.110.14.5 2019/01/22 07:42:40 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -262,17 +262,12 @@
struct netbsd32_sendsig_hook_t netbsd32_sendsig_hook;
-MODULE_CALL_HOOK_DECL(netbsd32_sendsig_hook, void,
- (const ksiginfo_t *ksi, const sigset_t *mask));
-MODULE_CALL_VOID_HOOK(netbsd32_sendsig_hook,
- (const ksiginfo_t *ksi, const sigset_t *mask), (ksi, mask),
- netbsd32_sendsig_siginfo(ksi, mask));
-
void
netbsd32_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
{
- netbsd32_sendsig_hook_call(ksi, mask);
+ MODULE_CALL_VOID_HOOK(netbsd32_sendsig_hook, (ksi, mask),
+ netbsd32_sendsig_siginfo(ksi, mask));
}
#undef DEBUG
diff -r 6e5850345feb -r 888bb063fa40 sys/compat/common/if_43.c
--- a/sys/compat/common/if_43.c Mon Jan 21 06:49:27 2019 +0000
+++ b/sys/compat/common/if_43.c Tue Jan 22 07:42:40 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_43.c,v 1.14.2.13 2019/01/18 00:01:00 pgoyette Exp $ */
+/* $NetBSD: if_43.c,v 1.14.2.14 2019/01/22 07:42:40 pgoyette Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.14.2.13 2019/01/18 00:01:00 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.14.2.14 2019/01/22 07:42:40 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -78,15 +78,6 @@
#if defined(COMPAT_43)
-/*
- * Hook for calling the if43_20 compatability routine.
- *
- * XXX The if43_20 routine doesn't really have any effect, since its
- * XXX return value is ignored (see compat/common/if_43.c)!
- */
-MODULE_CALL_HOOK_DECL(if43_20_hook, int, (u_long ncmd));
-MODULE_CALL_HOOK(if43_20_hook, int, (u_long ncmd), (ncmd), enosys());
-
/*
* Use a wrapper so that the compat_cvtcmd() can return a u_long
*/
@@ -221,7 +212,7 @@
case TAPGIFNAME:
return ncmd;
default:
- (void)if43_20_hook_call(ncmd);
+ MODULE_CALL_HOOK(if43_20_hook, (ncmd), enosys(), ncmd);
return ncmd;
}
}
diff -r 6e5850345feb -r 888bb063fa40 sys/compat/netbsd32/netbsd32_kern_proc.c
--- a/sys/compat/netbsd32/netbsd32_kern_proc.c Mon Jan 21 06:49:27 2019 +0000
+++ b/sys/compat/netbsd32/netbsd32_kern_proc.c Tue Jan 22 07:42:40 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_kern_proc.c,v 1.1.2.6 2019/01/14 13:34:27 pgoyette Exp $ */
+/* $NetBSD: netbsd32_kern_proc.c,v 1.1.2.7 2019/01/22 07:42:40 pgoyette Exp $ */
/*-
* Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_kern_proc.c,v 1.1.2.6 2019/01/14 13:34:27 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_kern_proc.c,v 1.1.2.7 2019/01/22 07:42:40 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_kstack.h"
@@ -124,14 +124,14 @@
return 0;
}
-static void
-get_base32(char **argv, size_t i, vaddr_t *base)
+static vaddr_t
+get_base32(char **argv, size_t i)
{
netbsd32_charp *argv32;
argv32 = (netbsd32_charp *)argv;
- *base = (vaddr_t)NETBSD32PTR64(argv32[i]);
+ return (vaddr_t)NETBSD32PTR64(argv32[i]);
}
#if !defined(_RUMPSERVER)
diff -r 6e5850345feb -r 888bb063fa40 sys/compat/netbsd32/netbsd32_module.c
--- a/sys/compat/netbsd32/netbsd32_module.c Mon Jan 21 06:49:27 2019 +0000
+++ b/sys/compat/netbsd32/netbsd32_module.c Tue Jan 22 07:42:40 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_module.c,v 1.6.2.12 2019/01/18 00:01:01 pgoyette Exp $ */
+/* $NetBSD: netbsd32_module.c,v 1.6.2.13 2019/01/22 07:42:40 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_module.c,v 1.6.2.12 2019/01/18 00:01:01 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_module.c,v 1.6.2.13 2019/01/22 07:42:40 pgoyette Exp $");
#include <sys/param.h>
#include <sys/dirent.h>
@@ -200,16 +200,6 @@
return EPASSTHROUGH;
}
-/* Module hook for netbsd32_80_modctl */
-MODULE_CALL_HOOK_DECL(compat32_80_modctl_hook, int,
- (struct lwp *lwp, const struct netbsd32_modctl_args *uap,
- register_t *result));
-MODULE_CALL_HOOK(compat32_80_modctl_hook, int,
- (struct lwp *lwp, const struct netbsd32_modctl_args *uap,
- register_t *result),
- (lwp, uap, result),
- enosys());
-
int
netbsd32_modctl(struct lwp *lwp, const struct netbsd32_modctl_args *uap,
register_t *result)
@@ -229,7 +219,8 @@
arg = SCARG_P32(uap, arg);
- error = compat32_80_modctl_hook_call(lwp, uap, result);
+ MODULE_CALL_HOOK(compat32_80_modctl_hook, (lwp, uap, result),
+ enosys(), error);
if (error != EPASSTHROUGH && error != ENOSYS)
return error;
diff -r 6e5850345feb -r 888bb063fa40 sys/dev/bio.c
--- a/sys/dev/bio.c Mon Jan 21 06:49:27 2019 +0000
+++ b/sys/dev/bio.c Tue Jan 22 07:42:40 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bio.c,v 1.13.16.8 2019/01/18 00:01:01 pgoyette Exp $ */
+/* $NetBSD: bio.c,v 1.13.16.9 2019/01/22 07:42:40 pgoyette Exp $ */
/* $OpenBSD: bio.c,v 1.9 2007/03/20 02:35:55 marco Exp $ */
/*
@@ -28,7 +28,7 @@
/* A device controller ioctl tunnelling device. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bio.c,v 1.13.16.8 2019/01/18 00:01:01 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bio.c,v 1.13.16.9 2019/01/22 07:42:40 pgoyette Exp $");
#include "opt_compat_netbsd.h"
Home |
Main Index |
Thread Index |
Old Index