compat_stub.h revision 1.7
1/* $NetBSD: compat_stub.h,v 1.7 2019/01/29 04:54:42 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 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_30_fill_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_30_copy_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 */ 130 131struct RF_Config_s; 132struct RF_Raid_s; 133MODULE_HOOK(raidframe50_ioctl_hook, int, 134 (int, int, struct RF_Raid_s *, int, void *, struct RF_Config_s **)); 135MODULE_HOOK(raidframe80_ioctl_hook, int, 136 (int, int, struct RF_Raid_s *, int, void *, struct RF_Config_s **)); 137 138/* 139 * puffs compatibility 140 */ 141 142struct puffs_req; 143MODULE_HOOK(puffs_50_out_hook, int, 144 (struct puffs_req *, struct puffs_req **, ssize_t *)); /* outgoing */ 145MODULE_HOOK(puffs_50_in_hook, void, 146 (struct puffs_req *, struct puffs_req *)); /* incoming */ 147 148/* 149 * wsevents compatibility 150 */ 151 152struct wscons_event; 153struct uio; 154MODULE_HOOK(wsevent_50_copyout_events_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_20_ioctl_hook, int, 193 (struct ieee80211com *, u_long, void *)); 194 195/* 196 * if_43 compatibility 197 */ 198struct socket; 199 200MODULE_HOOK(if_43_cvtcmd_hook, int, (u_long *, u_long)); 201MODULE_HOOK(if_43_ifioctl_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(compat_43_ttioctl_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_syscalls_50 compatibility 225 */ 226 227MODULE_HOOK(uipc_syscalls_50_hook, int, (struct lwp *, u_long, void *)); 228 229/* 230 * rtsock 14 compatibility 231 */ 232struct ifnet; 233struct rt_walkarg; 234struct rt_addrinfo; 235MODULE_HOOK(rtsock_14_oifmsg_hook, void, (struct ifnet *)); 236MODULE_HOOK(rtsock_14_iflist_hook, int, 237 (struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *, size_t)); 238 239/* 240 * Hooks for rtsock_50 241 */ 242 243struct rtentry; 244struct ifaddr; 245MODULE_HOOK(rtsock_50_oifmsg_hook, void, (struct ifnet *)); 246MODULE_HOOK(rtsock_50_iflist_hook, int, 247 (struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *, size_t)); 248MODULE_HOOK(rtsock_50_rt_missmsg_hook, void, 249 (int, const struct rt_addrinfo *, int, int)); 250MODULE_HOOK(rtsock_50_rt_ifmsg_hook, void, (struct ifnet *)); 251MODULE_HOOK(rtsock_50_rt_newaddrmsg_hook, void, 252 (int, struct ifaddr *, int, struct rtentry *)); 253MODULE_HOOK(rtsock_50_rt_ifannouncemsg_hook, void, (struct ifnet *, int)); 254MODULE_HOOK(rtsock_50_rt_ieee80211msg_hook, void, 255 (struct ifnet *, int, void *, size_t)); 256 257/* 258 * Hooks for rtsock_70 259 */ 260struct ifaddr; 261MODULE_HOOK(rtsock_70_newaddr_hook, void, (int, struct ifaddr *)); 262MODULE_HOOK(rtsock_70_iflist_hook, int, 263 (struct rt_walkarg *, struct ifaddr *, struct rt_addrinfo *)); 264 265/* 266 * modctl handler for old style OSTAT 267 */ 268struct iovec; 269MODULE_HOOK(compat_modstat_80_hook, int, (int, struct iovec *, void *)); 270 271/* 272 * mask for kern_sig_43's killpg 273 */ 274extern int kern_sig_43_pgid_mask; 275 276/* 277 * Hooks for kern_proc.c for netbsd32 compat 278 */ 279struct ps_strings; 280MODULE_HOOK(kern_proc_32_copyin_hook, int, 281 (struct proc *, struct ps_strings *)); 282MODULE_HOOK(kern_proc_32_base_hook, vaddr_t, (char **, size_t)); 283 284/* 285 * Hook to allow sparc fpu code to see if a process is using sunos 286 * emulation, and select proper fup codes 287 */ 288struct emul; 289MODULE_HOOK(get_emul_sunos_hook, int, (const struct emul **)); 290 291/* 292 * Hooks for rnd_ioctl_50 293 */ 294MODULE_HOOK(rnd_ioctl_50_hook, int, (struct file *, u_long, void *)); 295MODULE_HOOK(rnd_ioctl_50_32_hook, int, (struct file *, u_long, void *)); 296 297/* 298 * Hooks for compat_60 ttioctl and ptmioctl 299 */ 300MODULE_HOOK(compat_60_ttioctl_hook, int, 301 (struct tty *, u_long, void *, int, struct lwp *)); 302MODULE_HOOK(compat_60_ptmioctl_hook, int, 303 (dev_t, u_long, void *, int, struct lwp *)); 304 305/* 306 * Hook for compat_10 openat 307 */ 308struct pathbuf; 309MODULE_HOOK(compat_10_openat_hook, int, (struct pathbuf **)); 310 311/* 312 * Hook for compat_70_unp_addsockcred 313 */ 314struct mbuf; 315MODULE_HOOK(compat_70_unp_hook, struct mbuf *, 316 (struct lwp *, struct mbuf *)); 317 318/* 319 * Hook for sysvipc50 sysctl 320 */ 321#include <sys/sysctl.h> 322MODULE_HOOK(sysvipc50_sysctl_hook, int, (SYSCTLFN_PROTO)); 323 324/* 325 * Hook for 32-bit machine name 326 * 327 * This probably would be better placed in compat/netbsd32/netbsd32_mod.c 328 * but the consumer code in linux32_exec_elf32.c is sometimes included in 329 * the main kernel, and not in a compat_netbsd32 module. (In particular, 330 * this is true for i386 and sgimips.) 331 */ 332MODULE_HOOK(netbsd32_machine32_hook, const char *, (void)); 333#endif /* _SYS_COMPAT_STUB_H */ 334