compat_stub.h revision 1.2
1/* $NetBSD: compat_stub.h,v 1.2 2019/01/27 02:08:50 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 * Routine hooks for compat_50___sys_ntp_gettime 40 * 41 * MP-hooks not needed since the NTP code is not modular 42 */ 43 44struct ntptimeval; 45struct timex; 46 47extern void (*vec_ntp_gettime)(struct ntptimeval *); 48extern int (*vec_ntp_timestatus)(void); 49extern void (*vec_ntp_adjtime1)(struct timex *); 50 51/* 52MODULE_HOOK(ntp_gettime_hook, int, (struct ntptimeval *)); 53MODULE_HOOK(ntp_timestatus_hook, int, (void); 54MODULE_HOOK(ntp_adjtime1_hook, int, (struct timex *)); 55*/ 56 57/* 58 * Routine hooks for SCTP code - used by rtsock 59 * 60 * MP-hooks not needed since the SCTP code is not modular 61 */ 62struct ifaddr; 63extern void (*vec_sctp_add_ip_address)(struct ifaddr *); 64extern void (*vec_sctp_delete_ip_address)(struct ifaddr *); 65 66/* 67MODULE_HOOK(sctp_add_ip_address, int, struct ifaddr *); 68MODULE_HOOK(sctp_delete_ip_address, int, struct ifaddr *); 69*/ 70 71 72/* 73 * usb devinfo compatability 74 */ 75 76struct usbd_device; 77struct usb_device_info_old; 78struct usb_event; 79struct usb_event_old; 80struct uio; 81MODULE_HOOK(usb_subr_30_fill_hook, int, 82 (struct usbd_device *, struct usb_device_info_old *, int, 83 void (*)(struct usbd_device *, char *, size_t, char *, size_t, int, int), 84 int (*)(char *, size_t, int))); 85MODULE_HOOK(usb_subr_30_copy_hook, int, 86 (struct usb_event *, struct usb_event_old *, struct uio *)); 87 88/* 89 * Routine vector for dev/ccd ioctl() 90 */ 91 92MODULE_HOOK(ccd_ioctl_60_hook, int, (dev_t, u_long, void *, int, struct lwp *, 93 int (*f)(dev_t, u_long, void *, int, struct lwp *))) 94 95/* 96 * Routine vector for dev/clockctl ioctl() 97 */ 98 99MODULE_HOOK(clockctl_ioctl_50_hook, int, 100 (dev_t, u_long, void *, int, struct lwp *)); 101 102/* 103 * if_sppp device compatability ioctl subroutine 104 */ 105 106struct sppp; 107MODULE_HOOK(sppp_params_50_hook, int, (struct sppp *, u_long, void *)); 108 109/* 110 * cryptodev compatability ioctl 111 */ 112 113struct fcrypt; 114struct session_op; 115struct csession; 116struct crypt_op; 117struct crypt_n_op; 118struct kmutex_t; 119MODULE_HOOK(ocryptof_50_hook, int, (struct file *, u_long, void *)); 120 121/* 122 * raidframe compatability 123 */ 124 125struct RF_Config_s; 126struct RF_Raid_s; 127MODULE_HOOK(raidframe50_ioctl_hook, int, 128 (int, int, struct RF_Raid_s *, int, void *, struct RF_Config_s **)); 129MODULE_HOOK(raidframe80_ioctl_hook, int, 130 (int, int, struct RF_Raid_s *, int, void *, struct RF_Config_s **)); 131 132/* 133 * puffs compatability 134 */ 135 136struct puffs_req; 137MODULE_HOOK(puffs_50_out_hook, int, 138 (struct puffs_req *, struct puffs_req **, ssize_t *)); /* outgoing */ 139MODULE_HOOK(puffs_50_in_hook, void, 140 (struct puffs_req *, struct puffs_req *)); /* incoming */ 141 142/* 143 * wsevents compatability 144 */ 145 146struct wscons_event; 147struct uio; 148MODULE_HOOK(wsevent_50_copyout_events_hook, int, 149 (const struct wscons_event *, int, struct uio *)); 150 151/* 152 * sysmon_power compatability 153 */ 154 155struct power_event; 156struct sysmon_pswitch; 157MODULE_HOOK(compat_sysmon_power_40_hook, void, 158 (struct power_event *, struct sysmon_pswitch *, int)); 159 160/* 161 * compat_bio indirect function pointer 162 */ 163 164MODULE_HOOK(compat_bio_30_hook, int, 165 (void *, u_long, void *, int(*)(void *, u_long, void *))); 166 167/* 168 * vnd_30 ioctl compatability 169 */ 170struct vattr; 171MODULE_HOOK(compat_vndioctl_30_hook, int, (u_long, struct lwp *, void *, int, 172 struct vattr *, int (*)(struct lwp *, void *, int, struct vattr *))); 173 174/* 175 * vnd_50 ioctl compatability 176 */ 177struct vattr; 178MODULE_HOOK(compat_vndioctl_50_hook, int, (u_long, struct lwp *, void *, int, 179 struct vattr *, int (*)(struct lwp *, void *, int, struct vattr *))); 180 181/* 182 * ieee80211 ioctl compatability 183 */ 184struct ieee80211_ostats; 185struct ieee80211_stats; 186 187MODULE_HOOK(ieee80211_ostats_hook, int, 188 (struct ieee80211_ostats *, struct ieee80211_stats *)); 189 190/* 191 * if_43 compatability 192 */ 193struct socket; 194 195MODULE_HOOK(if_43_cvtcmd_hook, int, (u_long *, u_long)); 196MODULE_HOOK(if_43_ifioctl_hook, int, 197 (struct socket *, u_long, u_long, void *, struct lwp *)); 198 199/* 200 * if43_20 compatability 201 */ 202MODULE_HOOK(if43_20_hook, int, (u_long)); 203 204/* 205 * uipc_syscalls_40 compatability 206 */ 207 208MODULE_HOOK(uipc_syscalls_40_hook, int, (u_long, void *)); 209 210/* 211 * uipc_syscalls_50 compatability 212 */ 213 214MODULE_HOOK(uipc_syscalls_50_hook, int, (struct lwp *, u_long, void *)); 215 216/* 217 * rtsock 14 compatability 218 */ 219struct ifnet; 220struct rt_walkarg; 221struct rt_addrinfo; 222MODULE_HOOK(rtsock_14_oifmsg_hook, void, (struct ifnet *)); 223MODULE_HOOK(rtsock_14_iflist_hook, int, 224 (struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *, size_t)); 225 226/* 227 * Hooks for rtsock_50 228 */ 229 230struct rtentry; 231struct ifaddr; 232MODULE_HOOK(rtsock_50_oifmsg_hook, void, (struct ifnet *)); 233MODULE_HOOK(rtsock_50_iflist_hook, int, 234 (struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *, size_t)); 235MODULE_HOOK(rtsock_50_rt_missmsg_hook, void, 236 (int, const struct rt_addrinfo *, int, int)); 237MODULE_HOOK(rtsock_50_rt_ifmsg_hook, void, (struct ifnet *)); 238MODULE_HOOK(rtsock_50_rt_newaddrmsg_hook, void, 239 (int, struct ifaddr *, int, struct rtentry *)); 240MODULE_HOOK(rtsock_50_rt_ifannouncemsg_hook, void, (struct ifnet *, int)); 241MODULE_HOOK(rtsock_50_rt_ieee80211msg_hook, void, 242 (struct ifnet *, int, void *, size_t)); 243 244/* 245 * Hooks for rtsock_70 246 */ 247struct ifaddr; 248MODULE_HOOK(rtsock_70_newaddr_hook, void, (int, struct ifaddr *)); 249MODULE_HOOK(rtsock_70_iflist_hook, int, 250 (struct rt_walkarg *, struct ifaddr *, struct rt_addrinfo *)); 251 252/* 253 * modctl handler for old style OSTAT 254 */ 255struct iovec; 256MODULE_HOOK(compat_modstat_80_hook, int, (int, struct iovec *, void *)); 257 258/* 259 * mask for kern_sig_43's killpg 260 */ 261extern int kern_sig_43_pgid_mask; 262 263/* 264 * Hooks for kern_proc.c for netbsd32 compat 265 */ 266struct ps_strings; 267MODULE_HOOK(kern_proc_32_copyin_hook, int, 268 (struct proc *, struct ps_strings *)); 269MODULE_HOOK(kern_proc_32_base_hook, vaddr_t, (char **, size_t)); 270 271/* 272 * Hook to allow sparc fpu code to see if a process is using sunos 273 * emulation, and select proper fup codes 274 */ 275struct emul; 276MODULE_HOOK(get_emul_sunos_hook, int, (const struct emul **)); 277 278/* 279 * Hooks for rnd_ioctl_50 280 */ 281MODULE_HOOK(rnd_ioctl_50_hook, int, (struct file *, u_long, void *)); 282MODULE_HOOK(rnd_ioctl_50_32_hook, int, (struct file *, u_long, void *)); 283 284/* 285 * Hooks for compat_60 ttioctl and ptmioctl 286 */ 287MODULE_HOOK(compat_60_ttioctl_hook, int, 288 (dev_t, u_long, void *, int, struct lwp *)); 289MODULE_HOOK(compat_60_ptmioctl_hook, int, 290 (dev_t, u_long, void *, int, struct lwp *)); 291 292/* 293 * Hook for compat_10 openat 294 */ 295struct pathbuf; 296MODULE_HOOK(compat_10_openat_hook, int, (struct pathbuf **)); 297 298/* 299 * Hook for compat_70_unp_addsockcred 300 */ 301struct mbuf; 302MODULE_HOOK(compat_70_unp_hook, struct mbuf *, 303 (struct lwp *, struct mbuf *)); 304 305/* 306 * Hook for sysvipc50 sysctl 307 */ 308#include <sys/sysctl.h> 309MODULE_HOOK(sysvipc50_sysctl_hook, int, (SYSCTLFN_PROTO)); 310 311/* 312 * Hook for 32-bit machine name 313 * 314 * This probably would be better placed in compat/netbsd32/netbsd32_mod.c 315 * but the consumer code in linux32_exec_elf32.c is sometimes included in 316 * the main kernel, and not in a compat_netbsd32 module. (In particular, 317 * this is true for i386 and sgimips.) 318 */ 319MODULE_HOOK(netbsd32_machine32_hook, const char *, (void)); 320#endif /* _SYS_COMPAT_STUB_H */ 321