compat_stub.h revision 1.4
1/* $NetBSD: compat_stub.h,v 1.4 2019/01/28 21:13:58 christos 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 ieee80211com;
185
186MODULE_HOOK(ieee80211_20_ioctl_hook, int,
187    (struct ieee80211com *ic, u_long cmd, void *data));
188
189/*
190 * if_43 compatability
191 */
192struct socket;
193
194MODULE_HOOK(if_43_cvtcmd_hook, int, (u_long *, u_long));
195MODULE_HOOK(if_43_ifioctl_hook, int,
196    (struct socket *, u_long, u_long, void *, struct lwp *));
197
198/*
199 * if43_20 compatability
200 */
201MODULE_HOOK(if43_20_hook, int, (u_long));
202
203/*
204 * tty 43 ioctl compatibility
205 */
206struct tty;
207
208MODULE_HOOK(compat_43_ttioctl_hook, int,
209    (struct tty *, u_long, void *, int, struct lwp *));
210
211/*
212 * uipc_syscalls_40 compatability
213 */
214
215MODULE_HOOK(uipc_syscalls_40_hook, int, (u_long, void *));
216
217/*
218 * uipc_syscalls_50 compatability
219 */
220
221MODULE_HOOK(uipc_syscalls_50_hook, int, (struct lwp *, u_long, void *));
222
223/*
224 * rtsock 14 compatability
225 */
226struct ifnet;
227struct rt_walkarg;
228struct rt_addrinfo;
229MODULE_HOOK(rtsock_14_oifmsg_hook, void, (struct ifnet *));
230MODULE_HOOK(rtsock_14_iflist_hook, int,
231    (struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *, size_t));
232
233/*
234 * Hooks for rtsock_50
235 */
236
237struct rtentry;
238struct ifaddr;
239MODULE_HOOK(rtsock_50_oifmsg_hook, void, (struct ifnet *));
240MODULE_HOOK(rtsock_50_iflist_hook, int,
241    (struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *, size_t));
242MODULE_HOOK(rtsock_50_rt_missmsg_hook, void,
243    (int, const struct rt_addrinfo *, int, int));
244MODULE_HOOK(rtsock_50_rt_ifmsg_hook, void, (struct ifnet *));
245MODULE_HOOK(rtsock_50_rt_newaddrmsg_hook, void,
246    (int, struct ifaddr *, int, struct rtentry *));
247MODULE_HOOK(rtsock_50_rt_ifannouncemsg_hook, void, (struct ifnet *, int));
248MODULE_HOOK(rtsock_50_rt_ieee80211msg_hook, void,
249    (struct ifnet *, int, void *, size_t));
250
251/*
252 * Hooks for rtsock_70
253 */
254struct ifaddr;
255MODULE_HOOK(rtsock_70_newaddr_hook, void, (int, struct ifaddr *));
256MODULE_HOOK(rtsock_70_iflist_hook, int,
257    (struct rt_walkarg *, struct ifaddr *, struct rt_addrinfo *));
258
259/*
260 * modctl handler for old style OSTAT
261 */
262struct iovec;
263MODULE_HOOK(compat_modstat_80_hook, int, (int, struct iovec *, void *));
264
265/*
266 * mask for kern_sig_43's killpg
267 */
268extern int kern_sig_43_pgid_mask;
269
270/*
271 * Hooks for kern_proc.c for netbsd32 compat
272 */
273struct ps_strings;
274MODULE_HOOK(kern_proc_32_copyin_hook, int,
275    (struct proc *, struct ps_strings *));
276MODULE_HOOK(kern_proc_32_base_hook, vaddr_t, (char **, size_t));
277
278/*
279 * Hook to allow sparc fpu code to see if a process is using sunos
280 * emulation, and select proper fup codes
281 */
282struct emul;
283MODULE_HOOK(get_emul_sunos_hook, int, (const struct emul **));
284
285/*
286 * Hooks for rnd_ioctl_50
287 */
288MODULE_HOOK(rnd_ioctl_50_hook, int, (struct file *, u_long, void *));
289MODULE_HOOK(rnd_ioctl_50_32_hook, int, (struct file *, u_long, void *));
290
291/*
292 * Hooks for compat_60 ttioctl and ptmioctl
293 */
294MODULE_HOOK(compat_60_ttioctl_hook, int,
295    (struct tty *, u_long, void *, int, struct lwp *));
296MODULE_HOOK(compat_60_ptmioctl_hook, int,
297    (dev_t, u_long, void *, int, struct lwp *));
298
299/*
300 * Hook for compat_10 openat
301 */
302struct pathbuf;
303MODULE_HOOK(compat_10_openat_hook, int, (struct pathbuf **));
304
305/*
306 * Hook for compat_70_unp_addsockcred
307 */
308struct mbuf;
309MODULE_HOOK(compat_70_unp_hook, struct mbuf *,
310    (struct lwp *, struct mbuf *));
311
312/*
313 * Hook for sysvipc50 sysctl
314 */
315#include <sys/sysctl.h>
316MODULE_HOOK(sysvipc50_sysctl_hook, int, (SYSCTLFN_PROTO));
317
318/*
319 * Hook for 32-bit machine name
320 *
321 * This probably would be better placed in compat/netbsd32/netbsd32_mod.c
322 * but the consumer code in linux32_exec_elf32.c is sometimes included in
323 * the main kernel, and not in a compat_netbsd32 module.  (In particular,
324 * this is true for i386 and sgimips.)
325 */
326MODULE_HOOK(netbsd32_machine32_hook, const char *, (void));
327#endif	/* _SYS_COMPAT_STUB_H */
328