compat_stub.h revision 1.19
1/* $NetBSD: compat_stub.h,v 1.19 2019/09/27 00:32:03 pgoyette Exp $ */ 2 3/*- 4 * Copyright (c) 2018 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Paul Goyette 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32#ifndef _SYS_COMPAT_STUB_H 33#define _SYS_COMPAT_STUB_H 34 35#include <sys/module_hook.h> 36#include <sys/param.h> 37#include <sys/socket.h> 38 39/* 40 * NOTE: If you make changes here, please remember to update the 41 * kernel version number in sys/param.h to ensure that kernel 42 * and modules stay in sync. 43 */ 44 45/* 46 * Routine hooks for compat_50___sys_ntp_gettime 47 * 48 * MP-hooks not needed since the NTP code is not modular 49 */ 50 51struct ntptimeval; 52struct timex; 53 54extern void (*vec_ntp_gettime)(struct ntptimeval *); 55extern int (*vec_ntp_timestatus)(void); 56extern void (*vec_ntp_adjtime1)(struct timex *); 57 58/* 59MODULE_HOOK(ntp_gettime_hook, int, (struct ntptimeval *)); 60MODULE_HOOK(ntp_timestatus_hook, int, (void); 61MODULE_HOOK(ntp_adjtime1_hook, int, (struct timex *)); 62*/ 63 64/* 65 * Routine hooks for SCTP code - used by rtsock 66 * 67 * MP-hooks not needed since the SCTP code is not modular 68 */ 69struct ifaddr; 70extern void (*vec_sctp_add_ip_address)(struct ifaddr *); 71extern void (*vec_sctp_delete_ip_address)(struct ifaddr *); 72 73/* 74MODULE_HOOK(sctp_add_ip_address, int, struct ifaddr *); 75MODULE_HOOK(sctp_delete_ip_address, int, struct ifaddr *); 76*/ 77 78 79/* 80 * usb devinfo compatibility 81 */ 82 83struct usbd_device; 84struct usb_device_info_old; 85struct usb_event; 86struct usb_event_old; 87struct uio; 88MODULE_HOOK(usb_subr_fill_30_hook, int, 89 (struct usbd_device *, struct usb_device_info_old *, int, 90 void (*)(struct usbd_device *, char *, size_t, char *, size_t, int, int), 91 int (*)(char *, size_t, int))); 92MODULE_HOOK(usb_subr_copy_30_hook, int, 93 (struct usb_event *, struct usb_event_old *, struct uio *)); 94 95/* 96 * Routine vector for dev/ccd ioctl() 97 */ 98 99MODULE_HOOK(ccd_ioctl_60_hook, int, (dev_t, u_long, void *, int, struct lwp *, 100 int (*f)(dev_t, u_long, void *, int, struct lwp *))) 101 102/* 103 * Routine vector for dev/clockctl ioctl() 104 */ 105 106MODULE_HOOK(clockctl_ioctl_50_hook, int, 107 (dev_t, u_long, void *, int, struct lwp *)); 108 109/* 110 * if_sppp device compatibility ioctl subroutine 111 */ 112 113struct sppp; 114MODULE_HOOK(sppp_params_50_hook, int, (struct sppp *, u_long, void *)); 115 116/* 117 * cryptodev compatibility ioctl 118 */ 119 120struct fcrypt; 121struct session_op; 122struct csession; 123struct crypt_op; 124struct crypt_n_op; 125struct kmutex_t; 126MODULE_HOOK(ocryptof_50_hook, int, (struct file *, u_long, void *)); 127 128/* 129 * raidframe compatibility 130 */ 131struct raid_softc; 132MODULE_HOOK(raidframe_ioctl_50_hook, int, 133 (struct raid_softc *, u_long, void *)); 134MODULE_HOOK(raidframe_ioctl_80_hook, int, 135 (struct raid_softc *, u_long, void *)); 136MODULE_HOOK(raidframe_netbsd32_ioctl_hook, int, 137 (struct raid_softc *, u_long, void *)); 138 139/* 140 * puffs compatibility 141 */ 142 143struct puffs_req; 144MODULE_HOOK(puffs_out_50_hook, int, 145 (struct puffs_req *, struct puffs_req **, ssize_t *)); /* outgoing */ 146MODULE_HOOK(puffs_in_50_hook, void, 147 (struct puffs_req *, struct puffs_req *)); /* incoming */ 148 149/* 150 * wsevents compatibility 151 */ 152 153struct wscons_event; 154struct uio; 155MODULE_HOOK(wscons_copyout_events_50_hook, int, 156 (const struct wscons_event *, int, struct uio *)); 157 158/* 159 * sysmon_power compatibility 160 */ 161 162struct power_event; 163struct sysmon_pswitch; 164MODULE_HOOK(compat_sysmon_power_40_hook, void, 165 (struct power_event *, struct sysmon_pswitch *, int)); 166 167/* 168 * compat_bio indirect function pointer 169 */ 170 171MODULE_HOOK(compat_bio_30_hook, int, 172 (void *, u_long, void *, int(*)(void *, u_long, void *))); 173 174/* 175 * vnd_30 ioctl compatibility 176 */ 177struct vattr; 178MODULE_HOOK(compat_vndioctl_30_hook, int, (u_long, struct lwp *, void *, int, 179 struct vattr *, int (*)(struct lwp *, void *, int, struct vattr *))); 180 181/* 182 * vnd_50 ioctl compatibility 183 */ 184struct vattr; 185MODULE_HOOK(compat_vndioctl_50_hook, int, (u_long, struct lwp *, void *, int, 186 struct vattr *, int (*)(struct lwp *, void *, int, struct vattr *))); 187 188/* 189 * ieee80211 ioctl compatibility 190 */ 191struct ieee80211com; 192 193MODULE_HOOK(ieee80211_ioctl_20_hook, int, 194 (struct ieee80211com *, u_long, void *)); 195 196/* 197 * if_43 compatibility 198 */ 199struct socket; 200 201MODULE_HOOK(if_cvtcmd_43_hook, int, (u_long *, u_long)); 202MODULE_HOOK(if_ifioctl_43_hook, int, 203 (struct socket *, u_long, u_long, void *, struct lwp *)); 204 205/* 206 * if43_cvtcmd_20 compatibility 207 */ 208MODULE_HOOK(if43_cvtcmd_20_hook, int, (u_long)); 209 210/* 211 * tty 43 ioctl compatibility 212 */ 213struct tty; 214 215MODULE_HOOK(tty_ttioctl_43_hook, int, 216 (struct tty *, u_long, void *, int, struct lwp *)); 217 218/* 219 * uipc_syscalls_40 compatibility 220 */ 221 222MODULE_HOOK(uipc_syscalls_40_hook, int, (u_long, void *)); 223 224/* 225 * uipc_socket_50 compatibility 226 */ 227struct sockopt; 228struct mbuf; 229 230MODULE_HOOK(uipc_socket_50_setopt1_hook, int, 231 (int, struct socket *, const struct sockopt *)); 232MODULE_HOOK(uipc_socket_50_getopt1_hook, int, 233 (int, struct socket *, struct sockopt *)); 234MODULE_HOOK(uipc_socket_50_sbts_hook, int, (int, struct mbuf ***)); 235 236/* 237 * uipc_syscalls_50 compatibility 238 */ 239 240MODULE_HOOK(uipc_syscalls_50_hook, int, (struct lwp *, u_long, void *)); 241 242/* 243 * rtsock 14 compatibility 244 */ 245struct ifnet; 246struct rt_walkarg; 247struct rt_addrinfo; 248MODULE_HOOK(rtsock_oifmsg_14_hook, void, (struct ifnet *)); 249MODULE_HOOK(rtsock_iflist_14_hook, int, 250 (struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *, size_t)); 251 252/* 253 * Hooks for rtsock_50 254 */ 255 256struct rtentry; 257struct ifaddr; 258MODULE_HOOK(rtsock_oifmsg_50_hook, void, (struct ifnet *)); 259MODULE_HOOK(rtsock_iflist_50_hook, int, 260 (struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *, size_t)); 261MODULE_HOOK(rtsock_rt_missmsg_50_hook, void, 262 (int, const struct rt_addrinfo *, int, int)); 263MODULE_HOOK(rtsock_rt_ifmsg_50_hook, void, (struct ifnet *)); 264MODULE_HOOK(rtsock_rt_addrmsg_rt_50_hook, void, 265 (int, struct ifaddr *, int, struct rtentry *)); 266MODULE_HOOK(rtsock_rt_addrmsg_src_50_hook, void, 267 (int, struct ifaddr *, const struct sockaddr *)); 268MODULE_HOOK(rtsock_rt_addrmsg_50_hook, void, (int, struct ifaddr *)); 269MODULE_HOOK(rtsock_rt_ifannouncemsg_50_hook, void, (struct ifnet *, int)); 270MODULE_HOOK(rtsock_rt_ieee80211msg_50_hook, void, 271 (struct ifnet *, int, void *, size_t)); 272 273/* 274 * Hooks for rtsock_70 275 */ 276struct ifaddr; 277MODULE_HOOK(rtsock_newaddr_70_hook, void, (int, struct ifaddr *)); 278MODULE_HOOK(rtsock_iflist_70_hook, int, 279 (struct rt_walkarg *, struct ifaddr *, struct rt_addrinfo *)); 280 281/* 282 * modctl handler for old style OSTAT 283 */ 284struct iovec; 285MODULE_HOOK(compat_modstat_80_hook, int, (int, struct iovec *, void *)); 286 287/* 288 * mask for kern_sig_43's killpg 289 */ 290extern int kern_sig_43_pgid_mask; 291 292/* 293 * Hooks for kern_proc.c for netbsd32 compat 294 */ 295struct ps_strings; 296MODULE_HOOK(kern_proc32_copyin_hook, int, 297 (struct proc *, struct ps_strings *)); 298MODULE_HOOK(kern_proc32_base_hook, vaddr_t, (char **, size_t)); 299 300/* 301 * Hook to allow sparc fpu code to see if a process is using sunos 302 * emulation, and select proper fup codes 303 */ 304struct emul; 305MODULE_HOOK(get_emul_sunos_hook, int, (const struct emul **)); 306 307/* 308 * Hooks for rnd_ioctl_50 309 */ 310MODULE_HOOK(rnd_ioctl_50_hook, int, (struct file *, u_long, void *)); 311MODULE_HOOK(rnd_ioctl32_50_hook, int, (struct file *, u_long, void *)); 312 313/* 314 * Hooks for compat_60 ttioctl and ptmioctl 315 */ 316MODULE_HOOK(tty_ttioctl_60_hook, int, 317 (struct tty *, u_long, void *, int, struct lwp *)); 318MODULE_HOOK(tty_ptmioctl_60_hook, int, 319 (dev_t, u_long, void *, int, struct lwp *)); 320 321/* 322 * Hook for compat_10 openat 323 */ 324struct pathbuf; 325MODULE_HOOK(vfs_openat_10_hook, int, (struct pathbuf **)); 326 327/* 328 * Hook for compat_70_unp_addsockcred 329 */ 330MODULE_HOOK(uipc_unp_70_hook, struct mbuf *, 331 (struct lwp *, struct mbuf *)); 332 333/* 334 * Hook for sysvipc50 sysctl 335 */ 336#include <sys/sysctl.h> 337MODULE_HOOK(sysvipc_sysctl_50_hook, int, (SYSCTLFN_PROTO)); 338 339/* 340 * ifmedia_80 compatibility 341 */ 342 343struct ifmedia; 344struct ifreq; 345MODULE_HOOK(ifmedia_80_pre_hook, int, (struct ifreq *, u_long *, bool *)); 346MODULE_HOOK(ifmedia_80_post_hook, int, (struct ifreq *, u_long)); 347 348/* 349 * Hook for 32-bit machine name 350 * 351 * This probably would be better placed in compat/netbsd32/netbsd32_mod.c 352 * but the consumer code in linux32_exec_elf32.c is sometimes included in 353 * the main kernel, and not in a compat_netbsd32 module. (In particular, 354 * this is true for i386 and sgimips.) 355 */ 356struct reg; 357MODULE_HOOK(netbsd32_machine32_hook, const char *, (void)); 358MODULE_HOOK(netbsd32_reg_validate_hook, int, 359 (struct lwp *, const struct reg *)); 360#endif /* _SYS_COMPAT_STUB_H */ 361