No empty .Rs/.Re
[netbsd-mini2440.git] / sys / compat / netbsd32 / netbsd32_ioctl.h
blob3ef0026096da624545104bba4be1b11ea92ea3f1
1 /* $NetBSD: netbsd32_ioctl.h,v 1.24 2008/06/23 23:14:42 njoly Exp $ */
3 /*
4 * Copyright (c) 1998, 2001 Matthew R. Green
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
29 /* we define some handy macros here... */
30 #define IOCTL_STRUCT_CONV_TO(cmd, type) \
31 size = IOCPARM_LEN(cmd); \
32 if (size > sizeof(stkbuf)) \
33 data = memp = kmem_alloc(size, KM_SLEEP); \
34 else \
35 data = (void *)stkbuf; \
36 __CONCAT(netbsd32_to_, type)((struct __CONCAT(netbsd32_, type) *) \
37 data32, (struct type *)data, cmd); \
38 error = (*fp->f_ops->fo_ioctl)(fp, cmd, data); \
39 __CONCAT(netbsd32_from_, type)((struct type *)data, \
40 (struct __CONCAT(netbsd32_, type) *)data32, cmd); \
41 break
43 /* from <sys/audioio.h> */
44 #if 0
45 #define AUDIO_WSEEK _IOR('A', 25, u_long)
46 #endif
48 /* from <sys/dkio.h> */
49 typedef netbsd32_pointer_t netbsd32_disklabel_tp_t;
50 typedef netbsd32_pointer_t netbsd32_partition_tp_t;
51 struct netbsd32_partinfo {
52 netbsd32_disklabel_tp_t disklab;
53 netbsd32_partition_tp_t part;
55 #if 1
56 #define DIOCGPART32 _IOW('d', 104, struct netbsd32_partinfo) /* get partition */
57 #endif
59 #if 0 /* not implemented by anything */
60 struct netbsd32_format_op {
61 netbsd32_charp df_buf;
62 int df_count; /* value-result */
63 daddr_t df_startblk;
64 int df_reg[8]; /* result */
66 #define DIOCRFORMAT32 _IOWR('d', 105, struct netbsd32_format_op)
67 #define DIOCWFORMAT32 _IOWR('d', 106, struct netbsd32_format_op)
68 #endif
70 /* can wait! */
71 #if 0
72 dev/ccdvar.h:219:#define CCDIOCSET _IOWR('F', 16, struct ccd_ioctl) /* enable ccd */
73 dev/ccdvar.h:220:#define CCDIOCCLR _IOW('F', 17, struct ccd_ioctl) /* disable ccd */
75 dev/md.h:45:#define MD_GETCONF _IOR('r', 0, struct md_conf) /* get unit config */
76 dev/md.h:46:#define MD_SETCONF _IOW('r', 1, struct md_conf) /* set unit config */
78 dev/wscons/wsconsio.h:133:#define WSKBDIO_GETMAP _IOWR('W', 13, struct wskbd_map_data)
79 dev/wscons/wsconsio.h:134:#define WSKBDIO_SETMAP _IOW('W', 14, struct wskbd_map_data)
81 dev/wscons/wsconsio.h:188:#define WSDISPLAYIO_GETCMAP _IOW('W', 66, struct wsdisplay_cmap)
82 dev/wscons/wsconsio.h:189:#define WSDISPLAYIO_PUTCMAP _IOW('W', 67, struct wsdisplay_cmap)
84 dev/wscons/wsconsio.h:227:#define WSDISPLAYIO_GCURSOR _IOWR('W', 73, struct wsdisplay_cursor)
85 dev/wscons/wsconsio.h:228:#define WSDISPLAYIO_SCURSOR _IOW('W', 74, struct wsdisplay_cursor)
87 dev/wscons/wsconsio.h:241:#define WSDISPLAYIO_SFONT _IOW('W', 77, struct wsdisplay_font)
89 net/bpf.h:127:#define BIOCSETF _IOW('B',103, struct bpf_program)
90 net/bpf.h:138:#define BIOCSTCPF _IOW('B',114, struct bpf_program)
91 net/bpf.h:139:#define BIOCSUDPF _IOW('B',115, struct bpf_program)
92 net/if_ppp.h:110:#define PPPIOCSPASS _IOW('t', 71, struct bpf_program) /* set pass filter */
93 net/if_ppp.h:111:#define PPPIOCSACTIVE _IOW('t', 70, struct bpf_program) /* set active filt */
95 net/if_atm.h:88:#define SIOCATMENA _IOWR('a', 123, struct atm_pseudoioctl) /* enable */
96 net/if_atm.h:89:#define SIOCATMDIS _IOWR('a', 124, struct atm_pseudoioctl) /* disable */
98 net/if_ppp.h:105:#define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data)
100 netccitt/x25.h:157:#define SIOCSIFCONF_X25 _IOW('i', 12, struct ifreq_x25) /* set ifnet config */
101 netccitt/x25.h:158:#define SIOCGIFCONF_X25 _IOWR('i',13, struct ifreq_x25) /* get ifnet config */
103 netinet/ip_fil.h:46:#define SIOCGETFS _IOR('r', 64, struct friostat)
104 netinet/ip_fil.h:56:#define SIOCFRZST _IOWR('r', 74, struct friostat)
106 netinet/ip_fil.h:42:#define SIOCADAFR _IOW('r', 60, struct frentry)
107 netinet/ip_fil.h:43:#define SIOCRMAFR _IOW('r', 61, struct frentry)
108 netinet/ip_fil.h:49:#define SIOCADIFR _IOW('r', 67, struct frentry)
109 netinet/ip_fil.h:50:#define SIOCRMIFR _IOW('r', 68, struct frentry)
110 netinet/ip_fil.h:52:#define SIOCINAFR _IOW('r', 70, struct frentry)
111 netinet/ip_fil.h:53:#define SIOCINIFR _IOW('r', 71, struct frentry)
112 netinet/ip_fil.h:57:#define SIOCZRLST _IOWR('r', 75, struct frentry)
114 netinet/ip_fil.h:78:#define SIOCAUTHW _IOWR(r, 76, struct fr_info)
115 netinet/ip_fil.h:79:#define SIOCAUTHR _IOWR(r, 77, struct fr_info)
117 netinet/ip_fil.h:60:#define SIOCATHST _IOWR('r', 78, struct fr_authstat)
119 netinet/ip_nat.h:22:#define SIOCADNAT _IOW('r', 80, struct ipnat)
120 netinet/ip_nat.h:23:#define SIOCRMNAT _IOW('r', 81, struct ipnat)
122 netinet/ip_nat.h:24:#define SIOCGNATS _IOR('r', 82, struct natstat)
124 netinet/ip_nat.h:25:#define SIOCGNATL _IOWR('r', 83, struct natlookup)
126 netinet/ip_nat.h:26:#define SIOCGFRST _IOR('r', 84, struct ipfrstat)
128 netinet/ip_nat.h:27:#define SIOCGIPST _IOR('r', 85, struct ips_stat)
130 sys/lkm.h:286:#define LMRESERV _IOWR('K', 0, struct lmc_resrv)
132 sys/lkm.h:287:#define LMLOADBUF _IOW('K', 1, struct lmc_loadbuf)
134 sys/lkm.h:291:#define LMLOAD _IOW('K', 9, struct lmc_load)
136 sys/lkm.h:292:#define LMUNLOAD _IOWR('K', 10, struct lmc_unload)
138 sys/lkm.h:293:#define LMSTAT _IOWR('K', 11, struct lmc_stat)
140 sys/rnd.h:186:#define RNDGETPOOL _IOR('R', 103, u_char *) /* get whole pool */
142 sys/scanio.h:86:#define SCIOCGET _IOR('S', 1, struct scan_io) /* retrieve parameters */
143 sys/scanio.h:87:#define SCIOCSET _IOW('S', 2, struct scan_io) /* set parameters */
145 sys/scsiio.h:43:#define SCIOCCOMMAND _IOWR('Q', 1, scsireq_t)
146 #endif
148 /* from <net/if.h> */
150 typedef netbsd32_pointer_t netbsd32_ifreq_tp_t;
152 * note that ifr_data is the only one that needs to be changed
154 struct netbsd32_oifreq {
155 char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
156 union {
157 struct sockaddr ifru_addr;
158 struct sockaddr ifru_dstaddr;
159 struct sockaddr ifru_broadaddr;
160 short ifru_flags;
161 int ifru_metric;
162 int ifru_mtu;
163 int ifru_dlt;
164 u_int ifru_value;
165 netbsd32_caddr_t ifru_data;
166 struct {
167 uint32_t b_buflen;
168 netbsd32_caddr_t b_buf;
169 } ifru_b;
170 } ifr_ifru;
171 #define ifr_addr ifr_ifru.ifru_addr /* address */
172 #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
173 #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
174 #define ifr_flags ifr_ifru.ifru_flags /* flags */
175 #define ifr_metric ifr_ifru.ifru_metric /* metric */
176 #define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
177 #define ifr_media ifr_ifru.ifru_metric /* media options (overload) */
178 #define ifr_data ifr_ifru.ifru_data /* for use by interface */
180 struct netbsd32_ifreq {
181 char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
182 union {
183 struct sockaddr ifru_addr;
184 struct sockaddr ifru_dstaddr;
185 struct sockaddr ifru_broadaddr;
186 struct sockaddr_storage ifru_space;
187 short ifru_flags;
188 int ifru_metric;
189 int ifru_mtu;
190 int ifru_dlt;
191 u_int ifru_value;
192 netbsd32_caddr_t ifru_data;
193 struct {
194 uint32_t b_buflen;
195 netbsd32_caddr_t b_buf;
196 } ifru_b;
197 } ifr_ifru;
199 #if 1
200 /* from <dev/pci/if_devar.h> */
201 #define SIOCGADDRROM32 _IOW('i', 240, struct netbsd32_ifreq) /* get 128 bytes of ROM */
202 #define SIOCGCHIPID32 _IOWR('i', 241, struct netbsd32_ifreq) /* get chipid */
203 /* from <sys/sockio.h> */
204 #define SIOCSIFADDR32 _IOW('i', 12, struct netbsd32_ifreq) /* set ifnet address */
205 #define OSIOCSIFADDR32 _IOW('i', 12, struct netbsd32_oifreq) /* set ifnet address */
206 #define OOSIOCGIFADDR32 _IOWR('i', 13, struct netbsd32_oifreq) /* get ifnet address */
208 #define SIOCGIFADDR32 _IOWR('i', 33, struct netbsd32_ifreq) /* get ifnet address */
209 #define OSIOCGIFADDR32 _IOWR('i', 33, struct netbsd32_oifreq) /* get ifnet address */
211 #define SIOCSIFDSTADDR32 _IOW('i', 14, struct netbsd32_ifreq) /* set p-p address */
212 #define OSIOCSIFDSTADDR32 _IOW('i', 14, struct netbsd32_oifreq) /* set p-p address */
213 #define OOSIOCGIFDSTADDR32 _IOWR('i', 15, struct netbsd32_oifreq) /* get p-p address */
215 #define SIOCGIFDSTADDR32 _IOWR('i', 34, struct netbsd32_ifreq) /* get p-p address */
216 #define OSIOCGIFDSTADDR32 _IOWR('i', 34, struct netbsd32_oifreq) /* get p-p address */
218 #define SIOCSIFFLAGS32 _IOW('i', 16, struct netbsd32_ifreq) /* set ifnet flags */
219 #define OSIOCSIFFLAGS32 _IOW('i', 16, struct netbsd32_oifreq) /* set ifnet flags */
221 #define SIOCGIFFLAGS32 _IOWR('i', 17, struct netbsd32_ifreq) /* get ifnet flags */
222 #define OSIOCGIFFLAGS32 _IOWR('i', 17, struct netbsd32_oifreq) /* get ifnet flags */
225 #define SIOCSIFBRDADDR32 _IOW('i', 19, struct netbsd32_ifreq) /* set broadcast addr */
226 #define OSIOCSIFBRDADDR32 _IOW('i', 19, struct netbsd32_oifreq) /* set broadcast addr */
227 #define OOSIOCGIFBRDADDR32 _IOWR('i', 18, struct netbsd32_oifreq) /* get broadcast addr */
229 #define SIOCGIFBRDADDR32 _IOWR('i', 35, struct netbsd32_ifreq) /* get broadcast addr */
230 #define OSIOCGIFBRDADDR32 _IOWR('i', 35, struct netbsd32_oifreq) /* get broadcast addr */
232 #define OOSIOCGIFNETMASK32 _IOWR('i', 21, struct netbsd32_oifreq) /* get net addr mask */
234 #define SIOCGIFNETMASK32 _IOWR('i', 37, struct netbsd32_ifreq) /* get net addr mask */
235 #define OSIOCGIFNETMASK32 _IOWR('i', 37, struct netbsd32_oifreq) /* get net addr mask */
237 #define SIOCSIFNETMASK32 _IOW('i', 22, struct netbsd32_ifreq) /* set net addr mask */
238 #define OSIOCSIFNETMASK32 _IOW('i', 22, struct netbsd32_oifreq) /* set net addr mask */
240 #define SIOCGIFMETRIC32 _IOWR('i', 23, struct netbsd32_ifreq) /* get IF metric */
241 #define OSIOCGIFMETRIC32 _IOWR('i', 23, struct netbsd32_oifreq) /* get IF metric */
243 #define SIOCSIFMETRIC32 _IOW('i', 24, struct netbsd32_ifreq) /* set IF metric */
244 #define OSIOCSIFMETRIC32 _IOW('i', 24, struct netbsd32_oifreq) /* set IF metric */
246 #define SIOCDIFADDR32 _IOW('i', 25, struct netbsd32_ifreq) /* delete IF addr */
247 #define OSIOCDIFADDR32 _IOW('i', 25, struct netbsd32_oifreq) /* delete IF addr */
249 #define SIOCADDMULTI32 _IOW('i', 49, struct netbsd32_ifreq) /* add m'cast addr */
250 #define OSIOCADDMULTI32 _IOW('i', 49, struct netbsd32_oifreq) /* add m'cast addr */
252 #define SIOCDELMULTI32 _IOW('i', 50, struct netbsd32_ifreq) /* del m'cast addr */
253 #define OSIOCDELMULTI32 _IOW('i', 50, struct netbsd32_oifreq) /* del m'cast addr */
255 #define SIOCSIFMEDIA32 _IOWR('i', 53, struct netbsd32_ifreq) /* set net media */
256 #define OSIOCSIFMEDIA32 _IOWR('i', 53, struct netbsd32_oifreq) /* set net media */
258 #define SIOCSIFMTU32 _IOW('i', 127, struct netbsd32_ifreq) /* set ifnet mtu */
259 #define OSIOCSIFMTU32 _IOW('i', 127, struct netbsd32_oifreq) /* set ifnet mtu */
261 #define SIOCGIFMTU32 _IOWR('i', 126, struct netbsd32_ifreq) /* get ifnet mtu */
262 #define OSIOCGIFMTU32 _IOWR('i', 126, struct netbsd32_oifreq) /* get ifnet mtu */
263 /* was 125 SIOCSIFASYNCMAP32 */
264 /* was 124 SIOCGIFASYNCMAP32 */
265 /* from <net/bpf.h> */
266 #define BIOCGETIF32 _IOR('B',107, struct netbsd32_ifreq)
267 #define BIOCSETIF32 _IOW('B',108, struct netbsd32_ifreq)
268 /* from <netatalk/phase2.h> */
269 #define SIOCPHASE1_32 _IOW('i', 100, struct netbsd32_ifreq) /* AppleTalk phase 1 */
270 #define SIOCPHASE2_32 _IOW('i', 101, struct netbsd32_ifreq) /* AppleTalk phase 2 */
271 #endif
273 /* from <net/if.h> */
274 struct netbsd32_ifconf {
275 int ifc_len; /* size of associated buffer */
276 union {
277 netbsd32_caddr_t ifcu_buf;
278 netbsd32_ifreq_tp_t ifcu_req;
279 } ifc_ifcu;
280 #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
281 #define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */
283 #if 1
284 /* from <sys/sockio.h> */
285 #define OOSIOCGIFCONF32 _IOWR('i', 20, struct netbsd32_ifconf) /* get ifnet list */
286 #define OSIOCGIFCONF32 _IOWR('i', 36, struct netbsd32_ifconf) /* get ifnet list */
287 #define SIOCGIFCONF32 _IOWR('i', 38, struct netbsd32_ifconf) /* get ifnet list */
288 #endif
290 /* from <net/if.h> */
291 struct netbsd32_ifmediareq {
292 char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */
293 int ifm_current; /* current media options */
294 int ifm_mask; /* don't care mask */
295 int ifm_status; /* media status */
296 int ifm_active; /* active options */
297 int ifm_count; /* # entries in ifm_ulist
298 array */
299 netbsd32_intp ifm_ulist; /* media words */
301 #if 1
302 /* from <sys/sockio.h> */
303 #define SIOCGIFMEDIA32 _IOWR('i', 54, struct netbsd32_ifmediareq) /* get net media */
304 #endif
306 /* from <net/if.h> */
307 struct netbsd32_ifdrv {
308 char ifd_name[IFNAMSIZ]; /* if name, e.g. "en0" */
309 netbsd32_u_long ifd_cmd;
310 netbsd32_size_t ifd_len;
311 netbsd32_voidp ifd_data;
313 #if 1
314 /* from <sys/sockio.h> */
315 #define SIOCSDRVSPEC32 _IOW('i', 123, struct netbsd32_ifdrv) /* set driver-specific */
316 #endif
318 /* from <netinet/ip_mroute.h> */
319 struct netbsd32_sioc_vif_req {
320 vifi_t vifi; /* vif number */
321 netbsd32_u_long icount; /* input packet count on vif */
322 netbsd32_u_long ocount; /* output packet count on vif */
323 netbsd32_u_long ibytes; /* input byte count on vif */
324 netbsd32_u_long obytes; /* output byte count on vif */
326 #if 1
327 /* from <sys/sockio.h> */
328 #define SIOCGETVIFCNT32 _IOWR('u', 51, struct netbsd32_sioc_vif_req)/* vif pkt cnt */
329 #endif
331 struct netbsd32_sioc_sg_req {
332 struct in_addr src;
333 struct in_addr grp;
334 u_long pktcnt;
335 u_long bytecnt;
336 u_long wrong_if;
338 #if 1
339 /* from <sys/sockio.h> */
340 #define SIOCGETSGCNT32 _IOWR('u', 52, struct netbsd32_sioc_sg_req) /* sg pkt cnt */
341 #endif