Module Name: src
Committed By: pgoyette
Date: Tue Sep 18 01:15:58 UTC 2018
Modified Files:
src/sys/compat/common [pgoyette-compat]: if_43.c usb_subr_30.c
src/sys/dev [pgoyette-compat]: bio.c ccd.c clockctl.c vnd.c
src/sys/dev/raidframe [pgoyette-compat]: rf_netbsdkintf.c
src/sys/dev/sysmon [pgoyette-compat]: sysmon_power.c
src/sys/dev/usb [pgoyette-compat]: ugen.c uhid.c usb.c
src/sys/dev/wscons [pgoyette-compat]: wsevent.c
src/sys/fs/puffs [pgoyette-compat]: puffs_msgif.c
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
src/sys/sys [pgoyette-compat]: compat_stub.h
Log Message:
Split the COMPAT_CALL_HOOK to separate the declaration from the
implementation. Some hooks are called from multiple source files,
and the old method resulted in duplicate implementations.
Implement MP-safe hooks for the usb_subr_30 code. Pass the helper
functions as arguments to the compat code so it does not have to
determine if the kernel contains usb code.
To generate a diff of this commit:
cvs rdiff -u -r1.14.2.2 -r1.14.2.3 src/sys/compat/common/if_43.c
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/compat/common/usb_subr_30.c
cvs rdiff -u -r1.13.16.2 -r1.13.16.3 src/sys/dev/bio.c
cvs rdiff -u -r1.175.2.5 -r1.175.2.6 src/sys/dev/ccd.c
cvs rdiff -u -r1.35.14.2 -r1.35.14.3 src/sys/dev/clockctl.c
cvs rdiff -u -r1.263.2.3 -r1.263.2.4 src/sys/dev/vnd.c
cvs rdiff -u -r1.356.2.3 -r1.356.2.4 src/sys/dev/raidframe/rf_netbsdkintf.c
cvs rdiff -u -r1.58.2.2 -r1.58.2.3 src/sys/dev/sysmon/sysmon_power.c
cvs rdiff -u -r1.139.2.2 -r1.139.2.3 src/sys/dev/usb/ugen.c
cvs rdiff -u -r1.101.2.2 -r1.101.2.3 src/sys/dev/usb/uhid.c
cvs rdiff -u -r1.168.2.3 -r1.168.2.4 src/sys/dev/usb/usb.c
cvs rdiff -u -r1.37.2.3 -r1.37.2.4 src/sys/dev/wscons/wsevent.c
cvs rdiff -u -r1.101.10.3 -r1.101.10.4 src/sys/fs/puffs/puffs_msgif.c
cvs rdiff -u -r1.1.2.18 -r1.1.2.19 src/sys/kern/compat_stub.c
cvs rdiff -u -r1.23.2.10 -r1.23.2.11 src/sys/kern/sys_module.c
cvs rdiff -u -r1.179.2.4 -r1.179.2.5 src/sys/net/if_spppsubr.c
cvs rdiff -u -r1.238.2.7 -r1.238.2.8 src/sys/net/rtsock.c
cvs rdiff -u -r1.98.2.2 -r1.98.2.3 src/sys/opencrypto/cryptodev.c
cvs rdiff -u -r1.1.2.23 -r1.1.2.24 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/if_43.c
diff -u src/sys/compat/common/if_43.c:1.14.2.2 src/sys/compat/common/if_43.c:1.14.2.3
--- src/sys/compat/common/if_43.c:1.14.2.2 Mon Sep 17 11:04:30 2018
+++ src/sys/compat/common/if_43.c Tue Sep 18 01:15:57 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_43.c,v 1.14.2.2 2018/09/17 11:04:30 pgoyette Exp $ */
+/* $NetBSD: if_43.c,v 1.14.2.3 2018/09/18 01:15:57 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.2 2018/09/17 11:04:30 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.14.2.3 2018/09/18 01:15:57 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -78,6 +78,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.
#include <uvm/uvm_extern.h>
/* COMPAT_HOOK for replacing the cmdcvt() function */
+COMPAT_CALL_HOOK_DECL(ieee80211_get_ostats_20_hook, f, (int cmd), (cmd), cmd);
COMPAT_CALL_HOOK(ieee80211_get_ostats_20_hook, f, (int cmd), (cmd), cmd);
u_long
Index: src/sys/compat/common/usb_subr_30.c
diff -u src/sys/compat/common/usb_subr_30.c:1.1.2.1 src/sys/compat/common/usb_subr_30.c:1.1.2.2
--- src/sys/compat/common/usb_subr_30.c:1.1.2.1 Thu Mar 29 23:23:03 2018
+++ src/sys/compat/common/usb_subr_30.c Tue Sep 18 01:15:57 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: usb_subr_30.c,v 1.1.2.1 2018/03/29 23:23:03 pgoyette Exp $ */
+/* $NetBSD: usb_subr_30.c,v 1.1.2.2 2018/09/18 01:15:57 pgoyette Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
/*
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_subr_30.c,v 1.1.2.1 2018/03/29 23:23:03 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr_30.c,v 1.1.2.2 2018/09/18 01:15:57 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -126,7 +126,10 @@ usb_copy_old_devinfo(struct usb_device_i
static int
usbd_fill_deviceinfo_old(struct usbd_device *dev,
- struct usb_device_info_old *di, int usedev)
+ struct usb_device_info_old *di, int usedev,
+ void (*do_devinfo_vp)(struct usbd_device *, char *, size_t, char *,
+ size_t, int, int),
+ int (*do_printBCD)(char *cp, size_t l, int bcd))
{
struct usbd_port *p;
int i, j, err;
@@ -134,9 +137,9 @@ usbd_fill_deviceinfo_old(struct usbd_dev
di->udi_bus = device_unit(dev->ud_bus->ub_usbctl);
di->udi_addr = dev->ud_addr;
di->udi_cookie = dev->ud_cookie;
- (*vec_usbd_devinfo_vp)(dev, di->udi_vendor, sizeof(di->udi_vendor),
+ (*do_devinfo_vp)(dev, di->udi_vendor, sizeof(di->udi_vendor),
di->udi_product, sizeof(di->udi_product), usedev, 0);
- (*vec_usbd_printBCD)(di->udi_release, sizeof(di->udi_release),
+ (*do_printBCD)(di->udi_release, sizeof(di->udi_release),
UGETW(dev->ud_ddesc.bcdDevice));
di->udi_vendorNo = UGETW(dev->ud_ddesc.idVendor);
di->udi_productNo = UGETW(dev->ud_ddesc.idProduct);
@@ -226,18 +229,20 @@ usb_copy_to_old30(struct usb_event *ue,
return 0;
}
+COMPAT_SET_HOOK2(usb_subr_30_hook, "usb_30", usbd_fill_deviceinfo_old,
+ usb_copy_to_old30);
+COMPAT_UNSET_HOOK2(usb_subr_30_hook);
+
void
usb_30_init(void)
{
- usbd30_fill_deviceinfo_old = usbd_fill_deviceinfo_old;
- usb30_copy_to_old = usb_copy_to_old30;
+ usb_subr_30_hook_set();
}
void
usb_30_fini(void)
{
- usbd30_fill_deviceinfo_old = (void *)enosys;
- usb30_copy_to_old = (void *)enosys;
+ usb_subr_30_hook_unset();
}
Index: src/sys/dev/bio.c
diff -u src/sys/dev/bio.c:1.13.16.2 src/sys/dev/bio.c:1.13.16.3
--- src/sys/dev/bio.c:1.13.16.2 Mon Sep 17 11:04:30 2018
+++ src/sys/dev/bio.c Tue Sep 18 01:15:57 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: bio.c,v 1.13.16.2 2018/09/17 11:04:30 pgoyette Exp $ */
+/* $NetBSD: bio.c,v 1.13.16.3 2018/09/18 01:15:57 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.2 2018/09/17 11:04:30 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bio.c,v 1.13.16.3 2018/09/18 01:15:57 pgoyette Exp $");
#include "opt_compat_netbsd.h"
@@ -115,6 +115,9 @@ bioclose(dev_t dev, int flags, int mode,
}
/* Hook up the compat_bio_30 routine */
+COMPAT_CALL_HOOK_DECL(compat_bio_30_hook, f,
+ (void * cookie, u_long cmd, void *addr, int(*ff)(void *, u_long, void *)),
+ (cookie, cmd, addr, ff), enosys());
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());
Index: src/sys/dev/ccd.c
diff -u src/sys/dev/ccd.c:1.175.2.5 src/sys/dev/ccd.c:1.175.2.6
--- src/sys/dev/ccd.c:1.175.2.5 Sun Sep 16 04:57:22 2018
+++ src/sys/dev/ccd.c Tue Sep 18 01:15:57 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ccd.c,v 1.175.2.5 2018/09/16 04:57:22 pgoyette Exp $ */
+/* $NetBSD: ccd.c,v 1.175.2.6 2018/09/18 01:15:57 pgoyette Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.175.2.5 2018/09/16 04:57:22 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.175.2.6 2018/09/18 01:15:57 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -1061,6 +1061,10 @@ ccdread(dev_t dev, struct uio *uio, int
* This looks ugly, since we pass the "real" ioctl function as an
* argument to the compat_xxx function.
*/
+COMPAT_CALL_HOOK_DECL(ccd_ioctl_60_hook, f, (dev_t dev, u_long cmd, void *data,
+ int flag, struct lwp *l, int (*ff)(dev_t, u_long, void *, int,
+ struct lwp *)),
+ (dev, cmd, data, flag, l, ccdioctl), enosys());
COMPAT_CALL_HOOK(ccd_ioctl_60_hook, f, (dev_t dev, u_long cmd, void *data,
int flag, struct lwp *l, int (*ff)(dev_t, u_long, void *, int,
struct lwp *)),
Index: src/sys/dev/clockctl.c
diff -u src/sys/dev/clockctl.c:1.35.14.2 src/sys/dev/clockctl.c:1.35.14.3
--- src/sys/dev/clockctl.c:1.35.14.2 Mon Sep 17 11:04:30 2018
+++ src/sys/dev/clockctl.c Tue Sep 18 01:15:57 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: clockctl.c,v 1.35.14.2 2018/09/17 11:04:30 pgoyette Exp $ */
+/* $NetBSD: clockctl.c,v 1.35.14.3 2018/09/18 01:15:57 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.2 2018/09/17 11:04:30 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.35.14.3 2018/09/18 01:15:57 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_ntp.h"
@@ -201,6 +201,9 @@ clockctl_modcmd(modcmd_t cmd, void *data
}
/* Hook the compat_50 stuff */
+COMPAT_CALL_HOOK_DECL(clockctl_ioctl_50_hook, f,
+ (dev_t dev, u_long cmd, void *data, int flags, struct lwp *l),
+ (dev, cmd, data, flags, l), enosys());
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());
Index: src/sys/dev/vnd.c
diff -u src/sys/dev/vnd.c:1.263.2.3 src/sys/dev/vnd.c:1.263.2.4
--- src/sys/dev/vnd.c:1.263.2.3 Mon Sep 17 11:04:30 2018
+++ src/sys/dev/vnd.c Tue Sep 18 01:15:57 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: vnd.c,v 1.263.2.3 2018/09/17 11:04:30 pgoyette Exp $ */
+/* $NetBSD: vnd.c,v 1.263.2.4 2018/09/18 01:15:57 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.3 2018/09/17 11:04:30 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.263.2.4 2018/09/18 01:15:57 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vnd.h"
@@ -1111,6 +1111,11 @@ vndioctl_get(struct lwp *l, void *data,
}
}
+COMPAT_CALL_HOOK_DECL(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());
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 *)),
Index: src/sys/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.356.2.3 src/sys/dev/raidframe/rf_netbsdkintf.c:1.356.2.4
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.356.2.3 Mon Sep 17 11:04:30 2018
+++ src/sys/dev/raidframe/rf_netbsdkintf.c Tue Sep 18 01:15:57 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsdkintf.c,v 1.356.2.3 2018/09/17 11:04:30 pgoyette Exp $ */
+/* $NetBSD: rf_netbsdkintf.c,v 1.356.2.4 2018/09/18 01:15:57 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.3 2018/09/17 11:04:30 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.356.2.4 2018/09/18 01:15:57 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -1038,11 +1038,22 @@ raid_detach_unlocked(struct raid_softc *
}
/* Hooks to call the 5.0 and 8.0 ioctl compat code */
+COMPAT_CALL_HOOK_DECL(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(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_DECL(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());
COMPAT_CALL_HOOK(raidframe80_ioctl_hook, f,
(int cmd, int initted, RF_Raid_t *raidPtr, int unit, void *data,
RF_Config_t **k_cfg),
Index: src/sys/dev/sysmon/sysmon_power.c
diff -u src/sys/dev/sysmon/sysmon_power.c:1.58.2.2 src/sys/dev/sysmon/sysmon_power.c:1.58.2.3
--- src/sys/dev/sysmon/sysmon_power.c:1.58.2.2 Mon Sep 17 11:04:31 2018
+++ src/sys/dev/sysmon/sysmon_power.c Tue Sep 18 01:15:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sysmon_power.c,v 1.58.2.2 2018/09/17 11:04:31 pgoyette Exp $ */
+/* $NetBSD: sysmon_power.c,v 1.58.2.3 2018/09/18 01:15:58 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.2 2018/09/17 11:04:31 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_power.c,v 1.58.2.3 2018/09/18 01:15:58 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -318,6 +318,9 @@ sysmon_power_event_queue_flush(void)
/*
* Call the compat hook function
*/
+COMPAT_CALL_HOOK_DECL(compat_sysmon_power_40_hook, f,
+ (power_event_t *pev, struct sysmon_pswitch *pswitch, int event),
+ (pev, pswitch, event), enosys());
COMPAT_CALL_HOOK(compat_sysmon_power_40_hook, f,
(power_event_t *pev, struct sysmon_pswitch *pswitch, int event),
(pev, pswitch, event), enosys());
Index: src/sys/dev/usb/ugen.c
diff -u src/sys/dev/usb/ugen.c:1.139.2.2 src/sys/dev/usb/ugen.c:1.139.2.3
--- src/sys/dev/usb/ugen.c:1.139.2.2 Thu Sep 6 06:56:04 2018
+++ src/sys/dev/usb/ugen.c Tue Sep 18 01:15:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ugen.c,v 1.139.2.2 2018/09/06 06:56:04 pgoyette Exp $ */
+/* $NetBSD: ugen.c,v 1.139.2.3 2018/09/18 01:15:58 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.139.2.2 2018/09/06 06:56:04 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.139.2.3 2018/09/18 01:15:58 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -1439,6 +1439,13 @@ ugen_get_alt_index(struct ugen_softc *sc
return usbd_get_interface_altindex(iface);
}
+COMPAT_CALL_HOOK_DECL(usb_subr_30_hook, f1,
+ (struct usbd_device *udev, struct usb_device_info_old * addr, int usedev,
+ void (*fill_devinfo_vp)(struct usbd_device *, char *, size_t, char *,
+ size_t, int, int), int (*printBCD)(char *, size_t, int)),
+ (udev, addr, usedev, fill_devinfo_vp, printBCD),
+ enosys());
+
Static int
ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd,
void *addr, int flag, struct lwp *l)
@@ -1837,8 +1844,9 @@ ugen_do_ioctl(struct ugen_softc *sc, int
(struct usb_device_info *)addr, 0);
break;
case USB_GET_DEVICEINFO_OLD:
- if ((*usbd30_fill_deviceinfo_old)(sc->sc_udev,
- (struct usb_device_info_old *)addr, 0) == 0)
+ if (usb_subr_30_hook_f1_call(sc->sc_udev,
+ (struct usb_device_info_old *)addr, 0,
+ usbd_devinfo_vp, usbd_printBCD) == 0)
return 0;
return EINVAL;
default:
Index: src/sys/dev/usb/uhid.c
diff -u src/sys/dev/usb/uhid.c:1.101.2.2 src/sys/dev/usb/uhid.c:1.101.2.3
--- src/sys/dev/usb/uhid.c:1.101.2.2 Thu Sep 6 06:56:04 2018
+++ src/sys/dev/usb/uhid.c Tue Sep 18 01:15:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: uhid.c,v 1.101.2.2 2018/09/06 06:56:04 pgoyette Exp $ */
+/* $NetBSD: uhid.c,v 1.101.2.3 2018/09/18 01:15:58 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2004, 2008, 2012 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.101.2.2 2018/09/06 06:56:04 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.101.2.3 2018/09/18 01:15:58 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -513,6 +513,13 @@ uhidwrite(dev_t dev, struct uio *uio, in
return error;
}
+COMPAT_CALL_HOOK_DECL(usb_subr_30_hook, f1,
+ (struct usbd_device *udev, struct usb_device_info_old * addr, int usedev,
+ void (*fill_devinfo_vp)(struct usbd_device *, char *, size_t, char *,
+ size_t, int, int), int (*printBCD)(char *, size_t, int)),
+ (udev, addr, usedev, fill_devinfo_vp, printBCD),
+ enosys());
+
int
uhid_do_ioctl(struct uhid_softc *sc, u_long cmd, void *addr,
int flag, struct lwp *l)
@@ -654,9 +661,9 @@ uhid_do_ioctl(struct uhid_softc *sc, u_l
(struct usb_device_info *)addr, 0);
break;
case USB_GET_DEVICEINFO_OLD:
- err = (*usbd30_fill_deviceinfo_old)(
- sc->sc_hdev.sc_parent->sc_udev,
- (struct usb_device_info_old *)addr, 0);
+ err = usb_subr_30_hook_f1_call( sc->sc_hdev.sc_parent->sc_udev,
+ (struct usb_device_info_old *)addr, 0,
+ usbd_devinfo_vp, usbd_printBCD);
if (err == 0)
return 0;
break;
Index: src/sys/dev/usb/usb.c
diff -u src/sys/dev/usb/usb.c:1.168.2.3 src/sys/dev/usb/usb.c:1.168.2.4
--- src/sys/dev/usb/usb.c:1.168.2.3 Thu Sep 6 06:56:05 2018
+++ src/sys/dev/usb/usb.c Tue Sep 18 01:15:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: usb.c,v 1.168.2.3 2018/09/06 06:56:05 pgoyette Exp $ */
+/* $NetBSD: usb.c,v 1.168.2.4 2018/09/18 01:15:58 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.168.2.3 2018/09/06 06:56:05 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.168.2.4 2018/09/18 01:15:58 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -646,6 +646,14 @@ usbopen(dev_t dev, int flag, int mode, s
return 0;
}
+/* Call hook for usbd30_fill_device_info_old() */
+COMPAT_CALL_HOOK_DECL(usb_subr_30_hook, f2,
+ (struct usb_event *ue, struct usb_event_old *ueo, struct uio *uio),
+ (ue, ueo, uio), enosys());
+COMPAT_CALL_HOOK(usb_subr_30_hook, f2,
+ (struct usb_event *ue, struct usb_event_old *ueo, struct uio *uio),
+ (ue, ueo, uio), enosys());
+
int
usbread(dev_t dev, struct uio *uio, int flag)
{
@@ -686,7 +694,7 @@ usbread(dev_t dev, struct uio *uio, int
mutex_exit(&usb_event_lock);
if (!error) {
if (useold) { /* copy fields to old struct */
- error = (*usb30_copy_to_old)(ue, ueo, uio);
+ error = usb_subr_30_hook_f2_call(ue, ueo, uio);
if (error == ENOSYS)
error = EINVAL;
@@ -718,6 +726,20 @@ usbclose(dev_t dev, int flag, int mode,
return 0;
}
+/* Call the hook for usb30_copy_to_old() */
+COMPAT_CALL_HOOK_DECL(usb_subr_30_hook, f1,
+ (struct usbd_device *udev, struct usb_device_info_old * addr, int usedev,
+ void (*fill_devinfo_vp)(struct usbd_device *, char *, size_t, char *,
+ size_t, int, int), int (*printBCD)(char *, size_t, int)),
+ (udev, addr, usedev, fill_devinfo_vp, printBCD),
+ enosys());
+COMPAT_CALL_HOOK(usb_subr_30_hook, f1,
+ (struct usbd_device *udev, struct usb_device_info_old * addr, int usedev,
+ void (*fill_devinfo_vp)(struct usbd_device *, char *, size_t, char *,
+ size_t, int, int), int (*printBCD)(char *, size_t, int)),
+ (udev, addr, usedev, fill_devinfo_vp, printBCD),
+ enosys());
+
int
usbioctl(dev_t devt, u_long cmd, void *data, int flag, struct lwp *l)
{
@@ -866,7 +888,8 @@ usbioctl(dev_t devt, u_long cmd, void *d
error = ENXIO;
goto fail;
}
- error = (*usbd30_fill_deviceinfo_old)(dev, di, 1);
+ error = usb_subr_30_hook_f1_call(dev, di, 1,
+ usbd_devinfo_vp, usbd_printBCD);
if (error == ENOSYS)
error = EINVAL;
if (error)
Index: src/sys/dev/wscons/wsevent.c
diff -u src/sys/dev/wscons/wsevent.c:1.37.2.3 src/sys/dev/wscons/wsevent.c:1.37.2.4
--- src/sys/dev/wscons/wsevent.c:1.37.2.3 Mon Sep 17 11:04:31 2018
+++ src/sys/dev/wscons/wsevent.c Tue Sep 18 01:15:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: wsevent.c,v 1.37.2.3 2018/09/17 11:04:31 pgoyette Exp $ */
+/* $NetBSD: wsevent.c,v 1.37.2.4 2018/09/18 01:15:58 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.3 2018/09/17 11:04:31 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.37.2.4 2018/09/18 01:15:58 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -189,6 +189,9 @@ wsevent_fini(struct wseventvar *ev)
softint_disestablish(ev->sih);
}
+COMPAT_CALL_HOOK_DECL(wsevent_50_copyout_events_hook, f,
+ (const struct wscons_event *events, int cnt, struct uio *uio),
+ (events, cnt, uio), enosys());
COMPAT_CALL_HOOK(wsevent_50_copyout_events_hook, f,
(const struct wscons_event *events, int cnt, struct uio *uio),
(events, cnt, uio), enosys());
Index: src/sys/fs/puffs/puffs_msgif.c
diff -u src/sys/fs/puffs/puffs_msgif.c:1.101.10.3 src/sys/fs/puffs/puffs_msgif.c:1.101.10.4
--- src/sys/fs/puffs/puffs_msgif.c:1.101.10.3 Mon Sep 17 11:04:31 2018
+++ src/sys/fs/puffs/puffs_msgif.c Tue Sep 18 01:15:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs_msgif.c,v 1.101.10.3 2018/09/17 11:04:31 pgoyette Exp $ */
+/* $NetBSD: puffs_msgif.c,v 1.101.10.4 2018/09/18 01:15:58 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.3 2018/09/17 11:04:31 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_msgif.c,v 1.101.10.4 2018/09/18 01:15:58 pgoyette Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -325,11 +325,17 @@ puffs_getmsgid(struct puffs_mount *pmp)
/* Routines to call the compat hooks */
/* Out-going */
+COMPAT_CALL_HOOK_DECL(puffs50_compat_hook, f1,
+ (struct puffs_req *oreq, struct puffs_req **creqp, ssize_t *deltap),
+ (oreq, creqp, deltap), enosys());
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_DECL(puffs50_compat_hook, f2,
+ (struct puffs_req *oreq, struct puffs_req *creqp),
+ (oreq, creqp), enosys());
COMPAT_CALL_HOOK(puffs50_compat_hook, f2,
(struct puffs_req *oreq, struct puffs_req *creqp),
(oreq, creqp), enosys());
Index: src/sys/kern/compat_stub.c
diff -u src/sys/kern/compat_stub.c:1.1.2.18 src/sys/kern/compat_stub.c:1.1.2.19
--- src/sys/kern/compat_stub.c:1.1.2.18 Mon Sep 17 11:04:31 2018
+++ src/sys/kern/compat_stub.c Tue Sep 18 01:15:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.1.2.18 2018/09/17 11:04:31 pgoyette Exp $ */
+/* $NetBSD: compat_stub.c,v 1.1.2.19 2018/09/18 01:15:58 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -33,7 +33,6 @@
#ifdef _KERNEL_OPT
#include "opt_ntp.h"
-#include "usb.h" /* XXX No other way to determine if USB is present */
#endif
#include <sys/systm.h>
@@ -58,32 +57,10 @@ void (*vec_ntp_gettime)(struct ntptimeva
int (*vec_ntp_timestatus)(void) = NULL;
#endif
-#if NUSB > 0
-#include <dev/usb/usb.h>
-#include <dev/usb/usbdi.h>
-#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
+struct usb_subr_30_hook_t usb_subr_30_hook;
/*
* ccd device compatability ioctl
Index: src/sys/kern/sys_module.c
diff -u src/sys/kern/sys_module.c:1.23.2.10 src/sys/kern/sys_module.c:1.23.2.11
--- src/sys/kern/sys_module.c:1.23.2.10 Mon Sep 17 11:04:31 2018
+++ src/sys/kern/sys_module.c Tue Sep 18 01:15:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_module.c,v 1.23.2.10 2018/09/17 11:04:31 pgoyette Exp $ */
+/* $NetBSD: sys_module.c,v 1.23.2.11 2018/09/18 01:15:58 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.10 2018/09/17 11:04:31 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_module.c,v 1.23.2.11 2018/09/18 01:15:58 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_modular.h"
@@ -262,6 +262,8 @@ handle_modctl_stat(struct iovec *iov, vo
}
/* COMPAT_HOOK glue for modstat_80 */
+COMPAT_CALL_HOOK_DECL(compat_modstat_80_hook, f,
+ (int cmd, struct iovec *iov, void *arg), (cmd, iov, arg), enosys());
COMPAT_CALL_HOOK(compat_modstat_80_hook, f,
(int cmd, struct iovec *iov, void *arg), (cmd, iov, arg), enosys());
Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.179.2.4 src/sys/net/if_spppsubr.c:1.179.2.5
--- src/sys/net/if_spppsubr.c:1.179.2.4 Mon Sep 17 11:04:31 2018
+++ src/sys/net/if_spppsubr.c Tue Sep 18 01:15:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_spppsubr.c,v 1.179.2.4 2018/09/17 11:04:31 pgoyette Exp $ */
+/* $NetBSD: if_spppsubr.c,v 1.179.2.5 2018/09/18 01:15:58 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.4 2018/09/17 11:04:31 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.179.2.5 2018/09/18 01:15:58 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -5612,6 +5612,8 @@ sppp_suggest_ip6_addr(struct sppp *sp, s
#endif /*INET6*/
/* Hook the sppp_params50 compat code */
+COMPAT_CALL_HOOK_DECL(sppp_params_50_hook, f,
+ (struct sppp *sp, u_long cmd, void *data), (sp, cmd, data), enosys());
COMPAT_CALL_HOOK(sppp_params_50_hook, f,
(struct sppp *sp, u_long cmd, void *data), (sp, cmd, data), enosys());
Index: src/sys/net/rtsock.c
diff -u src/sys/net/rtsock.c:1.238.2.7 src/sys/net/rtsock.c:1.238.2.8
--- src/sys/net/rtsock.c:1.238.2.7 Mon Sep 17 11:04:31 2018
+++ src/sys/net/rtsock.c Tue Sep 18 01:15:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rtsock.c,v 1.238.2.7 2018/09/17 11:04:31 pgoyette Exp $ */
+/* $NetBSD: rtsock.c,v 1.238.2.8 2018/09/18 01:15:58 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.7 2018/09/17 11:04:31 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.238.2.8 2018/09/18 01:15:58 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -1383,15 +1383,23 @@ COMPATNAME(rt_missmsg)(int type, const s
* COMPAT_xx options and we would otherwise end up with duplicate
* global symbols.
*/
-static
+COMPAT_CALL_HOOK_DECL(rtsock14_hook, f1, (struct ifnet *ifp), (ifp), enosys());
+#ifndef COMPAT_RTSOCK
COMPAT_CALL_HOOK(rtsock14_hook, f1, (struct ifnet *ifp), (ifp), enosys());
+#endif
-static
+COMPAT_CALL_HOOK_DECL(rtsock14_hook, f2,
+ (struct ifnet *ifp, struct rt_walkarg *w, struct rt_addrinfo *info,
+ size_t len),
+ (ifp, w, info, len),
+ enosys());
+#ifndef COMPAT_RTSOCK
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());
+#endif
/*
* This routine is called to generate a message from the routing
Index: src/sys/opencrypto/cryptodev.c
diff -u src/sys/opencrypto/cryptodev.c:1.98.2.2 src/sys/opencrypto/cryptodev.c:1.98.2.3
--- src/sys/opencrypto/cryptodev.c:1.98.2.2 Mon Sep 17 11:04:31 2018
+++ src/sys/opencrypto/cryptodev.c Tue Sep 18 01:15:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cryptodev.c,v 1.98.2.2 2018/09/17 11:04:31 pgoyette Exp $ */
+/* $NetBSD: cryptodev.c,v 1.98.2.3 2018/09/18 01:15:58 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.2 2018/09/17 11:04:31 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.98.2.3 2018/09/18 01:15:58 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -220,6 +220,8 @@ cryptof_write(file_t *fp, off_t *poff,
}
/* Hook the ocryptodev 50 compat code */
+COMPAT_CALL_HOOK_DECL(ocryptof_50_hook, f,
+ (struct file *fp, u_long cmd, void *data), (fp, cmd, data), enosys());
COMPAT_CALL_HOOK(ocryptof_50_hook, f,
(struct file *fp, u_long cmd, void *data), (fp, cmd, data), enosys());
Index: src/sys/sys/compat_stub.h
diff -u src/sys/sys/compat_stub.h:1.1.2.23 src/sys/sys/compat_stub.h:1.1.2.24
--- src/sys/sys/compat_stub.h:1.1.2.23 Mon Sep 17 11:04:31 2018
+++ src/sys/sys/compat_stub.h Tue Sep 18 01:15:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.h,v 1.1.2.23 2018/09/17 11:04:31 pgoyette Exp $ */
+/* $NetBSD: compat_stub.h,v 1.1.2.24 2018/09/18 01:15:58 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -156,9 +156,10 @@ static void (hook ## _unset)(void) \
pserialize_destroy(hook.psz); \
}
-#define COMPAT_CALL_HOOK(hook, which, decl, args, default) \
+#define COMPAT_CALL_HOOK_DECL(hook, which, decl, args, default) \
int \
-hook ## _ ## which ## _call decl; \
+hook ## _ ## which ## _call decl;
+#define COMPAT_CALL_HOOK(hook, which, decl, args, default) \
int \
hook ## _ ## which ## _call decl \
{ \
@@ -198,16 +199,18 @@ COMPAT_HOOK2(ntp_gettime_hooks, (struct
/*
* 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;
+COMPAT_HOOK2(usb_subr_30_hook,
+ (struct usbd_device *, struct usb_device_info_old *, int,
+ void (*)(struct usbd_device *, char *, size_t, char *, size_t, int, int),
+ int (*)(char *, size_t, int)),
+ (struct usb_event *, struct usb_event_old *, struct uio *));
/*
* Routine vector for dev/ccd ioctl()
@@ -287,17 +290,6 @@ struct vattr;
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);
-
-extern int (*usb30_copy_to_old)(struct usb_event *ue, struct usb_event_old *ueo,
- struct uio *uio);
-
-extern void (*vec_usbd_devinfo_vp)(struct usbd_device *, char *, size_t, char *,
- size_t, int, int);
-
-extern int (*vec_usbd_printBCD)(char *cp, size_t l, int bcd);
-
/*
* ieee80211 ioctl compatability
*/