compat_stub.h revision 1.14
11.14Sroy/*	$NetBSD: compat_stub.h,v 1.14 2019/04/29 11:57:22 roy Exp $	*/
21.2Spgoyette
31.2Spgoyette/*-
41.2Spgoyette * Copyright (c) 2018 The NetBSD Foundation, Inc.
51.2Spgoyette * All rights reserved.
61.2Spgoyette *
71.2Spgoyette * This code is derived from software contributed to The NetBSD Foundation
81.2Spgoyette * by Paul Goyette
91.2Spgoyette *
101.2Spgoyette * Redistribution and use in source and binary forms, with or without
111.2Spgoyette * modification, are permitted provided that the following conditions
121.2Spgoyette * are met:
131.2Spgoyette * 1. Redistributions of source code must retain the above copyright
141.2Spgoyette *    notice, this list of conditions and the following disclaimer.
151.2Spgoyette * 2. Redistributions in binary form must reproduce the above copyright
161.2Spgoyette *    notice, this list of conditions and the following disclaimer in the
171.2Spgoyette *    documentation and/or other materials provided with the distribution.
181.2Spgoyette *
191.2Spgoyette * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
201.2Spgoyette * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
211.2Spgoyette * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
221.2Spgoyette * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
231.2Spgoyette * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
241.2Spgoyette * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
251.2Spgoyette * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
261.2Spgoyette * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
271.2Spgoyette * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
281.2Spgoyette * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
291.2Spgoyette * POSSIBILITY OF SUCH DAMAGE.
301.2Spgoyette */
311.2Spgoyette
321.2Spgoyette#ifndef _SYS_COMPAT_STUB_H
331.2Spgoyette#define _SYS_COMPAT_STUB_H
341.2Spgoyette
351.2Spgoyette#include <sys/module_hook.h>
361.2Spgoyette#include <sys/param.h>
371.2Spgoyette
381.2Spgoyette/*
391.7Spgoyette * NOTE: If you make changes here, please remember to update the
401.7Spgoyette * kernel version number in sys/param.h to ensure that kernel
411.7Spgoyette * and modules stay in sync.
421.7Spgoyette */
431.7Spgoyette
441.7Spgoyette/*
451.2Spgoyette * Routine hooks for compat_50___sys_ntp_gettime
461.2Spgoyette *
471.2Spgoyette * MP-hooks not needed since the NTP code is not modular
481.2Spgoyette */
491.2Spgoyette
501.2Spgoyettestruct ntptimeval;
511.2Spgoyettestruct timex;
521.2Spgoyette
531.2Spgoyetteextern void (*vec_ntp_gettime)(struct ntptimeval *);
541.2Spgoyetteextern int (*vec_ntp_timestatus)(void);
551.2Spgoyetteextern void (*vec_ntp_adjtime1)(struct timex *);
561.2Spgoyette
571.2Spgoyette/*
581.2SpgoyetteMODULE_HOOK(ntp_gettime_hook, int, (struct ntptimeval *));
591.2SpgoyetteMODULE_HOOK(ntp_timestatus_hook, int, (void);
601.2SpgoyetteMODULE_HOOK(ntp_adjtime1_hook, int, (struct timex *));
611.2Spgoyette*/
621.2Spgoyette
631.2Spgoyette/*
641.2Spgoyette * Routine hooks for SCTP code - used by rtsock
651.2Spgoyette *
661.2Spgoyette * MP-hooks not needed since the SCTP code is not modular
671.2Spgoyette */
681.2Spgoyettestruct ifaddr;
691.2Spgoyetteextern void (*vec_sctp_add_ip_address)(struct ifaddr *);
701.2Spgoyetteextern void (*vec_sctp_delete_ip_address)(struct ifaddr *);
711.2Spgoyette
721.2Spgoyette/*
731.2SpgoyetteMODULE_HOOK(sctp_add_ip_address, int, struct ifaddr *);
741.2SpgoyetteMODULE_HOOK(sctp_delete_ip_address, int, struct ifaddr *);
751.2Spgoyette*/
761.2Spgoyette
771.2Spgoyette
781.2Spgoyette/*
791.5Schristos * usb devinfo compatibility
801.2Spgoyette */
811.2Spgoyette
821.2Spgoyettestruct usbd_device;
831.2Spgoyettestruct usb_device_info_old;
841.2Spgoyettestruct usb_event;
851.2Spgoyettestruct usb_event_old;
861.2Spgoyettestruct uio;
871.8SpgoyetteMODULE_HOOK(usb_subr_fill_30_hook, int,
881.2Spgoyette    (struct usbd_device *, struct usb_device_info_old *, int,
891.2Spgoyette      void (*)(struct usbd_device *, char *, size_t, char *, size_t, int, int),
901.2Spgoyette      int (*)(char *, size_t, int)));
911.8SpgoyetteMODULE_HOOK(usb_subr_copy_30_hook, int,
921.2Spgoyette    (struct usb_event *, struct usb_event_old *, struct uio *));
931.2Spgoyette
941.2Spgoyette/*
951.2Spgoyette * Routine vector for dev/ccd ioctl()
961.2Spgoyette */
971.2Spgoyette
981.2SpgoyetteMODULE_HOOK(ccd_ioctl_60_hook, int, (dev_t, u_long, void *, int, struct lwp *,
991.2Spgoyette    int (*f)(dev_t, u_long, void *, int, struct lwp *)))
1001.2Spgoyette
1011.2Spgoyette/*
1021.2Spgoyette * Routine vector for dev/clockctl ioctl()
1031.2Spgoyette */
1041.2Spgoyette
1051.2SpgoyetteMODULE_HOOK(clockctl_ioctl_50_hook, int,
1061.2Spgoyette    (dev_t, u_long, void *, int, struct lwp *));
1071.2Spgoyette
1081.2Spgoyette/*
1091.5Schristos * if_sppp device compatibility ioctl subroutine
1101.2Spgoyette */
1111.2Spgoyette
1121.2Spgoyettestruct sppp;
1131.2SpgoyetteMODULE_HOOK(sppp_params_50_hook, int, (struct sppp *, u_long, void *));
1141.2Spgoyette
1151.2Spgoyette/*
1161.5Schristos * cryptodev compatibility ioctl
1171.2Spgoyette */
1181.2Spgoyette
1191.2Spgoyettestruct fcrypt;
1201.2Spgoyettestruct session_op;
1211.2Spgoyettestruct csession;
1221.2Spgoyettestruct crypt_op;
1231.2Spgoyettestruct crypt_n_op;
1241.2Spgoyettestruct kmutex_t;
1251.2SpgoyetteMODULE_HOOK(ocryptof_50_hook, int, (struct file *, u_long, void *));
1261.2Spgoyette
1271.2Spgoyette/*
1281.5Schristos * raidframe compatibility
1291.2Spgoyette */
1301.11Schristosstruct raid_softc;
1311.8SpgoyetteMODULE_HOOK(raidframe_ioctl_50_hook, int,
1321.11Schristos    (struct raid_softc *, u_long, void *));
1331.8SpgoyetteMODULE_HOOK(raidframe_ioctl_80_hook, int,
1341.11Schristos    (struct raid_softc *, u_long, void *));
1351.11SchristosMODULE_HOOK(raidframe_netbsd32_ioctl_hook, int,
1361.11Schristos    (struct raid_softc *, u_long, void *));
1371.2Spgoyette
1381.2Spgoyette/*
1391.5Schristos * puffs compatibility
1401.2Spgoyette */
1411.2Spgoyette
1421.2Spgoyettestruct puffs_req;
1431.8SpgoyetteMODULE_HOOK(puffs_out_50_hook, int,
1441.2Spgoyette    (struct puffs_req *, struct puffs_req **, ssize_t *));	/* outgoing */
1451.8SpgoyetteMODULE_HOOK(puffs_in_50_hook, void,
1461.2Spgoyette    (struct puffs_req *, struct puffs_req *));			/* incoming */
1471.2Spgoyette
1481.2Spgoyette/*
1491.5Schristos * wsevents compatibility
1501.2Spgoyette */
1511.2Spgoyette
1521.2Spgoyettestruct wscons_event;
1531.2Spgoyettestruct uio;
1541.8SpgoyetteMODULE_HOOK(wscons_copyout_events_50_hook, int,
1551.2Spgoyette    (const struct wscons_event *, int, struct uio *));
1561.2Spgoyette
1571.2Spgoyette/*
1581.5Schristos * sysmon_power compatibility
1591.2Spgoyette */
1601.2Spgoyette
1611.2Spgoyettestruct power_event;
1621.2Spgoyettestruct sysmon_pswitch;
1631.2SpgoyetteMODULE_HOOK(compat_sysmon_power_40_hook, void,
1641.2Spgoyette    (struct power_event *, struct sysmon_pswitch *, int));
1651.2Spgoyette
1661.2Spgoyette/*
1671.2Spgoyette * compat_bio indirect function pointer
1681.2Spgoyette */
1691.2Spgoyette
1701.2SpgoyetteMODULE_HOOK(compat_bio_30_hook, int,
1711.2Spgoyette    (void *, u_long, void *, int(*)(void *, u_long, void *)));
1721.2Spgoyette
1731.2Spgoyette/*
1741.5Schristos * vnd_30 ioctl compatibility
1751.2Spgoyette */
1761.2Spgoyettestruct vattr;
1771.2SpgoyetteMODULE_HOOK(compat_vndioctl_30_hook, int, (u_long, struct lwp *, void *, int,
1781.2Spgoyette    struct vattr *, int (*)(struct lwp *, void *, int, struct vattr *)));
1791.2Spgoyette
1801.2Spgoyette/*
1811.5Schristos * vnd_50 ioctl compatibility
1821.2Spgoyette */
1831.2Spgoyettestruct vattr;
1841.2SpgoyetteMODULE_HOOK(compat_vndioctl_50_hook, int, (u_long, struct lwp *, void *, int,
1851.2Spgoyette    struct vattr *, int (*)(struct lwp *, void *, int, struct vattr *)));
1861.2Spgoyette
1871.2Spgoyette/*
1881.5Schristos * ieee80211 ioctl compatibility
1891.2Spgoyette */
1901.4Schristosstruct ieee80211com;
1911.2Spgoyette
1921.8SpgoyetteMODULE_HOOK(ieee80211_ioctl_20_hook, int,
1931.5Schristos    (struct ieee80211com *, u_long, void *));
1941.2Spgoyette
1951.2Spgoyette/*
1961.5Schristos * if_43 compatibility
1971.2Spgoyette */
1981.2Spgoyettestruct socket;
1991.2Spgoyette
2001.8SpgoyetteMODULE_HOOK(if_cvtcmd_43_hook, int, (u_long *, u_long));
2011.8SpgoyetteMODULE_HOOK(if_ifioctl_43_hook, int,
2021.2Spgoyette    (struct socket *, u_long, u_long, void *, struct lwp *));
2031.2Spgoyette
2041.2Spgoyette/*
2051.6Spgoyette * if43_cvtcmd_20 compatibility
2061.2Spgoyette */
2071.6SpgoyetteMODULE_HOOK(if43_cvtcmd_20_hook, int, (u_long));
2081.2Spgoyette
2091.2Spgoyette/*
2101.3Schristos * tty 43 ioctl compatibility
2111.3Schristos */
2121.3Schristosstruct tty;
2131.3Schristos
2141.8SpgoyetteMODULE_HOOK(tty_ttioctl_43_hook, int,
2151.3Schristos    (struct tty *, u_long, void *, int, struct lwp *));
2161.3Schristos
2171.3Schristos/*
2181.5Schristos * uipc_syscalls_40 compatibility
2191.2Spgoyette */
2201.2Spgoyette
2211.2SpgoyetteMODULE_HOOK(uipc_syscalls_40_hook, int, (u_long, void *));
2221.2Spgoyette
2231.2Spgoyette/*
2241.12Spgoyette * uipc_socket_50 compatibility
2251.12Spgoyette */
2261.12Spgoyettestruct sockopt;
2271.12Spgoyettestruct mbuf;
2281.12Spgoyette
2291.12SpgoyetteMODULE_HOOK(uipc_socket_50_setopt1_hook, int,
2301.13Spgoyette    (int, struct socket *, const struct sockopt *));
2311.12SpgoyetteMODULE_HOOK(uipc_socket_50_getopt1_hook, int,
2321.13Spgoyette    (int, struct socket *, struct sockopt *));
2331.12SpgoyetteMODULE_HOOK(uipc_socket_50_sbts_hook, int, (int, struct mbuf **));
2341.12Spgoyette
2351.12Spgoyette/*
2361.5Schristos * uipc_syscalls_50 compatibility
2371.2Spgoyette */
2381.2Spgoyette
2391.2SpgoyetteMODULE_HOOK(uipc_syscalls_50_hook, int, (struct lwp *, u_long, void *));
2401.2Spgoyette
2411.2Spgoyette/*
2421.5Schristos * rtsock 14 compatibility
2431.2Spgoyette */
2441.2Spgoyettestruct ifnet;
2451.2Spgoyettestruct rt_walkarg;
2461.2Spgoyettestruct rt_addrinfo;
2471.8SpgoyetteMODULE_HOOK(rtsock_oifmsg_14_hook, void, (struct ifnet *));
2481.8SpgoyetteMODULE_HOOK(rtsock_iflist_14_hook, int,
2491.2Spgoyette    (struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *, size_t));
2501.2Spgoyette
2511.2Spgoyette/*
2521.2Spgoyette * Hooks for rtsock_50
2531.2Spgoyette */
2541.2Spgoyette
2551.2Spgoyettestruct rtentry;
2561.2Spgoyettestruct ifaddr;
2571.8SpgoyetteMODULE_HOOK(rtsock_oifmsg_50_hook, void, (struct ifnet *));
2581.8SpgoyetteMODULE_HOOK(rtsock_iflist_50_hook, int,
2591.2Spgoyette    (struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *, size_t));
2601.8SpgoyetteMODULE_HOOK(rtsock_rt_missmsg_50_hook, void,
2611.2Spgoyette    (int, const struct rt_addrinfo *, int, int));
2621.8SpgoyetteMODULE_HOOK(rtsock_rt_ifmsg_50_hook, void, (struct ifnet *));
2631.14SroyMODULE_HOOK(rtsock_rt_addrmsg_rt_50_hook, void,
2641.2Spgoyette    (int, struct ifaddr *, int, struct rtentry *));
2651.14SroyMODULE_HOOK(rtsock_rt_addrmsg_50_hook, void, (int, struct ifaddr *));
2661.8SpgoyetteMODULE_HOOK(rtsock_rt_ifannouncemsg_50_hook, void, (struct ifnet *, int));
2671.8SpgoyetteMODULE_HOOK(rtsock_rt_ieee80211msg_50_hook, void,
2681.2Spgoyette    (struct ifnet *, int, void *, size_t));
2691.2Spgoyette
2701.2Spgoyette/*
2711.2Spgoyette * Hooks for rtsock_70
2721.2Spgoyette */
2731.2Spgoyettestruct ifaddr;
2741.8SpgoyetteMODULE_HOOK(rtsock_newaddr_70_hook, void, (int, struct ifaddr *));
2751.8SpgoyetteMODULE_HOOK(rtsock_iflist_70_hook, int,
2761.2Spgoyette    (struct rt_walkarg *, struct ifaddr *, struct rt_addrinfo *));
2771.2Spgoyette
2781.2Spgoyette/*
2791.2Spgoyette * modctl handler for old style OSTAT
2801.2Spgoyette */
2811.2Spgoyettestruct iovec;
2821.2SpgoyetteMODULE_HOOK(compat_modstat_80_hook, int, (int, struct iovec *, void *));
2831.2Spgoyette
2841.2Spgoyette/*
2851.2Spgoyette * mask for kern_sig_43's killpg
2861.2Spgoyette */
2871.2Spgoyetteextern int kern_sig_43_pgid_mask;
2881.2Spgoyette
2891.2Spgoyette/*
2901.2Spgoyette * Hooks for kern_proc.c for netbsd32 compat
2911.2Spgoyette */
2921.2Spgoyettestruct ps_strings;
2931.8SpgoyetteMODULE_HOOK(kern_proc32_copyin_hook, int,
2941.2Spgoyette    (struct proc *, struct ps_strings *));
2951.8SpgoyetteMODULE_HOOK(kern_proc32_base_hook, vaddr_t, (char **, size_t));
2961.2Spgoyette
2971.2Spgoyette/*
2981.2Spgoyette * Hook to allow sparc fpu code to see if a process is using sunos
2991.2Spgoyette * emulation, and select proper fup codes
3001.2Spgoyette */
3011.2Spgoyettestruct emul;
3021.2SpgoyetteMODULE_HOOK(get_emul_sunos_hook, int, (const struct emul **));
3031.2Spgoyette
3041.2Spgoyette/*
3051.2Spgoyette * Hooks for rnd_ioctl_50
3061.2Spgoyette */
3071.2SpgoyetteMODULE_HOOK(rnd_ioctl_50_hook, int, (struct file *, u_long, void *));
3081.8SpgoyetteMODULE_HOOK(rnd_ioctl32_50_hook, int, (struct file *, u_long, void *));
3091.2Spgoyette
3101.2Spgoyette/*
3111.2Spgoyette * Hooks for compat_60 ttioctl and ptmioctl
3121.2Spgoyette */
3131.8SpgoyetteMODULE_HOOK(tty_ttioctl_60_hook, int,
3141.3Schristos    (struct tty *, u_long, void *, int, struct lwp *));
3151.8SpgoyetteMODULE_HOOK(tty_ptmioctl_60_hook, int,
3161.2Spgoyette    (dev_t, u_long, void *, int, struct lwp *));
3171.2Spgoyette
3181.2Spgoyette/*
3191.2Spgoyette * Hook for compat_10 openat
3201.2Spgoyette */
3211.2Spgoyettestruct pathbuf;
3221.8SpgoyetteMODULE_HOOK(vfs_openat_10_hook, int, (struct pathbuf **));
3231.2Spgoyette
3241.2Spgoyette/*
3251.2Spgoyette * Hook for compat_70_unp_addsockcred
3261.2Spgoyette */
3271.8SpgoyetteMODULE_HOOK(uipc_unp_70_hook, struct mbuf *,
3281.2Spgoyette    (struct lwp *, struct mbuf *));
3291.2Spgoyette
3301.2Spgoyette/*
3311.2Spgoyette * Hook for sysvipc50 sysctl
3321.2Spgoyette */
3331.2Spgoyette#include <sys/sysctl.h>
3341.8SpgoyetteMODULE_HOOK(sysvipc_sysctl_50_hook, int, (SYSCTLFN_PROTO));
3351.2Spgoyette
3361.2Spgoyette/*
3371.2Spgoyette * Hook for 32-bit machine name
3381.2Spgoyette *
3391.2Spgoyette * This probably would be better placed in compat/netbsd32/netbsd32_mod.c
3401.2Spgoyette * but the consumer code in linux32_exec_elf32.c is sometimes included in
3411.2Spgoyette * the main kernel, and not in a compat_netbsd32 module.  (In particular,
3421.2Spgoyette * this is true for i386 and sgimips.)
3431.2Spgoyette */
3441.2SpgoyetteMODULE_HOOK(netbsd32_machine32_hook, const char *, (void));
3451.2Spgoyette#endif	/* _SYS_COMPAT_STUB_H */
346