Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/pgoyette-compat]: src/sys Remove the HOOK2 versions of the MODULE_HOOK m...



details:   https://anonhg.NetBSD.org/src/rev/2bdb08d7eeed
branches:  pgoyette-compat
changeset: 447491:2bdb08d7eeed
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Jan 13 10:49:49 2019 +0000

description:
Remove the HOOK2 versions of the MODULE_HOOK macros.  There were
only a few uses, and using them led to some lack of clarity in the
code.  Instead, we now use two separate hooks, with names that
make it clear(er) what we're doing.

This also positions us to start unraveling some of the rtsock_50
mess, which will need (at least) five hooks.

diffstat:

 sys/arch/amd64/amd64/netbsd32_machdep.c     |  10 +-
 sys/arch/mips/mips/netbsd32_machdep.c       |  10 +-
 sys/arch/sparc/fpu/fpu.c                    |  10 +-
 sys/arch/sparc64/sparc64/netbsd32_machdep.c |  10 +-
 sys/compat/common/if_43.c                   |  22 +++++---
 sys/compat/common/rtsock_14.c               |  17 +++--
 sys/compat/common/rtsock_70.c               |  17 +++--
 sys/compat/common/tty_60.c                  |  17 +++--
 sys/compat/common/usb_subr_30.c             |  17 +++--
 sys/compat/netbsd32/netbsd32_kern_proc.c    |  17 +++--
 sys/compat/netbsd32/netbsd32_module.c       |  10 +-
 sys/dev/bio.c                               |  10 +-
 sys/dev/ccd.c                               |  12 ++--
 sys/dev/clockctl.c                          |  10 +-
 sys/dev/raidframe/rf_netbsdkintf.c          |  16 +++---
 sys/dev/sysmon/sysmon_power.c               |  10 +-
 sys/dev/usb/ugen.c                          |   8 +-
 sys/dev/usb/uhid.c                          |   8 +-
 sys/dev/usb/usb.c                           |  20 +++---
 sys/dev/vnd.c                               |  16 +++---
 sys/dev/wscons/wsevent.c                    |  10 +-
 sys/fs/puffs/puffs_compat.c                 |  17 +++--
 sys/fs/puffs/puffs_msgif.c                  |  16 +++---
 sys/kern/compat_stub.c                      |  25 ++++++---
 sys/kern/kern_proc.c                        |  16 +++---
 sys/kern/kern_rndq.c                        |  16 +++---
 sys/kern/sys_module.c                       |  10 +-
 sys/kern/sysv_ipc.c                         |  10 +-
 sys/kern/tty.c                              |  12 ++--
 sys/kern/tty_ptm.c                          |  10 +-
 sys/kern/uipc_usrreq.c                      |  12 ++--
 sys/kern/vfs_syscalls.c                     |  10 +-
 sys/net/if.c                                |  30 +++++-----
 sys/net/if_spppsubr.c                       |  10 +-
 sys/net/rtsock.c                            |  41 ++++++++-------
 sys/net80211/ieee80211_ioctl.c              |   8 +-
 sys/opencrypto/cryptodev.c                  |  10 +-
 sys/sys/compat_stub.h                       |  36 ++++++++-----
 sys/sys/module_hook.h                       |  75 ++--------------------------
 39 files changed, 310 insertions(+), 331 deletions(-)

diffs (truncated from 2052 to 300 lines):

diff -r 03f08d6c3350 -r 2bdb08d7eeed sys/arch/amd64/amd64/netbsd32_machdep.c
--- a/sys/arch/amd64/amd64/netbsd32_machdep.c   Sun Jan 13 07:05:10 2019 +0000
+++ b/sys/arch/amd64/amd64/netbsd32_machdep.c   Sun Jan 13 10:49:49 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_machdep.c,v 1.115.2.12 2018/12/26 14:01:31 pgoyette Exp $     */
+/*     $NetBSD: netbsd32_machdep.c,v 1.115.2.13 2019/01/13 10:49:49 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.12 2018/12/26 14:01:31 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.115.2.13 2019/01/13 10:49:49 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -275,9 +275,9 @@
 
 struct netbsd32_sendsig_hook_t netbsd32_sendsig_hook;
 
-MODULE_CALL_HOOK_DECL(netbsd32_sendsig_hook, f,
+MODULE_CALL_HOOK_DECL(netbsd32_sendsig_hook,
     (const ksiginfo_t *ksi, const sigset_t *mask));
-MODULE_CALL_HOOK(netbsd32_sendsig_hook, f,
+MODULE_CALL_HOOK(netbsd32_sendsig_hook,
     (const ksiginfo_t *ksi, const sigset_t *mask), (ksi, mask),
     netbsd32_sendsig_siginfo(ksi, mask));
 
@@ -285,7 +285,7 @@
 netbsd32_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
 {
 
-       netbsd32_sendsig_hook_f_call(ksi, mask);
+       netbsd32_sendsig_hook_call(ksi, mask);
 }
 
 #ifdef COREDUMP
diff -r 03f08d6c3350 -r 2bdb08d7eeed sys/arch/mips/mips/netbsd32_machdep.c
--- a/sys/arch/mips/mips/netbsd32_machdep.c     Sun Jan 13 07:05:10 2019 +0000
+++ b/sys/arch/mips/mips/netbsd32_machdep.c     Sun Jan 13 10:49:49 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_machdep.c,v 1.15.2.8 2018/12/26 14:01:40 pgoyette Exp $       */
+/*     $NetBSD: netbsd32_machdep.c,v 1.15.2.9 2019/01/13 10:49:49 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.8 2018/12/26 14:01:40 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.15.2.9 2019/01/13 10:49:49 pgoyette Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_coredump.h"
@@ -309,9 +309,9 @@
 
 struct netbsd32_sendsig_hook_t netbsd32_sendsig_hook;
  
-MODULE_CALL_HOOK_DECL(netbsd32_sendsig_hook, f,
+MODULE_CALL_HOOK_DECL(netbsd32_sendsig_hook,
     (const ksiginfo_t *ksi, const sigset_t *mask));
-MODULE_CALL_HOOK(netbsd32_sendsig_hook, f,
+MODULE_CALL_HOOK(netbsd32_sendsig_hook,
     (const ksiginfo_t *ksi, const sigset_t *mask), (ksi, mask),  
     netbsd32_sendsig_siginfo(ksi, mask));
 
@@ -319,7 +319,7 @@
 netbsd32_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
 {
 
-       netbsd32_sendsig_hook_f_call(ksi, mask);
+       netbsd32_sendsig_hook_call(ksi, mask);
 }
 
 void    
diff -r 03f08d6c3350 -r 2bdb08d7eeed sys/arch/sparc/fpu/fpu.c
--- a/sys/arch/sparc/fpu/fpu.c  Sun Jan 13 07:05:10 2019 +0000
+++ b/sys/arch/sparc/fpu/fpu.c  Sun Jan 13 10:49:49 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu.c,v 1.27.46.1 2018/10/02 01:43:53 pgoyette Exp $ */
+/*     $NetBSD: fpu.c,v 1.27.46.2 2019/01/13 10:49:49 pgoyette Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.27.46.1 2018/10/02 01:43:53 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.27.46.2 2019/01/13 10:49:49 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -122,8 +122,8 @@
 /*
  * HOOK for checking if the lwp's emul matches sunos
  */
-MODULE_CALL_HOOK_DECL(get_emul_sunos_hook, f, (const struct emul **emul));
-MODULE_CALL_HOOK(get_emul_sunos_hook, f, (const struct emul ** emul), (emul),
+MODULE_CALL_HOOK_DECL(get_emul_sunos_hook, (const struct emul **emul));
+MODULE_CALL_HOOK(get_emul_sunos_hook, (const struct emul ** emul), (emul),
     enosys());
 
 /*
@@ -150,7 +150,7 @@
        int code = 0;
        const struct emul *sunos_emul;
 
-       if (get_emul_sunos_hook_f_call(&sunos_emul) == 0 &&
+       if (get_emul_sunos_hook_call(&sunos_emul) == 0 &&
            p->p_emul == sunos_emul)
                fpu_codes = fpu_codes_sunos;
        else
diff -r 03f08d6c3350 -r 2bdb08d7eeed sys/arch/sparc64/sparc64/netbsd32_machdep.c
--- a/sys/arch/sparc64/sparc64/netbsd32_machdep.c       Sun Jan 13 07:05:10 2019 +0000
+++ b/sys/arch/sparc64/sparc64/netbsd32_machdep.c       Sun Jan 13 10:49:49 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_machdep.c,v 1.110.14.1 2018/09/30 00:17:55 pgoyette Exp $     */
+/*     $NetBSD: netbsd32_machdep.c,v 1.110.14.2 2019/01/13 10:49:49 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.1 2018/09/30 00:17:55 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.110.14.2 2019/01/13 10:49:49 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -262,9 +262,9 @@
 
 struct netbsd32_sendsig_hook_t netbsd32_sendsig_hook;
         
-MODULE_CALL_HOOK_DECL(netbsd32_sendsig_hook, f,
+MODULE_CALL_HOOK_DECL(netbsd32_sendsig_hook,
     (const ksiginfo_t *ksi, const sigset_t *mask));  
-MODULE_CALL_HOOK(netbsd32_sendsig_hook, f,
+MODULE_CALL_HOOK(netbsd32_sendsig_hook,
     (const ksiginfo_t *ksi, const sigset_t *mask), (ksi, mask),
     netbsd32_sendsig_siginfo(ksi, mask));
 
@@ -272,7 +272,7 @@
 netbsd32_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
 {
 
-       netbsd32_sendsig_hook_f_call(ksi, mask);
+       netbsd32_sendsig_hook_call(ksi, mask);
 }
 
 #undef DEBUG
diff -r 03f08d6c3350 -r 2bdb08d7eeed sys/compat/common/if_43.c
--- a/sys/compat/common/if_43.c Sun Jan 13 07:05:10 2019 +0000
+++ b/sys/compat/common/if_43.c Sun Jan 13 10:49:49 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_43.c,v 1.14.2.10 2018/10/15 04:33:34 pgoyette Exp $ */
+/*     $NetBSD: if_43.c,v 1.14.2.11 2019/01/13 10:49:49 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.10 2018/10/15 04:33:34 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.14.2.11 2019/01/13 10:49:49 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -84,8 +84,8 @@
  * 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, f, (u_long ncmd));
-MODULE_CALL_HOOK(if43_20_hook, f, (u_long ncmd), (ncmd), enosys());
+MODULE_CALL_HOOK_DECL(if43_20_hook, (u_long ncmd));
+MODULE_CALL_HOOK(if43_20_hook, (u_long ncmd), (ncmd), enosys());
 
 /* 
  * Use a wrapper so that the compat_cvtcmd() can return a u_long
@@ -221,7 +221,7 @@
                case TAPGIFNAME:
                        return ncmd;
                default:
-                       (void)if43_20_hook_f_call(ncmd);
+                       (void)if43_20_hook_call(ncmd);
                        return ncmd;
                }
        }
@@ -298,14 +298,17 @@
        return error;
 }
 
-MODULE_SET_HOOK2(if_43_hook, "if_43", do_compat_cvtcmd, compat_ifioctl);
-MODULE_UNSET_HOOK2(if_43_hook);
+MODULE_SET_HOOK(if_43_cvtcmd_hook, "if_43", do_compat_cvtcmd);
+MODULE_SET_HOOK(if_43_ifioctl_hook, "if_43", compat_ifioctl);
+MODULE_UNSET_HOOK(if_43_cvtcmd_hook);
+MODULE_UNSET_HOOK(if_43_ifioctl_hook);
 
 int
 if_43_init(void)
 {
 
-       if_43_hook_set();
+       if_43_cvtcmd_hook_set();
+       if_43_ifioctl_hook_set();
        return 0;
 }
 
@@ -313,7 +316,8 @@
 if_43_fini(void)
 {
 
-       if_43_hook_unset();
+       if_43_cvtcmd_hook_unset();
+       if_43_ifioctl_hook_unset();
        return 0;
 }
 #endif /* defined(COMPAT_43) */
diff -r 03f08d6c3350 -r 2bdb08d7eeed sys/compat/common/rtsock_14.c
--- a/sys/compat/common/rtsock_14.c     Sun Jan 13 07:05:10 2019 +0000
+++ b/sys/compat/common/rtsock_14.c     Sun Jan 13 10:49:49 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock_14.c,v 1.5.14.4 2018/09/22 04:56:28 pgoyette Exp $      */
+/*     $NetBSD: rtsock_14.c,v 1.5.14.5 2019/01/13 10:49:49 pgoyette Exp $      */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock_14.c,v 1.5.14.4 2018/09/22 04:56:28 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_14.c,v 1.5.14.5 2019/01/13 10:49:49 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -174,20 +174,23 @@
        return 0;
 }
 
-MODULE_SET_HOOK2(rtsock14_hook, "rts_14", compat_14_rt_oifmsg,
-    compat_14_iflist);
-MODULE_UNSET_HOOK2(rtsock14_hook);
+MODULE_SET_HOOK(rtsock_14_oifmsg_hook, "rts_14", compat_14_rt_oifmsg);
+MODULE_SET_HOOK(rtsock_14_iflist_hook, "rts_14", compat_14_iflist);
+MODULE_UNSET_HOOK(rtsock_14_oifmsg_hook);
+MODULE_UNSET_HOOK(rtsock_14_iflist_hook);
 
 void
 rtsock_14_init(void)
 {
 
-       rtsock14_hook_set();
+       rtsock_14_iflist_hook_set();
+       rtsock_14_oifmsg_hook_set();
 }
 
 void
 rtsock_14_fini(void)
 {
 
-       rtsock14_hook_unset();
+       rtsock_14_iflist_hook_unset();
+       rtsock_14_oifmsg_hook_unset();
 }
diff -r 03f08d6c3350 -r 2bdb08d7eeed sys/compat/common/rtsock_70.c
--- a/sys/compat/common/rtsock_70.c     Sun Jan 13 07:05:10 2019 +0000
+++ b/sys/compat/common/rtsock_70.c     Sun Jan 13 10:49:49 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock_70.c,v 1.2.2.2 2018/10/15 04:33:34 pgoyette Exp $       */
+/*     $NetBSD: rtsock_70.c,v 1.2.2.3 2019/01/13 10:49:49 pgoyette Exp $       */
 
 /*
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock_70.c,v 1.2.2.2 2018/10/15 04:33:34 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_70.c,v 1.2.2.3 2019/01/13 10:49:49 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -117,20 +117,23 @@
        return error;
 }
 
-MODULE_SET_HOOK2(rtsock_70_hook, "rts_70", compat_70_rt_newaddrmsg1,
-    compat_70_iflist_addr);
-MODULE_UNSET_HOOK2(rtsock_70_hook);
+MODULE_SET_HOOK(rtsock_70_newaddr_hook, "rts_70", compat_70_rt_newaddrmsg1);
+MODULE_SET_HOOK(rtsock_70_iflist_hook, "rts_70", compat_70_iflist_addr);
+MODULE_UNSET_HOOK(rtsock_70_newaddr_hook);
+MODULE_UNSET_HOOK(rtsock_70_iflist_hook);



Home | Main Index | Thread Index | Old Index