Module Name:    src
Committed By:   pgoyette
Date:           Mon Sep 17 11:04:31 UTC 2018

Modified Files:
        src/sys/compat/common [pgoyette-compat]: bio_30.c clockctl_50.c if_43.c
            if_spppsubr50.c kern_mod_80.c rtsock_14.c sysmon_power_40.c
            vnd_30.c
        src/sys/compat/net [pgoyette-compat]: if.h
        src/sys/dev [pgoyette-compat]: bio.c clockctl.c vnd.c
        src/sys/dev/raidframe [pgoyette-compat]: rf_compat50.c rf_compat80.c
            rf_netbsdkintf.c
        src/sys/dev/sysmon [pgoyette-compat]: sysmon_power.c
        src/sys/dev/wscons [pgoyette-compat]: wsevent.c wsevent_50.c
        src/sys/fs/puffs [pgoyette-compat]: puffs_compat.c puffs_msgif.c
            puffs_sys.h
        src/sys/kern [pgoyette-compat]: compat_stub.c sys_module.c
        src/sys/net [pgoyette-compat]: if_spppsubr.c rtsock.c
        src/sys/opencrypto [pgoyette-compat]: cryptodev.c ocryptodev.c
        src/sys/sys [pgoyette-compat]: compat_stub.h

Log Message:
Adapt (most of) the indirect function pointers to the new MP-safe
mechanism.  Still remaining are the compat_netbsd32 stuff, and
some usb subroutines.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/compat/common/bio_30.c \
    src/sys/compat/common/clockctl_50.c src/sys/compat/common/if_spppsubr50.c \
    src/sys/compat/common/sysmon_power_40.c src/sys/compat/common/vnd_30.c
cvs rdiff -u -r1.14.2.1 -r1.14.2.2 src/sys/compat/common/if_43.c
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/compat/common/kern_mod_80.c
cvs rdiff -u -r1.5.14.1 -r1.5.14.2 src/sys/compat/common/rtsock_14.c
cvs rdiff -u -r1.4 -r1.4.14.1 src/sys/compat/net/if.h
cvs rdiff -u -r1.13.16.1 -r1.13.16.2 src/sys/dev/bio.c
cvs rdiff -u -r1.35.14.1 -r1.35.14.2 src/sys/dev/clockctl.c
cvs rdiff -u -r1.263.2.2 -r1.263.2.3 src/sys/dev/vnd.c
cvs rdiff -u -r1.3.2.2 -r1.3.2.3 src/sys/dev/raidframe/rf_compat50.c
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/dev/raidframe/rf_compat80.c
cvs rdiff -u -r1.356.2.2 -r1.356.2.3 src/sys/dev/raidframe/rf_netbsdkintf.c
cvs rdiff -u -r1.58.2.1 -r1.58.2.2 src/sys/dev/sysmon/sysmon_power.c
cvs rdiff -u -r1.37.2.2 -r1.37.2.3 src/sys/dev/wscons/wsevent.c
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/dev/wscons/wsevent_50.c
cvs rdiff -u -r1.4.16.1 -r1.4.16.2 src/sys/fs/puffs/puffs_compat.c
cvs rdiff -u -r1.101.10.2 -r1.101.10.3 src/sys/fs/puffs/puffs_msgif.c
cvs rdiff -u -r1.90.16.1 -r1.90.16.2 src/sys/fs/puffs/puffs_sys.h
cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/sys/kern/compat_stub.c
cvs rdiff -u -r1.23.2.9 -r1.23.2.10 src/sys/kern/sys_module.c
cvs rdiff -u -r1.179.2.3 -r1.179.2.4 src/sys/net/if_spppsubr.c
cvs rdiff -u -r1.238.2.6 -r1.238.2.7 src/sys/net/rtsock.c
cvs rdiff -u -r1.98.2.1 -r1.98.2.2 src/sys/opencrypto/cryptodev.c
cvs rdiff -u -r1.11.2.1 -r1.11.2.2 src/sys/opencrypto/ocryptodev.c
cvs rdiff -u -r1.1.2.22 -r1.1.2.23 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/compat/common/bio_30.c
diff -u src/sys/compat/common/bio_30.c:1.1.2.1 src/sys/compat/common/bio_30.c:1.1.2.2
--- src/sys/compat/common/bio_30.c:1.1.2.1	Wed Mar 28 04:18:24 2018
+++ src/sys/compat/common/bio_30.c	Mon Sep 17 11:04:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bio_30.c,v 1.1.2.1 2018/03/28 04:18:24 pgoyette Exp $ */
+/*	$NetBSD: bio_30.c,v 1.1.2.2 2018/09/17 11:04:30 pgoyette Exp $ */
 /*	$OpenBSD: bio.c,v 1.9 2007/03/20 02:35:55 marco Exp $	*/
 
 /*
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bio_30.c,v 1.1.2.1 2018/03/28 04:18:24 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bio_30.c,v 1.1.2.2 2018/09/17 11:04:30 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -88,16 +88,19 @@ compat_30_bio(void *cookie, u_long cmd, 
 	}
 }
 
+COMPAT_SET_HOOK(compat_bio_30_hook, "bio_30", compat_30_bio);
+COMPAT_UNSET_HOOK(compat_bio_30_hook);
+
 void
 bio_30_init(void)
 {
 
-	compat_bio_30 = compat_30_bio;
+	compat_bio_30_hook_set();
 }
 
 void
 bio_30_fini(void)
 {
 
-	compat_bio_30 = (void *)enosys;
+	compat_bio_30_hook_unset();
 }
Index: src/sys/compat/common/clockctl_50.c
diff -u src/sys/compat/common/clockctl_50.c:1.1.2.1 src/sys/compat/common/clockctl_50.c:1.1.2.2
--- src/sys/compat/common/clockctl_50.c:1.1.2.1	Wed Mar 21 04:48:31 2018
+++ src/sys/compat/common/clockctl_50.c	Mon Sep 17 11:04:30 2018
@@ -1,4 +1,4 @@
-/*      $NetBSD: clockctl_50.c,v 1.1.2.1 2018/03/21 04:48:31 pgoyette Exp $ */
+/*      $NetBSD: clockctl_50.c,v 1.1.2.2 2018/09/17 11:04:30 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clockctl_50.c,v 1.1.2.1 2018/03/21 04:48:31 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clockctl_50.c,v 1.1.2.2 2018/09/17 11:04:30 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -122,16 +122,19 @@ compat50_clockctlioctl(dev_t dev, u_long
 	return (error);
 }
 
+COMPAT_SET_HOOK(clockctl_ioctl_50_hook, "clk_50", compat50_clockctlioctl);
+COMPAT_UNSET_HOOK(clockctl_ioctl_50_hook);
+
 void
 clockctl_50_init(void)
 {
 
-	compat_clockctl_ioctl_50 = compat50_clockctlioctl;
+	clockctl_ioctl_50_hook_set();
 }
 
 void
 clockctl_50_fini(void)
 {
 
-	compat_clockctl_ioctl_50 = (void *)enosys;
+	clockctl_ioctl_50_hook_unset();
 }
Index: src/sys/compat/common/if_spppsubr50.c
diff -u src/sys/compat/common/if_spppsubr50.c:1.1.2.1 src/sys/compat/common/if_spppsubr50.c:1.1.2.2
--- src/sys/compat/common/if_spppsubr50.c:1.1.2.1	Wed Mar 21 10:12:48 2018
+++ src/sys/compat/common/if_spppsubr50.c	Mon Sep 17 11:04:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr50.c,v 1.1.2.1 2018/03/21 10:12:48 pgoyette Exp $	 */
+/*	$NetBSD: if_spppsubr50.c,v 1.1.2.2 2018/09/17 11:04:30 pgoyette Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr50.c,v 1.1.2.1 2018/03/21 10:12:48 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr50.c,v 1.1.2.2 2018/09/17 11:04:30 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -154,16 +154,19 @@ sppp_compat50_params(struct sppp *sp, u_
 	return 0;
 }
 
+COMPAT_SET_HOOK(sppp_params_50_hook, "sppp60", sppp_compat50_params);
+COMPAT_UNSET_HOOK(sppp_params_50_hook);
+
 void
 if_spppsubr_50_init(void)
 {
 
-	sppp_params50 = sppp_compat50_params;
+	sppp_params_50_hook_set();
 }
 
 void
 if_spppsubr_50_fini(void)
 {
 
-	sppp_params50 = (void *)enosys;
+	sppp_params_50_hook_unset();
 }
Index: src/sys/compat/common/sysmon_power_40.c
diff -u src/sys/compat/common/sysmon_power_40.c:1.1.2.1 src/sys/compat/common/sysmon_power_40.c:1.1.2.2
--- src/sys/compat/common/sysmon_power_40.c:1.1.2.1	Tue Mar 27 07:29:44 2018
+++ src/sys/compat/common/sysmon_power_40.c	Mon Sep 17 11:04:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_power_40.c,v 1.1.2.1 2018/03/27 07:29:44 pgoyette Exp $	*/
+/*	$NetBSD: sysmon_power_40.c,v 1.1.2.2 2018/09/17 11:04:30 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2007 Juan Romero Pardines.
@@ -62,7 +62,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysmon_power_40.c,v 1.1.2.1 2018/03/27 07:29:44 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_power_40.c,v 1.1.2.2 2018/09/17 11:04:30 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -73,7 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: sysmon_power
 
 #include <compat/common/compat_mod.h>
 
-static void
+static int
 compat_40_sysmon_power(power_event_t *pev, struct sysmon_pswitch *pswitch,
     int event)
 {
@@ -86,18 +86,22 @@ compat_40_sysmon_power(power_event_t *pe
 			          pswitch->smpsw_name,
 			          sizeof(pev->pev_switch.psws_name));
 		}
+	return 0;
 }
 
+COMPAT_SET_HOOK(compat_sysmon_power_40_hook, "smon60", compat_40_sysmon_power);
+COMPAT_UNSET_HOOK(compat_sysmon_power_40_hook);
+ 
 void
 sysmon_power_40_init(void)
 {
 
-	compat_sysmon_power_40 = compat_40_sysmon_power;
+	compat_sysmon_power_40_hook_set();
 }
 
 void
 sysmon_power_40_fini(void)
 {
 
-	compat_sysmon_power_40 = (void *)voidop;
+	compat_sysmon_power_40_hook_unset();
 }
Index: src/sys/compat/common/vnd_30.c
diff -u src/sys/compat/common/vnd_30.c:1.1.2.1 src/sys/compat/common/vnd_30.c:1.1.2.2
--- src/sys/compat/common/vnd_30.c:1.1.2.1	Wed Mar 28 07:51:09 2018
+++ src/sys/compat/common/vnd_30.c	Mon Sep 17 11:04:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd_30.c,v 1.1.2.1 2018/03/28 07:51:09 pgoyette Exp $	*/
+/*	$NetBSD: vnd_30.c,v 1.1.2.2 2018/09/17 11:04:30 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd_30.c,v 1.1.2.1 2018/03/28 07:51:09 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd_30.c,v 1.1.2.2 2018/09/17 11:04:30 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -104,7 +104,7 @@ compat_30_vndioctl(u_long cmd, struct lw
 	int error;
 
 	if (cmd != VNDIOCGET30)
-		return ENOSYS;
+		return EPASSTHROUGH;
 
 	error = (*get)(l, data, unit, vattr_p);
 	if (error != 0)
@@ -115,16 +115,19 @@ compat_30_vndioctl(u_long cmd, struct lw
 	return 0;
 }
 
+COMPAT_SET_HOOK(compat_vndioctl_30_hook, "vnd_30", compat_30_vndioctl);
+COMPAT_UNSET_HOOK(compat_vndioctl_30_hook);
+
 void
 vnd_30_init(void)
 {
 
-	compat_vndioctl_30 = compat_30_vndioctl;
+	compat_vndioctl_30_hook_set();
 }
 
 void
 vnd_30_fini(void)
 {
 
-	compat_vndioctl_30 = (void *)enosys;
+	compat_vndioctl_30_hook_unset();
 }

Index: src/sys/compat/common/if_43.c
diff -u src/sys/compat/common/if_43.c:1.14.2.1 src/sys/compat/common/if_43.c:1.14.2.2
--- src/sys/compat/common/if_43.c:1.14.2.1	Fri Mar 30 02:28:49 2018
+++ src/sys/compat/common/if_43.c	Mon Sep 17 11:04:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_43.c,v 1.14.2.1 2018/03/30 02:28:49 pgoyette Exp $	*/
+/*	$NetBSD: if_43.c,v 1.14.2.2 2018/09/17 11:04:30 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.1 2018/03/30 02:28:49 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.14.2.2 2018/09/17 11:04:30 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -77,6 +77,9 @@ __KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.
 #include <compat/common/if_43.h>
 #include <uvm/uvm_extern.h>
 
+/* COMPAT_HOOK for replacing the cmdcvt() function */
+COMPAT_CALL_HOOK(ieee80211_get_ostats_20_hook, f, (int cmd), (cmd), cmd);
+
 u_long 
 compat_cvtcmd(u_long cmd)
 { 
@@ -202,10 +205,7 @@ compat_cvtcmd(u_long cmd)
 		case TAPGIFNAME:
 			return ncmd;
 		default:
-			if ((*if43_20_cvtcmd)(ncmd) == 0)
-				return ncmd;
-			else
-				return cmd;
+			return ieee80211_get_ostats_20_hook_f_call(ncmd);
 		}
 	}
 }

Index: src/sys/compat/common/kern_mod_80.c
diff -u src/sys/compat/common/kern_mod_80.c:1.1.2.4 src/sys/compat/common/kern_mod_80.c:1.1.2.5
--- src/sys/compat/common/kern_mod_80.c:1.1.2.4	Fri Sep  7 23:32:30 2018
+++ src/sys/compat/common/kern_mod_80.c	Mon Sep 17 11:04:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_mod_80.c,v 1.1.2.4 2018/09/07 23:32:30 pgoyette Exp $	*/
+/*	$NetBSD: kern_mod_80.c,v 1.1.2.5 2018/09/17 11:04:30 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_mod_80.c,v 1.1.2.4 2018/09/07 23:32:30 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_mod_80.c,v 1.1.2.5 2018/09/17 11:04:30 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_modular.h"
@@ -151,16 +151,19 @@ compat_80_modstat(int cmd, struct iovec 
 	return error;
 }
 
+COMPAT_SET_HOOK(compat_modstat_80_hook, "mod_80",compat_80_modstat);
+COMPAT_UNSET_HOOK(compat_modstat_80_hook);
+
 void
 kern_mod_80_init(void)
 {
 
-	compat_modstat_80 = compat_80_modstat;
+	compat_modstat_80_hook_set();
 }
 
 void
 kern_mod_80_fini(void)
 {
 
-	compat_modstat_80 = (void *)enosys;
+	compat_modstat_80_hook_unset();
 }

Index: src/sys/compat/common/rtsock_14.c
diff -u src/sys/compat/common/rtsock_14.c:1.5.14.1 src/sys/compat/common/rtsock_14.c:1.5.14.2
--- src/sys/compat/common/rtsock_14.c:1.5.14.1	Fri Mar 30 10:09:07 2018
+++ src/sys/compat/common/rtsock_14.c	Mon Sep 17 11:04:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock_14.c,v 1.5.14.1 2018/03/30 10:09:07 pgoyette Exp $	*/
+/*	$NetBSD: rtsock_14.c,v 1.5.14.2 2018/09/17 11:04:30 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.1 2018/03/30 10:09:07 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_14.c,v 1.5.14.2 2018/09/17 11:04:30 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -91,7 +91,7 @@ __KERNEL_RCSID(0, "$NetBSD: rtsock_14.c,
 
 #include <compat/common/compat_mod.h>
 
-void
+int
 compat_14_rt_oifmsg(struct ifnet *ifp)
 {
 	struct if_msghdr14 oifm;
@@ -100,7 +100,7 @@ compat_14_rt_oifmsg(struct ifnet *ifp)
 	struct timeval tv;
 
 	if (compat_50_route_info.ri_cb.any_count == 0)
-		return;
+		return 0;
 	(void)memset(&info, 0, sizeof(info));
 	(void)memset(&oifm, 0, sizeof(oifm));
 	oifm.ifm_index = ifp->if_index;
@@ -127,8 +127,9 @@ compat_14_rt_oifmsg(struct ifnet *ifp)
 	oifm.ifm_addrs = 0;
 	m = compat_50_rt_msg1(RTM_OOIFINFO, &info, (void *)&oifm, sizeof(oifm));
 	if (m == NULL)
-		return;
+		return 0;
 	compat_50_route_enqueue(m, 0);
+	return 0;
 }
 
 int
@@ -169,18 +170,20 @@ compat_14_iflist(struct ifnet *ifp, stru
 	return 0;
 }
 
+COMPAT_SET_HOOK2(rtsock14_hook, "rts_14", compat_14_rt_oifmsg,
+    compat_14_iflist);
+COMPAT_UNSET_HOOK2(rtsock14_hook);
+
 void
 rtsock_14_init(void)
 {
 
-	rtsock14_oifmsg = compat_14_rt_oifmsg;
-	rtsock14_iflist = compat_14_iflist;
+	rtsock14_hook_set();
 }
 
 void
 rtsock_14_fini(void)
 {
 
-	rtsock14_oifmsg = (void *)voidop;
-	rtsock14_iflist = (void *)enosys;
+	rtsock14_hook_unset();
 }

Index: src/sys/compat/net/if.h
diff -u src/sys/compat/net/if.h:1.4 src/sys/compat/net/if.h:1.4.14.1
--- src/sys/compat/net/if.h:1.4	Wed Sep 21 10:50:23 2016
+++ src/sys/compat/net/if.h	Mon Sep 17 11:04:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.4 2016/09/21 10:50:23 roy Exp $	*/
+/*	$NetBSD: if.h,v 1.4.14.1 2018/09/17 11:04:30 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -107,7 +107,7 @@ struct if_msghdr14 {
 	struct	if_data14 ifm_data; /* statistics and other data about if */
 };
 
-void compat_14_rt_oifmsg(struct ifnet *);
+int compat_14_rt_oifmsg(struct ifnet *);
 int compat_14_iflist(struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *,
     size_t);
 

Index: src/sys/dev/bio.c
diff -u src/sys/dev/bio.c:1.13.16.1 src/sys/dev/bio.c:1.13.16.2
--- src/sys/dev/bio.c:1.13.16.1	Wed Mar 28 04:18:24 2018
+++ src/sys/dev/bio.c	Mon Sep 17 11:04:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bio.c,v 1.13.16.1 2018/03/28 04:18:24 pgoyette Exp $ */
+/*	$NetBSD: bio.c,v 1.13.16.2 2018/09/17 11:04:30 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.1 2018/03/28 04:18:24 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bio.c,v 1.13.16.2 2018/09/17 11:04:30 pgoyette Exp $");
 
 #include "opt_compat_netbsd.h"
 
@@ -114,6 +114,11 @@ bioclose(dev_t dev, int flags, int mode,
 	return 0;
 }
 
+/* Hook up the compat_bio_30 routine */
+COMPAT_CALL_HOOK(compat_bio_30_hook, f,
+    (void * cookie, u_long cmd, void *addr, int(*ff)(void *, u_long, void *)),
+    (cookie, cmd, addr, ff), enosys());
+
 static int
 bioioctl(dev_t dev, u_long cmd, void *addr, int flag, struct  lwp *l)
 {
@@ -189,7 +194,7 @@ bioioctl(dev_t dev, u_long cmd, void *ad
 			return ENOENT;
 		}
 		mutex_exit(&bio_lock);
-		error = (*compat_bio_30)(common->bc_cookie, cmd, addr,
+		error = compat_bio_30_hook_f_call(common->bc_cookie, cmd, addr,
 		    bio_delegate_ioctl);
 		if (error == ENOSYS)
 			error = bio_delegate_ioctl(common->bc_cookie, cmd,

Index: src/sys/dev/clockctl.c
diff -u src/sys/dev/clockctl.c:1.35.14.1 src/sys/dev/clockctl.c:1.35.14.2
--- src/sys/dev/clockctl.c:1.35.14.1	Wed Mar 21 04:48:32 2018
+++ src/sys/dev/clockctl.c	Mon Sep 17 11:04:30 2018
@@ -1,4 +1,4 @@
-/*      $NetBSD: clockctl.c,v 1.35.14.1 2018/03/21 04:48:32 pgoyette Exp $ */
+/*      $NetBSD: clockctl.c,v 1.35.14.2 2018/09/17 11:04:30 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.35.14.1 2018/03/21 04:48:32 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.35.14.2 2018/09/17 11:04:30 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ntp.h"
@@ -46,9 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: clockctl.c,v
 #include <sys/device.h>
 #include <sys/time.h>
 #include <sys/conf.h>
-#ifdef NTP
 #include <sys/timex.h>
-#endif /* NTP */
 #include <sys/kauth.h>
 #include <sys/module.h>
 #include <sys/mutex.h>
@@ -202,6 +200,11 @@ clockctl_modcmd(modcmd_t cmd, void *data
 	return error;
 }
 
+/* Hook the compat_50 stuff */
+COMPAT_CALL_HOOK(clockctl_ioctl_50_hook, f,
+    (dev_t dev, u_long cmd, void *data, int flags, struct lwp *l),
+    (dev, cmd, data, flags, l), enosys());
+
 int
 clockctlioctl(
     dev_t dev,
@@ -245,11 +248,14 @@ clockctlioctl(
 		error = clock_settime1(l->l_proc, args->clock_id, &ts, false);
 		break;
 	}
-#ifdef NTP
 	case CLOCKCTL_NTP_ADJTIME: {
 		struct clockctl_ntp_adjtime *args = data;
 		struct timex ntv;
 
+		if (vec_ntp_timestatus == NULL) {
+			error = ENOTTY;
+			break;
+		}
 		error = copyin(args->tp, &ntv, sizeof(ntv));
 		if (error)
 			return (error);
@@ -261,9 +267,8 @@ clockctlioctl(
 			args->retval = ntp_timestatus();
 		break;
 	}
-#endif /* NTP */
 	default:
-		error = (*compat_clockctl_ioctl_50)(dev, cmd, data, flags, l);
+		error = clockctl_ioctl_50_hook_f_call(dev, cmd, data, flags, l);
 		if (error == ENOSYS)
 			error = ENOTTY;
 	}

Index: src/sys/dev/vnd.c
diff -u src/sys/dev/vnd.c:1.263.2.2 src/sys/dev/vnd.c:1.263.2.3
--- src/sys/dev/vnd.c:1.263.2.2	Thu Sep  6 06:55:48 2018
+++ src/sys/dev/vnd.c	Mon Sep 17 11:04:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.263.2.2 2018/09/06 06:55:48 pgoyette Exp $	*/
+/*	$NetBSD: vnd.c,v 1.263.2.3 2018/09/17 11:04:30 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.263.2.2 2018/09/06 06:55:48 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.263.2.3 2018/09/17 11:04:30 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -1111,6 +1111,12 @@ vndioctl_get(struct lwp *l, void *data, 
 	}
 }
 
+COMPAT_CALL_HOOK(compat_vndioctl_30_hook, f,
+    (u_long cmd, struct lwp *l, void *data, int unit, struct vattr *vattr,
+     int (*ff)(struct lwp *, void *, int, struct vattr *)),
+    (cmd, l, data, unit, vattr, ff),
+    enosys());
+
 /* ARGSUSED */
 static int
 vndioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
@@ -1158,13 +1164,13 @@ vndioctl(dev_t dev, u_long cmd, void *da
 		return 0;
 	}
 	default:
-		error = (*compat_vndioctl_30)(cmd, l, data, unit, &vattr,
-		    vndioctl_get);
-		if (error == ENOSYS) {
-			error = 0;
-			break;
+		error = compat_vndioctl_30_hook_f_call(cmd, l, data, unit,
+		    &vattr, vndioctl_get);
+		if (error == ENOSYS)
+			error = EINVAL;
+		if (error != EPASSTHROUGH) {
+			return error;
 		}
-		return error;
 	}
 
 	vnd = device_lookup_private(&vnd_cd, unit);

Index: src/sys/dev/raidframe/rf_compat50.c
diff -u src/sys/dev/raidframe/rf_compat50.c:1.3.2.2 src/sys/dev/raidframe/rf_compat50.c:1.3.2.3
--- src/sys/dev/raidframe/rf_compat50.c:1.3.2.2	Sat Mar 24 08:23:20 2018
+++ src/sys/dev/raidframe/rf_compat50.c	Mon Sep 17 11:04:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_compat50.c,v 1.3.2.2 2018/03/24 08:23:20 pgoyette Exp $	*/
+/*	$NetBSD: rf_compat50.c,v 1.3.2.3 2018/09/17 11:04:30 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -239,16 +239,19 @@ raidframe_ioctl_50(int cmd, int initted,
 	return EPASSTHROUGH;
 }
 
+COMPAT_SET_HOOK(raidframe50_ioctl_hook, "raid50", raidframe_ioctl_50);
+COMPAT_UNSET_HOOK(raidframe50_ioctl_hook)
+
 void
 raidframe_50_init(void)
 {
 
-	raidframe50_ioctl = raidframe_ioctl_50;
+	raidframe50_ioctl_hook_set();
 }
 
 void
 raidframe_50_fini(void)
 {
 
-	raidframe50_ioctl = (void *)enosys;
+	raidframe50_ioctl_hook_unset();
 }

Index: src/sys/dev/raidframe/rf_compat80.c
diff -u src/sys/dev/raidframe/rf_compat80.c:1.2.2.2 src/sys/dev/raidframe/rf_compat80.c:1.2.2.3
--- src/sys/dev/raidframe/rf_compat80.c:1.2.2.2	Sat Mar 24 08:22:44 2018
+++ src/sys/dev/raidframe/rf_compat80.c	Mon Sep 17 11:04:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_compat80.c,v 1.2.2.2 2018/03/24 08:22:44 pgoyette Exp $	*/
+/*	$NetBSD: rf_compat80.c,v 1.2.2.3 2018/09/17 11:04:30 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2017 Matthew R. Green
@@ -264,17 +264,20 @@ int error;
 	return EPASSTHROUGH;
 }
  
-void  
-raidframe_80_init(void)
-{ 
+COMPAT_SET_HOOK(raidframe80_ioctl_hook, "raid80", raidframe_ioctl_80);
+COMPAT_UNSET_HOOK(raidframe80_ioctl_hook)
  
-	raidframe80_ioctl = raidframe_ioctl_80;
+void
+raidframe_80_init(void)
+{
+  
+        raidframe80_ioctl_hook_set();
 }
  
 void
 raidframe_80_fini(void)
 {
  
-	raidframe80_ioctl = (void *)enosys;
+        raidframe80_ioctl_hook_unset();
 }
 

Index: src/sys/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.356.2.2 src/sys/dev/raidframe/rf_netbsdkintf.c:1.356.2.3
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.356.2.2	Sun Sep  9 22:12:16 2018
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Mon Sep 17 11:04:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.356.2.2 2018/09/09 22:12:16 pgoyette Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.356.2.3 2018/09/17 11:04:30 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***********************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.356.2.2 2018/09/09 22:12:16 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.356.2.3 2018/09/17 11:04:30 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1037,6 +1037,18 @@ raid_detach_unlocked(struct raid_softc *
 	return 0;
 }
 
+/* Hooks to call the 5.0 and 8.0 ioctl compat code */
+COMPAT_CALL_HOOK(raidframe50_ioctl_hook, f,
+    (int cmd, int initted, RF_Raid_t *raidPtr, int unit, void *data,
+     RF_Config_t **k_cfg),
+    (cmd, initted, raidPtr, unit, data, k_cfg),
+    enosys());
+COMPAT_CALL_HOOK(raidframe80_ioctl_hook, f,
+    (int cmd, int initted, RF_Raid_t *raidPtr, int unit, void *data,
+     RF_Config_t **k_cfg),
+    (cmd, initted, raidPtr, unit, data, k_cfg),
+    enosys());
+
 static int
 raidioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
 {
@@ -1120,8 +1132,8 @@ raidioctl(dev_t dev, u_long cmd, void *d
 	 * * If compat code returns EAGAIN, we need to finish via config
 	 * * Otherwise the cmd has been handled and we just return
 	 */
-	retcode = (*raidframe50_ioctl)(cmd, (rs->sc_flags & RAIDF_INITED),
-	    raidPtr, unit, data, &k_cfg);
+	retcode = raidframe50_ioctl_hook_f_call(cmd,
+	    (rs->sc_flags & RAIDF_INITED), raidPtr, unit, data, &k_cfg);
 	if (retcode == ENOSYS)
 		retcode = 0;
 	else if (retcode == EAGAIN)
@@ -1129,8 +1141,8 @@ raidioctl(dev_t dev, u_long cmd, void *d
 	else if (retcode != EPASSTHROUGH)
 		return retcode;
 
-	retcode = (*raidframe80_ioctl)(cmd, (rs->sc_flags & RAIDF_INITED),
-	    raidPtr, unit, data, &k_cfg);
+	retcode = raidframe80_ioctl_hook_f_call(cmd,
+	    (rs->sc_flags & RAIDF_INITED), raidPtr, unit, data, &k_cfg);
 	if (retcode == ENOSYS)
 		retcode = 0;
 	else if (retcode == EAGAIN)

Index: src/sys/dev/sysmon/sysmon_power.c
diff -u src/sys/dev/sysmon/sysmon_power.c:1.58.2.1 src/sys/dev/sysmon/sysmon_power.c:1.58.2.2
--- src/sys/dev/sysmon/sysmon_power.c:1.58.2.1	Tue Mar 27 07:29:44 2018
+++ src/sys/dev/sysmon/sysmon_power.c	Mon Sep 17 11:04:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_power.c,v 1.58.2.1 2018/03/27 07:29:44 pgoyette Exp $	*/
+/*	$NetBSD: sysmon_power.c,v 1.58.2.2 2018/09/17 11:04:31 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2007 Juan Romero Pardines.
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysmon_power.c,v 1.58.2.1 2018/03/27 07:29:44 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_power.c,v 1.58.2.2 2018/09/17 11:04:31 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -316,6 +316,13 @@ sysmon_power_event_queue_flush(void)
 }
 
 /*
+ * Call the compat hook function
+ */
+COMPAT_CALL_HOOK(compat_sysmon_power_40_hook, f,
+    (power_event_t *pev, struct sysmon_pswitch *pswitch, int event),
+    (pev, pswitch, event), enosys());
+
+/*
  * sysmon_power_daemon_task:
  *
  *	Assign required power event members and sends a signal
@@ -346,7 +353,7 @@ sysmon_power_daemon_task(struct power_ev
 
 		pev.pev_type = POWER_EVENT_SWITCH_STATE_CHANGE;
 
-		(*compat_sysmon_power_40)(&pev, pswitch, event);
+		(void)compat_sysmon_power_40_hook_f_call(&pev, pswitch, event);
 
 		error = sysmon_power_make_dictionary(ped->dict,
 						     pswitch,

Index: src/sys/dev/wscons/wsevent.c
diff -u src/sys/dev/wscons/wsevent.c:1.37.2.2 src/sys/dev/wscons/wsevent.c:1.37.2.3
--- src/sys/dev/wscons/wsevent.c:1.37.2.2	Mon Jun 25 07:26:03 2018
+++ src/sys/dev/wscons/wsevent.c	Mon Sep 17 11:04:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: wsevent.c,v 1.37.2.2 2018/06/25 07:26:03 pgoyette Exp $ */
+/* $NetBSD: wsevent.c,v 1.37.2.3 2018/09/17 11:04:31 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2006, 2008 The NetBSD Foundation, Inc.
@@ -104,7 +104,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.37.2.2 2018/06/25 07:26:03 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.37.2.3 2018/09/17 11:04:31 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -189,6 +189,10 @@ wsevent_fini(struct wseventvar *ev)
 	softint_disestablish(ev->sih);
 }
 
+COMPAT_CALL_HOOK(wsevent_50_copyout_events_hook, f,
+    (const struct wscons_event *events, int cnt, struct uio *uio),
+    (events, cnt, uio), enosys());
+
 static int
 wsevent_copyout_events(const struct wscons_event *events, int cnt,
     struct uio *uio, int ver)
@@ -197,7 +201,7 @@ wsevent_copyout_events(const struct wsco
 
 	switch (ver) {
 	case 0:
-		error = (*wsevent_50_copyout_events)(events, cnt, uio);
+		error = wsevent_50_copyout_events_hook_f_call(events, cnt, uio);
 		if (error == ENOSYS)
 			error = EINVAL;
 		return error;

Index: src/sys/dev/wscons/wsevent_50.c
diff -u src/sys/dev/wscons/wsevent_50.c:1.1.2.3 src/sys/dev/wscons/wsevent_50.c:1.1.2.4
--- src/sys/dev/wscons/wsevent_50.c:1.1.2.3	Thu Jun 14 10:36:01 2018
+++ src/sys/dev/wscons/wsevent_50.c	Mon Sep 17 11:04:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: wsevent_50.c,v 1.1.2.3 2018/06/14 10:36:01 pgoyette Exp $ */
+/* $NetBSD: wsevent_50.c,v 1.1.2.4 2018/09/17 11:04:31 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2006, 2008 The NetBSD Foundation, Inc.
@@ -104,7 +104,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsevent_50.c,v 1.1.2.3 2018/06/14 10:36:01 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsevent_50.c,v 1.1.2.4 2018/09/17 11:04:31 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -144,16 +144,20 @@ wsevent_copyout_events50(const struct ws
 	return 0;
 }
 
+COMPAT_SET_HOOK(wsevent_50_copyout_events_hook, "wsc_50",
+    wsevent_copyout_events50);
+COMPAT_UNSET_HOOK(wsevent_50_copyout_events_hook);
+
 void
 wsevent_50_init(void)
 {
 
-	wsevent_50_copyout_events = wsevent_copyout_events50;
+	wsevent_50_copyout_events_hook_set();
 }
 
 void
 wsevent_50_fini(void)
 {
 
-	wsevent_50_copyout_events = (void *)enosys;
+	wsevent_50_copyout_events_hook_unset();
 }

Index: src/sys/fs/puffs/puffs_compat.c
diff -u src/sys/fs/puffs/puffs_compat.c:1.4.16.1 src/sys/fs/puffs/puffs_compat.c:1.4.16.2
--- src/sys/fs/puffs/puffs_compat.c:1.4.16.1	Sat Mar 24 08:24:40 2018
+++ src/sys/fs/puffs/puffs_compat.c	Mon Sep 17 11:04:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_compat.c,v 1.4.16.1 2018/03/24 08:24:40 pgoyette Exp $	*/
+/*	$NetBSD: puffs_compat.c,v 1.4.16.2 2018/09/17 11:04:31 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_compat.c,v 1.4.16.1 2018/03/24 08:24:40 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_compat.c,v 1.4.16.2 2018/09/17 11:04:31 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -343,7 +343,7 @@ puffs_compat_outgoing(struct puffs_req *
 #define ASSIGN(field)							\
 	omsg->field = cmsg->field;
 
-void
+int
 puffs_compat_incoming(struct puffs_req *preq, struct puffs_req *creq)
 {
 
@@ -434,18 +434,21 @@ puffs_compat_incoming(struct puffs_req *
 			panic("puffs compat ops come in pairs");
 		}
 	}
+	return 0;
 }
 
+COMPAT_SET_HOOK2(puffs50_compat_hook, "pffs50", puffs_compat_outgoing,
+    puffs_compat_incoming);
+COMPAT_UNSET_HOOK2(puffs50_compat_hook);
+
 void puffs_50_init(void)
 {
 
-	puffs50_compat_outgoing = puffs_compat_outgoing;
-	puffs50_compat_incoming = puffs_compat_incoming;
+	puffs50_compat_hook_set();
 }
 
 void puffs_50_fini(void)
 {
 
-	puffs50_compat_outgoing = (void *)enosys;
-	puffs50_compat_incoming = (void *)voidop;
+	puffs50_compat_hook_unset();
 }

Index: src/sys/fs/puffs/puffs_msgif.c
diff -u src/sys/fs/puffs/puffs_msgif.c:1.101.10.2 src/sys/fs/puffs/puffs_msgif.c:1.101.10.3
--- src/sys/fs/puffs/puffs_msgif.c:1.101.10.2	Sat Mar 24 10:46:13 2018
+++ src/sys/fs/puffs/puffs_msgif.c	Mon Sep 17 11:04:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_msgif.c,v 1.101.10.2 2018/03/24 10:46:13 pgoyette Exp $	*/
+/*	$NetBSD: puffs_msgif.c,v 1.101.10.3 2018/09/17 11:04:31 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_msgif.c,v 1.101.10.2 2018/03/24 10:46:13 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_msgif.c,v 1.101.10.3 2018/09/17 11:04:31 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -323,6 +323,17 @@ puffs_getmsgid(struct puffs_mount *pmp)
 	return rv;
 }
 
+/* Routines to call the compat hooks */
+	/* Out-going */
+COMPAT_CALL_HOOK(puffs50_compat_hook, f1,
+     (struct puffs_req *oreq, struct puffs_req **creqp, ssize_t *deltap),
+     (oreq, creqp, deltap), enosys());
+
+	/* Incoming */
+COMPAT_CALL_HOOK(puffs50_compat_hook, f2,
+     (struct puffs_req *oreq, struct puffs_req *creqp),
+     (oreq, creqp), enosys());
+
 /*
  * A word about reference counting of parks.  A reference must be taken
  * when accessing a park and additionally when it is on a queue.  So
@@ -350,7 +361,7 @@ puffs_msg_enqueue(struct puffs_mount *pm
 #if 1
 	/* check if we do compat adjustments */
 	if (pmp->pmp_docompat &&
-	    (*puffs50_compat_outgoing)(preq, &creq, &delta) == 0) {
+	    puffs50_compat_hook_f1_call(preq, &creq, &delta) == 0) {
 		park->park_creq = park->park_preq;
 		park->park_creqlen = park->park_maxlen;
 
@@ -807,7 +818,8 @@ puffsop_msg(void *ctx, struct puffs_req 
 			size_t csize;
 
 			KASSERT(pmp->pmp_docompat);
-			(*puffs50_compat_incoming)(preq, park->park_creq);
+			(void)puffs50_compat_hook_f2_call(preq,
+			    park->park_creq);
 			creq = park->park_creq;
 			csize = park->park_creqlen;
 			park->park_creq = park->park_preq;

Index: src/sys/fs/puffs/puffs_sys.h
diff -u src/sys/fs/puffs/puffs_sys.h:1.90.16.1 src/sys/fs/puffs/puffs_sys.h:1.90.16.2
--- src/sys/fs/puffs/puffs_sys.h:1.90.16.1	Sat Mar 24 08:24:40 2018
+++ src/sys/fs/puffs/puffs_sys.h	Mon Sep 17 11:04:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_sys.h,v 1.90.16.1 2018/03/24 08:24:40 pgoyette Exp $	*/
+/*	$NetBSD: puffs_sys.h,v 1.90.16.2 2018/09/17 11:04:31 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006  Antti Kantee.  All Rights Reserved.
@@ -291,7 +291,7 @@ void	puffs_senderr(struct puffs_mount *,
 		      puffs_cookie_t);
 
 int	puffs_compat_outgoing(struct puffs_req *, struct puffs_req**, ssize_t*);
-void	puffs_compat_incoming(struct puffs_req *, struct puffs_req *);
+int	puffs_compat_incoming(struct puffs_req *, struct puffs_req *);
 
 void	puffs_updatenode(struct puffs_node *, int, voff_t);
 #define PUFFS_UPDATEATIME	0x01

Index: src/sys/kern/compat_stub.c
diff -u src/sys/kern/compat_stub.c:1.1.2.17 src/sys/kern/compat_stub.c:1.1.2.18
--- src/sys/kern/compat_stub.c:1.1.2.17	Sun Sep 16 04:57:22 2018
+++ src/sys/kern/compat_stub.c	Mon Sep 17 11:04:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.1.2.17 2018/09/16 04:57:22 pgoyette Exp $	*/
+/* $NetBSD: compat_stub.c,v 1.1.2.18 2018/09/17 11:04:31 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 
 #ifdef _KERNEL_OPT
 #include "opt_ntp.h"
-#include "usb.h"
+#include "usb.h"	/* XXX No other way to determine if USB is present */
 #endif
 
 #include <sys/systm.h>
@@ -46,6 +46,8 @@
 
 /*
  * Routine vectors for compat_50___sys_ntp_gettime
+ *
+ * MP-hooks not needed since the NTP code is not modular
  */
 
 #ifdef NTP
@@ -62,6 +64,28 @@ int (*vec_ntp_timestatus)(void) = NULL;
 #endif
 
 /*
+ * usb device_info compatability
+ *
+ * MP-hooks not needed since the USB code is not modular
+ */
+int (*usbd30_fill_deviceinfo_old)(struct usbd_device *,
+    struct usb_device_info_old *, int) = (void *)enosys;
+
+int (*usb30_copy_to_old)(struct usb_event *, struct usb_event_old *,
+    struct uio *) = (void *)enosys;
+
+#if NUSB > 0
+void (*vec_usbd_devinfo_vp)(struct usbd_device *, char *, size_t, char *,
+    size_t, int, int) = usbd_devinfo_vp;
+int (*vec_usbd_printBCD)(char *cp, size_t l, int bcd) = usbd_printBCD;
+
+#else
+void (*vec_usbd_devinfo_vp)(struct usbd_device *, char *, size_t, char *,
+    size_t, int, int) = NULL;
+int (*vec_usbd_printBCD)(char *cp, size_t l, int bcd) = NULL;
+#endif
+
+/*
  * ccd device compatability ioctl
  */
 
@@ -70,30 +94,33 @@ struct ccd_ioctl_60_hook_t ccd_ioctl_60_
 /*
  * clockctl device compatability ioctl
  */
-int (*compat_clockctl_ioctl_50)(dev_t, u_long, void *, int, struct lwp *) =
-    (void *)enosys;
+
+struct clockctl_ioctl_50_hook_t clockctl_ioctl_50_hook;
 
 /*
  * if_sppp device compatability ioctl subroutine
  */
-int (*sppp_params50)(struct sppp *, u_long, void *) = (void *)enosys;
+
+struct sppp_params_50_hook_t sppp_params_50_hook;
 
 /*
  * cryptodev compatability ioctl
  */
-int (*ocryptof50_ioctl)(struct file *, u_long, void *) = (void *)enosys;
+
+struct ocryptof_50_hook_t ocryptof_50_hook;
 
 /*
  * raidframe compatability
  */
-int (*raidframe50_ioctl)(int, int, struct RF_Raid_s *, int, void *,
-    struct RF_Config_s **) = (void *)enosys;
-int (*raidframe80_ioctl)(int, int, struct RF_Raid_s *, int, void *,
-    struct RF_Config_s **) = (void *)enosys;
+struct raidframe50_ioctl_hook_t raidframe50_ioctl_hook;
+struct raidframe80_ioctl_hook_t raidframe80_ioctl_hook;
 
 /*
  * puffs compatability
  */
+
+struct puffs50_compat_hook_t puffs50_compat_hook;
+
 int (*puffs50_compat_outgoing)(struct puffs_req *, struct puffs_req **,
     ssize_t *) = (void *)enosys;
 void (*puffs50_compat_incoming)(struct puffs_req *, struct puffs_req *) =
@@ -102,51 +129,29 @@ void (*puffs50_compat_incoming)(struct p
 /*
  * wsevents compatability
  */
-int (*wsevent_50_copyout_events)(const struct wscons_event *, int,
-    struct uio *) = (void *)enosys;
+struct wsevent_50_copyout_events_hook_t wsevent_50_copyout_events_hook;
 
 /*
  * sysmon_power compatability
  */
-void (*compat_sysmon_power_40)(struct power_event *, struct sysmon_pswitch *,
-    int) = (void *)voidop;
+struct compat_sysmon_power_40_hook_t compat_sysmon_power_40_hook;
 
 /*
- * bio compatability
+ * compat_bio compatability
  */
-
-int (*compat_bio_30)(void *, u_long, void *, int(*)(void *, u_long, void *)) =
-    (void *)enosys;
+struct compat_bio_30_hook_t compat_bio_30_hook;
 
 /*
  * vnd ioctl compatability
  */
-int (*compat_vndioctl_30)(u_long, struct lwp *, void *, int, struct vattr *,
-    int (*get)(struct lwp *, void *, int, struct vattr *)) = (void *)enosys;
-
-/*
- * usb device_info compatability
- */
-int (*usbd30_fill_deviceinfo_old)(struct usbd_device *,
-    struct usb_device_info_old *, int) = (void *)enosys;
-
-int (*usb30_copy_to_old)(struct usb_event *, struct usb_event_old *,
-    struct uio *) = (void *)enosys;
-
-#if NUSB > 0
-void (*vec_usbd_devinfo_vp)(struct usbd_device *, char *, size_t, char *,
-    size_t, int, int) = usbd_devinfo_vp;
-int (*vec_usbd_printBCD)(char *cp, size_t l, int bcd) = usbd_printBCD;
-
-#else
-void (*vec_usbd_devinfo_vp)(struct usbd_device *, char *, size_t, char *,
-    size_t, int, int) = NULL;
-int (*vec_usbd_printBCD)(char *cp, size_t l, int bcd) = NULL;
-#endif
+struct compat_vndioctl_30_hook_t compat_vndioctl_30_hook;
 
 /*
  * ieee80211 ioctl compatability
  */
+struct ieee80211_ostats_hook_t ieee80211_ostats_hook;
+struct ieee80211_get_ostats_20_hook_t ieee80211_get_ostats_20_hook;
+
 int (*ieee80211_get_ostats_20)(struct ieee80211_ostats *,
     struct ieee80211_stats *) = (void *)enosys;
 
@@ -155,14 +160,12 @@ int (*if43_20_cvtcmd)(int) = (void *)eno
 /*
  * rtsock 14 compatability
  */
-void (*rtsock14_oifmsg)(struct ifnet *) = (void *)voidop;
-int (*rtsock14_iflist)(struct ifnet *, struct rt_walkarg *,
-    struct rt_addrinfo *, size_t) = (void *)enosys;
+struct rtsock14_hook_t rtsock14_hook;
 
 /*
  * modctl handler for old style OSTAT
  */
-int (*compat_modstat_80)(int, struct iovec *, void *) = (void *)enosys;
+struct compat_modstat_80_hook_t compat_modstat_80_hook;
 
 /*
  * mask for kern_sig_43's killpg (updated by compat_09)

Index: src/sys/kern/sys_module.c
diff -u src/sys/kern/sys_module.c:1.23.2.9 src/sys/kern/sys_module.c:1.23.2.10
--- src/sys/kern/sys_module.c:1.23.2.9	Fri Sep  7 23:32:30 2018
+++ src/sys/kern/sys_module.c	Mon Sep 17 11:04:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_module.c,v 1.23.2.9 2018/09/07 23:32:30 pgoyette Exp $	*/
+/*	$NetBSD: sys_module.c,v 1.23.2.10 2018/09/17 11:04:31 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_module.c,v 1.23.2.9 2018/09/07 23:32:30 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_module.c,v 1.23.2.10 2018/09/17 11:04:31 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_modular.h"
@@ -261,6 +261,10 @@ handle_modctl_stat(struct iovec *iov, vo
 	return error;
 }
 
+/* COMPAT_HOOK glue for modstat_80 */
+COMPAT_CALL_HOOK(compat_modstat_80_hook, f,
+    (int cmd, struct iovec *iov, void *arg), (cmd, iov, arg), enosys());
+
 int
 sys_modctl(struct lwp *l, const struct sys_modctl_args *uap,
 	   register_t *retval)
@@ -325,7 +329,8 @@ sys_modctl(struct lwp *l, const struct s
 		break;
 
 	default:
-		error = (*compat_modstat_80)(SCARG(uap, cmd), &iov, arg);
+		error = compat_modstat_80_hook_f_call(SCARG(uap, cmd),
+		    &iov, arg);
 		if (error == ENOSYS)
 			error = EINVAL;
 		break;

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.179.2.3 src/sys/net/if_spppsubr.c:1.179.2.4
--- src/sys/net/if_spppsubr.c:1.179.2.3	Sat Apr  7 04:12:19 2018
+++ src/sys/net/if_spppsubr.c	Mon Sep 17 11:04:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.179.2.3 2018/04/07 04:12:19 pgoyette Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.179.2.4 2018/09/17 11:04:31 pgoyette Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.179.2.3 2018/04/07 04:12:19 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.179.2.4 2018/09/17 11:04:31 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -5611,6 +5611,10 @@ sppp_suggest_ip6_addr(struct sppp *sp, s
 }
 #endif /*INET6*/
 
+/* Hook the sppp_params50 compat code */
+COMPAT_CALL_HOOK(sppp_params_50_hook, f,
+    (struct sppp *sp, u_long cmd, void *data), (sp, cmd, data), enosys());
+
 /*
  * Process ioctl requests specific to the PPP interface.
  * Permissions have already been checked.
@@ -5916,7 +5920,7 @@ sppp_params(struct sppp *sp, u_long cmd,
 	    {
 		int ret;
 
-		ret = (*sppp_params50)(sp, cmd, data);
+		ret = sppp_params_50_hook_f_call(sp, cmd, data);
 		if (ret != ENOSYS)
 			return ret;
 		return (EINVAL);

Index: src/sys/net/rtsock.c
diff -u src/sys/net/rtsock.c:1.238.2.6 src/sys/net/rtsock.c:1.238.2.7
--- src/sys/net/rtsock.c:1.238.2.6	Thu Sep  6 06:56:44 2018
+++ src/sys/net/rtsock.c	Mon Sep 17 11:04:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.238.2.6 2018/09/06 06:56:44 pgoyette Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.238.2.7 2018/09/17 11:04:31 pgoyette Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.238.2.6 2018/09/06 06:56:44 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.238.2.7 2018/09/17 11:04:31 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1377,6 +1377,23 @@ COMPATNAME(rt_missmsg)(int type, const s
 }
 
 /*
+ * COMPAT_HOOK glue for rtsock14_oifmsg and rtsock14_iflist
+ *
+ * Make them static since this same code is compiled for different
+ * COMPAT_xx options and we would otherwise end up with duplicate
+ * global symbols.
+ */
+static
+COMPAT_CALL_HOOK(rtsock14_hook, f1, (struct ifnet *ifp), (ifp), enosys());
+
+static
+COMPAT_CALL_HOOK(rtsock14_hook, f2,
+    (struct ifnet *ifp, struct rt_walkarg *w, struct rt_addrinfo *info,
+     size_t len),
+    (ifp, w, info, len),
+    enosys());
+
+/*
  * This routine is called to generate a message from the routing
  * socket indicating that the status of a network interface has changed.
  */
@@ -1400,7 +1417,7 @@ COMPATNAME(rt_ifmsg)(struct ifnet *ifp)
 	if (m == NULL)
 		return;
 	COMPATNAME(route_enqueue)(m, 0);
-	(*rtsock14_oifmsg)(ifp);
+	(void)rtsock14_hook_f1_call(ifp);
 #ifdef COMPAT_50
 	compat_50_rt_oifmsg(ifp);
 #endif
@@ -1768,7 +1785,7 @@ sysctl_iflist(int af, struct rt_walkarg 
 		break;
 	case NET_RT_OOOIFLIST:
 		cmd = RTM_OOIFINFO;
-		iflist_if = rtsock14_iflist;
+		iflist_if = rtsock14_hook_f2_call;
 		break;
 #ifdef COMPAT_50
 	case NET_RT_OOIFLIST:

Index: src/sys/opencrypto/cryptodev.c
diff -u src/sys/opencrypto/cryptodev.c:1.98.2.1 src/sys/opencrypto/cryptodev.c:1.98.2.2
--- src/sys/opencrypto/cryptodev.c:1.98.2.1	Fri Mar 23 09:41:10 2018
+++ src/sys/opencrypto/cryptodev.c	Mon Sep 17 11:04:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cryptodev.c,v 1.98.2.1 2018/03/23 09:41:10 pgoyette Exp $ */
+/*	$NetBSD: cryptodev.c,v 1.98.2.2 2018/09/17 11:04:31 pgoyette Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $	*/
 /*	$OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $	*/
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.98.2.1 2018/03/23 09:41:10 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.98.2.2 2018/09/17 11:04:31 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -86,6 +86,7 @@ __KERNEL_RCSID(0, "$NetBSD: cryptodev.c,
 #include <sys/atomic.h>
 #include <sys/stat.h>
 #include <sys/module.h>
+#include <sys/compat_stub.h> 
 
 #ifdef _KERNEL_OPT
 #include "opt_ocf.h"
@@ -218,6 +219,10 @@ cryptof_write(file_t *fp, off_t *poff,
 	return EIO;
 }
 
+/* Hook the ocryptodev 50 compat code */
+COMPAT_CALL_HOOK(ocryptof_50_hook, f,
+    (struct file *fp, u_long cmd, void *data), (fp, cmd, data), enosys());
+
 /* ARGSUSED */
 int
 cryptof_ioctl(struct file *fp, u_long cmd, void *data)
@@ -439,7 +444,7 @@ reterr:
 		break;
 	default:
 		/* Check for backward compatible commands */
-		error = (*ocryptof50_ioctl)(fp, cmd, data);
+		error = ocryptof_50_hook_f_call(fp, cmd, data);
 		if (error == ENOSYS)
 			error = EINVAL;
 		return error;

Index: src/sys/opencrypto/ocryptodev.c
diff -u src/sys/opencrypto/ocryptodev.c:1.11.2.1 src/sys/opencrypto/ocryptodev.c:1.11.2.2
--- src/sys/opencrypto/ocryptodev.c:1.11.2.1	Fri Mar 23 09:41:10 2018
+++ src/sys/opencrypto/ocryptodev.c	Mon Sep 17 11:04:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ocryptodev.c,v 1.11.2.1 2018/03/23 09:41:10 pgoyette Exp $ */
+/*	$NetBSD: ocryptodev.c,v 1.11.2.2 2018/09/17 11:04:31 pgoyette Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $	*/
 /*	$OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $	*/
 
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ocryptodev.c,v 1.11.2.1 2018/03/23 09:41:10 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ocryptodev.c,v 1.11.2.2 2018/09/17 11:04:31 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -89,6 +89,7 @@ __KERNEL_RCSID(0, "$NetBSD: ocryptodev.c
 #include <sys/select.h>
 #include <sys/poll.h>
 #include <sys/atomic.h>
+#include <sys/compat_stub.h> 
 
 #ifdef _KERNEL_OPT
 #include "opt_ocf.h"
@@ -284,16 +285,19 @@ ocryptodev_msession(struct fcrypt *fcr, 
 	return 0;
 }
 
+COMPAT_SET_HOOK(ocryptof_50_hook, "cryp50", ocryptof_ioctl);
+COMPAT_UNSET_HOOK(ocryptof_50_hook);
+
 void
 cryptodev_50_init(void)
 {
 
-	ocryptof50_ioctl = ocryptof_ioctl;
+	ocryptof_50_hook_set();
 }
 
 void
 cryptodev_50_fini(void)
 {
 
-	ocryptof50_ioctl = (void *)enosys;
+	ocryptof_50_hook_unset();
 }

Index: src/sys/sys/compat_stub.h
diff -u src/sys/sys/compat_stub.h:1.1.2.22 src/sys/sys/compat_stub.h:1.1.2.23
--- src/sys/sys/compat_stub.h:1.1.2.22	Sun Sep 16 04:56:26 2018
+++ src/sys/sys/compat_stub.h	Mon Sep 17 11:04:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.h,v 1.1.2.22 2018/09/16 04:56:26 pgoyette Exp $	*/
+/* $NetBSD: compat_stub.h,v 1.1.2.23 2018/09/17 11:04:31 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -185,6 +185,8 @@ hook ## _ ## which ## _call decl				\
 
 /*
  * Routine hooks for compat_50___sys_ntp_gettime
+ *
+ * MP-hooks not needed since the NTP code is not modular
  */
 
 struct ntptimeval;
@@ -195,6 +197,19 @@ extern int (*vec_ntp_timestatus)(void);
 COMPAT_HOOK2(ntp_gettime_hooks, (struct ntptimeval *), (void))
 
 /*
+ * usb devinfo compatability
+ *
+ * MP-hooks not needed since the USB code is not modular
+ */
+
+struct usbd_device;
+struct usb_device_info;
+struct usb_device_info_old;
+struct usb_event;
+struct usb_event_old;
+struct uio;
+
+/*
  * Routine vector for dev/ccd ioctl()
  */
 
@@ -205,42 +220,40 @@ COMPAT_HOOK(ccd_ioctl_60_hook, (dev_t, u
  * Routine vector for dev/clockctl ioctl()
  */
 
-extern int (*compat_clockctl_ioctl_50)(dev_t, u_long, void *, int,
-    struct lwp *);
+COMPAT_HOOK(clockctl_ioctl_50_hook, (dev_t, u_long, void *, int, struct lwp *));
 
 /*
  * if_sppp device compatability ioctl subroutine
  */
+
 struct sppp;
-extern int (*sppp_params50)(struct sppp *, u_long, void *);
+COMPAT_HOOK(sppp_params_50_hook, (struct sppp *, u_long, void *));
 
 /*
  * cryptodev compatability ioctl
  */
-extern int (*ocryptof50_ioctl)(struct file *, u_long, void *);
+
+COMPAT_HOOK(ocryptof_50_hook, (struct file *, u_long, void *));
 
 /*
  * raidframe compatability
  */
 
-struct RF_Raid_s;
 struct RF_Config_s;
-struct raid_softc;
-
-extern int (*raidframe50_ioctl)(int, int, struct RF_Raid_s *, int, void *,
-    struct RF_Config_s **);
-extern int (*raidframe80_ioctl)(int, int, struct RF_Raid_s *, int, void *,
-    struct RF_Config_s **);
+struct RF_Raid_s;
+COMPAT_HOOK(raidframe50_ioctl_hook, (int, int, struct RF_Raid_s *, int, void *,
+    struct RF_Config_s **));
+COMPAT_HOOK(raidframe80_ioctl_hook, (int, int, struct RF_Raid_s *, int, void *,
+    struct RF_Config_s **));
 
 /*
  * puffs compatability
  */
 
 struct puffs_req;
-
-extern int (*puffs50_compat_outgoing)(struct puffs_req *, struct puffs_req **,
-    ssize_t *);
-extern void (*puffs50_compat_incoming)(struct puffs_req *, struct puffs_req *);
+COMPAT_HOOK2(puffs50_compat_hook,
+    (struct puffs_req *, struct puffs_req **, ssize_t *),	/* outgoing */
+    (struct puffs_req *, struct puffs_req *));			/* incoming */
 
 /*
  * wsevents compatability
@@ -248,9 +261,8 @@ extern void (*puffs50_compat_incoming)(s
 
 struct wscons_event;
 struct uio;
-
-extern int (*wsevent_50_copyout_events)(const struct wscons_event *, int,
-    struct uio *);
+COMPAT_HOOK(wsevent_50_copyout_events_hook,
+    (const struct wscons_event *, int, struct uio *));
 
 /*
  * sysmon_power compatability
@@ -258,34 +270,22 @@ extern int (*wsevent_50_copyout_events)(
 
 struct power_event;
 struct sysmon_pswitch;
-
-extern void (*compat_sysmon_power_40)(struct power_event *,
-    struct sysmon_pswitch *, int);
+COMPAT_HOOK(compat_sysmon_power_40_hook, (struct power_event *,
+    struct sysmon_pswitch *, int));
 
 /*
- * compat_30 indirect function pointer
+ * compat_bio indirect function pointer
  */
-extern int (*compat_bio_30)(void *, u_long, void *,
-    int(*)(void *, u_long, void *));
+
+COMPAT_HOOK(compat_bio_30_hook, (void *, u_long, void *,
+    int(*)(void *, u_long, void *)));
 
 /*
  * vnd_30 ioctl compatability
  */
 struct vattr;
-
-extern int (*compat_vndioctl_30)(u_long, struct lwp *, void *, int,
-    struct vattr *, int (*)(struct lwp *, void *, int, struct vattr *));
-
-/*
- * usb devinfo compatability
- */
-
-struct usbd_device;
-struct usb_device_info;
-struct usb_device_info_old;
-struct usb_event;
-struct usb_event_old;
-struct uio;
+COMPAT_HOOK(compat_vndioctl_30_hook, (u_long, struct lwp *, void *, int,
+    struct vattr *, int (*)(struct lwp *, void *, int, struct vattr *)));
 
 extern int (*usbd30_fill_deviceinfo_old)(struct usbd_device *,
     struct usb_device_info_old *, int);
@@ -304,6 +304,10 @@ extern int (*vec_usbd_printBCD)(char *cp
 struct ieee80211_ostats;
 struct ieee80211_stats; 
 
+COMPAT_HOOK(ieee80211_ostats_hook, (struct ieee80211_ostats *,
+    struct ieee80211_stats *));
+COMPAT_HOOK(ieee80211_get_ostats_20_hook, (int));
+
 extern int (*ieee80211_get_ostats_20)(struct ieee80211_ostats *, 
     struct ieee80211_stats *);
 
@@ -315,20 +319,18 @@ extern int (*if43_20_cvtcmd)(int);
 struct ifnet;
 struct rt_walkarg;
 struct rt_addrinfo;
-
-extern void (*rtsock14_oifmsg)(struct ifnet *);
-extern int (*rtsock14_iflist)(struct ifnet *, struct rt_walkarg *,
-    struct rt_addrinfo *, size_t);
+COMPAT_HOOK2(rtsock14_hook, (struct ifnet *),
+    (struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *, size_t));
 
 /*
  * modctl handler for old style OSTAT
  */
 struct iovec;
-
-extern int (*compat_modstat_80)(int, struct iovec *, void *);
-#endif	/* _SYS_COMPAT_STUB_H */
+COMPAT_HOOK(compat_modstat_80_hook, (int, struct iovec *, void *));
 
 /*
  * mask for kern_sig_43's killpg
  */
 extern int kern_sig_43_pgid_mask;
+
+#endif	/* _SYS_COMPAT_STUB_H */

Reply via email to