| @@ -1,1405 +1,1422 @@ | | | @@ -1,1405 +1,1422 @@ |
1 | /* $NetBSD: netbsd32_ioctl.c,v 1.89 2017/01/14 16:34:44 maya Exp $ */ | | 1 | /* $NetBSD: netbsd32_ioctl.c,v 1.89.8.1 2017/11/27 14:07:53 martin Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1998, 2001 Matthew R. Green | | 4 | * Copyright (c) 1998, 2001 Matthew R. Green |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
15 | * | | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | | 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 | | 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | | 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | | 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 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 | | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
26 | * SUCH DAMAGE. | | 26 | * SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | /* | | 29 | /* |
30 | * handle ioctl conversions from netbsd32 -> 64-bit kernel | | 30 | * handle ioctl conversions from netbsd32 -> 64-bit kernel |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | #include <sys/cdefs.h> | | 33 | #include <sys/cdefs.h> |
34 | __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.89 2017/01/14 16:34:44 maya Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.89.8.1 2017/11/27 14:07:53 martin Exp $"); |
35 | | | 35 | |
36 | #if defined(_KERNEL_OPT) | | 36 | #if defined(_KERNEL_OPT) |
37 | #include "opt_ntp.h" | | 37 | #include "opt_ntp.h" |
38 | #endif | | 38 | #endif |
39 | | | 39 | |
40 | #include <sys/param.h> | | 40 | #include <sys/param.h> |
41 | #include <sys/systm.h> | | 41 | #include <sys/systm.h> |
42 | #include <sys/filedesc.h> | | 42 | #include <sys/filedesc.h> |
43 | #include <sys/ioctl.h> | | 43 | #include <sys/ioctl.h> |
44 | #include <sys/file.h> | | 44 | #include <sys/file.h> |
45 | #include <sys/proc.h> | | 45 | #include <sys/proc.h> |
46 | #include <sys/socketvar.h> | | 46 | #include <sys/socketvar.h> |
47 | #include <sys/audioio.h> | | 47 | #include <sys/audioio.h> |
48 | #include <sys/disklabel.h> | | 48 | #include <sys/disklabel.h> |
49 | #include <sys/dkio.h> | | 49 | #include <sys/dkio.h> |
50 | #include <sys/ataio.h> | | 50 | #include <sys/ataio.h> |
51 | #include <sys/sockio.h> | | 51 | #include <sys/sockio.h> |
52 | #include <sys/socket.h> | | 52 | #include <sys/socket.h> |
53 | #include <sys/ttycom.h> | | 53 | #include <sys/ttycom.h> |
54 | #include <sys/mount.h> | | 54 | #include <sys/mount.h> |
55 | #include <sys/syscallargs.h> | | 55 | #include <sys/syscallargs.h> |
56 | #include <sys/ktrace.h> | | 56 | #include <sys/ktrace.h> |
57 | #include <sys/kmem.h> | | 57 | #include <sys/kmem.h> |
58 | #include <sys/envsys.h> | | 58 | #include <sys/envsys.h> |
59 | #include <sys/wdog.h> | | 59 | #include <sys/wdog.h> |
60 | #include <sys/clockctl.h> | | 60 | #include <sys/clockctl.h> |
61 | #include <sys/exec_elf.h> | | 61 | #include <sys/exec_elf.h> |
62 | #include <sys/ksyms.h> | | 62 | #include <sys/ksyms.h> |
63 | #include <sys/drvctlio.h> | | 63 | #include <sys/drvctlio.h> |
64 | | | 64 | |
65 | #ifdef __sparc__ | | 65 | #ifdef __sparc__ |
66 | #include <dev/sun/fbio.h> | | 66 | #include <dev/sun/fbio.h> |
67 | #include <machine/openpromio.h> | | 67 | #include <machine/openpromio.h> |
68 | #endif | | 68 | #endif |
69 | | | 69 | |
70 | #include <net/if.h> | | 70 | #include <net/if.h> |
71 | #include <net/route.h> | | 71 | #include <net/route.h> |
72 | | | 72 | |
73 | #include <net/if_pppoe.h> | | 73 | #include <net/if_pppoe.h> |
74 | #include <net/if_sppp.h> | | 74 | #include <net/if_sppp.h> |
75 | | | 75 | |
76 | #include <net/npf/npf.h> | | 76 | #include <net/npf/npf.h> |
77 | | | 77 | |
78 | #include <net/bpf.h> | | 78 | #include <net/bpf.h> |
79 | #include <netinet/in.h> | | 79 | #include <netinet/in.h> |
80 | #include <netinet/in_var.h> | | 80 | #include <netinet/in_var.h> |
81 | #include <netinet/igmp.h> | | 81 | #include <netinet/igmp.h> |
82 | #include <netinet/igmp_var.h> | | 82 | #include <netinet/igmp_var.h> |
83 | #include <netinet/ip_mroute.h> | | 83 | #include <netinet/ip_mroute.h> |
84 | | | 84 | |
85 | #include <compat/sys/sockio.h> | | 85 | #include <compat/sys/sockio.h> |
86 | | | 86 | |
87 | #include <compat/netbsd32/netbsd32.h> | | 87 | #include <compat/netbsd32/netbsd32.h> |
88 | #include <compat/netbsd32/netbsd32_ioctl.h> | | 88 | #include <compat/netbsd32/netbsd32_ioctl.h> |
89 | #include <compat/netbsd32/netbsd32_syscallargs.h> | | 89 | #include <compat/netbsd32/netbsd32_syscallargs.h> |
90 | #include <compat/netbsd32/netbsd32_conv.h> | | 90 | #include <compat/netbsd32/netbsd32_conv.h> |
91 | | | 91 | |
92 | #include <dev/vndvar.h> | | 92 | #include <dev/vndvar.h> |
93 | | | 93 | |
94 | /* convert to/from different structures */ | | 94 | /* convert to/from different structures */ |
95 | | | 95 | |
96 | #if 0 | | 96 | #if 0 |
97 | static inline void | | 97 | static inline void |
98 | netbsd32_to_format_op(struct netbsd32_format_op *s32p, struct format_op *p, u_long cmd) | | 98 | netbsd32_to_format_op(struct netbsd32_format_op *s32p, struct format_op *p, u_long cmd) |
99 | { | | 99 | { |
100 | | | 100 | |
101 | p->df_buf = (char *)NETBSD32PTR64(s32p->df_buf); | | 101 | p->df_buf = (char *)NETBSD32PTR64(s32p->df_buf); |
102 | p->df_count = s32p->df_count; | | 102 | p->df_count = s32p->df_count; |
103 | p->df_startblk = s32p->df_startblk; | | 103 | p->df_startblk = s32p->df_startblk; |
104 | memcpy(p->df_reg, s32p->df_reg, sizeof(s32p->df_reg)); | | 104 | memcpy(p->df_reg, s32p->df_reg, sizeof(s32p->df_reg)); |
105 | } | | 105 | } |
106 | #endif | | 106 | #endif |
107 | | | 107 | |
108 | static inline void | | 108 | static inline void |
109 | netbsd32_to_ifreq(struct netbsd32_ifreq *s32p, struct ifreq *p, u_long cmd) | | 109 | netbsd32_to_ifreq(struct netbsd32_ifreq *s32p, struct ifreq *p, u_long cmd) |
110 | { | | 110 | { |
111 | | | 111 | |
112 | memcpy(p, s32p, sizeof *s32p); | | 112 | memcpy(p, s32p, sizeof *s32p); |
113 | /* | | 113 | /* |
114 | * XXX | | 114 | * XXX |
115 | * struct ifreq says the same, but sometimes the ifr_data | | 115 | * struct ifreq says the same, but sometimes the ifr_data |
116 | * union member needs to be converted to 64 bits... this | | 116 | * union member needs to be converted to 64 bits... this |
117 | * is very driver specific and so we ignore it for now.. | | 117 | * is very driver specific and so we ignore it for now.. |
118 | */ | | 118 | */ |
119 | if (cmd == SIOCGIFDATA || cmd == SIOCZIFDATA) | | 119 | switch (cmd) { |
| | | 120 | case SIOCGIFDATA: |
| | | 121 | case SIOCZIFDATA: |
| | | 122 | case SIOCGIFGENERIC: |
| | | 123 | case SIOCSIFGENERIC: |
120 | p->ifr_data = (void *)NETBSD32PTR64(s32p->ifr_data); | | 124 | p->ifr_data = (void *)NETBSD32PTR64(s32p->ifr_data); |
| | | 125 | break; |
| | | 126 | } |
121 | } | | 127 | } |
122 | | | 128 | |
123 | static inline void | | 129 | static inline void |
124 | netbsd32_to_oifreq(struct netbsd32_oifreq *s32p, struct oifreq *p, u_long cmd) | | 130 | netbsd32_to_oifreq(struct netbsd32_oifreq *s32p, struct oifreq *p, u_long cmd) |
125 | { | | 131 | { |
126 | | | 132 | |
127 | memcpy(p, s32p, sizeof *s32p); | | 133 | memcpy(p, s32p, sizeof *s32p); |
128 | /* | | 134 | /* |
129 | * XXX | | 135 | * XXX |
130 | * struct ifreq says the same, but sometimes the ifr_data | | 136 | * struct ifreq says the same, but sometimes the ifr_data |
131 | * union member needs to be converted to 64 bits... this | | 137 | * union member needs to be converted to 64 bits... this |
132 | * is very driver specific and so we ignore it for now.. | | 138 | * is very driver specific and so we ignore it for now.. |
133 | */ | | 139 | */ |
134 | if (cmd == SIOCGIFDATA || cmd == SIOCZIFDATA) | | 140 | if (cmd == SIOCGIFDATA || cmd == SIOCZIFDATA) |
135 | p->ifr_data = (void *)NETBSD32PTR64(s32p->ifr_data); | | 141 | p->ifr_data = (void *)NETBSD32PTR64(s32p->ifr_data); |
136 | } | | 142 | } |
137 | | | 143 | |
138 | static inline void | | 144 | static inline void |
139 | netbsd32_to_if_addrprefreq(const struct netbsd32_if_addrprefreq *ifap32, | | 145 | netbsd32_to_if_addrprefreq(const struct netbsd32_if_addrprefreq *ifap32, |
140 | struct if_addrprefreq *ifap, u_long cmd) | | 146 | struct if_addrprefreq *ifap, u_long cmd) |
141 | { | | 147 | { |
142 | strlcpy(ifap->ifap_name, ifap32->ifap_name, sizeof(ifap->ifap_name)); | | 148 | strlcpy(ifap->ifap_name, ifap32->ifap_name, sizeof(ifap->ifap_name)); |
143 | ifap->ifap_preference = ifap32->ifap_preference; | | 149 | ifap->ifap_preference = ifap32->ifap_preference; |
144 | memcpy(&ifap->ifap_addr, &ifap32->ifap_addr, | | 150 | memcpy(&ifap->ifap_addr, &ifap32->ifap_addr, |
145 | min(ifap32->ifap_addr.ss_len, _SS_MAXSIZE)); | | 151 | min(ifap32->ifap_addr.ss_len, _SS_MAXSIZE)); |
146 | } | | 152 | } |
147 | | | 153 | |
148 | static inline void | | 154 | static inline void |
149 | netbsd32_to_ifconf(struct netbsd32_ifconf *s32p, struct ifconf *p, u_long cmd) | | 155 | netbsd32_to_ifconf(struct netbsd32_ifconf *s32p, struct ifconf *p, u_long cmd) |
150 | { | | 156 | { |
151 | | | 157 | |
152 | p->ifc_len = s32p->ifc_len; | | 158 | p->ifc_len = s32p->ifc_len; |
153 | /* ifc_buf & ifc_req are the same size so this works */ | | 159 | /* ifc_buf & ifc_req are the same size so this works */ |
154 | p->ifc_buf = (void *)NETBSD32PTR64(s32p->ifc_buf); | | 160 | p->ifc_buf = (void *)NETBSD32PTR64(s32p->ifc_buf); |
155 | } | | 161 | } |
156 | | | 162 | |
157 | static inline void | | 163 | static inline void |
158 | netbsd32_to_ifmediareq(struct netbsd32_ifmediareq *s32p, struct ifmediareq *p, u_long cmd) | | 164 | netbsd32_to_ifmediareq(struct netbsd32_ifmediareq *s32p, struct ifmediareq *p, u_long cmd) |
159 | { | | 165 | { |
160 | | | 166 | |
161 | memcpy(p, s32p, sizeof *s32p); | | 167 | memcpy(p, s32p, sizeof *s32p); |
162 | p->ifm_ulist = (int *)NETBSD32PTR64(s32p->ifm_ulist); | | 168 | p->ifm_ulist = (int *)NETBSD32PTR64(s32p->ifm_ulist); |
163 | } | | 169 | } |
164 | | | 170 | |
165 | static inline void | | 171 | static inline void |
166 | netbsd32_to_pppoediscparms(struct netbsd32_pppoediscparms *s32p, | | 172 | netbsd32_to_pppoediscparms(struct netbsd32_pppoediscparms *s32p, |
167 | struct pppoediscparms *p, u_long cmd) | | 173 | struct pppoediscparms *p, u_long cmd) |
168 | { | | 174 | { |
169 | | | 175 | |
170 | memcpy(p->ifname, s32p->ifname, sizeof p->ifname); | | 176 | memcpy(p->ifname, s32p->ifname, sizeof p->ifname); |
171 | memcpy(p->eth_ifname, s32p->eth_ifname, sizeof p->eth_ifname); | | 177 | memcpy(p->eth_ifname, s32p->eth_ifname, sizeof p->eth_ifname); |
172 | p->ac_name = (char *)NETBSD32PTR64(s32p->ac_name); | | 178 | p->ac_name = (char *)NETBSD32PTR64(s32p->ac_name); |
173 | p->ac_name_len = s32p->ac_name_len; | | 179 | p->ac_name_len = s32p->ac_name_len; |
174 | p->service_name = (char *)NETBSD32PTR64(s32p->service_name); | | 180 | p->service_name = (char *)NETBSD32PTR64(s32p->service_name); |
175 | p->service_name_len = s32p->service_name_len; | | 181 | p->service_name_len = s32p->service_name_len; |
176 | } | | 182 | } |
177 | | | 183 | |
178 | static inline void | | 184 | static inline void |
179 | netbsd32_to_spppauthcfg(struct netbsd32_spppauthcfg *s32p, | | 185 | netbsd32_to_spppauthcfg(struct netbsd32_spppauthcfg *s32p, |
180 | struct spppauthcfg *p, u_long cmd) | | 186 | struct spppauthcfg *p, u_long cmd) |
181 | { | | 187 | { |
182 | | | 188 | |
183 | memcpy(p->ifname, s32p->ifname, sizeof p->ifname); | | 189 | memcpy(p->ifname, s32p->ifname, sizeof p->ifname); |
184 | p->hisauth = s32p->hisauth; | | 190 | p->hisauth = s32p->hisauth; |
185 | p->myauth = s32p->myauth; | | 191 | p->myauth = s32p->myauth; |
186 | p->myname_length = s32p->myname_length; | | 192 | p->myname_length = s32p->myname_length; |
187 | p->mysecret_length = s32p->mysecret_length; | | 193 | p->mysecret_length = s32p->mysecret_length; |
188 | p->hisname_length = s32p->hisname_length; | | 194 | p->hisname_length = s32p->hisname_length; |
189 | p->hissecret_length = s32p->hissecret_length; | | 195 | p->hissecret_length = s32p->hissecret_length; |
190 | p->myauthflags = s32p->myauthflags; | | 196 | p->myauthflags = s32p->myauthflags; |
191 | p->hisauthflags = s32p->hisauthflags; | | 197 | p->hisauthflags = s32p->hisauthflags; |
192 | p->myname = (char *)NETBSD32PTR64(s32p->myname); | | 198 | p->myname = (char *)NETBSD32PTR64(s32p->myname); |
193 | p->mysecret = (char *)NETBSD32PTR64(s32p->mysecret); | | 199 | p->mysecret = (char *)NETBSD32PTR64(s32p->mysecret); |
194 | p->hisname = (char *)NETBSD32PTR64(s32p->hisname); | | 200 | p->hisname = (char *)NETBSD32PTR64(s32p->hisname); |
195 | p->hissecret = (char *)NETBSD32PTR64(s32p->hissecret); | | 201 | p->hissecret = (char *)NETBSD32PTR64(s32p->hissecret); |
196 | } | | 202 | } |
197 | | | 203 | |
198 | static inline void | | 204 | static inline void |
199 | netbsd32_to_ifdrv(struct netbsd32_ifdrv *s32p, struct ifdrv *p, u_long cmd) | | 205 | netbsd32_to_ifdrv(struct netbsd32_ifdrv *s32p, struct ifdrv *p, u_long cmd) |
200 | { | | 206 | { |
201 | | | 207 | |
202 | memcpy(p->ifd_name, s32p->ifd_name, sizeof p->ifd_name); | | 208 | memcpy(p->ifd_name, s32p->ifd_name, sizeof p->ifd_name); |
203 | p->ifd_cmd = s32p->ifd_cmd; | | 209 | p->ifd_cmd = s32p->ifd_cmd; |
204 | p->ifd_len = s32p->ifd_len; | | 210 | p->ifd_len = s32p->ifd_len; |
205 | p->ifd_data = (void *)NETBSD32PTR64(s32p->ifd_data); | | 211 | p->ifd_data = (void *)NETBSD32PTR64(s32p->ifd_data); |
206 | } | | 212 | } |
207 | | | 213 | |
208 | static inline void | | 214 | static inline void |
209 | netbsd32_to_sioc_vif_req(struct netbsd32_sioc_vif_req *s32p, struct sioc_vif_req *p, u_long cmd) | | 215 | netbsd32_to_sioc_vif_req(struct netbsd32_sioc_vif_req *s32p, struct sioc_vif_req *p, u_long cmd) |
210 | { | | 216 | { |
211 | | | 217 | |
212 | p->vifi = s32p->vifi; | | 218 | p->vifi = s32p->vifi; |
213 | p->icount = (u_long)s32p->icount; | | 219 | p->icount = (u_long)s32p->icount; |
214 | p->ocount = (u_long)s32p->ocount; | | 220 | p->ocount = (u_long)s32p->ocount; |
215 | p->ibytes = (u_long)s32p->ibytes; | | 221 | p->ibytes = (u_long)s32p->ibytes; |
216 | p->obytes = (u_long)s32p->obytes; | | 222 | p->obytes = (u_long)s32p->obytes; |
217 | } | | 223 | } |
218 | | | 224 | |
219 | static inline void | | 225 | static inline void |
220 | netbsd32_to_sioc_sg_req(struct netbsd32_sioc_sg_req *s32p, struct sioc_sg_req *p, u_long cmd) | | 226 | netbsd32_to_sioc_sg_req(struct netbsd32_sioc_sg_req *s32p, struct sioc_sg_req *p, u_long cmd) |
221 | { | | 227 | { |
222 | | | 228 | |
223 | p->src = s32p->src; | | 229 | p->src = s32p->src; |
224 | p->grp = s32p->grp; | | 230 | p->grp = s32p->grp; |
225 | p->pktcnt = (u_long)s32p->pktcnt; | | 231 | p->pktcnt = (u_long)s32p->pktcnt; |
226 | p->bytecnt = (u_long)s32p->bytecnt; | | 232 | p->bytecnt = (u_long)s32p->bytecnt; |
227 | p->wrong_if = (u_long)s32p->wrong_if; | | 233 | p->wrong_if = (u_long)s32p->wrong_if; |
228 | } | | 234 | } |
229 | | | 235 | |
230 | static inline void | | 236 | static inline void |
231 | netbsd32_to_atareq(struct netbsd32_atareq *s32p, struct atareq *p, u_long cmd) | | 237 | netbsd32_to_atareq(struct netbsd32_atareq *s32p, struct atareq *p, u_long cmd) |
232 | { | | 238 | { |
233 | p->flags = (u_long)s32p->flags; | | 239 | p->flags = (u_long)s32p->flags; |
234 | p->command = s32p->command; | | 240 | p->command = s32p->command; |
235 | p->features = s32p->features; | | 241 | p->features = s32p->features; |
236 | p->sec_count = s32p->sec_count; | | 242 | p->sec_count = s32p->sec_count; |
237 | p->sec_num = s32p->sec_num; | | 243 | p->sec_num = s32p->sec_num; |
238 | p->head = s32p->head; | | 244 | p->head = s32p->head; |
239 | p->cylinder = s32p->cylinder; | | 245 | p->cylinder = s32p->cylinder; |
240 | p->databuf = (char *)NETBSD32PTR64(s32p->databuf); | | 246 | p->databuf = (char *)NETBSD32PTR64(s32p->databuf); |
241 | p->datalen = (u_long)s32p->datalen; | | 247 | p->datalen = (u_long)s32p->datalen; |
242 | p->timeout = s32p->timeout; | | 248 | p->timeout = s32p->timeout; |
243 | p->retsts = s32p->retsts; | | 249 | p->retsts = s32p->retsts; |
244 | p->error = s32p->error; | | 250 | p->error = s32p->error; |
245 | } | | 251 | } |
246 | | | 252 | |
247 | static inline void | | 253 | static inline void |
248 | netbsd32_to_vnd_ioctl(struct netbsd32_vnd_ioctl *s32p, struct vnd_ioctl *p, u_long cmd) | | 254 | netbsd32_to_vnd_ioctl(struct netbsd32_vnd_ioctl *s32p, struct vnd_ioctl *p, u_long cmd) |
249 | { | | 255 | { |
250 | | | 256 | |
251 | p->vnd_file = (char *)NETBSD32PTR64(s32p->vnd_file); | | 257 | p->vnd_file = (char *)NETBSD32PTR64(s32p->vnd_file); |
252 | p->vnd_flags = s32p->vnd_flags; | | 258 | p->vnd_flags = s32p->vnd_flags; |
253 | p->vnd_geom = s32p->vnd_geom; | | 259 | p->vnd_geom = s32p->vnd_geom; |
254 | p->vnd_osize = s32p->vnd_osize; | | 260 | p->vnd_osize = s32p->vnd_osize; |
255 | p->vnd_size = s32p->vnd_size; | | 261 | p->vnd_size = s32p->vnd_size; |
256 | } | | 262 | } |
257 | | | 263 | |
258 | static inline void | | 264 | static inline void |
259 | netbsd32_to_vnd_user(struct netbsd32_vnd_user *s32p, struct vnd_user *p, u_long cmd) | | 265 | netbsd32_to_vnd_user(struct netbsd32_vnd_user *s32p, struct vnd_user *p, u_long cmd) |
260 | { | | 266 | { |
261 | | | 267 | |
262 | p->vnu_unit = s32p->vnu_unit; | | 268 | p->vnu_unit = s32p->vnu_unit; |
263 | p->vnu_dev = s32p->vnu_dev; | | 269 | p->vnu_dev = s32p->vnu_dev; |
264 | p->vnu_ino = s32p->vnu_ino; | | 270 | p->vnu_ino = s32p->vnu_ino; |
265 | } | | 271 | } |
266 | | | 272 | |
267 | static inline void | | 273 | static inline void |
268 | netbsd32_to_vnd_ioctl50(struct netbsd32_vnd_ioctl50 *s32p, struct vnd_ioctl50 *p, u_long cmd) | | 274 | netbsd32_to_vnd_ioctl50(struct netbsd32_vnd_ioctl50 *s32p, struct vnd_ioctl50 *p, u_long cmd) |
269 | { | | 275 | { |
270 | | | 276 | |
271 | p->vnd_file = (char *)NETBSD32PTR64(s32p->vnd_file); | | 277 | p->vnd_file = (char *)NETBSD32PTR64(s32p->vnd_file); |
272 | p->vnd_flags = s32p->vnd_flags; | | 278 | p->vnd_flags = s32p->vnd_flags; |
273 | p->vnd_geom = s32p->vnd_geom; | | 279 | p->vnd_geom = s32p->vnd_geom; |
274 | p->vnd_size = s32p->vnd_size; | | 280 | p->vnd_size = s32p->vnd_size; |
275 | } | | 281 | } |
276 | | | 282 | |
277 | static inline void | | 283 | static inline void |
278 | netbsd32_to_plistref(struct netbsd32_plistref *s32p, struct plistref *p, u_long cmd) | | 284 | netbsd32_to_plistref(struct netbsd32_plistref *s32p, struct plistref *p, u_long cmd) |
279 | { | | 285 | { |
280 | | | 286 | |
281 | p->pref_plist = NETBSD32PTR64(s32p->pref_plist); | | 287 | p->pref_plist = NETBSD32PTR64(s32p->pref_plist); |
282 | p->pref_len = s32p->pref_len; | | 288 | p->pref_len = s32p->pref_len; |
283 | } | | 289 | } |
284 | | | 290 | |
285 | static inline void | | 291 | static inline void |
286 | netbsd32_to_u_long(netbsd32_u_long *s32p, u_long *p, u_long cmd) | | 292 | netbsd32_to_u_long(netbsd32_u_long *s32p, u_long *p, u_long cmd) |
287 | { | | 293 | { |
288 | | | 294 | |
289 | *p = (u_long)*s32p; | | 295 | *p = (u_long)*s32p; |
290 | } | | 296 | } |
291 | | | 297 | |
292 | static inline void | | 298 | static inline void |
293 | netbsd32_to_voidp(netbsd32_voidp *s32p, voidp *p, u_long cmd) | | 299 | netbsd32_to_voidp(netbsd32_voidp *s32p, voidp *p, u_long cmd) |
294 | { | | 300 | { |
295 | | | 301 | |
296 | *p = (void *)NETBSD32PTR64(*s32p); | | 302 | *p = (void *)NETBSD32PTR64(*s32p); |
297 | } | | 303 | } |
298 | | | 304 | |
299 | static inline void | | 305 | static inline void |
300 | netbsd32_to_wdog_conf(struct netbsd32_wdog_conf *s32p, struct wdog_conf *p, u_long cmd) | | 306 | netbsd32_to_wdog_conf(struct netbsd32_wdog_conf *s32p, struct wdog_conf *p, u_long cmd) |
301 | { | | 307 | { |
302 | | | 308 | |
303 | p->wc_names = (char *)NETBSD32PTR64(s32p->wc_names); | | 309 | p->wc_names = (char *)NETBSD32PTR64(s32p->wc_names); |
304 | p->wc_count = s32p->wc_count; | | 310 | p->wc_count = s32p->wc_count; |
305 | } | | 311 | } |
306 | | | 312 | |
307 | static inline void | | 313 | static inline void |
308 | netbsd32_to_bpf_program(struct netbsd32_bpf_program *s32p, struct bpf_program *p, u_long cmd) | | 314 | netbsd32_to_bpf_program(struct netbsd32_bpf_program *s32p, struct bpf_program *p, u_long cmd) |
309 | { | | 315 | { |
310 | | | 316 | |
311 | p->bf_insns = (void *)NETBSD32PTR64(s32p->bf_insns); | | 317 | p->bf_insns = (void *)NETBSD32PTR64(s32p->bf_insns); |
312 | p->bf_len = s32p->bf_len; | | 318 | p->bf_len = s32p->bf_len; |
313 | } | | 319 | } |
314 | | | 320 | |
315 | static inline void | | 321 | static inline void |
316 | netbsd32_to_bpf_dltlist(struct netbsd32_bpf_dltlist *s32p, struct bpf_dltlist *p, u_long cmd) | | 322 | netbsd32_to_bpf_dltlist(struct netbsd32_bpf_dltlist *s32p, struct bpf_dltlist *p, u_long cmd) |
317 | { | | 323 | { |
318 | | | 324 | |
319 | p->bfl_list = (void *)NETBSD32PTR64(s32p->bfl_list); | | 325 | p->bfl_list = (void *)NETBSD32PTR64(s32p->bfl_list); |
320 | p->bfl_len = s32p->bfl_len; | | 326 | p->bfl_len = s32p->bfl_len; |
321 | } | | 327 | } |
322 | | | 328 | |
323 | /* wsdisplay stuff */ | | 329 | /* wsdisplay stuff */ |
324 | static inline void | | 330 | static inline void |
325 | netbsd32_to_wsdisplay_addscreendata(struct netbsd32_wsdisplay_addscreendata *asd32, | | 331 | netbsd32_to_wsdisplay_addscreendata(struct netbsd32_wsdisplay_addscreendata *asd32, |
326 | struct wsdisplay_addscreendata *asd, | | 332 | struct wsdisplay_addscreendata *asd, |
327 | u_long cmd) | | 333 | u_long cmd) |
328 | { | | 334 | { |
329 | asd->screentype = (char *)NETBSD32PTR64(asd32->screentype); | | 335 | asd->screentype = (char *)NETBSD32PTR64(asd32->screentype); |
330 | asd->emul = (char *)NETBSD32PTR64(asd32->emul); | | 336 | asd->emul = (char *)NETBSD32PTR64(asd32->emul); |
331 | asd->idx = asd32->idx; | | 337 | asd->idx = asd32->idx; |
332 | } | | 338 | } |
333 | | | 339 | |
334 | static inline void | | 340 | static inline void |
335 | netbsd32_to_ieee80211req(struct netbsd32_ieee80211req *ireq32, | | 341 | netbsd32_to_ieee80211req(struct netbsd32_ieee80211req *ireq32, |
336 | struct ieee80211req *ireq, u_long cmd) | | 342 | struct ieee80211req *ireq, u_long cmd) |
337 | { | | 343 | { |
338 | strlcpy(ireq->i_name, ireq32->i_name, IFNAMSIZ); | | 344 | strlcpy(ireq->i_name, ireq32->i_name, IFNAMSIZ); |
339 | ireq->i_type = ireq32->i_type; | | 345 | ireq->i_type = ireq32->i_type; |
340 | ireq->i_val = ireq32->i_val; | | 346 | ireq->i_val = ireq32->i_val; |
341 | ireq->i_len = ireq32->i_len; | | 347 | ireq->i_len = ireq32->i_len; |
342 | ireq->i_data = NETBSD32PTR64(ireq32->i_data); | | 348 | ireq->i_data = NETBSD32PTR64(ireq32->i_data); |
343 | } | | 349 | } |
344 | | | 350 | |
345 | static inline void | | 351 | static inline void |
346 | netbsd32_to_ieee80211_nwkey(struct netbsd32_ieee80211_nwkey *nwk32, | | 352 | netbsd32_to_ieee80211_nwkey(struct netbsd32_ieee80211_nwkey *nwk32, |
347 | struct ieee80211_nwkey *nwk, | | 353 | struct ieee80211_nwkey *nwk, |
348 | u_long cmd) | | 354 | u_long cmd) |
349 | { | | 355 | { |
350 | int i; | | 356 | int i; |
351 | | | 357 | |
352 | strlcpy(nwk->i_name, nwk32->i_name, IFNAMSIZ); | | 358 | strlcpy(nwk->i_name, nwk32->i_name, IFNAMSIZ); |
353 | nwk->i_wepon = nwk32->i_wepon; | | 359 | nwk->i_wepon = nwk32->i_wepon; |
354 | nwk->i_defkid = nwk32->i_defkid; | | 360 | nwk->i_defkid = nwk32->i_defkid; |
355 | for (i = 0; i < IEEE80211_WEP_NKID; i++) { | | 361 | for (i = 0; i < IEEE80211_WEP_NKID; i++) { |
356 | nwk->i_key[i].i_keylen = nwk32->i_key[i].i_keylen; | | 362 | nwk->i_key[i].i_keylen = nwk32->i_key[i].i_keylen; |
357 | nwk->i_key[i].i_keydat = | | 363 | nwk->i_key[i].i_keydat = |
358 | NETBSD32PTR64(nwk32->i_key[i].i_keydat); | | 364 | NETBSD32PTR64(nwk32->i_key[i].i_keydat); |
359 | } | | 365 | } |
360 | } | | 366 | } |
361 | | | 367 | |
362 | static inline void | | 368 | static inline void |
363 | netbsd32_to_wsdisplay_cursor(struct netbsd32_wsdisplay_cursor *c32, | | 369 | netbsd32_to_wsdisplay_cursor(struct netbsd32_wsdisplay_cursor *c32, |
364 | struct wsdisplay_cursor *c, | | 370 | struct wsdisplay_cursor *c, |
365 | u_long cmd) | | 371 | u_long cmd) |
366 | { | | 372 | { |
367 | c->which = c32->which; | | 373 | c->which = c32->which; |
368 | c->enable = c32->enable; | | 374 | c->enable = c32->enable; |
369 | c->pos.x = c32->pos.x; | | 375 | c->pos.x = c32->pos.x; |
370 | c->pos.y = c32->pos.y; | | 376 | c->pos.y = c32->pos.y; |
371 | c->hot.x = c32->hot.x; | | 377 | c->hot.x = c32->hot.x; |
372 | c->hot.y = c32->hot.y; | | 378 | c->hot.y = c32->hot.y; |
373 | c->size.x = c32->size.x; | | 379 | c->size.x = c32->size.x; |
374 | c->size.y = c32->size.y; | | 380 | c->size.y = c32->size.y; |
375 | c->cmap.index = c32->cmap.index; | | 381 | c->cmap.index = c32->cmap.index; |
376 | c->cmap.count = c32->cmap.count; | | 382 | c->cmap.count = c32->cmap.count; |
377 | c->cmap.red = NETBSD32PTR64(c32->cmap.red); | | 383 | c->cmap.red = NETBSD32PTR64(c32->cmap.red); |
378 | c->cmap.green = NETBSD32PTR64(c32->cmap.green); | | 384 | c->cmap.green = NETBSD32PTR64(c32->cmap.green); |
379 | c->cmap.blue = NETBSD32PTR64(c32->cmap.blue); | | 385 | c->cmap.blue = NETBSD32PTR64(c32->cmap.blue); |
380 | c->image = NETBSD32PTR64(c32->image); | | 386 | c->image = NETBSD32PTR64(c32->image); |
381 | c->mask = NETBSD32PTR64(c32->mask); | | 387 | c->mask = NETBSD32PTR64(c32->mask); |
382 | } | | 388 | } |
383 | | | 389 | |
384 | static inline void | | 390 | static inline void |
385 | netbsd32_to_wsdisplay_cmap(struct netbsd32_wsdisplay_cmap *c32, | | 391 | netbsd32_to_wsdisplay_cmap(struct netbsd32_wsdisplay_cmap *c32, |
386 | struct wsdisplay_cmap *c, | | 392 | struct wsdisplay_cmap *c, |
387 | u_long cmd) | | 393 | u_long cmd) |
388 | { | | 394 | { |
389 | c->index = c32->index; | | 395 | c->index = c32->index; |
390 | c->count = c32->count; | | 396 | c->count = c32->count; |
391 | c->red = NETBSD32PTR64(c32->red); | | 397 | c->red = NETBSD32PTR64(c32->red); |
392 | c->green = NETBSD32PTR64(c32->green); | | 398 | c->green = NETBSD32PTR64(c32->green); |
393 | c->blue = NETBSD32PTR64(c32->blue); | | 399 | c->blue = NETBSD32PTR64(c32->blue); |
394 | } | | 400 | } |
395 | | | 401 | |
396 | static inline void | | 402 | static inline void |
397 | netbsd32_to_clockctl_settimeofday( | | 403 | netbsd32_to_clockctl_settimeofday( |
398 | const struct netbsd32_clockctl_settimeofday *s32p, | | 404 | const struct netbsd32_clockctl_settimeofday *s32p, |
399 | struct clockctl_settimeofday *p, | | 405 | struct clockctl_settimeofday *p, |
400 | u_long cmd) | | 406 | u_long cmd) |
401 | { | | 407 | { |
402 | | | 408 | |
403 | p->tv = NETBSD32PTR64(s32p->tv); | | 409 | p->tv = NETBSD32PTR64(s32p->tv); |
404 | p->tzp = NETBSD32PTR64(s32p->tzp); | | 410 | p->tzp = NETBSD32PTR64(s32p->tzp); |
405 | } | | 411 | } |
406 | | | 412 | |
407 | static inline void | | 413 | static inline void |
408 | netbsd32_to_clockctl_adjtime( | | 414 | netbsd32_to_clockctl_adjtime( |
409 | const struct netbsd32_clockctl_adjtime *s32p, | | 415 | const struct netbsd32_clockctl_adjtime *s32p, |
410 | struct clockctl_adjtime *p, | | 416 | struct clockctl_adjtime *p, |
411 | u_long cmd) | | 417 | u_long cmd) |
412 | { | | 418 | { |
413 | | | 419 | |
414 | p->delta = NETBSD32PTR64(s32p->delta); | | 420 | p->delta = NETBSD32PTR64(s32p->delta); |
415 | p->olddelta = NETBSD32PTR64(s32p->olddelta); | | 421 | p->olddelta = NETBSD32PTR64(s32p->olddelta); |
416 | } | | 422 | } |
417 | | | 423 | |
418 | static inline void | | 424 | static inline void |
419 | netbsd32_to_clockctl_clock_settime( | | 425 | netbsd32_to_clockctl_clock_settime( |
420 | const struct netbsd32_clockctl_clock_settime *s32p, | | 426 | const struct netbsd32_clockctl_clock_settime *s32p, |
421 | struct clockctl_clock_settime *p, | | 427 | struct clockctl_clock_settime *p, |
422 | u_long cmd) | | 428 | u_long cmd) |
423 | { | | 429 | { |
424 | | | 430 | |
425 | p->clock_id = s32p->clock_id; | | 431 | p->clock_id = s32p->clock_id; |
426 | p->tp = NETBSD32PTR64(s32p->tp); | | 432 | p->tp = NETBSD32PTR64(s32p->tp); |
427 | } | | 433 | } |
428 | | | 434 | |
429 | #ifdef NTP | | 435 | #ifdef NTP |
430 | static inline void | | 436 | static inline void |
431 | netbsd32_to_clockctl_ntp_adjtime( | | 437 | netbsd32_to_clockctl_ntp_adjtime( |
432 | const struct netbsd32_clockctl_ntp_adjtime *s32p, | | 438 | const struct netbsd32_clockctl_ntp_adjtime *s32p, |
433 | struct clockctl_ntp_adjtime *p, | | 439 | struct clockctl_ntp_adjtime *p, |
434 | u_long cmd) | | 440 | u_long cmd) |
435 | { | | 441 | { |
436 | | | 442 | |
437 | p->tp = NETBSD32PTR64(s32p->tp); | | 443 | p->tp = NETBSD32PTR64(s32p->tp); |
438 | p->retval = s32p->retval; | | 444 | p->retval = s32p->retval; |
439 | } | | 445 | } |
440 | #endif | | 446 | #endif |
441 | | | 447 | |
442 | static inline void | | 448 | static inline void |
443 | netbsd32_to_ksyms_gsymbol( | | 449 | netbsd32_to_ksyms_gsymbol( |
444 | const struct netbsd32_ksyms_gsymbol *s32p, | | 450 | const struct netbsd32_ksyms_gsymbol *s32p, |
445 | struct ksyms_gsymbol *p, | | 451 | struct ksyms_gsymbol *p, |
446 | u_long cmd) | | 452 | u_long cmd) |
447 | { | | 453 | { |
448 | | | 454 | |
449 | p->kg_name = NETBSD32PTR64(s32p->kg_name); | | 455 | p->kg_name = NETBSD32PTR64(s32p->kg_name); |
450 | } | | 456 | } |
451 | | | 457 | |
452 | static inline void | | 458 | static inline void |
453 | netbsd32_to_ksyms_gvalue( | | 459 | netbsd32_to_ksyms_gvalue( |
454 | const struct netbsd32_ksyms_gvalue *s32p, | | 460 | const struct netbsd32_ksyms_gvalue *s32p, |
455 | struct ksyms_gvalue *p, | | 461 | struct ksyms_gvalue *p, |
456 | u_long cmd) | | 462 | u_long cmd) |
457 | { | | 463 | { |
458 | | | 464 | |
459 | p->kv_name = NETBSD32PTR64(s32p->kv_name); | | 465 | p->kv_name = NETBSD32PTR64(s32p->kv_name); |
460 | } | | 466 | } |
461 | | | 467 | |
462 | static inline void | | 468 | static inline void |
463 | netbsd32_to_npf_ioctl_table( | | 469 | netbsd32_to_npf_ioctl_table( |
464 | const struct netbsd32_npf_ioctl_table *s32p, | | 470 | const struct netbsd32_npf_ioctl_table *s32p, |
465 | struct npf_ioctl_table *p, | | 471 | struct npf_ioctl_table *p, |
466 | u_long cmd) | | 472 | u_long cmd) |
467 | { | | 473 | { |
468 | | | 474 | |
469 | p->nct_cmd = s32p->nct_cmd; | | 475 | p->nct_cmd = s32p->nct_cmd; |
470 | p->nct_name = NETBSD32PTR64(s32p->nct_name); | | 476 | p->nct_name = NETBSD32PTR64(s32p->nct_name); |
471 | switch (s32p->nct_cmd) { | | 477 | switch (s32p->nct_cmd) { |
472 | case NPF_CMD_TABLE_LOOKUP: | | 478 | case NPF_CMD_TABLE_LOOKUP: |
473 | case NPF_CMD_TABLE_ADD: | | 479 | case NPF_CMD_TABLE_ADD: |
474 | case NPF_CMD_TABLE_REMOVE: | | 480 | case NPF_CMD_TABLE_REMOVE: |
475 | p->nct_data.ent = s32p->nct_data.ent; | | 481 | p->nct_data.ent = s32p->nct_data.ent; |
476 | break; | | 482 | break; |
477 | case NPF_CMD_TABLE_LIST: | | 483 | case NPF_CMD_TABLE_LIST: |
478 | p->nct_data.buf.buf = NETBSD32PTR64(s32p->nct_data.buf.buf); | | 484 | p->nct_data.buf.buf = NETBSD32PTR64(s32p->nct_data.buf.buf); |
479 | p->nct_data.buf.len = s32p->nct_data.buf.len; | | 485 | p->nct_data.buf.len = s32p->nct_data.buf.len; |
480 | break; | | 486 | break; |
481 | } | | 487 | } |
482 | } | | 488 | } |
483 | | | 489 | |
484 | static inline void | | 490 | static inline void |
485 | netbsd32_to_devlistargs( | | 491 | netbsd32_to_devlistargs( |
486 | const struct netbsd32_devlistargs *s32p, | | 492 | const struct netbsd32_devlistargs *s32p, |
487 | struct devlistargs *p, | | 493 | struct devlistargs *p, |
488 | u_long cmd) | | 494 | u_long cmd) |
489 | { | | 495 | { |
490 | memcpy(p->l_devname, s32p->l_devname, sizeof(p->l_devname)); | | 496 | memcpy(p->l_devname, s32p->l_devname, sizeof(p->l_devname)); |
491 | p->l_children = s32p->l_children; | | 497 | p->l_children = s32p->l_children; |
492 | p->l_childname = NETBSD32PTR64(s32p->l_childname); | | 498 | p->l_childname = NETBSD32PTR64(s32p->l_childname); |
493 | } | | 499 | } |
494 | | | 500 | |
495 | static inline void | | 501 | static inline void |
496 | netbsd32_to_devrescanargs( | | 502 | netbsd32_to_devrescanargs( |
497 | const struct netbsd32_devrescanargs *s32p, | | 503 | const struct netbsd32_devrescanargs *s32p, |
498 | struct devrescanargs *p, | | 504 | struct devrescanargs *p, |
499 | u_long cmd) | | 505 | u_long cmd) |
500 | { | | 506 | { |
501 | memcpy(p->busname, s32p->busname, sizeof(p->busname)); | | 507 | memcpy(p->busname, s32p->busname, sizeof(p->busname)); |
502 | memcpy(p->ifattr, s32p->ifattr, sizeof(p->ifattr)); | | 508 | memcpy(p->ifattr, s32p->ifattr, sizeof(p->ifattr)); |
503 | p->numlocators = s32p->numlocators; | | 509 | p->numlocators = s32p->numlocators; |
504 | p->locators = NETBSD32PTR64(s32p->locators); | | 510 | p->locators = NETBSD32PTR64(s32p->locators); |
505 | } | | 511 | } |
506 | | | 512 | |
507 | /* | | 513 | /* |
508 | * handle ioctl conversions from 64-bit kernel -> netbsd32 | | 514 | * handle ioctl conversions from 64-bit kernel -> netbsd32 |
509 | */ | | 515 | */ |
510 | | | 516 | |
511 | #if 0 | | 517 | #if 0 |
512 | static inline void | | 518 | static inline void |
513 | netbsd32_from_format_op(struct format_op *p, struct netbsd32_format_op *s32p, u_long cmd) | | 519 | netbsd32_from_format_op(struct format_op *p, struct netbsd32_format_op *s32p, u_long cmd) |
514 | { | | 520 | { |
515 | | | 521 | |
516 | /* filled in */ | | 522 | /* filled in */ |
517 | #if 0 | | 523 | #if 0 |
518 | s32p->df_buf = (netbsd32_charp)p->df_buf; | | 524 | s32p->df_buf = (netbsd32_charp)p->df_buf; |
519 | #endif | | 525 | #endif |
520 | s32p->df_count = p->df_count; | | 526 | s32p->df_count = p->df_count; |
521 | s32p->df_startblk = p->df_startblk; | | 527 | s32p->df_startblk = p->df_startblk; |
522 | memcpy(s32p->df_reg, p->df_reg, sizeof(p->df_reg)); | | 528 | memcpy(s32p->df_reg, p->df_reg, sizeof(p->df_reg)); |
523 | } | | 529 | } |
524 | #endif | | 530 | #endif |
525 | | | 531 | |
526 | static inline void | | 532 | static inline void |
527 | netbsd32_from_ifreq(struct ifreq *p, struct netbsd32_ifreq *s32p, u_long cmd) | | 533 | netbsd32_from_ifreq(struct ifreq *p, struct netbsd32_ifreq *s32p, u_long cmd) |
528 | { | | 534 | { |
529 | | | 535 | |
530 | /* | | 536 | /* |
531 | * XXX | | 537 | * XXX |
532 | * struct ifreq says the same, but sometimes the ifr_data | | 538 | * struct ifreq says the same, but sometimes the ifr_data |
533 | * union member needs to be converted to 64 bits... this | | 539 | * union member needs to be converted to 64 bits... this |
534 | * is very driver specific and so we ignore it for now.. | | 540 | * is very driver specific and so we ignore it for now.. |
535 | */ | | 541 | */ |
536 | memcpy(s32p, p, sizeof *s32p); | | 542 | memcpy(s32p, p, sizeof *s32p); |
537 | if (cmd == SIOCGIFDATA || cmd == SIOCZIFDATA) | | 543 | switch (cmd) { |
| | | 544 | case SIOCGIFDATA: |
| | | 545 | case SIOCZIFDATA: |
| | | 546 | case SIOCGIFGENERIC: |
| | | 547 | case SIOCSIFGENERIC: |
538 | NETBSD32PTR32(s32p->ifr_data, p->ifr_data); | | 548 | NETBSD32PTR32(s32p->ifr_data, p->ifr_data); |
| | | 549 | break; |
| | | 550 | } |
539 | } | | 551 | } |
540 | | | 552 | |
541 | static inline void | | 553 | static inline void |
542 | netbsd32_from_oifreq(struct oifreq *p, struct netbsd32_oifreq *s32p, u_long cmd) | | 554 | netbsd32_from_oifreq(struct oifreq *p, struct netbsd32_oifreq *s32p, u_long cmd) |
543 | { | | 555 | { |
544 | | | 556 | |
545 | /* | | 557 | /* |
546 | * XXX | | 558 | * XXX |
547 | * struct ifreq says the same, but sometimes the ifr_data | | 559 | * struct ifreq says the same, but sometimes the ifr_data |
548 | * union member needs to be converted to 64 bits... this | | 560 | * union member needs to be converted to 64 bits... this |
549 | * is very driver specific and so we ignore it for now.. | | 561 | * is very driver specific and so we ignore it for now.. |
550 | */ | | 562 | */ |
551 | memcpy(s32p, p, sizeof *s32p); | | 563 | memcpy(s32p, p, sizeof *s32p); |
552 | if (cmd == SIOCGIFDATA || cmd == SIOCZIFDATA) | | 564 | if (cmd == SIOCGIFDATA || cmd == SIOCZIFDATA) |
553 | NETBSD32PTR32(s32p->ifr_data, p->ifr_data); | | 565 | NETBSD32PTR32(s32p->ifr_data, p->ifr_data); |
554 | } | | 566 | } |
555 | | | 567 | |
556 | static inline void | | 568 | static inline void |
557 | netbsd32_from_if_addrprefreq(const struct if_addrprefreq *ifap, | | 569 | netbsd32_from_if_addrprefreq(const struct if_addrprefreq *ifap, |
558 | struct netbsd32_if_addrprefreq *ifap32, u_long cmd) | | 570 | struct netbsd32_if_addrprefreq *ifap32, u_long cmd) |
559 | { | | 571 | { |
560 | strlcpy(ifap32->ifap_name, ifap->ifap_name, sizeof(ifap32->ifap_name)); | | 572 | strlcpy(ifap32->ifap_name, ifap->ifap_name, sizeof(ifap32->ifap_name)); |
561 | ifap32->ifap_preference = ifap->ifap_preference; | | 573 | ifap32->ifap_preference = ifap->ifap_preference; |
562 | memcpy(&ifap32->ifap_addr, &ifap->ifap_addr, | | 574 | memcpy(&ifap32->ifap_addr, &ifap->ifap_addr, |
563 | min(ifap->ifap_addr.ss_len, _SS_MAXSIZE)); | | 575 | min(ifap->ifap_addr.ss_len, _SS_MAXSIZE)); |
564 | } | | 576 | } |
565 | | | 577 | |
566 | static inline void | | 578 | static inline void |
567 | netbsd32_from_ifconf(struct ifconf *p, struct netbsd32_ifconf *s32p, u_long cmd) | | 579 | netbsd32_from_ifconf(struct ifconf *p, struct netbsd32_ifconf *s32p, u_long cmd) |
568 | { | | 580 | { |
569 | | | 581 | |
570 | s32p->ifc_len = p->ifc_len; | | 582 | s32p->ifc_len = p->ifc_len; |
571 | /* ifc_buf & ifc_req are the same size so this works */ | | 583 | /* ifc_buf & ifc_req are the same size so this works */ |
572 | NETBSD32PTR32(s32p->ifc_buf, p->ifc_buf); | | 584 | NETBSD32PTR32(s32p->ifc_buf, p->ifc_buf); |
573 | } | | 585 | } |
574 | | | 586 | |
575 | static inline void | | 587 | static inline void |
576 | netbsd32_from_ifmediareq(struct ifmediareq *p, struct netbsd32_ifmediareq *s32p, u_long cmd) | | 588 | netbsd32_from_ifmediareq(struct ifmediareq *p, struct netbsd32_ifmediareq *s32p, u_long cmd) |
577 | { | | 589 | { |
578 | | | 590 | |
579 | memcpy(s32p, p, sizeof *p); | | 591 | memcpy(s32p, p, sizeof *p); |
580 | /* filled in? */ | | 592 | /* filled in? */ |
581 | #if 0 | | 593 | #if 0 |
582 | s32p->ifm_ulist = (netbsd32_intp_t)p->ifm_ulist; | | 594 | s32p->ifm_ulist = (netbsd32_intp_t)p->ifm_ulist; |
583 | #endif | | 595 | #endif |
584 | } | | 596 | } |
585 | | | 597 | |
586 | static inline void | | 598 | static inline void |
587 | netbsd32_from_pppoediscparms(struct pppoediscparms *p, | | 599 | netbsd32_from_pppoediscparms(struct pppoediscparms *p, |
588 | struct netbsd32_pppoediscparms *s32p, u_long cmd) | | 600 | struct netbsd32_pppoediscparms *s32p, u_long cmd) |
589 | { | | 601 | { |
590 | | | 602 | |
591 | memcpy(s32p->ifname, p->ifname, sizeof s32p->ifname); | | 603 | memcpy(s32p->ifname, p->ifname, sizeof s32p->ifname); |
592 | memcpy(s32p->eth_ifname, p->eth_ifname, sizeof s32p->eth_ifname); | | 604 | memcpy(s32p->eth_ifname, p->eth_ifname, sizeof s32p->eth_ifname); |
593 | NETBSD32PTR32(s32p->ac_name, p->ac_name); | | 605 | NETBSD32PTR32(s32p->ac_name, p->ac_name); |
594 | s32p->ac_name_len = p->ac_name_len; | | 606 | s32p->ac_name_len = p->ac_name_len; |
595 | NETBSD32PTR32(s32p->service_name, p->service_name); | | 607 | NETBSD32PTR32(s32p->service_name, p->service_name); |
596 | s32p->service_name_len = p->service_name_len; | | 608 | s32p->service_name_len = p->service_name_len; |
597 | } | | 609 | } |
598 | | | 610 | |
599 | static inline void | | 611 | static inline void |
600 | netbsd32_from_spppauthcfg(struct spppauthcfg *p, | | 612 | netbsd32_from_spppauthcfg(struct spppauthcfg *p, |
601 | struct netbsd32_spppauthcfg *s32p, u_long cmd) | | 613 | struct netbsd32_spppauthcfg *s32p, u_long cmd) |
602 | { | | 614 | { |
603 | | | 615 | |
604 | memcpy(s32p->ifname, p->ifname, sizeof s32p->ifname); | | 616 | memcpy(s32p->ifname, p->ifname, sizeof s32p->ifname); |
605 | s32p->hisauth = p->hisauth; | | 617 | s32p->hisauth = p->hisauth; |
606 | s32p->myauth = p->myauth; | | 618 | s32p->myauth = p->myauth; |
607 | s32p->myname_length = p->myname_length; | | 619 | s32p->myname_length = p->myname_length; |
608 | s32p->mysecret_length = p->mysecret_length; | | 620 | s32p->mysecret_length = p->mysecret_length; |
609 | s32p->hisname_length = p->hisname_length; | | 621 | s32p->hisname_length = p->hisname_length; |
610 | s32p->hissecret_length = p->hissecret_length; | | 622 | s32p->hissecret_length = p->hissecret_length; |
611 | s32p->myauthflags = p->myauthflags; | | 623 | s32p->myauthflags = p->myauthflags; |
612 | s32p->hisauthflags = p->hisauthflags; | | 624 | s32p->hisauthflags = p->hisauthflags; |
613 | NETBSD32PTR32(s32p->myname, p->myname); | | 625 | NETBSD32PTR32(s32p->myname, p->myname); |
614 | NETBSD32PTR32(s32p->mysecret, p->mysecret); | | 626 | NETBSD32PTR32(s32p->mysecret, p->mysecret); |
615 | NETBSD32PTR32(s32p->hisname, p->hisname); | | 627 | NETBSD32PTR32(s32p->hisname, p->hisname); |
616 | NETBSD32PTR32(s32p->hissecret, p->hissecret); | | 628 | NETBSD32PTR32(s32p->hissecret, p->hissecret); |
617 | } | | 629 | } |
618 | | | 630 | |
619 | static inline void | | 631 | static inline void |
620 | netbsd32_from_ifdrv(struct ifdrv *p, struct netbsd32_ifdrv *s32p, u_long cmd) | | 632 | netbsd32_from_ifdrv(struct ifdrv *p, struct netbsd32_ifdrv *s32p, u_long cmd) |
621 | { | | 633 | { |
622 | | | 634 | |
623 | memcpy(s32p->ifd_name, p->ifd_name, sizeof s32p->ifd_name); | | 635 | memcpy(s32p->ifd_name, p->ifd_name, sizeof s32p->ifd_name); |
624 | s32p->ifd_cmd = p->ifd_cmd; | | 636 | s32p->ifd_cmd = p->ifd_cmd; |
625 | s32p->ifd_len = p->ifd_len; | | 637 | s32p->ifd_len = p->ifd_len; |
626 | NETBSD32PTR32(s32p->ifd_data, p->ifd_data); | | 638 | NETBSD32PTR32(s32p->ifd_data, p->ifd_data); |
627 | } | | 639 | } |
628 | | | 640 | |
629 | static inline void | | 641 | static inline void |
630 | netbsd32_from_sioc_vif_req(struct sioc_vif_req *p, struct netbsd32_sioc_vif_req *s32p, u_long cmd) | | 642 | netbsd32_from_sioc_vif_req(struct sioc_vif_req *p, struct netbsd32_sioc_vif_req *s32p, u_long cmd) |
631 | { | | 643 | { |
632 | | | 644 | |
633 | s32p->vifi = p->vifi; | | 645 | s32p->vifi = p->vifi; |
634 | s32p->icount = (netbsd32_u_long)p->icount; | | 646 | s32p->icount = (netbsd32_u_long)p->icount; |
635 | s32p->ocount = (netbsd32_u_long)p->ocount; | | 647 | s32p->ocount = (netbsd32_u_long)p->ocount; |
636 | s32p->ibytes = (netbsd32_u_long)p->ibytes; | | 648 | s32p->ibytes = (netbsd32_u_long)p->ibytes; |
637 | s32p->obytes = (netbsd32_u_long)p->obytes; | | 649 | s32p->obytes = (netbsd32_u_long)p->obytes; |
638 | } | | 650 | } |
639 | | | 651 | |
640 | static inline void | | 652 | static inline void |
641 | netbsd32_from_sioc_sg_req(struct sioc_sg_req *p, struct netbsd32_sioc_sg_req *s32p, u_long cmd) | | 653 | netbsd32_from_sioc_sg_req(struct sioc_sg_req *p, struct netbsd32_sioc_sg_req *s32p, u_long cmd) |
642 | { | | 654 | { |
643 | | | 655 | |
644 | s32p->src = p->src; | | 656 | s32p->src = p->src; |
645 | s32p->grp = p->grp; | | 657 | s32p->grp = p->grp; |
646 | s32p->pktcnt = (netbsd32_u_long)p->pktcnt; | | 658 | s32p->pktcnt = (netbsd32_u_long)p->pktcnt; |
647 | s32p->bytecnt = (netbsd32_u_long)p->bytecnt; | | 659 | s32p->bytecnt = (netbsd32_u_long)p->bytecnt; |
648 | s32p->wrong_if = (netbsd32_u_long)p->wrong_if; | | 660 | s32p->wrong_if = (netbsd32_u_long)p->wrong_if; |
649 | } | | 661 | } |
650 | | | 662 | |
651 | static inline void | | 663 | static inline void |
652 | netbsd32_from_atareq(struct atareq *p, struct netbsd32_atareq *s32p, u_long cmd) | | 664 | netbsd32_from_atareq(struct atareq *p, struct netbsd32_atareq *s32p, u_long cmd) |
653 | { | | 665 | { |
654 | s32p->flags = (netbsd32_u_long)p->flags; | | 666 | s32p->flags = (netbsd32_u_long)p->flags; |
655 | s32p->command = p->command; | | 667 | s32p->command = p->command; |
656 | s32p->features = p->features; | | 668 | s32p->features = p->features; |
657 | s32p->sec_count = p->sec_count; | | 669 | s32p->sec_count = p->sec_count; |
658 | s32p->sec_num = p->sec_num; | | 670 | s32p->sec_num = p->sec_num; |
659 | s32p->head = p->head; | | 671 | s32p->head = p->head; |
660 | s32p->cylinder = p->cylinder; | | 672 | s32p->cylinder = p->cylinder; |
661 | NETBSD32PTR32(s32p->databuf, p->databuf); | | 673 | NETBSD32PTR32(s32p->databuf, p->databuf); |
662 | s32p->datalen = (netbsd32_u_long)p->datalen; | | 674 | s32p->datalen = (netbsd32_u_long)p->datalen; |
663 | s32p->timeout = p->timeout; | | 675 | s32p->timeout = p->timeout; |
664 | s32p->retsts = p->retsts; | | 676 | s32p->retsts = p->retsts; |
665 | s32p->error = p->error; | | 677 | s32p->error = p->error; |
666 | } | | 678 | } |
667 | | | 679 | |
668 | static inline void | | 680 | static inline void |
669 | netbsd32_from_vnd_ioctl(struct vnd_ioctl *p, struct netbsd32_vnd_ioctl *s32p, u_long cmd) | | 681 | netbsd32_from_vnd_ioctl(struct vnd_ioctl *p, struct netbsd32_vnd_ioctl *s32p, u_long cmd) |
670 | { | | 682 | { |
671 | | | 683 | |
672 | s32p->vnd_flags = p->vnd_flags; | | 684 | s32p->vnd_flags = p->vnd_flags; |
673 | s32p->vnd_geom = p->vnd_geom; | | 685 | s32p->vnd_geom = p->vnd_geom; |
674 | s32p->vnd_osize = p->vnd_osize; | | 686 | s32p->vnd_osize = p->vnd_osize; |
675 | s32p->vnd_size = p->vnd_size; | | 687 | s32p->vnd_size = p->vnd_size; |
676 | } | | 688 | } |
677 | | | 689 | |
678 | static inline void | | 690 | static inline void |
679 | netbsd32_from_vnd_user(struct vnd_user *p, struct netbsd32_vnd_user *s32p, u_long cmd) | | 691 | netbsd32_from_vnd_user(struct vnd_user *p, struct netbsd32_vnd_user *s32p, u_long cmd) |
680 | { | | 692 | { |
681 | | | 693 | |
682 | s32p->vnu_unit = p->vnu_unit; | | 694 | s32p->vnu_unit = p->vnu_unit; |
683 | s32p->vnu_dev = p->vnu_dev; | | 695 | s32p->vnu_dev = p->vnu_dev; |
684 | s32p->vnu_ino = p->vnu_ino; | | 696 | s32p->vnu_ino = p->vnu_ino; |
685 | } | | 697 | } |
686 | | | 698 | |
687 | static inline void | | 699 | static inline void |
688 | netbsd32_from_vnd_ioctl50(struct vnd_ioctl50 *p, struct netbsd32_vnd_ioctl50 *s32p, u_long cmd) | | 700 | netbsd32_from_vnd_ioctl50(struct vnd_ioctl50 *p, struct netbsd32_vnd_ioctl50 *s32p, u_long cmd) |
689 | { | | 701 | { |
690 | | | 702 | |
691 | s32p->vnd_flags = p->vnd_flags; | | 703 | s32p->vnd_flags = p->vnd_flags; |
692 | s32p->vnd_geom = p->vnd_geom; | | 704 | s32p->vnd_geom = p->vnd_geom; |
693 | s32p->vnd_size = p->vnd_size; | | 705 | s32p->vnd_size = p->vnd_size; |
694 | } | | 706 | } |
695 | | | 707 | |
696 | static inline void | | 708 | static inline void |
697 | netbsd32_from_plistref(struct plistref *p, struct netbsd32_plistref *s32p, u_long cmd) | | 709 | netbsd32_from_plistref(struct plistref *p, struct netbsd32_plistref *s32p, u_long cmd) |
698 | { | | 710 | { |
699 | | | 711 | |
700 | NETBSD32PTR32(s32p->pref_plist, p->pref_plist); | | 712 | NETBSD32PTR32(s32p->pref_plist, p->pref_plist); |
701 | s32p->pref_len = p->pref_len; | | 713 | s32p->pref_len = p->pref_len; |
702 | } | | 714 | } |
703 | | | 715 | |
704 | static inline void | | 716 | static inline void |
705 | netbsd32_from_wdog_conf(struct wdog_conf *p, struct netbsd32_wdog_conf *s32p, u_long cmd) | | 717 | netbsd32_from_wdog_conf(struct wdog_conf *p, struct netbsd32_wdog_conf *s32p, u_long cmd) |
706 | { | | 718 | { |
707 | | | 719 | |
708 | NETBSD32PTR32(s32p->wc_names, p->wc_names); | | 720 | NETBSD32PTR32(s32p->wc_names, p->wc_names); |
709 | s32p->wc_count = p->wc_count; | | 721 | s32p->wc_count = p->wc_count; |
710 | } | | 722 | } |
711 | | | 723 | |
712 | /* wsdisplay stuff */ | | 724 | /* wsdisplay stuff */ |
713 | static inline void | | 725 | static inline void |
714 | netbsd32_from_wsdisplay_addscreendata(struct wsdisplay_addscreendata *asd, | | 726 | netbsd32_from_wsdisplay_addscreendata(struct wsdisplay_addscreendata *asd, |
715 | struct netbsd32_wsdisplay_addscreendata *asd32, | | 727 | struct netbsd32_wsdisplay_addscreendata *asd32, |
716 | u_long cmd) | | 728 | u_long cmd) |
717 | { | | 729 | { |
718 | NETBSD32PTR32(asd32->screentype, asd->screentype); | | 730 | NETBSD32PTR32(asd32->screentype, asd->screentype); |
719 | NETBSD32PTR32(asd32->emul, asd->emul); | | 731 | NETBSD32PTR32(asd32->emul, asd->emul); |
720 | asd32->idx = asd->idx; | | 732 | asd32->idx = asd->idx; |
721 | } | | 733 | } |
722 | | | 734 | |
723 | static inline void | | 735 | static inline void |
724 | netbsd32_from_wsdisplay_cursor(struct wsdisplay_cursor *c, | | 736 | netbsd32_from_wsdisplay_cursor(struct wsdisplay_cursor *c, |
725 | struct netbsd32_wsdisplay_cursor *c32, | | 737 | struct netbsd32_wsdisplay_cursor *c32, |
726 | u_long cmd) | | 738 | u_long cmd) |
727 | { | | 739 | { |
728 | c32->which = c->which; | | 740 | c32->which = c->which; |
729 | c32->enable = c->enable; | | 741 | c32->enable = c->enable; |
730 | c32->pos.x = c->pos.x; | | 742 | c32->pos.x = c->pos.x; |
731 | c32->pos.y = c->pos.y; | | 743 | c32->pos.y = c->pos.y; |
732 | c32->hot.x = c->hot.x; | | 744 | c32->hot.x = c->hot.x; |
733 | c32->hot.y = c->hot.y; | | 745 | c32->hot.y = c->hot.y; |
734 | c32->size.x = c->size.x; | | 746 | c32->size.x = c->size.x; |
735 | c32->size.y = c->size.y; | | 747 | c32->size.y = c->size.y; |
736 | c32->cmap.index = c->cmap.index; | | 748 | c32->cmap.index = c->cmap.index; |
737 | c32->cmap.count = c->cmap.count; | | 749 | c32->cmap.count = c->cmap.count; |
738 | NETBSD32PTR32(c32->cmap.red, c->cmap.red); | | 750 | NETBSD32PTR32(c32->cmap.red, c->cmap.red); |
739 | NETBSD32PTR32(c32->cmap.green, c->cmap.green); | | 751 | NETBSD32PTR32(c32->cmap.green, c->cmap.green); |
740 | NETBSD32PTR32(c32->cmap.blue, c->cmap.blue); | | 752 | NETBSD32PTR32(c32->cmap.blue, c->cmap.blue); |
741 | NETBSD32PTR32(c32->image, c->image); | | 753 | NETBSD32PTR32(c32->image, c->image); |
742 | NETBSD32PTR32(c32->mask, c->mask); | | 754 | NETBSD32PTR32(c32->mask, c->mask); |
743 | } | | 755 | } |
744 | | | 756 | |
745 | static inline void | | 757 | static inline void |
746 | netbsd32_from_wsdisplay_cmap(struct wsdisplay_cmap *c, | | 758 | netbsd32_from_wsdisplay_cmap(struct wsdisplay_cmap *c, |
747 | struct netbsd32_wsdisplay_cmap *c32, | | 759 | struct netbsd32_wsdisplay_cmap *c32, |
748 | u_long cmd) | | 760 | u_long cmd) |
749 | { | | 761 | { |
750 | c32->index = c->index; | | 762 | c32->index = c->index; |
751 | c32->count = c->count; | | 763 | c32->count = c->count; |
752 | NETBSD32PTR32(c32->red, c->red); | | 764 | NETBSD32PTR32(c32->red, c->red); |
753 | NETBSD32PTR32(c32->green, c->green); | | 765 | NETBSD32PTR32(c32->green, c->green); |
754 | NETBSD32PTR32(c32->blue, c->blue); | | 766 | NETBSD32PTR32(c32->blue, c->blue); |
755 | } | | 767 | } |
756 | | | 768 | |
757 | static inline void | | 769 | static inline void |
758 | netbsd32_from_ieee80211req(struct ieee80211req *ireq, | | 770 | netbsd32_from_ieee80211req(struct ieee80211req *ireq, |
759 | struct netbsd32_ieee80211req *ireq32, u_long cmd) | | 771 | struct netbsd32_ieee80211req *ireq32, u_long cmd) |
760 | { | | 772 | { |
761 | strlcpy(ireq32->i_name, ireq->i_name, IFNAMSIZ); | | 773 | strlcpy(ireq32->i_name, ireq->i_name, IFNAMSIZ); |
762 | ireq32->i_type = ireq->i_type; | | 774 | ireq32->i_type = ireq->i_type; |
763 | ireq32->i_val = ireq->i_val; | | 775 | ireq32->i_val = ireq->i_val; |
764 | ireq32->i_len = ireq->i_len; | | 776 | ireq32->i_len = ireq->i_len; |
765 | NETBSD32PTR32(ireq32->i_data, ireq->i_data); | | 777 | NETBSD32PTR32(ireq32->i_data, ireq->i_data); |
766 | } | | 778 | } |
767 | | | 779 | |
768 | static inline void | | 780 | static inline void |
769 | netbsd32_from_ieee80211_nwkey(struct ieee80211_nwkey *nwk, | | 781 | netbsd32_from_ieee80211_nwkey(struct ieee80211_nwkey *nwk, |
770 | struct netbsd32_ieee80211_nwkey *nwk32, | | 782 | struct netbsd32_ieee80211_nwkey *nwk32, |
771 | u_long cmd) | | 783 | u_long cmd) |
772 | { | | 784 | { |
773 | int i; | | 785 | int i; |
774 | | | 786 | |
775 | strlcpy(nwk32->i_name, nwk->i_name, IFNAMSIZ); | | 787 | strlcpy(nwk32->i_name, nwk->i_name, IFNAMSIZ); |
776 | nwk32->i_wepon = nwk->i_wepon; | | 788 | nwk32->i_wepon = nwk->i_wepon; |
777 | nwk32->i_defkid = nwk->i_defkid; | | 789 | nwk32->i_defkid = nwk->i_defkid; |
778 | for (i = 0; i < IEEE80211_WEP_NKID; i++) { | | 790 | for (i = 0; i < IEEE80211_WEP_NKID; i++) { |
779 | nwk32->i_key[i].i_keylen = nwk->i_key[i].i_keylen; | | 791 | nwk32->i_key[i].i_keylen = nwk->i_key[i].i_keylen; |
780 | NETBSD32PTR32(nwk32->i_key[i].i_keydat, | | 792 | NETBSD32PTR32(nwk32->i_key[i].i_keydat, |
781 | nwk->i_key[i].i_keydat); | | 793 | nwk->i_key[i].i_keydat); |
782 | } | | 794 | } |
783 | } | | 795 | } |
784 | | | 796 | |
785 | static inline void | | 797 | static inline void |
786 | netbsd32_from_bpf_program(struct bpf_program *p, struct netbsd32_bpf_program *s32p, u_long cmd) | | 798 | netbsd32_from_bpf_program(struct bpf_program *p, struct netbsd32_bpf_program *s32p, u_long cmd) |
787 | { | | 799 | { |
788 | | | 800 | |
789 | NETBSD32PTR32(s32p->bf_insns, p->bf_insns); | | 801 | NETBSD32PTR32(s32p->bf_insns, p->bf_insns); |
790 | s32p->bf_len = p->bf_len; | | 802 | s32p->bf_len = p->bf_len; |
791 | } | | 803 | } |
792 | | | 804 | |
793 | static inline void | | 805 | static inline void |
794 | netbsd32_from_bpf_dltlist(struct bpf_dltlist *p, struct netbsd32_bpf_dltlist *s32p, u_long cmd) | | 806 | netbsd32_from_bpf_dltlist(struct bpf_dltlist *p, struct netbsd32_bpf_dltlist *s32p, u_long cmd) |
795 | { | | 807 | { |
796 | | | 808 | |
797 | NETBSD32PTR32(s32p->bfl_list, p->bfl_list); | | 809 | NETBSD32PTR32(s32p->bfl_list, p->bfl_list); |
798 | s32p->bfl_len = p->bfl_len; | | 810 | s32p->bfl_len = p->bfl_len; |
799 | } | | 811 | } |
800 | | | 812 | |
801 | static inline void | | 813 | static inline void |
802 | netbsd32_from_u_long(u_long *p, netbsd32_u_long *s32p, u_long cmd) | | 814 | netbsd32_from_u_long(u_long *p, netbsd32_u_long *s32p, u_long cmd) |
803 | { | | 815 | { |
804 | | | 816 | |
805 | *s32p = (netbsd32_u_long)*p; | | 817 | *s32p = (netbsd32_u_long)*p; |
806 | } | | 818 | } |
807 | | | 819 | |
808 | static inline void | | 820 | static inline void |
809 | netbsd32_from_voidp(voidp *p, netbsd32_voidp *s32p, u_long cmd) | | 821 | netbsd32_from_voidp(voidp *p, netbsd32_voidp *s32p, u_long cmd) |
810 | { | | 822 | { |
811 | | | 823 | |
812 | NETBSD32PTR32(*s32p, *p); | | 824 | NETBSD32PTR32(*s32p, *p); |
813 | } | | 825 | } |
814 | | | 826 | |
815 | | | 827 | |
816 | static inline void | | 828 | static inline void |
817 | netbsd32_from_clockctl_settimeofday( | | 829 | netbsd32_from_clockctl_settimeofday( |
818 | const struct clockctl_settimeofday *p, | | 830 | const struct clockctl_settimeofday *p, |
819 | struct netbsd32_clockctl_settimeofday *s32p, | | 831 | struct netbsd32_clockctl_settimeofday *s32p, |
820 | u_long cmd) | | 832 | u_long cmd) |
821 | { | | 833 | { |
822 | | | 834 | |
823 | NETBSD32PTR32(s32p->tv, p->tv); | | 835 | NETBSD32PTR32(s32p->tv, p->tv); |
824 | NETBSD32PTR32(s32p->tzp, p->tzp); | | 836 | NETBSD32PTR32(s32p->tzp, p->tzp); |
825 | } | | 837 | } |
826 | | | 838 | |
827 | static inline void | | 839 | static inline void |
828 | netbsd32_from_clockctl_adjtime( | | 840 | netbsd32_from_clockctl_adjtime( |
829 | const struct clockctl_adjtime *p, | | 841 | const struct clockctl_adjtime *p, |
830 | struct netbsd32_clockctl_adjtime *s32p, | | 842 | struct netbsd32_clockctl_adjtime *s32p, |
831 | u_long cmd) | | 843 | u_long cmd) |
832 | { | | 844 | { |
833 | | | 845 | |
834 | NETBSD32PTR32(s32p->delta, p->delta); | | 846 | NETBSD32PTR32(s32p->delta, p->delta); |
835 | NETBSD32PTR32(s32p->olddelta, p->olddelta); | | 847 | NETBSD32PTR32(s32p->olddelta, p->olddelta); |
836 | } | | 848 | } |
837 | | | 849 | |
838 | static inline void | | 850 | static inline void |
839 | netbsd32_from_clockctl_clock_settime( | | 851 | netbsd32_from_clockctl_clock_settime( |
840 | const struct clockctl_clock_settime *p, | | 852 | const struct clockctl_clock_settime *p, |
841 | struct netbsd32_clockctl_clock_settime *s32p, | | 853 | struct netbsd32_clockctl_clock_settime *s32p, |
842 | u_long cmd) | | 854 | u_long cmd) |
843 | { | | 855 | { |
844 | | | 856 | |
845 | s32p->clock_id = p->clock_id; | | 857 | s32p->clock_id = p->clock_id; |
846 | NETBSD32PTR32(s32p->tp, p->tp); | | 858 | NETBSD32PTR32(s32p->tp, p->tp); |
847 | } | | 859 | } |
848 | | | 860 | |
849 | #ifdef NTP | | 861 | #ifdef NTP |
850 | static inline void | | 862 | static inline void |
851 | netbsd32_from_clockctl_ntp_adjtime( | | 863 | netbsd32_from_clockctl_ntp_adjtime( |
852 | const struct clockctl_ntp_adjtime *p, | | 864 | const struct clockctl_ntp_adjtime *p, |
853 | struct netbsd32_clockctl_ntp_adjtime *s32p, | | 865 | struct netbsd32_clockctl_ntp_adjtime *s32p, |
854 | u_long cmd) | | 866 | u_long cmd) |
855 | { | | 867 | { |
856 | | | 868 | |
857 | NETBSD32PTR32(s32p->tp, p->tp); | | 869 | NETBSD32PTR32(s32p->tp, p->tp); |
858 | s32p->retval = p->retval; | | 870 | s32p->retval = p->retval; |
859 | } | | 871 | } |
860 | #endif | | 872 | #endif |
861 | | | 873 | |
862 | static inline void | | 874 | static inline void |
863 | netbsd32_from_ksyms_gsymbol( | | 875 | netbsd32_from_ksyms_gsymbol( |
864 | const struct ksyms_gsymbol *p, | | 876 | const struct ksyms_gsymbol *p, |
865 | struct netbsd32_ksyms_gsymbol *s32p, | | 877 | struct netbsd32_ksyms_gsymbol *s32p, |
866 | u_long cmd) | | 878 | u_long cmd) |
867 | { | | 879 | { |
868 | | | 880 | |
869 | NETBSD32PTR32(s32p->kg_name, p->kg_name); | | 881 | NETBSD32PTR32(s32p->kg_name, p->kg_name); |
870 | s32p->kg_sym = p->kg_sym; | | 882 | s32p->kg_sym = p->kg_sym; |
871 | } | | 883 | } |
872 | | | 884 | |
873 | static inline void | | 885 | static inline void |
874 | netbsd32_from_ksyms_gvalue( | | 886 | netbsd32_from_ksyms_gvalue( |
875 | const struct ksyms_gvalue *p, | | 887 | const struct ksyms_gvalue *p, |
876 | struct netbsd32_ksyms_gvalue *s32p, | | 888 | struct netbsd32_ksyms_gvalue *s32p, |
877 | u_long cmd) | | 889 | u_long cmd) |
878 | { | | 890 | { |
879 | | | 891 | |
880 | NETBSD32PTR32(s32p->kv_name, p->kv_name); | | 892 | NETBSD32PTR32(s32p->kv_name, p->kv_name); |
881 | s32p->kv_value = p->kv_value; | | 893 | s32p->kv_value = p->kv_value; |
882 | } | | 894 | } |
883 | | | 895 | |
884 | static inline void | | 896 | static inline void |
885 | netbsd32_from_npf_ioctl_table( | | 897 | netbsd32_from_npf_ioctl_table( |
886 | const struct npf_ioctl_table *p, | | 898 | const struct npf_ioctl_table *p, |
887 | struct netbsd32_npf_ioctl_table *s32p, | | 899 | struct netbsd32_npf_ioctl_table *s32p, |
888 | u_long cmd) | | 900 | u_long cmd) |
889 | { | | 901 | { |
890 | | | 902 | |
891 | s32p->nct_cmd = p->nct_cmd; | | 903 | s32p->nct_cmd = p->nct_cmd; |
892 | NETBSD32PTR32(s32p->nct_name, p->nct_name); | | 904 | NETBSD32PTR32(s32p->nct_name, p->nct_name); |
893 | switch (p->nct_cmd) { | | 905 | switch (p->nct_cmd) { |
894 | case NPF_CMD_TABLE_LOOKUP: | | 906 | case NPF_CMD_TABLE_LOOKUP: |
895 | case NPF_CMD_TABLE_ADD: | | 907 | case NPF_CMD_TABLE_ADD: |
896 | case NPF_CMD_TABLE_REMOVE: | | 908 | case NPF_CMD_TABLE_REMOVE: |
897 | s32p->nct_data.ent = p->nct_data.ent; | | 909 | s32p->nct_data.ent = p->nct_data.ent; |
898 | break; | | 910 | break; |
899 | case NPF_CMD_TABLE_LIST: | | 911 | case NPF_CMD_TABLE_LIST: |
900 | NETBSD32PTR32(s32p->nct_data.buf.buf, p->nct_data.buf.buf); | | 912 | NETBSD32PTR32(s32p->nct_data.buf.buf, p->nct_data.buf.buf); |
901 | s32p->nct_data.buf.len = p->nct_data.buf.len; | | 913 | s32p->nct_data.buf.len = p->nct_data.buf.len; |
902 | break; | | 914 | break; |
903 | } | | 915 | } |
904 | } | | 916 | } |
905 | | | 917 | |
906 | static inline void | | 918 | static inline void |
907 | netbsd32_from_devlistargs( | | 919 | netbsd32_from_devlistargs( |
908 | const struct devlistargs *p, | | 920 | const struct devlistargs *p, |
909 | struct netbsd32_devlistargs *s32p, | | 921 | struct netbsd32_devlistargs *s32p, |
910 | u_long cmd) | | 922 | u_long cmd) |
911 | { | | 923 | { |
912 | memcpy(s32p->l_devname, p->l_devname, sizeof(s32p->l_devname)); | | 924 | memcpy(s32p->l_devname, p->l_devname, sizeof(s32p->l_devname)); |
913 | s32p->l_children = p->l_children; | | 925 | s32p->l_children = p->l_children; |
914 | NETBSD32PTR32(s32p->l_childname, p->l_childname); | | 926 | NETBSD32PTR32(s32p->l_childname, p->l_childname); |
915 | } | | 927 | } |
916 | | | 928 | |
917 | static inline void | | 929 | static inline void |
918 | netbsd32_from_devrescanargs( | | 930 | netbsd32_from_devrescanargs( |
919 | const struct devrescanargs *p, | | 931 | const struct devrescanargs *p, |
920 | struct netbsd32_devrescanargs *s32p, | | 932 | struct netbsd32_devrescanargs *s32p, |
921 | u_long cmd) | | 933 | u_long cmd) |
922 | { | | 934 | { |
923 | memcpy(s32p->busname, p->busname, sizeof(s32p->busname)); | | 935 | memcpy(s32p->busname, p->busname, sizeof(s32p->busname)); |
924 | memcpy(s32p->ifattr, p->ifattr, sizeof(s32p->ifattr)); | | 936 | memcpy(s32p->ifattr, p->ifattr, sizeof(s32p->ifattr)); |
925 | s32p->numlocators = p->numlocators; | | 937 | s32p->numlocators = p->numlocators; |
926 | NETBSD32PTR32(s32p->locators, p->locators); | | 938 | NETBSD32PTR32(s32p->locators, p->locators); |
927 | } | | 939 | } |
928 | | | 940 | |
929 | #ifdef NTP | | 941 | #ifdef NTP |
930 | static int | | 942 | static int |
931 | netbsd32_do_clockctl_ntp_adjtime(struct clockctl_ntp_adjtime *args) | | 943 | netbsd32_do_clockctl_ntp_adjtime(struct clockctl_ntp_adjtime *args) |
932 | { | | 944 | { |
933 | | | 945 | |
934 | struct netbsd32_timex ntv32; | | 946 | struct netbsd32_timex ntv32; |
935 | struct timex ntv; | | 947 | struct timex ntv; |
936 | int error; | | 948 | int error; |
937 | | | 949 | |
938 | error = copyin(args->tp, &ntv32, sizeof(ntv32)); | | 950 | error = copyin(args->tp, &ntv32, sizeof(ntv32)); |
939 | if (error) | | 951 | if (error) |
940 | return (error); | | 952 | return (error); |
941 | | | 953 | |
942 | netbsd32_to_timex(&ntv32, &ntv); | | 954 | netbsd32_to_timex(&ntv32, &ntv); |
943 | ntp_adjtime1(&ntv); | | 955 | ntp_adjtime1(&ntv); |
944 | netbsd32_from_timex(&ntv, &ntv32); | | 956 | netbsd32_from_timex(&ntv, &ntv32); |
945 | | | 957 | |
946 | error = copyout(&ntv32, args->tp, sizeof(ntv)); | | 958 | error = copyout(&ntv32, args->tp, sizeof(ntv)); |
947 | if (error == 0) | | 959 | if (error == 0) |
948 | args->retval = ntp_timestatus(); | | 960 | args->retval = ntp_timestatus(); |
949 | | | 961 | |
950 | return error; | | 962 | return error; |
951 | } | | 963 | } |
952 | #endif | | 964 | #endif |
953 | | | 965 | |
954 | /* | | 966 | /* |
955 | * main ioctl syscall. | | 967 | * main ioctl syscall. |
956 | * | | 968 | * |
957 | * ok, here we are in the biggy. we have to do fix ups depending | | 969 | * ok, here we are in the biggy. we have to do fix ups depending |
958 | * on the ioctl command before and afterwards. | | 970 | * on the ioctl command before and afterwards. |
959 | */ | | 971 | */ |
960 | int | | 972 | int |
961 | netbsd32_ioctl(struct lwp *l, const struct netbsd32_ioctl_args *uap, register_t *retval) | | 973 | netbsd32_ioctl(struct lwp *l, const struct netbsd32_ioctl_args *uap, register_t *retval) |
962 | { | | 974 | { |
963 | /* { | | 975 | /* { |
964 | syscallarg(int) fd; | | 976 | syscallarg(int) fd; |
965 | syscallarg(netbsd32_u_long) com; | | 977 | syscallarg(netbsd32_u_long) com; |
966 | syscallarg(netbsd32_voidp) data; | | 978 | syscallarg(netbsd32_voidp) data; |
967 | } */ | | 979 | } */ |
968 | struct proc *p = l->l_proc; | | 980 | struct proc *p = l->l_proc; |
969 | struct file *fp; | | 981 | struct file *fp; |
970 | struct filedesc *fdp; | | 982 | struct filedesc *fdp; |
971 | u_long com; | | 983 | u_long com; |
972 | int error = 0; | | 984 | int error = 0; |
973 | size_t size; | | 985 | size_t size; |
974 | size_t alloc_size32, size32; | | 986 | size_t alloc_size32, size32; |
975 | void *data, *memp = NULL; | | 987 | void *data, *memp = NULL; |
976 | void *data32, *memp32 = NULL; | | 988 | void *data32, *memp32 = NULL; |
977 | unsigned int fd; | | 989 | unsigned int fd; |
978 | fdfile_t *ff; | | 990 | fdfile_t *ff; |
979 | int tmp; | | 991 | int tmp; |
980 | #define STK_PARAMS 128 | | 992 | #define STK_PARAMS 128 |
981 | uint64_t stkbuf[STK_PARAMS/sizeof(uint64_t)]; | | 993 | uint64_t stkbuf[STK_PARAMS/sizeof(uint64_t)]; |
982 | uint64_t stkbuf32[STK_PARAMS/sizeof(uint64_t)]; | | 994 | uint64_t stkbuf32[STK_PARAMS/sizeof(uint64_t)]; |
983 | | | 995 | |
984 | /* | | 996 | /* |
985 | * we need to translate some commands (_IOW) before calling sys_ioctl, | | 997 | * we need to translate some commands (_IOW) before calling sys_ioctl, |
986 | * some after (_IOR), and some both (_IOWR). | | 998 | * some after (_IOR), and some both (_IOWR). |
987 | */ | | 999 | */ |
988 | #if 0 | | 1000 | #if 0 |
989 | { | | 1001 | { |
990 | const char * const dirs[8] = { | | 1002 | const char * const dirs[8] = { |
991 | "NONE!", "VOID", "OUT", "VOID|OUT!", "IN", "VOID|IN!", | | 1003 | "NONE!", "VOID", "OUT", "VOID|OUT!", "IN", "VOID|IN!", |
992 | "INOUT", "VOID|IN|OUT!" | | 1004 | "INOUT", "VOID|IN|OUT!" |
993 | }; | | 1005 | }; |
994 | | | 1006 | |
995 | printf("netbsd32_ioctl(%d, %x, %x): " | | 1007 | printf("netbsd32_ioctl(%d, %x, %x): " |
996 | "%s group %c base %d len %d\n", | | 1008 | "%s group %c base %d len %d\n", |
997 | SCARG(uap, fd), SCARG(uap, com), SCARG(uap, data).i32, | | 1009 | SCARG(uap, fd), SCARG(uap, com), SCARG(uap, data).i32, |
998 | dirs[((SCARG(uap, com) & IOC_DIRMASK)>>29)], | | 1010 | dirs[((SCARG(uap, com) & IOC_DIRMASK)>>29)], |
999 | IOCGROUP(SCARG(uap, com)), IOCBASECMD(SCARG(uap, com)), | | 1011 | IOCGROUP(SCARG(uap, com)), IOCBASECMD(SCARG(uap, com)), |
1000 | IOCPARM_LEN(SCARG(uap, com))); | | 1012 | IOCPARM_LEN(SCARG(uap, com))); |
1001 | } | | 1013 | } |
1002 | #endif | | 1014 | #endif |
1003 | | | 1015 | |
1004 | memp = NULL; | | 1016 | memp = NULL; |
1005 | memp32 = NULL; | | 1017 | memp32 = NULL; |
1006 | alloc_size32 = 0; | | 1018 | alloc_size32 = 0; |
1007 | size32 = 0; | | 1019 | size32 = 0; |
1008 | size = 0; | | 1020 | size = 0; |
1009 | | | 1021 | |
1010 | fdp = p->p_fd; | | 1022 | fdp = p->p_fd; |
1011 | fd = SCARG(uap, fd); | | 1023 | fd = SCARG(uap, fd); |
1012 | if ((fp = fd_getfile(fd)) == NULL) | | 1024 | if ((fp = fd_getfile(fd)) == NULL) |
1013 | return (EBADF); | | 1025 | return (EBADF); |
1014 | if ((fp->f_flag & (FREAD | FWRITE)) == 0) { | | 1026 | if ((fp->f_flag & (FREAD | FWRITE)) == 0) { |
1015 | error = EBADF; | | 1027 | error = EBADF; |
1016 | goto out; | | 1028 | goto out; |
1017 | } | | 1029 | } |
1018 | | | 1030 | |
1019 | ff = fdp->fd_dt->dt_ff[SCARG(uap, fd)]; | | 1031 | ff = fdp->fd_dt->dt_ff[SCARG(uap, fd)]; |
1020 | switch (com = SCARG(uap, com)) { | | 1032 | switch (com = SCARG(uap, com)) { |
1021 | case FIOCLEX: | | 1033 | case FIOCLEX: |
1022 | ff->ff_exclose = true; | | 1034 | ff->ff_exclose = true; |
1023 | fdp->fd_exclose = true; | | 1035 | fdp->fd_exclose = true; |
1024 | goto out; | | 1036 | goto out; |
1025 | | | 1037 | |
1026 | case FIONCLEX: | | 1038 | case FIONCLEX: |
1027 | ff->ff_exclose = false; | | 1039 | ff->ff_exclose = false; |
1028 | goto out; | | 1040 | goto out; |
1029 | } | | 1041 | } |
1030 | | | 1042 | |
1031 | /* | | 1043 | /* |
1032 | * Interpret high order word to find amount of data to be | | 1044 | * Interpret high order word to find amount of data to be |
1033 | * copied to/from the user's address space. | | 1045 | * copied to/from the user's address space. |
1034 | */ | | 1046 | */ |
1035 | size32 = IOCPARM_LEN(com); | | 1047 | size32 = IOCPARM_LEN(com); |
1036 | alloc_size32 = size32; | | 1048 | alloc_size32 = size32; |
1037 | | | 1049 | |
1038 | /* | | 1050 | /* |
1039 | * The disklabel is now padded to a multiple of 8 bytes however the old | | 1051 | * The disklabel is now padded to a multiple of 8 bytes however the old |
1040 | * disklabel on 32bit platforms wasn't. This leaves a difference in | | 1052 | * disklabel on 32bit platforms wasn't. This leaves a difference in |
1041 | * size of 4 bytes between the two but are otherwise identical. | | 1053 | * size of 4 bytes between the two but are otherwise identical. |
1042 | * To deal with this, we allocate enough space for the new disklabel | | 1054 | * To deal with this, we allocate enough space for the new disklabel |
1043 | * but only copyin/out the smaller amount. | | 1055 | * but only copyin/out the smaller amount. |
1044 | */ | | 1056 | */ |
1045 | if (IOCGROUP(com) == 'd') { | | 1057 | if (IOCGROUP(com) == 'd') { |
1046 | u_long ncom = com ^ (DIOCGDINFO ^ DIOCGDINFO32); | | 1058 | u_long ncom = com ^ (DIOCGDINFO ^ DIOCGDINFO32); |
1047 | switch (ncom) { | | 1059 | switch (ncom) { |
1048 | case DIOCGDINFO: | | 1060 | case DIOCGDINFO: |
1049 | case DIOCWDINFO: | | 1061 | case DIOCWDINFO: |
1050 | case DIOCSDINFO: | | 1062 | case DIOCSDINFO: |
1051 | case DIOCGDEFLABEL: | | 1063 | case DIOCGDEFLABEL: |
1052 | com = ncom; | | 1064 | com = ncom; |
1053 | if (IOCPARM_LEN(DIOCGDINFO32) < IOCPARM_LEN(DIOCGDINFO)) | | 1065 | if (IOCPARM_LEN(DIOCGDINFO32) < IOCPARM_LEN(DIOCGDINFO)) |
1054 | alloc_size32 = IOCPARM_LEN(DIOCGDINFO); | | 1066 | alloc_size32 = IOCPARM_LEN(DIOCGDINFO); |
1055 | break; | | 1067 | break; |
1056 | } | | 1068 | } |
1057 | } | | 1069 | } |
1058 | if (alloc_size32 > IOCPARM_MAX) { | | 1070 | if (alloc_size32 > IOCPARM_MAX) { |
1059 | error = ENOTTY; | | 1071 | error = ENOTTY; |
1060 | goto out; | | 1072 | goto out; |
1061 | } | | 1073 | } |
1062 | if (alloc_size32 > sizeof(stkbuf)) { | | 1074 | if (alloc_size32 > sizeof(stkbuf)) { |
1063 | memp32 = kmem_alloc(alloc_size32, KM_SLEEP); | | 1075 | memp32 = kmem_alloc(alloc_size32, KM_SLEEP); |
1064 | data32 = memp32; | | 1076 | data32 = memp32; |
1065 | } else | | 1077 | } else |
1066 | data32 = (void *)stkbuf32; | | 1078 | data32 = (void *)stkbuf32; |
1067 | if ((com >> IOCPARM_SHIFT) == 0) { | | 1079 | if ((com >> IOCPARM_SHIFT) == 0) { |
1068 | /* UNIX-style ioctl. */ | | 1080 | /* UNIX-style ioctl. */ |
1069 | data32 = SCARG_P32(uap, data); | | 1081 | data32 = SCARG_P32(uap, data); |
1070 | } else { | | 1082 | } else { |
1071 | if (com&IOC_IN) { | | 1083 | if (com&IOC_IN) { |
1072 | if (size32) { | | 1084 | if (size32) { |
1073 | error = copyin(SCARG_P32(uap, data), data32, | | 1085 | error = copyin(SCARG_P32(uap, data), data32, |
1074 | size32); | | 1086 | size32); |
1075 | if (error) { | | 1087 | if (error) { |
1076 | goto out; | | 1088 | goto out; |
1077 | } | | 1089 | } |
1078 | /* | | 1090 | /* |
1079 | * The data between size and alloc_size has | | 1091 | * The data between size and alloc_size has |
1080 | * not been overwritten. It shouldn't matter | | 1092 | * not been overwritten. It shouldn't matter |
1081 | * but let's clear that anyway. | | 1093 | * but let's clear that anyway. |
1082 | */ | | 1094 | */ |
1083 | if (__predict_false(size32 < alloc_size32)) { | | 1095 | if (__predict_false(size32 < alloc_size32)) { |
1084 | memset((char *)data32+size32, 0, | | 1096 | memset((char *)data32+size32, 0, |
1085 | alloc_size32 - size32); | | 1097 | alloc_size32 - size32); |
1086 | } | | 1098 | } |
1087 | ktrgenio(fd, UIO_WRITE, SCARG_P32(uap, data), | | 1099 | ktrgenio(fd, UIO_WRITE, SCARG_P32(uap, data), |
1088 | size32, 0); | | 1100 | size32, 0); |
1089 | } else | | 1101 | } else |
1090 | *(void **)data32 = SCARG_P32(uap, data); | | 1102 | *(void **)data32 = SCARG_P32(uap, data); |
1091 | } else if ((com&IOC_OUT) && size32) { | | 1103 | } else if ((com&IOC_OUT) && size32) { |
1092 | /* | | 1104 | /* |
1093 | * Zero the buffer so the user always | | 1105 | * Zero the buffer so the user always |
1094 | * gets back something deterministic. | | 1106 | * gets back something deterministic. |
1095 | */ | | 1107 | */ |
1096 | memset(data32, 0, alloc_size32); | | 1108 | memset(data32, 0, alloc_size32); |
1097 | } else if (com&IOC_VOID) { | | 1109 | } else if (com&IOC_VOID) { |
1098 | *(void **)data32 = SCARG_P32(uap, data); | | 1110 | *(void **)data32 = SCARG_P32(uap, data); |
1099 | } | | 1111 | } |
1100 | } | | 1112 | } |
1101 | | | 1113 | |
1102 | /* | | 1114 | /* |
1103 | * convert various structures, pointers, and other objects that | | 1115 | * convert various structures, pointers, and other objects that |
1104 | * change size from 32 bit -> 64 bit, for all ioctl commands. | | 1116 | * change size from 32 bit -> 64 bit, for all ioctl commands. |
1105 | */ | | 1117 | */ |
1106 | switch (SCARG(uap, com)) { | | 1118 | switch (SCARG(uap, com)) { |
1107 | case FIONBIO: | | 1119 | case FIONBIO: |
1108 | mutex_enter(&fp->f_lock); | | 1120 | mutex_enter(&fp->f_lock); |
1109 | if ((tmp = *(int *)data32) != 0) | | 1121 | if ((tmp = *(int *)data32) != 0) |
1110 | fp->f_flag |= FNONBLOCK; | | 1122 | fp->f_flag |= FNONBLOCK; |
1111 | else | | 1123 | else |
1112 | fp->f_flag &= ~FNONBLOCK; | | 1124 | fp->f_flag &= ~FNONBLOCK; |
1113 | mutex_exit(&fp->f_lock); | | 1125 | mutex_exit(&fp->f_lock); |
1114 | error = (*fp->f_ops->fo_ioctl)(fp, FIONBIO, (void *)&tmp); | | 1126 | error = (*fp->f_ops->fo_ioctl)(fp, FIONBIO, (void *)&tmp); |
1115 | break; | | 1127 | break; |
1116 | | | 1128 | |
1117 | case FIOASYNC: | | 1129 | case FIOASYNC: |
1118 | mutex_enter(&fp->f_lock); | | 1130 | mutex_enter(&fp->f_lock); |
1119 | if ((tmp = *(int *)data32) != 0) | | 1131 | if ((tmp = *(int *)data32) != 0) |
1120 | fp->f_flag |= FASYNC; | | 1132 | fp->f_flag |= FASYNC; |
1121 | else | | 1133 | else |
1122 | fp->f_flag &= ~FASYNC; | | 1134 | fp->f_flag &= ~FASYNC; |
1123 | mutex_exit(&fp->f_lock); | | 1135 | mutex_exit(&fp->f_lock); |
1124 | error = (*fp->f_ops->fo_ioctl)(fp, FIOASYNC, (void *)&tmp); | | 1136 | error = (*fp->f_ops->fo_ioctl)(fp, FIOASYNC, (void *)&tmp); |
1125 | break; | | 1137 | break; |
1126 | | | 1138 | |
1127 | case AUDIO_WSEEK32: | | 1139 | case AUDIO_WSEEK32: |
1128 | IOCTL_CONV_TO(AUDIO_WSEEK, u_long); | | 1140 | IOCTL_CONV_TO(AUDIO_WSEEK, u_long); |
1129 | | | 1141 | |
1130 | #if 0 /* not implemented by anything */ | | 1142 | #if 0 /* not implemented by anything */ |
1131 | case DIOCRFORMAT32: | | 1143 | case DIOCRFORMAT32: |
1132 | IOCTL_STRUCT_CONV_TO(DIOCRFORMAT, format_op); | | 1144 | IOCTL_STRUCT_CONV_TO(DIOCRFORMAT, format_op); |
1133 | case DIOCWFORMAT32: | | 1145 | case DIOCWFORMAT32: |
1134 | IOCTL_STRUCT_CONV_TO(DIOCWFORMAT, format_op); | | 1146 | IOCTL_STRUCT_CONV_TO(DIOCWFORMAT, format_op); |
1135 | #endif | | 1147 | #endif |
1136 | | | 1148 | |
1137 | case ATAIOCCOMMAND32: | | 1149 | case ATAIOCCOMMAND32: |
1138 | IOCTL_STRUCT_CONV_TO(ATAIOCCOMMAND, atareq); | | 1150 | IOCTL_STRUCT_CONV_TO(ATAIOCCOMMAND, atareq); |
1139 | | | 1151 | |
1140 | case SIOCIFGCLONERS32: | | 1152 | case SIOCIFGCLONERS32: |
1141 | { | | 1153 | { |
1142 | struct netbsd32_if_clonereq *req = | | 1154 | struct netbsd32_if_clonereq *req = |
1143 | (struct netbsd32_if_clonereq *)data32; | | 1155 | (struct netbsd32_if_clonereq *)data32; |
1144 | char *buf = NETBSD32PTR64(req->ifcr_buffer); | | 1156 | char *buf = NETBSD32PTR64(req->ifcr_buffer); |
1145 | | | 1157 | |
1146 | error = if_clone_list(req->ifcr_count, | | 1158 | error = if_clone_list(req->ifcr_count, |
1147 | buf, &req->ifcr_total); | | 1159 | buf, &req->ifcr_total); |
1148 | break; | | 1160 | break; |
1149 | } | | 1161 | } |
1150 | | | 1162 | |
1151 | /* | | 1163 | /* |
1152 | * only a few ifreq syscalls need conversion and those are | | 1164 | * only a few ifreq syscalls need conversion and those are |
1153 | * all driver specific... XXX | | 1165 | * all driver specific... XXX |
1154 | */ | | 1166 | */ |
1155 | #if 0 | | 1167 | #if 0 |
1156 | case SIOCGADDRROM3232: | | 1168 | case SIOCGADDRROM3232: |
1157 | IOCTL_STRUCT_CONV_TO(SIOCGADDRROM32, ifreq); | | 1169 | IOCTL_STRUCT_CONV_TO(SIOCGADDRROM32, ifreq); |
1158 | case SIOCGCHIPID32: | | 1170 | case SIOCGCHIPID32: |
1159 | IOCTL_STRUCT_CONV_TO(SIOCGCHIPID, ifreq); | | 1171 | IOCTL_STRUCT_CONV_TO(SIOCGCHIPID, ifreq); |
1160 | case SIOCSIFADDR32: | | 1172 | case SIOCSIFADDR32: |
1161 | IOCTL_STRUCT_CONV_TO(SIOCSIFADDR, ifreq); | | 1173 | IOCTL_STRUCT_CONV_TO(SIOCSIFADDR, ifreq); |
1162 | case OSIOCGIFADDR32: | | 1174 | case OSIOCGIFADDR32: |
1163 | IOCTL_STRUCT_CONV_TO(OSIOCGIFADDR, ifreq); | | 1175 | IOCTL_STRUCT_CONV_TO(OSIOCGIFADDR, ifreq); |
1164 | case SIOCGIFADDR32: | | 1176 | case SIOCGIFADDR32: |
1165 | IOCTL_STRUCT_CONV_TO(SIOCGIFADDR, ifreq); | | 1177 | IOCTL_STRUCT_CONV_TO(SIOCGIFADDR, ifreq); |
1166 | case SIOCSIFDSTADDR32: | | 1178 | case SIOCSIFDSTADDR32: |
1167 | IOCTL_STRUCT_CONV_TO(SIOCSIFDSTADDR, ifreq); | | 1179 | IOCTL_STRUCT_CONV_TO(SIOCSIFDSTADDR, ifreq); |
1168 | case OSIOCGIFDSTADDR32: | | 1180 | case OSIOCGIFDSTADDR32: |
1169 | IOCTL_STRUCT_CONV_TO(OSIOCGIFDSTADDR, ifreq); | | 1181 | IOCTL_STRUCT_CONV_TO(OSIOCGIFDSTADDR, ifreq); |
1170 | case SIOCGIFDSTADDR32: | | 1182 | case SIOCGIFDSTADDR32: |
1171 | IOCTL_STRUCT_CONV_TO(SIOCGIFDSTADDR, ifreq); | | 1183 | IOCTL_STRUCT_CONV_TO(SIOCGIFDSTADDR, ifreq); |
1172 | case OSIOCGIFBRDADDR32: | | 1184 | case OSIOCGIFBRDADDR32: |
1173 | IOCTL_STRUCT_CONV_TO(OSIOCGIFBRDADDR, ifreq); | | 1185 | IOCTL_STRUCT_CONV_TO(OSIOCGIFBRDADDR, ifreq); |
1174 | case SIOCGIFBRDADDR32: | | 1186 | case SIOCGIFBRDADDR32: |
1175 | IOCTL_STRUCT_CONV_TO(SIOCGIFBRDADDR, ifreq); | | 1187 | IOCTL_STRUCT_CONV_TO(SIOCGIFBRDADDR, ifreq); |
1176 | case SIOCSIFBRDADDR32: | | 1188 | case SIOCSIFBRDADDR32: |
1177 | IOCTL_STRUCT_CONV_TO(SIOCSIFBRDADDR, ifreq); | | 1189 | IOCTL_STRUCT_CONV_TO(SIOCSIFBRDADDR, ifreq); |
1178 | case OSIOCGIFNETMASK32: | | 1190 | case OSIOCGIFNETMASK32: |
1179 | IOCTL_STRUCT_CONV_TO(OSIOCGIFNETMASK, ifreq); | | 1191 | IOCTL_STRUCT_CONV_TO(OSIOCGIFNETMASK, ifreq); |
1180 | case SIOCGIFNETMASK32: | | 1192 | case SIOCGIFNETMASK32: |
1181 | IOCTL_STRUCT_CONV_TO(SIOCGIFNETMASK, ifreq); | | 1193 | IOCTL_STRUCT_CONV_TO(SIOCGIFNETMASK, ifreq); |
1182 | case SIOCSIFNETMASK32: | | 1194 | case SIOCSIFNETMASK32: |
1183 | IOCTL_STRUCT_CONV_TO(SIOCSIFNETMASK, ifreq); | | 1195 | IOCTL_STRUCT_CONV_TO(SIOCSIFNETMASK, ifreq); |
1184 | case SIOCGIFMETRIC32: | | 1196 | case SIOCGIFMETRIC32: |
1185 | IOCTL_STRUCT_CONV_TO(SIOCGIFMETRIC, ifreq); | | 1197 | IOCTL_STRUCT_CONV_TO(SIOCGIFMETRIC, ifreq); |
1186 | case SIOCSIFMETRIC32: | | 1198 | case SIOCSIFMETRIC32: |
1187 | IOCTL_STRUCT_CONV_TO(SIOCSIFMETRIC, ifreq); | | 1199 | IOCTL_STRUCT_CONV_TO(SIOCSIFMETRIC, ifreq); |
1188 | case SIOCDIFADDR32: | | 1200 | case SIOCDIFADDR32: |
1189 | IOCTL_STRUCT_CONV_TO(SIOCDIFADDR, ifreq); | | 1201 | IOCTL_STRUCT_CONV_TO(SIOCDIFADDR, ifreq); |
1190 | case SIOCADDMULTI32: | | 1202 | case SIOCADDMULTI32: |
1191 | IOCTL_STRUCT_CONV_TO(SIOCADDMULTI, ifreq); | | 1203 | IOCTL_STRUCT_CONV_TO(SIOCADDMULTI, ifreq); |
1192 | case SIOCDELMULTI32: | | 1204 | case SIOCDELMULTI32: |
1193 | IOCTL_STRUCT_CONV_TO(SIOCDELMULTI, ifreq); | | 1205 | IOCTL_STRUCT_CONV_TO(SIOCDELMULTI, ifreq); |
1194 | case SIOCSIFMEDIA32: | | 1206 | case SIOCSIFMEDIA32: |
1195 | IOCTL_STRUCT_CONV_TO(SIOCSIFMEDIA, ifreq); | | 1207 | IOCTL_STRUCT_CONV_TO(SIOCSIFMEDIA, ifreq); |
1196 | case SIOCSIFMTU32: | | 1208 | case SIOCSIFMTU32: |
1197 | IOCTL_STRUCT_CONV_TO(SIOCSIFMTU, ifreq); | | 1209 | IOCTL_STRUCT_CONV_TO(SIOCSIFMTU, ifreq); |
1198 | case SIOCGIFMTU32: | | 1210 | case SIOCGIFMTU32: |
1199 | IOCTL_STRUCT_CONV_TO(SIOCGIFMTU, ifreq); | | 1211 | IOCTL_STRUCT_CONV_TO(SIOCGIFMTU, ifreq); |
1200 | case BIOCGETIF32: | | 1212 | case BIOCGETIF32: |
1201 | IOCTL_STRUCT_CONV_TO(BIOCGETIF, ifreq); | | 1213 | IOCTL_STRUCT_CONV_TO(BIOCGETIF, ifreq); |
1202 | case BIOCSETIF32: | | 1214 | case BIOCSETIF32: |
1203 | IOCTL_STRUCT_CONV_TO(BIOCSETIF, ifreq); | | 1215 | IOCTL_STRUCT_CONV_TO(BIOCSETIF, ifreq); |
1204 | case SIOCPHASE132: | | 1216 | case SIOCPHASE132: |
1205 | IOCTL_STRUCT_CONV_TO(SIOCPHASE1, ifreq); | | 1217 | IOCTL_STRUCT_CONV_TO(SIOCPHASE1, ifreq); |
1206 | case SIOCPHASE232: | | 1218 | case SIOCPHASE232: |
1207 | IOCTL_STRUCT_CONV_TO(SIOCPHASE2, ifreq); | | 1219 | IOCTL_STRUCT_CONV_TO(SIOCPHASE2, ifreq); |
1208 | #endif | | 1220 | #endif |
1209 | | | 1221 | |
1210 | case OOSIOCGIFCONF32: | | 1222 | case OOSIOCGIFCONF32: |
1211 | IOCTL_STRUCT_CONV_TO(OOSIOCGIFCONF, ifconf); | | 1223 | IOCTL_STRUCT_CONV_TO(OOSIOCGIFCONF, ifconf); |
1212 | case OSIOCGIFCONF32: | | 1224 | case OSIOCGIFCONF32: |
1213 | IOCTL_STRUCT_CONV_TO(OSIOCGIFCONF, ifconf); | | 1225 | IOCTL_STRUCT_CONV_TO(OSIOCGIFCONF, ifconf); |
1214 | case SIOCGIFCONF32: | | 1226 | case SIOCGIFCONF32: |
1215 | IOCTL_STRUCT_CONV_TO(SIOCGIFCONF, ifconf); | | 1227 | IOCTL_STRUCT_CONV_TO(SIOCGIFCONF, ifconf); |
1216 | | | 1228 | |
1217 | case SIOCGIFFLAGS32: | | 1229 | case SIOCGIFFLAGS32: |
1218 | IOCTL_STRUCT_CONV_TO(SIOCGIFFLAGS, ifreq); | | 1230 | IOCTL_STRUCT_CONV_TO(SIOCGIFFLAGS, ifreq); |
1219 | case SIOCSIFFLAGS32: | | 1231 | case SIOCSIFFLAGS32: |
1220 | IOCTL_STRUCT_CONV_TO(SIOCSIFFLAGS, ifreq); | | 1232 | IOCTL_STRUCT_CONV_TO(SIOCSIFFLAGS, ifreq); |
1221 | | | 1233 | |
1222 | case SIOCGIFADDRPREF32: | | 1234 | case SIOCGIFADDRPREF32: |
1223 | IOCTL_STRUCT_CONV_TO(SIOCGIFADDRPREF, if_addrprefreq); | | 1235 | IOCTL_STRUCT_CONV_TO(SIOCGIFADDRPREF, if_addrprefreq); |
1224 | case SIOCSIFADDRPREF32: | | 1236 | case SIOCSIFADDRPREF32: |
1225 | IOCTL_STRUCT_CONV_TO(SIOCSIFADDRPREF, if_addrprefreq); | | 1237 | IOCTL_STRUCT_CONV_TO(SIOCSIFADDRPREF, if_addrprefreq); |
1226 | | | 1238 | |
1227 | | | 1239 | |
1228 | case OSIOCGIFFLAGS32: | | 1240 | case OSIOCGIFFLAGS32: |
1229 | IOCTL_STRUCT_CONV_TO(OSIOCGIFFLAGS, oifreq); | | 1241 | IOCTL_STRUCT_CONV_TO(OSIOCGIFFLAGS, oifreq); |
1230 | case OSIOCSIFFLAGS32: | | 1242 | case OSIOCSIFFLAGS32: |
1231 | IOCTL_STRUCT_CONV_TO(OSIOCSIFFLAGS, oifreq); | | 1243 | IOCTL_STRUCT_CONV_TO(OSIOCSIFFLAGS, oifreq); |
1232 | | | 1244 | |
1233 | case SIOCGIFMEDIA32: | | 1245 | case SIOCGIFMEDIA32: |
1234 | IOCTL_STRUCT_CONV_TO(SIOCGIFMEDIA, ifmediareq); | | 1246 | IOCTL_STRUCT_CONV_TO(SIOCGIFMEDIA, ifmediareq); |
1235 | | | 1247 | |
| | | 1248 | case SIOCGIFGENERIC32: |
| | | 1249 | IOCTL_STRUCT_CONV_TO(SIOCGIFGENERIC, ifreq); |
| | | 1250 | case SIOCSIFGENERIC32: |
| | | 1251 | IOCTL_STRUCT_CONV_TO(SIOCSIFGENERIC, ifreq); |
| | | 1252 | |
1236 | case PPPOESETPARMS32: | | 1253 | case PPPOESETPARMS32: |
1237 | IOCTL_STRUCT_CONV_TO(PPPOESETPARMS, pppoediscparms); | | 1254 | IOCTL_STRUCT_CONV_TO(PPPOESETPARMS, pppoediscparms); |
1238 | case PPPOEGETPARMS32: | | 1255 | case PPPOEGETPARMS32: |
1239 | IOCTL_STRUCT_CONV_TO(PPPOEGETPARMS, pppoediscparms); | | 1256 | IOCTL_STRUCT_CONV_TO(PPPOEGETPARMS, pppoediscparms); |
1240 | case SPPPGETAUTHCFG32: | | 1257 | case SPPPGETAUTHCFG32: |
1241 | IOCTL_STRUCT_CONV_TO(SPPPGETAUTHCFG, spppauthcfg); | | 1258 | IOCTL_STRUCT_CONV_TO(SPPPGETAUTHCFG, spppauthcfg); |
1242 | case SPPPSETAUTHCFG32: | | 1259 | case SPPPSETAUTHCFG32: |
1243 | IOCTL_STRUCT_CONV_TO(SPPPSETAUTHCFG, spppauthcfg); | | 1260 | IOCTL_STRUCT_CONV_TO(SPPPSETAUTHCFG, spppauthcfg); |
1244 | | | 1261 | |
1245 | case SIOCSDRVSPEC32: | | 1262 | case SIOCSDRVSPEC32: |
1246 | IOCTL_STRUCT_CONV_TO(SIOCSDRVSPEC, ifdrv); | | 1263 | IOCTL_STRUCT_CONV_TO(SIOCSDRVSPEC, ifdrv); |
1247 | case SIOCGDRVSPEC32: | | 1264 | case SIOCGDRVSPEC32: |
1248 | IOCTL_STRUCT_CONV_TO(SIOCGDRVSPEC, ifdrv); | | 1265 | IOCTL_STRUCT_CONV_TO(SIOCGDRVSPEC, ifdrv); |
1249 | | | 1266 | |
1250 | case SIOCGETVIFCNT32: | | 1267 | case SIOCGETVIFCNT32: |
1251 | IOCTL_STRUCT_CONV_TO(SIOCGETVIFCNT, sioc_vif_req); | | 1268 | IOCTL_STRUCT_CONV_TO(SIOCGETVIFCNT, sioc_vif_req); |
1252 | | | 1269 | |
1253 | case SIOCGETSGCNT32: | | 1270 | case SIOCGETSGCNT32: |
1254 | IOCTL_STRUCT_CONV_TO(SIOCGETSGCNT, sioc_sg_req); | | 1271 | IOCTL_STRUCT_CONV_TO(SIOCGETSGCNT, sioc_sg_req); |
1255 | | | 1272 | |
1256 | case VNDIOCSET32: | | 1273 | case VNDIOCSET32: |
1257 | IOCTL_STRUCT_CONV_TO(VNDIOCSET, vnd_ioctl); | | 1274 | IOCTL_STRUCT_CONV_TO(VNDIOCSET, vnd_ioctl); |
1258 | | | 1275 | |
1259 | case VNDIOCCLR32: | | 1276 | case VNDIOCCLR32: |
1260 | IOCTL_STRUCT_CONV_TO(VNDIOCCLR, vnd_ioctl); | | 1277 | IOCTL_STRUCT_CONV_TO(VNDIOCCLR, vnd_ioctl); |
1261 | | | 1278 | |
1262 | case VNDIOCGET32: | | 1279 | case VNDIOCGET32: |
1263 | IOCTL_STRUCT_CONV_TO(VNDIOCGET, vnd_user); | | 1280 | IOCTL_STRUCT_CONV_TO(VNDIOCGET, vnd_user); |
1264 | | | 1281 | |
1265 | case VNDIOCSET5032: | | 1282 | case VNDIOCSET5032: |
1266 | IOCTL_STRUCT_CONV_TO(VNDIOCSET50, vnd_ioctl50); | | 1283 | IOCTL_STRUCT_CONV_TO(VNDIOCSET50, vnd_ioctl50); |
1267 | | | 1284 | |
1268 | case VNDIOCCLR5032: | | 1285 | case VNDIOCCLR5032: |
1269 | IOCTL_STRUCT_CONV_TO(VNDIOCCLR50, vnd_ioctl50); | | 1286 | IOCTL_STRUCT_CONV_TO(VNDIOCCLR50, vnd_ioctl50); |
1270 | | | 1287 | |
1271 | case ENVSYS_GETDICTIONARY32: | | 1288 | case ENVSYS_GETDICTIONARY32: |
1272 | IOCTL_STRUCT_CONV_TO(ENVSYS_GETDICTIONARY, plistref); | | 1289 | IOCTL_STRUCT_CONV_TO(ENVSYS_GETDICTIONARY, plistref); |
1273 | case ENVSYS_SETDICTIONARY32: | | 1290 | case ENVSYS_SETDICTIONARY32: |
1274 | IOCTL_STRUCT_CONV_TO(ENVSYS_SETDICTIONARY, plistref); | | 1291 | IOCTL_STRUCT_CONV_TO(ENVSYS_SETDICTIONARY, plistref); |
1275 | case ENVSYS_REMOVEPROPS32: | | 1292 | case ENVSYS_REMOVEPROPS32: |
1276 | IOCTL_STRUCT_CONV_TO(ENVSYS_REMOVEPROPS, plistref); | | 1293 | IOCTL_STRUCT_CONV_TO(ENVSYS_REMOVEPROPS, plistref); |
1277 | | | 1294 | |
1278 | case WDOGIOC_GWDOGS32: | | 1295 | case WDOGIOC_GWDOGS32: |
1279 | IOCTL_STRUCT_CONV_TO(WDOGIOC_GWDOGS, wdog_conf); | | 1296 | IOCTL_STRUCT_CONV_TO(WDOGIOC_GWDOGS, wdog_conf); |
1280 | | | 1297 | |
1281 | case BIOCSETF32: | | 1298 | case BIOCSETF32: |
1282 | IOCTL_STRUCT_CONV_TO(BIOCSETF, bpf_program); | | 1299 | IOCTL_STRUCT_CONV_TO(BIOCSETF, bpf_program); |
1283 | case BIOCSTCPF32: | | 1300 | case BIOCSTCPF32: |
1284 | IOCTL_STRUCT_CONV_TO(BIOCSTCPF, bpf_program); | | 1301 | IOCTL_STRUCT_CONV_TO(BIOCSTCPF, bpf_program); |
1285 | case BIOCSUDPF32: | | 1302 | case BIOCSUDPF32: |
1286 | IOCTL_STRUCT_CONV_TO(BIOCSUDPF, bpf_program); | | 1303 | IOCTL_STRUCT_CONV_TO(BIOCSUDPF, bpf_program); |
1287 | case BIOCGDLTLIST32: | | 1304 | case BIOCGDLTLIST32: |
1288 | IOCTL_STRUCT_CONV_TO(BIOCGDLTLIST, bpf_dltlist); | | 1305 | IOCTL_STRUCT_CONV_TO(BIOCGDLTLIST, bpf_dltlist); |
1289 | | | 1306 | |
1290 | case WSDISPLAYIO_ADDSCREEN32: | | 1307 | case WSDISPLAYIO_ADDSCREEN32: |
1291 | IOCTL_STRUCT_CONV_TO(WSDISPLAYIO_ADDSCREEN, wsdisplay_addscreendata); | | 1308 | IOCTL_STRUCT_CONV_TO(WSDISPLAYIO_ADDSCREEN, wsdisplay_addscreendata); |
1292 | | | 1309 | |
1293 | case WSDISPLAYIO_GCURSOR32: | | 1310 | case WSDISPLAYIO_GCURSOR32: |
1294 | IOCTL_STRUCT_CONV_TO(WSDISPLAYIO_GCURSOR, wsdisplay_cursor); | | 1311 | IOCTL_STRUCT_CONV_TO(WSDISPLAYIO_GCURSOR, wsdisplay_cursor); |
1295 | case WSDISPLAYIO_SCURSOR32: | | 1312 | case WSDISPLAYIO_SCURSOR32: |
1296 | IOCTL_STRUCT_CONV_TO(WSDISPLAYIO_SCURSOR, wsdisplay_cursor); | | 1313 | IOCTL_STRUCT_CONV_TO(WSDISPLAYIO_SCURSOR, wsdisplay_cursor); |
1297 | | | 1314 | |
1298 | case WSDISPLAYIO_GETCMAP32: | | 1315 | case WSDISPLAYIO_GETCMAP32: |
1299 | IOCTL_STRUCT_CONV_TO(WSDISPLAYIO_GETCMAP, wsdisplay_cmap); | | 1316 | IOCTL_STRUCT_CONV_TO(WSDISPLAYIO_GETCMAP, wsdisplay_cmap); |
1300 | case WSDISPLAYIO_PUTCMAP32: | | 1317 | case WSDISPLAYIO_PUTCMAP32: |
1301 | IOCTL_STRUCT_CONV_TO(WSDISPLAYIO_PUTCMAP, wsdisplay_cmap); | | 1318 | IOCTL_STRUCT_CONV_TO(WSDISPLAYIO_PUTCMAP, wsdisplay_cmap); |
1302 | | | 1319 | |
1303 | case SIOCS8021132: | | 1320 | case SIOCS8021132: |
1304 | IOCTL_STRUCT_CONV_TO(SIOCS80211, ieee80211req); | | 1321 | IOCTL_STRUCT_CONV_TO(SIOCS80211, ieee80211req); |
1305 | case SIOCG8021132: | | 1322 | case SIOCG8021132: |
1306 | IOCTL_STRUCT_CONV_TO(SIOCG80211, ieee80211req); | | 1323 | IOCTL_STRUCT_CONV_TO(SIOCG80211, ieee80211req); |
1307 | case SIOCS80211NWKEY32: | | 1324 | case SIOCS80211NWKEY32: |
1308 | IOCTL_STRUCT_CONV_TO(SIOCS80211NWKEY, ieee80211_nwkey); | | 1325 | IOCTL_STRUCT_CONV_TO(SIOCS80211NWKEY, ieee80211_nwkey); |
1309 | case SIOCG80211NWKEY32: | | 1326 | case SIOCG80211NWKEY32: |
1310 | IOCTL_STRUCT_CONV_TO(SIOCG80211NWKEY, ieee80211_nwkey); | | 1327 | IOCTL_STRUCT_CONV_TO(SIOCG80211NWKEY, ieee80211_nwkey); |
1311 | | | 1328 | |
1312 | case POWER_EVENT_RECVDICT32: | | 1329 | case POWER_EVENT_RECVDICT32: |
1313 | IOCTL_STRUCT_CONV_TO(POWER_EVENT_RECVDICT, plistref); | | 1330 | IOCTL_STRUCT_CONV_TO(POWER_EVENT_RECVDICT, plistref); |
1314 | | | 1331 | |
1315 | case CLOCKCTL_SETTIMEOFDAY32: | | 1332 | case CLOCKCTL_SETTIMEOFDAY32: |
1316 | IOCTL_STRUCT_CONV_TO(CLOCKCTL_SETTIMEOFDAY, | | 1333 | IOCTL_STRUCT_CONV_TO(CLOCKCTL_SETTIMEOFDAY, |
1317 | clockctl_settimeofday); | | 1334 | clockctl_settimeofday); |
1318 | case CLOCKCTL_ADJTIME32: | | 1335 | case CLOCKCTL_ADJTIME32: |
1319 | IOCTL_STRUCT_CONV_TO(CLOCKCTL_ADJTIME, clockctl_adjtime); | | 1336 | IOCTL_STRUCT_CONV_TO(CLOCKCTL_ADJTIME, clockctl_adjtime); |
1320 | case CLOCKCTL_CLOCK_SETTIME32: | | 1337 | case CLOCKCTL_CLOCK_SETTIME32: |
1321 | IOCTL_STRUCT_CONV_TO(CLOCKCTL_CLOCK_SETTIME, | | 1338 | IOCTL_STRUCT_CONV_TO(CLOCKCTL_CLOCK_SETTIME, |
1322 | clockctl_clock_settime); | | 1339 | clockctl_clock_settime); |
1323 | case CLOCKCTL_NTP_ADJTIME32: | | 1340 | case CLOCKCTL_NTP_ADJTIME32: |
1324 | #ifdef NTP | | 1341 | #ifdef NTP |
1325 | { | | 1342 | { |
1326 | size = IOCPARM_LEN(CLOCKCTL_NTP_ADJTIME); | | 1343 | size = IOCPARM_LEN(CLOCKCTL_NTP_ADJTIME); |
1327 | if (size > sizeof(stkbuf)) | | 1344 | if (size > sizeof(stkbuf)) |
1328 | data = memp = kmem_alloc(size, KM_SLEEP); | | 1345 | data = memp = kmem_alloc(size, KM_SLEEP); |
1329 | else | | 1346 | else |
1330 | data = (void *)stkbuf; | | 1347 | data = (void *)stkbuf; |
1331 | | | 1348 | |
1332 | netbsd32_to_clockctl_ntp_adjtime( | | 1349 | netbsd32_to_clockctl_ntp_adjtime( |
1333 | (const struct netbsd32_clockctl_ntp_adjtime *)data32, | | 1350 | (const struct netbsd32_clockctl_ntp_adjtime *)data32, |
1334 | (struct clockctl_ntp_adjtime *)data, | | 1351 | (struct clockctl_ntp_adjtime *)data, |
1335 | CLOCKCTL_NTP_ADJTIME); | | 1352 | CLOCKCTL_NTP_ADJTIME); |
1336 | error = netbsd32_do_clockctl_ntp_adjtime( | | 1353 | error = netbsd32_do_clockctl_ntp_adjtime( |
1337 | (struct clockctl_ntp_adjtime *)data); | | 1354 | (struct clockctl_ntp_adjtime *)data); |
1338 | netbsd32_from_clockctl_ntp_adjtime( | | 1355 | netbsd32_from_clockctl_ntp_adjtime( |
1339 | (const struct clockctl_ntp_adjtime *)data, | | 1356 | (const struct clockctl_ntp_adjtime *)data, |
1340 | (struct netbsd32_clockctl_ntp_adjtime *)data32, | | 1357 | (struct netbsd32_clockctl_ntp_adjtime *)data32, |
1341 | CLOCKCTL_NTP_ADJTIME); | | 1358 | CLOCKCTL_NTP_ADJTIME); |
1342 | | | 1359 | |
1343 | break; | | 1360 | break; |
1344 | } | | 1361 | } |
1345 | #else | | 1362 | #else |
1346 | error = ENOTTY; | | 1363 | error = ENOTTY; |
1347 | break; | | 1364 | break; |
1348 | #endif /* NTP */ | | 1365 | #endif /* NTP */ |
1349 | | | 1366 | |
1350 | case KIOCGSYMBOL32: | | 1367 | case KIOCGSYMBOL32: |
1351 | IOCTL_STRUCT_CONV_TO(KIOCGSYMBOL, ksyms_gsymbol); | | 1368 | IOCTL_STRUCT_CONV_TO(KIOCGSYMBOL, ksyms_gsymbol); |
1352 | case KIOCGVALUE32: | | 1369 | case KIOCGVALUE32: |
1353 | IOCTL_STRUCT_CONV_TO(KIOCGVALUE, ksyms_gvalue); | | 1370 | IOCTL_STRUCT_CONV_TO(KIOCGVALUE, ksyms_gvalue); |
1354 | | | 1371 | |
1355 | case IOC_NPF_LOAD32: | | 1372 | case IOC_NPF_LOAD32: |
1356 | IOCTL_STRUCT_CONV_TO(IOC_NPF_LOAD, plistref); | | 1373 | IOCTL_STRUCT_CONV_TO(IOC_NPF_LOAD, plistref); |
1357 | case IOC_NPF_TABLE32: | | 1374 | case IOC_NPF_TABLE32: |
1358 | IOCTL_STRUCT_CONV_TO(IOC_NPF_TABLE, npf_ioctl_table); | | 1375 | IOCTL_STRUCT_CONV_TO(IOC_NPF_TABLE, npf_ioctl_table); |
1359 | case IOC_NPF_STATS32: | | 1376 | case IOC_NPF_STATS32: |
1360 | IOCTL_CONV_TO(IOC_NPF_STATS, voidp); | | 1377 | IOCTL_CONV_TO(IOC_NPF_STATS, voidp); |
1361 | case IOC_NPF_SAVE32: | | 1378 | case IOC_NPF_SAVE32: |
1362 | IOCTL_STRUCT_CONV_TO(IOC_NPF_SAVE, plistref); | | 1379 | IOCTL_STRUCT_CONV_TO(IOC_NPF_SAVE, plistref); |
1363 | case IOC_NPF_RULE32: | | 1380 | case IOC_NPF_RULE32: |
1364 | IOCTL_STRUCT_CONV_TO(IOC_NPF_RULE, plistref); | | 1381 | IOCTL_STRUCT_CONV_TO(IOC_NPF_RULE, plistref); |
1365 | | | 1382 | |
1366 | case DRVRESCANBUS32: | | 1383 | case DRVRESCANBUS32: |
1367 | IOCTL_STRUCT_CONV_TO(DRVRESCANBUS, devrescanargs); | | 1384 | IOCTL_STRUCT_CONV_TO(DRVRESCANBUS, devrescanargs); |
1368 | case DRVLISTDEV32: | | 1385 | case DRVLISTDEV32: |
1369 | IOCTL_STRUCT_CONV_TO(DRVLISTDEV, devlistargs); | | 1386 | IOCTL_STRUCT_CONV_TO(DRVLISTDEV, devlistargs); |
1370 | case DRVCTLCOMMAND32: | | 1387 | case DRVCTLCOMMAND32: |
1371 | IOCTL_STRUCT_CONV_TO(DRVCTLCOMMAND, plistref); | | 1388 | IOCTL_STRUCT_CONV_TO(DRVCTLCOMMAND, plistref); |
1372 | case DRVGETEVENT32: | | 1389 | case DRVGETEVENT32: |
1373 | IOCTL_STRUCT_CONV_TO(DRVGETEVENT, plistref); | | 1390 | IOCTL_STRUCT_CONV_TO(DRVGETEVENT, plistref); |
1374 | | | 1391 | |
1375 | default: | | 1392 | default: |
1376 | #ifdef NETBSD32_MD_IOCTL | | 1393 | #ifdef NETBSD32_MD_IOCTL |
1377 | error = netbsd32_md_ioctl(fp, com, data32, l); | | 1394 | error = netbsd32_md_ioctl(fp, com, data32, l); |
1378 | #else | | 1395 | #else |
1379 | error = (*fp->f_ops->fo_ioctl)(fp, com, data32); | | 1396 | error = (*fp->f_ops->fo_ioctl)(fp, com, data32); |
1380 | #endif | | 1397 | #endif |
1381 | break; | | 1398 | break; |
1382 | } | | 1399 | } |
1383 | | | 1400 | |
1384 | if (error == EPASSTHROUGH) | | 1401 | if (error == EPASSTHROUGH) |
1385 | error = ENOTTY; | | 1402 | error = ENOTTY; |
1386 | | | 1403 | |
1387 | /* | | 1404 | /* |
1388 | * Copy any data to user, size was | | 1405 | * Copy any data to user, size was |
1389 | * already set and checked above. | | 1406 | * already set and checked above. |
1390 | */ | | 1407 | */ |
1391 | if (error == 0 && (com&IOC_OUT) && size32) { | | 1408 | if (error == 0 && (com&IOC_OUT) && size32) { |
1392 | error = copyout(data32, SCARG_P32(uap, data), size32); | | 1409 | error = copyout(data32, SCARG_P32(uap, data), size32); |
1393 | ktrgenio(fd, UIO_READ, SCARG_P32(uap, data), | | 1410 | ktrgenio(fd, UIO_READ, SCARG_P32(uap, data), |
1394 | size32, error); | | 1411 | size32, error); |
1395 | } | | 1412 | } |
1396 | | | 1413 | |
1397 | out: | | 1414 | out: |
1398 | /* If we allocated data, free it here. */ | | 1415 | /* If we allocated data, free it here. */ |
1399 | if (memp32) | | 1416 | if (memp32) |
1400 | kmem_free(memp32, alloc_size32); | | 1417 | kmem_free(memp32, alloc_size32); |
1401 | if (memp) | | 1418 | if (memp) |
1402 | kmem_free(memp, size); | | 1419 | kmem_free(memp, size); |
1403 | fd_putfile(fd); | | 1420 | fd_putfile(fd); |
1404 | return (error); | | 1421 | return (error); |
1405 | } | | 1422 | } |