netbsd32_ioctl.h revision 1.77 1 1.77 simonb /* $NetBSD: netbsd32_ioctl.h,v 1.77 2021/01/17 10:50:01 simonb Exp $ */
2 1.1 mrg
3 1.1 mrg /*
4 1.6 mrg * Copyright (c) 1998, 2001 Matthew R. Green
5 1.1 mrg * All rights reserved.
6 1.1 mrg *
7 1.1 mrg * Redistribution and use in source and binary forms, with or without
8 1.1 mrg * modification, are permitted provided that the following conditions
9 1.1 mrg * are met:
10 1.1 mrg * 1. Redistributions of source code must retain the above copyright
11 1.1 mrg * notice, this list of conditions and the following disclaimer.
12 1.1 mrg * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 mrg * notice, this list of conditions and the following disclaimer in the
14 1.1 mrg * documentation and/or other materials provided with the distribution.
15 1.1 mrg *
16 1.1 mrg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 1.1 mrg * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 1.1 mrg * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 1.1 mrg * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 1.1 mrg * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 1.1 mrg * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 1.1 mrg * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 1.1 mrg * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 1.1 mrg * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 1.1 mrg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 1.1 mrg * SUCH DAMAGE.
27 1.1 mrg */
28 1.1 mrg
29 1.26 mrg #include <sys/device.h>
30 1.26 mrg #include <sys/disklabel.h>
31 1.26 mrg #include <sys/disk.h>
32 1.26 mrg
33 1.26 mrg #include <net/zlib.h>
34 1.26 mrg
35 1.26 mrg #include <dev/dkvar.h>
36 1.26 mrg #include <dev/vndvar.h>
37 1.26 mrg
38 1.72 simonb #include <dev/lockstat.h>
39 1.37 macallan #include <dev/wscons/wsconsio.h>
40 1.68 christos #include <net/route.h>
41 1.68 christos #include <netinet/in.h>
42 1.68 christos #include <netinet/ip_mroute.h>
43 1.38 macallan #include <net80211/ieee80211_ioctl.h>
44 1.37 macallan
45 1.74 simonb #include <compat/netbsd32/netbsd32.h>
46 1.74 simonb
47 1.7 mrg /* we define some handy macros here... */
48 1.7 mrg #define IOCTL_STRUCT_CONV_TO(cmd, type) \
49 1.8 mrg size = IOCPARM_LEN(cmd); \
50 1.7 mrg if (size > sizeof(stkbuf)) \
51 1.21 ad data = memp = kmem_alloc(size, KM_SLEEP); \
52 1.7 mrg else \
53 1.18 christos data = (void *)stkbuf; \
54 1.7 mrg __CONCAT(netbsd32_to_, type)((struct __CONCAT(netbsd32_, type) *) \
55 1.8 mrg data32, (struct type *)data, cmd); \
56 1.21 ad error = (*fp->f_ops->fo_ioctl)(fp, cmd, data); \
57 1.7 mrg __CONCAT(netbsd32_from_, type)((struct type *)data, \
58 1.15 mrg (struct __CONCAT(netbsd32_, type) *)data32, cmd); \
59 1.9 mrg break
60 1.16 perry
61 1.28 mrg #define IOCTL_CONV_TO(cmd, type) \
62 1.28 mrg size = IOCPARM_LEN(cmd); \
63 1.28 mrg if (size > sizeof(stkbuf)) \
64 1.28 mrg data = memp = kmem_alloc(size, KM_SLEEP); \
65 1.28 mrg else \
66 1.28 mrg data = (void *)stkbuf; \
67 1.28 mrg __CONCAT(netbsd32_to_, type)((__CONCAT(netbsd32_, type) *) \
68 1.28 mrg data32, (type *)data, cmd); \
69 1.28 mrg error = (*fp->f_ops->fo_ioctl)(fp, cmd, data); \
70 1.28 mrg __CONCAT(netbsd32_from_, type)((type *)data, \
71 1.28 mrg (__CONCAT(netbsd32_, type) *)data32, cmd); \
72 1.28 mrg break
73 1.28 mrg
74 1.1 mrg /* from <sys/audioio.h> */
75 1.28 mrg #define AUDIO_WSEEK32 _IOR('A', 25, netbsd32_u_long)
76 1.1 mrg
77 1.1 mrg /* from <sys/dkio.h> */
78 1.20 dsl typedef netbsd32_pointer_t netbsd32_disklabel_tp_t;
79 1.20 dsl typedef netbsd32_pointer_t netbsd32_partition_tp_t;
80 1.1 mrg
81 1.11 fvdl #if 0 /* not implemented by anything */
82 1.3 mrg struct netbsd32_format_op {
83 1.3 mrg netbsd32_charp df_buf;
84 1.1 mrg int df_count; /* value-result */
85 1.1 mrg daddr_t df_startblk;
86 1.1 mrg int df_reg[8]; /* result */
87 1.1 mrg };
88 1.4 eeh #define DIOCRFORMAT32 _IOWR('d', 105, struct netbsd32_format_op)
89 1.4 eeh #define DIOCWFORMAT32 _IOWR('d', 106, struct netbsd32_format_op)
90 1.1 mrg #endif
91 1.1 mrg
92 1.76 simonb /* from <sys/event.h> */
93 1.76 simonb
94 1.76 simonb struct netbsd32_kfilter_mapping {
95 1.76 simonb netbsd32_charp name; /* name to lookup or return */
96 1.76 simonb netbsd32_size_t len; /* length of name */
97 1.76 simonb uint32_t filter; /* filter to lookup or return */
98 1.76 simonb };
99 1.76 simonb
100 1.76 simonb /* map filter to name (max size len) */
101 1.76 simonb #define KFILTER_BYFILTER32 _IOWR('k', 0, struct netbsd32_kfilter_mapping)
102 1.76 simonb /* map name to filter (len ignored) */
103 1.76 simonb #define KFILTER_BYNAME32 _IOWR('k', 1, struct netbsd32_kfilter_mapping)
104 1.76 simonb
105 1.44 manu /* from <sys/ataio.h> */
106 1.44 manu struct netbsd32_atareq {
107 1.44 manu netbsd32_u_long flags;
108 1.44 manu u_char command;
109 1.44 manu u_char features;
110 1.44 manu u_char sec_count;
111 1.44 manu u_char sec_num;
112 1.44 manu u_char head;
113 1.44 manu u_short cylinder;
114 1.44 manu netbsd32_voidp databuf;
115 1.44 manu netbsd32_u_long datalen;
116 1.44 manu int timeout;
117 1.44 manu u_char retsts;
118 1.44 manu u_char error;
119 1.44 manu };
120 1.44 manu #define ATAIOCCOMMAND32 _IOWR('Q', 8, struct netbsd32_atareq)
121 1.44 manu
122 1.44 manu
123 1.39 bouyer /* from <net/bpf.h> */
124 1.39 bouyer struct netbsd32_bpf_program {
125 1.39 bouyer u_int bf_len;
126 1.39 bouyer netbsd32_pointer_t bf_insns;
127 1.39 bouyer };
128 1.39 bouyer
129 1.39 bouyer struct netbsd32_bpf_dltlist {
130 1.39 bouyer u_int bfl_len;
131 1.39 bouyer netbsd32_pointer_t bfl_list;
132 1.39 bouyer };
133 1.39 bouyer
134 1.39 bouyer #define BIOCSETF32 _IOW('B',103, struct netbsd32_bpf_program)
135 1.39 bouyer #define BIOCSTCPF32 _IOW('B',114, struct netbsd32_bpf_program)
136 1.39 bouyer #define BIOCSUDPF32 _IOW('B',115, struct netbsd32_bpf_program)
137 1.39 bouyer #define BIOCGDLTLIST32 _IOWR('B',119, struct netbsd32_bpf_dltlist)
138 1.65 christos #define BIOCSRTIMEOUT32 _IOW('B',122, struct netbsd32_timeval)
139 1.71 jmcneill #define BIOCSETWF32 _IOW('B',127, struct netbsd32_bpf_program)
140 1.39 bouyer
141 1.39 bouyer
142 1.37 macallan struct netbsd32_wsdisplay_addscreendata {
143 1.37 macallan int idx; /* screen index */
144 1.37 macallan netbsd32_charp screentype;
145 1.37 macallan netbsd32_charp emul;
146 1.37 macallan };
147 1.37 macallan #define WSDISPLAYIO_ADDSCREEN32 _IOW('W', 78, struct netbsd32_wsdisplay_addscreendata)
148 1.37 macallan
149 1.38 macallan /* the first member must be matched with struct ifreq */
150 1.43 christos struct netbsd32_ieee80211req {
151 1.43 christos char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
152 1.43 christos uint16_t i_type; /* req type */
153 1.43 christos int16_t i_val; /* Index or simple value */
154 1.43 christos uint16_t i_len; /* Index or simple value */
155 1.43 christos netbsd32_voidp i_data; /* Extra data */
156 1.43 christos };
157 1.43 christos #define SIOCS8021132 _IOW('i', 244, struct netbsd32_ieee80211req)
158 1.43 christos #define SIOCG8021132 _IOWR('i', 245, struct netbsd32_ieee80211req)
159 1.43 christos
160 1.43 christos /* the first member must be matched with struct ifreq */
161 1.38 macallan struct netbsd32_ieee80211_nwkey {
162 1.38 macallan char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
163 1.38 macallan int i_wepon; /* wep enabled flag */
164 1.38 macallan int i_defkid; /* default encrypt key id */
165 1.38 macallan struct {
166 1.38 macallan int i_keylen;
167 1.38 macallan netbsd32_charp i_keydat;
168 1.38 macallan } i_key[IEEE80211_WEP_NKID];
169 1.38 macallan };
170 1.38 macallan #define SIOCS80211NWKEY32 _IOW('i', 232, struct netbsd32_ieee80211_nwkey)
171 1.38 macallan #define SIOCG80211NWKEY32 _IOWR('i', 233, struct netbsd32_ieee80211_nwkey)
172 1.38 macallan
173 1.40 macallan /* for powerd */
174 1.40 macallan #define POWER_EVENT_RECVDICT32 _IOWR('P', 1, struct netbsd32_plistref)
175 1.40 macallan
176 1.41 macallan /* Colormap operations. Not applicable to all display types. */
177 1.41 macallan struct netbsd32_wsdisplay_cmap {
178 1.41 macallan u_int index; /* first element (0 origin) */
179 1.41 macallan u_int count; /* number of elements */
180 1.41 macallan netbsd32_charp red; /* red color map elements */
181 1.41 macallan netbsd32_charp green; /* green color map elements */
182 1.41 macallan netbsd32_charp blue; /* blue color map elements */
183 1.41 macallan };
184 1.41 macallan
185 1.41 macallan #define WSDISPLAYIO_GETCMAP32 _IOW('W', 66, struct netbsd32_wsdisplay_cmap)
186 1.41 macallan #define WSDISPLAYIO_PUTCMAP32 _IOW('W', 67, struct netbsd32_wsdisplay_cmap)
187 1.41 macallan
188 1.41 macallan struct netbsd32_wsdisplay_cursor {
189 1.41 macallan u_int which; /* values to get/set */
190 1.41 macallan u_int enable; /* enable/disable */
191 1.41 macallan struct wsdisplay_curpos pos; /* position */
192 1.41 macallan struct wsdisplay_curpos hot; /* hot spot */
193 1.41 macallan struct netbsd32_wsdisplay_cmap cmap; /* color map info */
194 1.41 macallan struct wsdisplay_curpos size; /* bit map size */
195 1.41 macallan netbsd32_charp image; /* image data */
196 1.41 macallan netbsd32_charp mask; /* mask data */
197 1.41 macallan };
198 1.41 macallan
199 1.41 macallan /* Cursor control: get/set cursor attributes/shape */
200 1.41 macallan #define WSDISPLAYIO_GCURSOR32 _IOWR('W', 73, struct netbsd32_wsdisplay_cursor)
201 1.41 macallan #define WSDISPLAYIO_SCURSOR32 _IOW('W', 74, struct netbsd32_wsdisplay_cursor)
202 1.41 macallan
203 1.58 macallan struct netbsd32_wsdisplay_font {
204 1.58 macallan netbsd32_charp name;
205 1.58 macallan int firstchar, numchars;
206 1.58 macallan int encoding;
207 1.58 macallan u_int fontwidth, fontheight, stride;
208 1.58 macallan int bitorder, byteorder;
209 1.58 macallan netbsd32_charp data;
210 1.58 macallan };
211 1.58 macallan #define WSDISPLAYIO_LDFONT32 _IOW('W', 77, struct netbsd32_wsdisplay_font)
212 1.58 macallan
213 1.58 macallan struct netbsd32_wsdisplay_usefontdata {
214 1.58 macallan netbsd32_charp name;
215 1.58 macallan };
216 1.58 macallan #define WSDISPLAYIO_SFONT32 _IOW('W', 80, struct netbsd32_wsdisplay_usefontdata)
217 1.58 macallan
218 1.1 mrg /* can wait! */
219 1.1 mrg #if 0
220 1.1 mrg dev/ccdvar.h:219:#define CCDIOCSET _IOWR('F', 16, struct ccd_ioctl) /* enable ccd */
221 1.1 mrg dev/ccdvar.h:220:#define CCDIOCCLR _IOW('F', 17, struct ccd_ioctl) /* disable ccd */
222 1.1 mrg
223 1.1 mrg dev/md.h:45:#define MD_GETCONF _IOR('r', 0, struct md_conf) /* get unit config */
224 1.1 mrg dev/md.h:46:#define MD_SETCONF _IOW('r', 1, struct md_conf) /* set unit config */
225 1.1 mrg
226 1.1 mrg dev/wscons/wsconsio.h:133:#define WSKBDIO_GETMAP _IOWR('W', 13, struct wskbd_map_data)
227 1.1 mrg dev/wscons/wsconsio.h:134:#define WSKBDIO_SETMAP _IOW('W', 14, struct wskbd_map_data)
228 1.1 mrg
229 1.1 mrg dev/wscons/wsconsio.h:188:#define WSDISPLAYIO_GETCMAP _IOW('W', 66, struct wsdisplay_cmap)
230 1.1 mrg dev/wscons/wsconsio.h:189:#define WSDISPLAYIO_PUTCMAP _IOW('W', 67, struct wsdisplay_cmap)
231 1.1 mrg
232 1.1 mrg dev/wscons/wsconsio.h:241:#define WSDISPLAYIO_SFONT _IOW('W', 77, struct wsdisplay_font)
233 1.1 mrg
234 1.1 mrg net/if_ppp.h:110:#define PPPIOCSPASS _IOW('t', 71, struct bpf_program) /* set pass filter */
235 1.1 mrg net/if_ppp.h:111:#define PPPIOCSACTIVE _IOW('t', 70, struct bpf_program) /* set active filt */
236 1.1 mrg
237 1.1 mrg net/if_ppp.h:105:#define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data)
238 1.1 mrg
239 1.28 mrg sys/module.h?
240 1.1 mrg
241 1.1 mrg sys/rnd.h:186:#define RNDGETPOOL _IOR('R', 103, u_char *) /* get whole pool */
242 1.1 mrg
243 1.1 mrg sys/scanio.h:86:#define SCIOCGET _IOR('S', 1, struct scan_io) /* retrieve parameters */
244 1.1 mrg sys/scanio.h:87:#define SCIOCSET _IOW('S', 2, struct scan_io) /* set parameters */
245 1.1 mrg
246 1.1 mrg sys/scsiio.h:43:#define SCIOCCOMMAND _IOWR('Q', 1, scsireq_t)
247 1.1 mrg #endif
248 1.1 mrg
249 1.1 mrg /* from <net/if.h> */
250 1.1 mrg
251 1.23 njoly typedef netbsd32_pointer_t netbsd32_ifreq_tp_t;
252 1.1 mrg /*
253 1.1 mrg * note that ifr_data is the only one that needs to be changed
254 1.1 mrg */
255 1.25 christos struct netbsd32_oifreq {
256 1.1 mrg char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
257 1.1 mrg union {
258 1.1 mrg struct sockaddr ifru_addr;
259 1.1 mrg struct sockaddr ifru_dstaddr;
260 1.1 mrg struct sockaddr ifru_broadaddr;
261 1.1 mrg short ifru_flags;
262 1.1 mrg int ifru_metric;
263 1.1 mrg int ifru_mtu;
264 1.25 christos int ifru_dlt;
265 1.25 christos u_int ifru_value;
266 1.19 christos netbsd32_caddr_t ifru_data;
267 1.25 christos struct {
268 1.25 christos uint32_t b_buflen;
269 1.25 christos netbsd32_caddr_t b_buf;
270 1.25 christos } ifru_b;
271 1.1 mrg } ifr_ifru;
272 1.1 mrg #define ifr_addr ifr_ifru.ifru_addr /* address */
273 1.1 mrg #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
274 1.1 mrg #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
275 1.1 mrg #define ifr_flags ifr_ifru.ifru_flags /* flags */
276 1.1 mrg #define ifr_metric ifr_ifru.ifru_metric /* metric */
277 1.1 mrg #define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
278 1.1 mrg #define ifr_media ifr_ifru.ifru_metric /* media options (overload) */
279 1.1 mrg #define ifr_data ifr_ifru.ifru_data /* for use by interface */
280 1.1 mrg };
281 1.25 christos struct netbsd32_ifreq {
282 1.25 christos char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
283 1.25 christos union {
284 1.25 christos struct sockaddr ifru_addr;
285 1.25 christos struct sockaddr ifru_dstaddr;
286 1.25 christos struct sockaddr ifru_broadaddr;
287 1.25 christos struct sockaddr_storage ifru_space;
288 1.25 christos short ifru_flags;
289 1.25 christos int ifru_metric;
290 1.25 christos int ifru_mtu;
291 1.25 christos int ifru_dlt;
292 1.25 christos u_int ifru_value;
293 1.25 christos netbsd32_caddr_t ifru_data;
294 1.25 christos struct {
295 1.25 christos uint32_t b_buflen;
296 1.25 christos netbsd32_caddr_t b_buf;
297 1.25 christos } ifru_b;
298 1.25 christos } ifr_ifru;
299 1.25 christos };
300 1.30 matt
301 1.30 matt struct netbsd32_if_addrprefreq {
302 1.30 matt char ifap_name[IFNAMSIZ];
303 1.30 matt uint16_t ifap_preference;
304 1.30 matt struct {
305 1.30 matt __uint8_t ss_len; /* address length */
306 1.30 matt sa_family_t ss_family; /* address family */
307 1.30 matt char __ss_pad1[_SS_PAD1SIZE];
308 1.30 matt __int32_t __ss_align[2];
309 1.30 matt char __ss_pad2[_SS_PAD2SIZE];
310 1.30 matt } ifap_addr;
311 1.30 matt };
312 1.30 matt
313 1.45 martin struct netbsd32_if_clonereq {
314 1.45 martin int ifcr_total;
315 1.45 martin int ifcr_count;
316 1.45 martin netbsd32_charp ifcr_buffer;
317 1.45 martin };
318 1.45 martin
319 1.2 mrg /* from <dev/pci/if_devar.h> */
320 1.4 eeh #define SIOCGADDRROM32 _IOW('i', 240, struct netbsd32_ifreq) /* get 128 bytes of ROM */
321 1.4 eeh #define SIOCGCHIPID32 _IOWR('i', 241, struct netbsd32_ifreq) /* get chipid */
322 1.2 mrg /* from <sys/sockio.h> */
323 1.4 eeh #define SIOCSIFADDR32 _IOW('i', 12, struct netbsd32_ifreq) /* set ifnet address */
324 1.25 christos #define OSIOCSIFADDR32 _IOW('i', 12, struct netbsd32_oifreq) /* set ifnet address */
325 1.25 christos #define OOSIOCGIFADDR32 _IOWR('i', 13, struct netbsd32_oifreq) /* get ifnet address */
326 1.25 christos
327 1.4 eeh #define SIOCGIFADDR32 _IOWR('i', 33, struct netbsd32_ifreq) /* get ifnet address */
328 1.25 christos #define OSIOCGIFADDR32 _IOWR('i', 33, struct netbsd32_oifreq) /* get ifnet address */
329 1.25 christos
330 1.4 eeh #define SIOCSIFDSTADDR32 _IOW('i', 14, struct netbsd32_ifreq) /* set p-p address */
331 1.25 christos #define OSIOCSIFDSTADDR32 _IOW('i', 14, struct netbsd32_oifreq) /* set p-p address */
332 1.25 christos #define OOSIOCGIFDSTADDR32 _IOWR('i', 15, struct netbsd32_oifreq) /* get p-p address */
333 1.25 christos
334 1.4 eeh #define SIOCGIFDSTADDR32 _IOWR('i', 34, struct netbsd32_ifreq) /* get p-p address */
335 1.25 christos #define OSIOCGIFDSTADDR32 _IOWR('i', 34, struct netbsd32_oifreq) /* get p-p address */
336 1.25 christos
337 1.4 eeh #define SIOCSIFFLAGS32 _IOW('i', 16, struct netbsd32_ifreq) /* set ifnet flags */
338 1.25 christos #define OSIOCSIFFLAGS32 _IOW('i', 16, struct netbsd32_oifreq) /* set ifnet flags */
339 1.25 christos
340 1.4 eeh #define SIOCGIFFLAGS32 _IOWR('i', 17, struct netbsd32_ifreq) /* get ifnet flags */
341 1.25 christos #define OSIOCGIFFLAGS32 _IOWR('i', 17, struct netbsd32_oifreq) /* get ifnet flags */
342 1.25 christos
343 1.25 christos
344 1.25 christos #define SIOCSIFBRDADDR32 _IOW('i', 19, struct netbsd32_ifreq) /* set broadcast addr */
345 1.25 christos #define OSIOCSIFBRDADDR32 _IOW('i', 19, struct netbsd32_oifreq) /* set broadcast addr */
346 1.25 christos #define OOSIOCGIFBRDADDR32 _IOWR('i', 18, struct netbsd32_oifreq) /* get broadcast addr */
347 1.25 christos
348 1.4 eeh #define SIOCGIFBRDADDR32 _IOWR('i', 35, struct netbsd32_ifreq) /* get broadcast addr */
349 1.25 christos #define OSIOCGIFBRDADDR32 _IOWR('i', 35, struct netbsd32_oifreq) /* get broadcast addr */
350 1.25 christos
351 1.25 christos #define OOSIOCGIFNETMASK32 _IOWR('i', 21, struct netbsd32_oifreq) /* get net addr mask */
352 1.25 christos
353 1.4 eeh #define SIOCGIFNETMASK32 _IOWR('i', 37, struct netbsd32_ifreq) /* get net addr mask */
354 1.25 christos #define OSIOCGIFNETMASK32 _IOWR('i', 37, struct netbsd32_oifreq) /* get net addr mask */
355 1.25 christos
356 1.4 eeh #define SIOCSIFNETMASK32 _IOW('i', 22, struct netbsd32_ifreq) /* set net addr mask */
357 1.25 christos #define OSIOCSIFNETMASK32 _IOW('i', 22, struct netbsd32_oifreq) /* set net addr mask */
358 1.25 christos
359 1.4 eeh #define SIOCGIFMETRIC32 _IOWR('i', 23, struct netbsd32_ifreq) /* get IF metric */
360 1.25 christos #define OSIOCGIFMETRIC32 _IOWR('i', 23, struct netbsd32_oifreq) /* get IF metric */
361 1.25 christos
362 1.4 eeh #define SIOCSIFMETRIC32 _IOW('i', 24, struct netbsd32_ifreq) /* set IF metric */
363 1.25 christos #define OSIOCSIFMETRIC32 _IOW('i', 24, struct netbsd32_oifreq) /* set IF metric */
364 1.25 christos
365 1.4 eeh #define SIOCDIFADDR32 _IOW('i', 25, struct netbsd32_ifreq) /* delete IF addr */
366 1.25 christos #define OSIOCDIFADDR32 _IOW('i', 25, struct netbsd32_oifreq) /* delete IF addr */
367 1.25 christos
368 1.30 matt #define SIOCSIFADDRPREF32 _IOW('i', 31, struct netbsd32_if_addrprefreq)
369 1.30 matt #define SIOCGIFADDRPREF32 _IOWR('i', 32, struct netbsd32_if_addrprefreq)
370 1.30 matt
371 1.4 eeh #define SIOCADDMULTI32 _IOW('i', 49, struct netbsd32_ifreq) /* add m'cast addr */
372 1.25 christos #define OSIOCADDMULTI32 _IOW('i', 49, struct netbsd32_oifreq) /* add m'cast addr */
373 1.25 christos
374 1.4 eeh #define SIOCDELMULTI32 _IOW('i', 50, struct netbsd32_ifreq) /* del m'cast addr */
375 1.25 christos #define OSIOCDELMULTI32 _IOW('i', 50, struct netbsd32_oifreq) /* del m'cast addr */
376 1.25 christos
377 1.67 msaitoh #define SIOCSIFMEDIA32_80 _IOWR('i', 53, struct netbsd32_ifreq) /* set net media */
378 1.67 msaitoh #define SIOCSIFMEDIA32_43 _IOWR('i', 53, struct netbsd32_oifreq) /* set net media */
379 1.67 msaitoh #define SIOCSIFMEDIA32 _IOWR('i', 55, struct netbsd32_ifreq) /* set net media */
380 1.25 christos
381 1.57 jmcneill #define SIOCSIFGENERIC32 _IOW('i', 57, struct netbsd32_ifreq) /* generic IF set op */
382 1.57 jmcneill #define SIOCGIFGENERIC32 _IOWR('i', 58, struct netbsd32_ifreq) /* generic IF get op */
383 1.57 jmcneill
384 1.45 martin #define SIOCIFGCLONERS32 _IOWR('i', 120, struct netbsd32_if_clonereq) /* get cloners */
385 1.45 martin
386 1.4 eeh #define SIOCSIFMTU32 _IOW('i', 127, struct netbsd32_ifreq) /* set ifnet mtu */
387 1.25 christos #define OSIOCSIFMTU32 _IOW('i', 127, struct netbsd32_oifreq) /* set ifnet mtu */
388 1.25 christos
389 1.4 eeh #define SIOCGIFMTU32 _IOWR('i', 126, struct netbsd32_ifreq) /* get ifnet mtu */
390 1.25 christos #define OSIOCGIFMTU32 _IOWR('i', 126, struct netbsd32_oifreq) /* get ifnet mtu */
391 1.12 christos /* was 125 SIOCSIFASYNCMAP32 */
392 1.12 christos /* was 124 SIOCGIFASYNCMAP32 */
393 1.1 mrg /* from <net/bpf.h> */
394 1.4 eeh #define BIOCGETIF32 _IOR('B',107, struct netbsd32_ifreq)
395 1.4 eeh #define BIOCSETIF32 _IOW('B',108, struct netbsd32_ifreq)
396 1.2 mrg /* from <netatalk/phase2.h> */
397 1.4 eeh #define SIOCPHASE1_32 _IOW('i', 100, struct netbsd32_ifreq) /* AppleTalk phase 1 */
398 1.4 eeh #define SIOCPHASE2_32 _IOW('i', 101, struct netbsd32_ifreq) /* AppleTalk phase 2 */
399 1.1 mrg
400 1.1 mrg /* from <net/if.h> */
401 1.3 mrg struct netbsd32_ifconf {
402 1.1 mrg int ifc_len; /* size of associated buffer */
403 1.1 mrg union {
404 1.19 christos netbsd32_caddr_t ifcu_buf;
405 1.3 mrg netbsd32_ifreq_tp_t ifcu_req;
406 1.1 mrg } ifc_ifcu;
407 1.1 mrg #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
408 1.1 mrg #define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */
409 1.1 mrg };
410 1.1 mrg /* from <sys/sockio.h> */
411 1.24 njoly #define OOSIOCGIFCONF32 _IOWR('i', 20, struct netbsd32_ifconf) /* get ifnet list */
412 1.24 njoly #define OSIOCGIFCONF32 _IOWR('i', 36, struct netbsd32_ifconf) /* get ifnet list */
413 1.24 njoly #define SIOCGIFCONF32 _IOWR('i', 38, struct netbsd32_ifconf) /* get ifnet list */
414 1.1 mrg
415 1.1 mrg /* from <net/if.h> */
416 1.3 mrg struct netbsd32_ifmediareq {
417 1.1 mrg char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */
418 1.1 mrg int ifm_current; /* current media options */
419 1.1 mrg int ifm_mask; /* don't care mask */
420 1.1 mrg int ifm_status; /* media status */
421 1.1 mrg int ifm_active; /* active options */
422 1.1 mrg int ifm_count; /* # entries in ifm_ulist
423 1.1 mrg array */
424 1.3 mrg netbsd32_intp ifm_ulist; /* media words */
425 1.1 mrg };
426 1.1 mrg /* from <sys/sockio.h> */
427 1.67 msaitoh #define SIOCGIFMEDIA32_80 _IOWR('i', 54, struct netbsd32_ifmediareq) /* get net media */
428 1.67 msaitoh #define SIOCGIFMEDIA32 _IOWR('i', 56, struct netbsd32_ifmediareq) /* get net media */
429 1.1 mrg
430 1.51 roy /* from net/if_pppoe.h */
431 1.51 roy struct netbsd32_pppoediscparms {
432 1.51 roy char ifname[IFNAMSIZ]; /* pppoe interface name */
433 1.51 roy char eth_ifname[IFNAMSIZ]; /* external ethernet interface name */
434 1.51 roy netbsd32_charp ac_name; /* access concentrator name (or NULL) */
435 1.51 roy netbsd32_size_t ac_name_len; /* on write: length of buffer for ac_name */
436 1.51 roy netbsd32_charp service_name; /* service name (or NULL) */
437 1.51 roy netbsd32_size_t service_name_len; /* on write: length of buffer for service name */
438 1.51 roy };
439 1.51 roy #define PPPOESETPARMS32 _IOW('i', 110, struct netbsd32_pppoediscparms)
440 1.51 roy #define PPPOEGETPARMS32 _IOWR('i', 111, struct netbsd32_pppoediscparms)
441 1.51 roy
442 1.50 roy /* from net/if_sppp.h */
443 1.50 roy struct netbsd32_spppauthcfg {
444 1.50 roy char ifname[IFNAMSIZ]; /* pppoe interface name */
445 1.50 roy u_int hisauth; /* one of SPPP_AUTHPROTO_* above */
446 1.50 roy u_int myauth; /* one of SPPP_AUTHPROTO_* above */
447 1.50 roy u_int myname_length; /* includes terminating 0 */
448 1.50 roy u_int mysecret_length; /* includes terminating 0 */
449 1.50 roy u_int hisname_length; /* includes terminating 0 */
450 1.50 roy u_int hissecret_length; /* includes terminating 0 */
451 1.50 roy u_int myauthflags;
452 1.50 roy u_int hisauthflags;
453 1.50 roy netbsd32_charp myname;
454 1.50 roy netbsd32_charp mysecret;
455 1.50 roy netbsd32_charp hisname;
456 1.50 roy netbsd32_charp hissecret;
457 1.50 roy };
458 1.50 roy #define SPPPGETAUTHCFG32 _IOWR('i', 120, struct netbsd32_spppauthcfg)
459 1.50 roy #define SPPPSETAUTHCFG32 _IOW('i', 121, struct netbsd32_spppauthcfg)
460 1.50 roy
461 1.1 mrg /* from <net/if.h> */
462 1.3 mrg struct netbsd32_ifdrv {
463 1.1 mrg char ifd_name[IFNAMSIZ]; /* if name, e.g. "en0" */
464 1.10 scw netbsd32_u_long ifd_cmd;
465 1.10 scw netbsd32_size_t ifd_len;
466 1.10 scw netbsd32_voidp ifd_data;
467 1.16 perry };
468 1.1 mrg /* from <sys/sockio.h> */
469 1.49 matt #define SIOCSDRVSPEC32 _IOW('i', 123, struct netbsd32_ifdrv) /* set driver-specific */
470 1.49 matt #define SIOCGDRVSPEC32 _IOWR('i', 123, struct netbsd32_ifdrv) /* get driver-specific */
471 1.1 mrg
472 1.1 mrg /* from <netinet/ip_mroute.h> */
473 1.3 mrg struct netbsd32_sioc_vif_req {
474 1.1 mrg vifi_t vifi; /* vif number */
475 1.3 mrg netbsd32_u_long icount; /* input packet count on vif */
476 1.3 mrg netbsd32_u_long ocount; /* output packet count on vif */
477 1.3 mrg netbsd32_u_long ibytes; /* input byte count on vif */
478 1.3 mrg netbsd32_u_long obytes; /* output byte count on vif */
479 1.1 mrg };
480 1.1 mrg /* from <sys/sockio.h> */
481 1.4 eeh #define SIOCGETVIFCNT32 _IOWR('u', 51, struct netbsd32_sioc_vif_req)/* vif pkt cnt */
482 1.1 mrg
483 1.77 simonb /* from <netinet6/nd6.h> */
484 1.77 simonb struct netbsd32_in6_nbrinfo {
485 1.77 simonb char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */
486 1.77 simonb struct in6_addr addr; /* IPv6 address of the neighbor */
487 1.77 simonb netbsd32_long asked; /* number of queries already sent for this addr */
488 1.77 simonb int isrouter; /* if it acts as a router */
489 1.77 simonb int state; /* reachability state */
490 1.77 simonb int expire; /* lifetime for NDP state transition */
491 1.77 simonb };
492 1.77 simonb /* from <netinet6/in6_var.h> */
493 1.77 simonb #define SIOCGNBRINFO_IN632 _IOWR('i', 78, struct netbsd32_in6_nbrinfo)
494 1.77 simonb
495 1.3 mrg struct netbsd32_sioc_sg_req {
496 1.1 mrg struct in_addr src;
497 1.1 mrg struct in_addr grp;
498 1.49 matt netbsd32_u_long pktcnt;
499 1.49 matt netbsd32_u_long bytecnt;
500 1.49 matt netbsd32_u_long wrong_if;
501 1.1 mrg };
502 1.1 mrg /* from <sys/sockio.h> */
503 1.4 eeh #define SIOCGETSGCNT32 _IOWR('u', 52, struct netbsd32_sioc_sg_req) /* sg pkt cnt */
504 1.26 mrg
505 1.75 simonb /* from <dev/ffsvar.h> */
506 1.75 simonb struct netbsd32_fss_set {
507 1.75 simonb netbsd32_charp fss_mount; /* Mount point of file system */
508 1.75 simonb netbsd32_charp fss_bstore; /* Path of backing store */
509 1.75 simonb blksize_t fss_csize; /* Preferred cluster size */
510 1.75 simonb int fss_flags; /* Initial flags */
511 1.75 simonb };
512 1.75 simonb
513 1.75 simonb struct netbsd32_fss_get {
514 1.75 simonb char fsg_mount[MNAMELEN]; /* Mount point of file system */
515 1.75 simonb struct netbsd32_timeval fsg_time; /* Time this snapshot was taken */
516 1.75 simonb blksize_t fsg_csize; /* Current cluster size */
517 1.75 simonb netbsd32_blkcnt_t fsg_mount_size; /* # clusters on file system */
518 1.75 simonb netbsd32_blkcnt_t fsg_bs_size; /* # clusters on backing store */
519 1.75 simonb };
520 1.75 simonb
521 1.75 simonb /* XXX: FSSIOCSET50 and FSSIOCGET50 are not (yet) handled */
522 1.75 simonb #define FSSIOCSET32 _IOW('F', 5, struct netbsd32_fss_set) /* Configure */
523 1.75 simonb #define FSSIOCGET32 _IOR('F', 1, struct netbsd32_fss_get) /* Status */
524 1.75 simonb
525 1.26 mrg struct netbsd32_vnd_ioctl {
526 1.26 mrg netbsd32_charp vnd_file; /* pathname of file to mount */
527 1.26 mrg int vnd_flags; /* flags; see below */
528 1.26 mrg struct vndgeom vnd_geom; /* geometry to emulate */
529 1.26 mrg unsigned int vnd_osize; /* (returned) size of disk */
530 1.74 simonb netbsd32_uint64 vnd_size; /* (returned) size of disk */
531 1.74 simonb };
532 1.26 mrg
533 1.26 mrg struct netbsd32_vnd_user {
534 1.26 mrg int vnu_unit; /* which vnd unit */
535 1.74 simonb netbsd32_dev_t vnu_dev; /* file is on this device... */
536 1.74 simonb netbsd32_ino_t vnu_ino; /* ...at this inode */
537 1.74 simonb };
538 1.26 mrg
539 1.26 mrg /* from <dev/vndvar.h> */
540 1.26 mrg #define VNDIOCSET32 _IOWR('F', 0, struct netbsd32_vnd_ioctl) /* enable disk */
541 1.26 mrg #define VNDIOCCLR32 _IOW('F', 1, struct netbsd32_vnd_ioctl) /* disable disk */
542 1.26 mrg #define VNDIOCGET32 _IOWR('F', 3, struct netbsd32_vnd_user) /* get list */
543 1.27 mrg
544 1.27 mrg struct netbsd32_vnd_ioctl50 {
545 1.27 mrg netbsd32_charp vnd_file; /* pathname of file to mount */
546 1.27 mrg int vnd_flags; /* flags; see below */
547 1.27 mrg struct vndgeom vnd_geom; /* geometry to emulate */
548 1.27 mrg unsigned int vnd_size; /* (returned) size of disk */
549 1.27 mrg } __packed;
550 1.28 mrg /* from <dev/vnd.c> */
551 1.27 mrg #define VNDIOCSET5032 _IOWR('F', 0, struct netbsd32_vnd_ioctl50)
552 1.27 mrg #define VNDIOCCLR5032 _IOW('F', 1, struct netbsd32_vnd_ioctl50)
553 1.29 njoly
554 1.29 njoly #define ENVSYS_GETDICTIONARY32 _IOWR('E', 0, struct netbsd32_plistref)
555 1.29 njoly #define ENVSYS_SETDICTIONARY32 _IOWR('E', 1, struct netbsd32_plistref)
556 1.29 njoly #define ENVSYS_REMOVEPROPS32 _IOWR('E', 2, struct netbsd32_plistref)
557 1.36 bouyer
558 1.36 bouyer /* from <sys/wdog.h> */
559 1.36 bouyer struct netbsd32_wdog_conf {
560 1.36 bouyer netbsd32_charp wc_names;
561 1.36 bouyer int wc_count;
562 1.36 bouyer };
563 1.36 bouyer #define WDOGIOC_GWDOGS32 _IOWR('w', 5, struct netbsd32_wdog_conf)
564 1.42 christos
565 1.42 christos
566 1.42 christos struct netbsd32_clockctl_settimeofday {
567 1.42 christos netbsd32_timevalp_t tv;
568 1.42 christos netbsd32_voidp tzp;
569 1.42 christos };
570 1.42 christos
571 1.42 christos #define CLOCKCTL_SETTIMEOFDAY32 _IOW('C', 0x5, \
572 1.42 christos struct netbsd32_clockctl_settimeofday)
573 1.42 christos
574 1.42 christos struct netbsd32_clockctl_adjtime {
575 1.42 christos netbsd32_timevalp_t delta;
576 1.42 christos netbsd32_timevalp_t olddelta;
577 1.42 christos };
578 1.42 christos
579 1.42 christos #define CLOCKCTL_ADJTIME32 _IOWR('C', 0x6, struct netbsd32_clockctl_adjtime)
580 1.42 christos
581 1.42 christos struct netbsd32_clockctl_clock_settime {
582 1.42 christos netbsd32_clockid_t clock_id;
583 1.42 christos netbsd32_timespecp_t tp;
584 1.42 christos };
585 1.42 christos
586 1.42 christos #define CLOCKCTL_CLOCK_SETTIME32 _IOW('C', 0x7, \
587 1.42 christos struct netbsd32_clockctl_clock_settime)
588 1.42 christos
589 1.42 christos struct netbsd32_clockctl_ntp_adjtime {
590 1.42 christos netbsd32_timexp_t tp;
591 1.55 mlelstv register32_t retval;
592 1.42 christos };
593 1.42 christos
594 1.42 christos #define CLOCKCTL_NTP_ADJTIME32 _IOWR('C', 0x8, \
595 1.42 christos struct netbsd32_clockctl_ntp_adjtime)
596 1.42 christos
597 1.47 matt #ifdef KIOCGSYMBOL
598 1.46 matt struct netbsd32_ksyms_gsymbol {
599 1.46 matt netbsd32_charp kg_name;
600 1.46 matt union {
601 1.48 matt Elf_Sym ku_sym;
602 1.46 matt } _un;
603 1.46 matt };
604 1.46 matt
605 1.46 matt struct netbsd32_ksyms_gvalue {
606 1.46 matt netbsd32_charp kv_name;
607 1.46 matt uint64_t kv_value;
608 1.46 matt };
609 1.46 matt
610 1.46 matt #define KIOCGVALUE32 _IOWR('l', 4, struct netbsd32_ksyms_gvalue)
611 1.46 matt #define KIOCGSYMBOL32 _IOWR('l', 5, struct netbsd32_ksyms_gsymbol)
612 1.47 matt #endif /* KIOCGSYMBOL */
613 1.52 roy
614 1.66 mlelstv #include <net/npf/npf.h>
615 1.66 mlelstv
616 1.66 mlelstv typedef struct netbsd32_npf_ioctl_buf {
617 1.66 mlelstv netbsd32_voidp buf;
618 1.66 mlelstv netbsd32_size_t len;
619 1.66 mlelstv } netbsd32_npf_ioctl_buf_t;
620 1.66 mlelstv
621 1.66 mlelstv typedef struct netbsd32_npf_ioctl_table {
622 1.66 mlelstv int nct_cmd;
623 1.66 mlelstv netbsd32_charp nct_name;
624 1.66 mlelstv union {
625 1.66 mlelstv npf_ioctl_ent_t ent;
626 1.66 mlelstv netbsd32_npf_ioctl_buf_t buf;
627 1.66 mlelstv } nct_data;
628 1.66 mlelstv } netbsd32_npf_ioctl_table_t;
629 1.66 mlelstv
630 1.66 mlelstv #define IOC_NPF_LOAD32 _IOWR('N', 102, netbsd32_nvlist_ref_t)
631 1.66 mlelstv #define IOC_NPF_TABLE32 _IOW('N', 103, struct netbsd32_npf_ioctl_table)
632 1.66 mlelstv #define IOC_NPF_STATS32 _IOW('N', 104, netbsd32_voidp)
633 1.66 mlelstv #define IOC_NPF_SAVE32 _IOR('N', 105, netbsd32_nvlist_ref_t)
634 1.66 mlelstv #define IOC_NPF_RULE32 _IOWR('N', 107, netbsd32_nvlist_ref_t)
635 1.66 mlelstv #define IOC_NPF_CONN_LOOKUP32 _IOWR('N', 108, netbsd32_nvlist_ref_t)
636 1.66 mlelstv
637 1.54 jmcneill /* From sys/drvctlio.h */
638 1.54 jmcneill struct netbsd32_devlistargs {
639 1.54 jmcneill char l_devname[16];
640 1.54 jmcneill netbsd32_charpp l_childname;
641 1.54 jmcneill netbsd32_size_t l_children;
642 1.54 jmcneill };
643 1.54 jmcneill
644 1.54 jmcneill struct netbsd32_devrescanargs {
645 1.54 jmcneill char busname[16];
646 1.54 jmcneill char ifattr[16];
647 1.54 jmcneill unsigned int numlocators;
648 1.54 jmcneill netbsd32_intp locators;
649 1.54 jmcneill };
650 1.54 jmcneill
651 1.54 jmcneill #define DRVRESCANBUS32 _IOW('D', 124, struct netbsd32_devrescanargs)
652 1.54 jmcneill #define DRVCTLCOMMAND32 _IOWR('D', 125, struct netbsd32_plistref)
653 1.54 jmcneill #define DRVLISTDEV32 _IOWR('D', 127, struct netbsd32_devlistargs)
654 1.54 jmcneill #define DRVGETEVENT32 _IOR('D', 128, struct netbsd32_plistref)
655 1.59 mlelstv
656 1.59 mlelstv /* From sys/disk.h, sys/dkio.h */
657 1.59 mlelstv
658 1.59 mlelstv struct netbsd32_dkwedge_list {
659 1.63 jdolecek netbsd32_voidp dkwl_buf; /* storage for dkwedge_info array */
660 1.59 mlelstv netbsd32_size_t dkwl_bufsize; /* size of that buffer */
661 1.59 mlelstv u_int dkwl_nwedges; /* total number of wedges */
662 1.59 mlelstv u_int dkwl_ncopied; /* number actually copied */
663 1.63 jdolecek } __packed;
664 1.59 mlelstv
665 1.59 mlelstv #define DIOCLWEDGES32 _IOWR('d', 124, struct netbsd32_dkwedge_list)
666 1.59 mlelstv
667 1.62 jdolecek struct netbsd32_disk_strategy {
668 1.62 jdolecek char dks_name[DK_STRATEGYNAMELEN]; /* name of strategy */
669 1.62 jdolecek netbsd32_charp dks_param; /* notyet; should be NULL */
670 1.62 jdolecek netbsd32_size_t dks_paramlen; /* notyet; should be 0 */
671 1.62 jdolecek } __packed;
672 1.62 jdolecek
673 1.62 jdolecek #define DIOCGSTRATEGY32 _IOR('d', 125, struct netbsd32_disk_strategy)
674 1.62 jdolecek #define DIOCSSTRATEGY32 _IOW('d', 126, struct netbsd32_disk_strategy)
675 1.68 christos
676 1.72 simonb /* from <dev/lockstat.h> */
677 1.72 simonb struct netbsd32_lsenable {
678 1.72 simonb netbsd32_uintptr_t le_csstart; /* callsite start */
679 1.72 simonb netbsd32_uintptr_t le_csend; /* callsite end */
680 1.72 simonb netbsd32_uintptr_t le_lockstart; /* lock address start */
681 1.72 simonb netbsd32_uintptr_t le_lockend; /* lock address end */
682 1.72 simonb netbsd32_uintptr_t le_nbufs; /* buffers to allocate, 0 = default */
683 1.72 simonb u_int le_flags; /* request flags */
684 1.72 simonb u_int le_mask; /* event mask (LB_*) */
685 1.72 simonb };
686 1.72 simonb
687 1.72 simonb struct netbsd32_lsdisable {
688 1.72 simonb netbsd32_size_t ld_size; /* buffer space allocated */
689 1.72 simonb struct netbsd32_timespec ld_time; /* time spent enabled */
690 1.72 simonb uint64_t ld_freq[64]; /* counter HZ by CPU number */
691 1.73 mrg };
692 1.72 simonb
693 1.72 simonb #define IOC_LOCKSTAT_ENABLE32 _IOW('L', 1, struct netbsd32_lsenable)
694 1.72 simonb #define IOC_LOCKSTAT_DISABLE32 _IOR('L', 2, struct netbsd32_lsdisable)
695 1.72 simonb
696 1.68 christos int netbsd32_drm_ioctl(struct file *, unsigned long, void *, struct lwp *);
697