compat_stub.h revision 1.14
1/* $NetBSD: compat_stub.h,v 1.14 2019/04/29 11:57:22 roy 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 38/* 39 * NOTE: If you make changes here, please remember to update the 40 * kernel version number in sys/param.h to ensure that kernel 41 * and modules stay in sync. 42 */ 43 44/* 45 * Routine hooks for compat_50___sys_ntp_gettime 46 * 47 * MP-hooks not needed since the NTP code is not modular 48 */ 49 50struct ntptimeval; 51struct timex; 52 53extern void (*vec_ntp_gettime)(struct ntptimeval *); 54extern int (*vec_ntp_timestatus)(void); 55extern void (*vec_ntp_adjtime1)(struct timex *); 56 57/* 58MODULE_HOOK(ntp_gettime_hook, int, (struct ntptimeval *)); 59MODULE_HOOK(ntp_timestatus_hook, int, (void); 60MODULE_HOOK(ntp_adjtime1_hook, int, (struct timex *)); 61*/ 62 63/* 64 * Routine hooks for SCTP code - used by rtsock 65 * 66 * MP-hooks not needed since the SCTP code is not modular 67 */ 68struct ifaddr; 69extern void (*vec_sctp_add_ip_address)(struct ifaddr *); 70extern void (*vec_sctp_delete_ip_address)(struct ifaddr *); 71 72/* 73MODULE_HOOK(sctp_add_ip_address, int, struct ifaddr *); 74MODULE_HOOK(sctp_delete_ip_address, int, struct ifaddr *); 75*/ 76 77 78/* 79 * usb devinfo compatibility 80 */ 81 82struct usbd_device; 83struct usb_device_info_old; 84struct usb_event; 85struct usb_event_old; 86struct uio; 87MODULE_HOOK(usb_subr_fill_30_hook, int, 88 (struct usbd_device *, struct usb_device_info_old *, int, 89 void (*)(struct usbd_device *, char *, size_t, char *, size_t, int, int), 90 int (*)(char *, size_t, int))); 91MODULE_HOOK(usb_subr_copy_30_hook, int, 92 (struct usb_event *, struct usb_event_old *, struct uio *)); 93 94/* 95 * Routine vector for dev/ccd ioctl() 96 */ 97 98MODULE_HOOK(ccd_ioctl_60_hook, int, (dev_t, u_long, void *, int, struct lwp *, 99 int (*f)(dev_t, u_long, void *, int, struct lwp *))) 100 101/* 102 * Routine vector for dev/clockctl ioctl() 103 */ 104 105MODULE_HOOK(clockctl_ioctl_50_hook, int, 106 (dev_t, u_long, void *, int, struct lwp *)); 107 108/* 109 * if_sppp device compatibility ioctl subroutine 110 */ 111 112struct sppp; 113MODULE_HOOK(sppp_params_50_hook, int, (struct sppp *, u_long, void *)); 114 115/* 116 * cryptodev compatibility ioctl 117 */ 118 119struct fcrypt; 120struct session_op; 121struct csession; 122struct crypt_op; 123struct crypt_n_op; 124struct kmutex_t; 125MODULE_HOOK(ocryptof_50_hook, int, (struct file *, u_long, void *)); 126 127/* 128 * raidframe compatibility 129 */ 130struct raid_softc; 131MODULE_HOOK(raidframe_ioctl_50_hook, int, 132 (struct raid_softc *, u_long, void *)); 133MODULE_HOOK(raidframe_ioctl_80_hook, int, 134 (struct raid_softc *, u_long, void *)); 135MODULE_HOOK(raidframe_netbsd32_ioctl_hook, int, 136 (struct raid_softc *, u_long, void *)); 137 138/* 139 * puffs compatibility 140 */ 141 142struct puffs_req; 143MODULE_HOOK(puffs_out_50_hook, int, 144 (struct puffs_req *, struct puffs_req **, ssize_t *)); /* outgoing */ 145MODULE_HOOK(puffs_in_50_hook, void, 146 (struct puffs_req *, struct puffs_req *)); /* incoming */ 147 148/* 149 * wsevents compatibility 150 */ 151 152struct wscons_event; 153struct uio; 154MODULE_HOOK(wscons_copyout_events_50_hook, int, 155 (const struct wscons_event *, int, struct uio *)); 156 157/* 158 * sysmon_power compatibility 159 */ 160 161struct power_event; 162struct sysmon_pswitch; 163MODULE_HOOK(compat_sysmon_power_40_hook, void, 164 (struct power_event *, struct sysmon_pswitch *, int)); 165 166/* 167 * compat_bio indirect function pointer 168 */ 169 170MODULE_HOOK(compat_bio_30_hook, int, 171 (void *, u_long, void *, int(*)(void *, u_long, void *))); 172 173/* 174 * vnd_30 ioctl compatibility 175 */ 176struct vattr; 177MODULE_HOOK(compat_vndioctl_30_hook, int, (u_long, struct lwp *, void *, int, 178 struct vattr *, int (*)(struct lwp *, void *, int, struct vattr *))); 179 180/* 181 * vnd_50 ioctl compatibility 182 */ 183struct vattr; 184MODULE_HOOK(compat_vndioctl_50_hook, int, (u_long, struct lwp *, void *, int, 185 struct vattr *, int (*)(struct lwp *, void *, int, struct vattr *))); 186 187/* 188 * ieee80211 ioctl compatibility 189 */ 190struct ieee80211com; 191 192MODULE_HOOK(ieee80211_ioctl_20_hook, int, 193 (struct ieee80211com *, u_long, void *)); 194 195/* 196 * if_43 compatibility 197 */ 198struct socket; 199 200MODULE_HOOK(if_cvtcmd_43_hook, int, (u_long *, u_long)); 201MODULE_HOOK(if_ifioctl_43_hook, int, 202 (struct socket *, u_long, u_long, void *, struct lwp *)); 203 204/* 205 * if43_cvtcmd_20 compatibility 206 */ 207MODULE_HOOK(if43_cvtcmd_20_hook, int, (u_long)); 208 209/* 210 * tty 43 ioctl compatibility 211 */ 212struct tty; 213 214MODULE_HOOK(tty_ttioctl_43_hook, int, 215 (struct tty *, u_long, void *, int, struct lwp *)); 216 217/* 218 * uipc_syscalls_40 compatibility 219 */ 220 221MODULE_HOOK(uipc_syscalls_40_hook, int, (u_long, void *)); 222 223/* 224 * uipc_socket_50 compatibility 225 */ 226struct sockopt; 227struct mbuf; 228 229MODULE_HOOK(uipc_socket_50_setopt1_hook, int, 230 (int, struct socket *, const struct sockopt *)); 231MODULE_HOOK(uipc_socket_50_getopt1_hook, int, 232 (int, struct socket *, struct sockopt *)); 233MODULE_HOOK(uipc_socket_50_sbts_hook, int, (int, struct mbuf **)); 234 235/* 236 * uipc_syscalls_50 compatibility 237 */ 238 239MODULE_HOOK(uipc_syscalls_50_hook, int, (struct lwp *, u_long, void *)); 240 241/* 242 * rtsock 14 compatibility 243 */ 244struct ifnet; 245struct rt_walkarg; 246struct rt_addrinfo; 247MODULE_HOOK(rtsock_oifmsg_14_hook, void, (struct ifnet *)); 248MODULE_HOOK(rtsock_iflist_14_hook, int, 249 (struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *, size_t)); 250 251/* 252 * Hooks for rtsock_50 253 */ 254 255struct rtentry; 256struct ifaddr; 257MODULE_HOOK(rtsock_oifmsg_50_hook, void, (struct ifnet *)); 258MODULE_HOOK(rtsock_iflist_50_hook, int, 259 (struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *, size_t)); 260MODULE_HOOK(rtsock_rt_missmsg_50_hook, void, 261 (int, const struct rt_addrinfo *, int, int)); 262MODULE_HOOK(rtsock_rt_ifmsg_50_hook, void, (struct ifnet *)); 263MODULE_HOOK(rtsock_rt_addrmsg_rt_50_hook, void, 264 (int, struct ifaddr *, int, struct rtentry *)); 265MODULE_HOOK(rtsock_rt_addrmsg_50_hook, void, (int, struct ifaddr *)); 266MODULE_HOOK(rtsock_rt_ifannouncemsg_50_hook, void, (struct ifnet *, int)); 267MODULE_HOOK(rtsock_rt_ieee80211msg_50_hook, void, 268 (struct ifnet *, int, void *, size_t)); 269 270/* 271 * Hooks for rtsock_70 272 */ 273struct ifaddr; 274MODULE_HOOK(rtsock_newaddr_70_hook, void, (int, struct ifaddr *)); 275MODULE_HOOK(rtsock_iflist_70_hook, int, 276 (struct rt_walkarg *, struct ifaddr *, struct rt_addrinfo *)); 277 278/* 279 * modctl handler for old style OSTAT 280 */ 281struct iovec; 282MODULE_HOOK(compat_modstat_80_hook, int, (int, struct iovec *, void *)); 283 284/* 285 * mask for kern_sig_43's killpg 286 */ 287extern int kern_sig_43_pgid_mask; 288 289/* 290 * Hooks for kern_proc.c for netbsd32 compat 291 */ 292struct ps_strings; 293MODULE_HOOK(kern_proc32_copyin_hook, int, 294 (struct proc *, struct ps_strings *)); 295MODULE_HOOK(kern_proc32_base_hook, vaddr_t, (char **, size_t)); 296 297/* 298 * Hook to allow sparc fpu code to see if a process is using sunos 299 * emulation, and select proper fup codes 300 */ 301struct emul; 302MODULE_HOOK(get_emul_sunos_hook, int, (const struct emul **)); 303 304/* 305 * Hooks for rnd_ioctl_50 306 */ 307MODULE_HOOK(rnd_ioctl_50_hook, int, (struct file *, u_long, void *)); 308MODULE_HOOK(rnd_ioctl32_50_hook, int, (struct file *, u_long, void *)); 309 310/* 311 * Hooks for compat_60 ttioctl and ptmioctl 312 */ 313MODULE_HOOK(tty_ttioctl_60_hook, int, 314 (struct tty *, u_long, void *, int, struct lwp *)); 315MODULE_HOOK(tty_ptmioctl_60_hook, int, 316 (dev_t, u_long, void *, int, struct lwp *)); 317 318/* 319 * Hook for compat_10 openat 320 */ 321struct pathbuf; 322MODULE_HOOK(vfs_openat_10_hook, int, (struct pathbuf **)); 323 324/* 325 * Hook for compat_70_unp_addsockcred 326 */ 327MODULE_HOOK(uipc_unp_70_hook, struct mbuf *, 328 (struct lwp *, struct mbuf *)); 329 330/* 331 * Hook for sysvipc50 sysctl 332 */ 333#include <sys/sysctl.h> 334MODULE_HOOK(sysvipc_sysctl_50_hook, int, (SYSCTLFN_PROTO)); 335 336/* 337 * Hook for 32-bit machine name 338 * 339 * This probably would be better placed in compat/netbsd32/netbsd32_mod.c 340 * but the consumer code in linux32_exec_elf32.c is sometimes included in 341 * the main kernel, and not in a compat_netbsd32 module. (In particular, 342 * this is true for i386 and sgimips.) 343 */ 344MODULE_HOOK(netbsd32_machine32_hook, const char *, (void)); 345#endif /* _SYS_COMPAT_STUB_H */ 346