Home | History | Annotate | Line # | Download | only in netbsd32
netbsd32_ioctl.h revision 1.56.8.2
      1 /*	$NetBSD: netbsd32_ioctl.h,v 1.56.8.2 2019/07/22 16:27:29 martin Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1998, 2001 Matthew R. Green
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  *
     16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     21  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     23  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     24  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26  * SUCH DAMAGE.
     27  */
     28 
     29 #include <sys/device.h>
     30 #include <sys/disklabel.h>
     31 #include <sys/disk.h>
     32 
     33 #include <net/zlib.h>
     34 
     35 #include <dev/dkvar.h>
     36 #include <dev/vndvar.h>
     37 
     38 #include <dev/wscons/wsconsio.h>
     39 #include <net80211/ieee80211_ioctl.h>
     40 
     41 /* we define some handy macros here... */
     42 #define IOCTL_STRUCT_CONV_TO(cmd, type)	\
     43 		size = IOCPARM_LEN(cmd); \
     44 		if (size > sizeof(stkbuf)) \
     45 			data = memp = kmem_alloc(size, KM_SLEEP); \
     46 		else \
     47 			data = (void *)stkbuf; \
     48 		__CONCAT(netbsd32_to_, type)((struct __CONCAT(netbsd32_, type) *) \
     49 			data32, (struct type *)data, cmd); \
     50 		error = (*fp->f_ops->fo_ioctl)(fp, cmd, data); \
     51 		__CONCAT(netbsd32_from_, type)((struct type *)data, \
     52 			(struct __CONCAT(netbsd32_, type) *)data32, cmd); \
     53 		break
     54 
     55 #define IOCTL_CONV_TO(cmd, type)	\
     56 		size = IOCPARM_LEN(cmd); \
     57 		if (size > sizeof(stkbuf)) \
     58 			data = memp = kmem_alloc(size, KM_SLEEP); \
     59 		else \
     60 			data = (void *)stkbuf; \
     61 		__CONCAT(netbsd32_to_, type)((__CONCAT(netbsd32_, type) *) \
     62 			data32, (type *)data, cmd); \
     63 		error = (*fp->f_ops->fo_ioctl)(fp, cmd, data); \
     64 		__CONCAT(netbsd32_from_, type)((type *)data, \
     65 			(__CONCAT(netbsd32_, type) *)data32, cmd); \
     66 		break
     67 
     68 /* from <sys/audioio.h> */
     69 #define AUDIO_WSEEK32	_IOR('A', 25, netbsd32_u_long)
     70 
     71 /* from <sys/dkio.h> */
     72 typedef netbsd32_pointer_t netbsd32_disklabel_tp_t;
     73 typedef netbsd32_pointer_t netbsd32_partition_tp_t;
     74 
     75 #if 0	/* not implemented by anything */
     76 struct netbsd32_format_op {
     77 	netbsd32_charp df_buf;
     78 	int	 df_count;		/* value-result */
     79 	daddr_t	 df_startblk;
     80 	int	 df_reg[8];		/* result */
     81 };
     82 #define DIOCRFORMAT32	_IOWR('d', 105, struct netbsd32_format_op)
     83 #define DIOCWFORMAT32	_IOWR('d', 106, struct netbsd32_format_op)
     84 #endif
     85 
     86 /* from <sys/ataio.h> */
     87 struct netbsd32_atareq {
     88 	netbsd32_u_long		flags;
     89 	u_char			command;
     90 	u_char			features;
     91 	u_char			sec_count;
     92 	u_char			sec_num;
     93 	u_char			head;
     94 	u_short			cylinder;
     95 	netbsd32_voidp		databuf;
     96 	netbsd32_u_long		datalen;
     97 	int			timeout;
     98 	u_char			retsts;
     99 	u_char			error;
    100 };
    101 #define ATAIOCCOMMAND32		_IOWR('Q', 8, struct netbsd32_atareq)
    102 
    103 
    104 /* from <net/bpf.h> */
    105 struct netbsd32_bpf_program {
    106 	u_int bf_len;
    107 	netbsd32_pointer_t bf_insns;
    108 };
    109 
    110 struct netbsd32_bpf_dltlist {
    111 	u_int bfl_len;
    112 	netbsd32_pointer_t bfl_list;
    113 };
    114 
    115 #define	BIOCSETF32	_IOW('B',103, struct netbsd32_bpf_program)
    116 #define BIOCSTCPF32	_IOW('B',114, struct netbsd32_bpf_program)
    117 #define BIOCSUDPF32	_IOW('B',115, struct netbsd32_bpf_program)
    118 #define BIOCGDLTLIST32	_IOWR('B',119, struct netbsd32_bpf_dltlist)
    119 #define BIOCSRTIMEOUT32	_IOW('B',122, struct netbsd32_timeval)
    120 
    121 
    122 struct netbsd32_wsdisplay_addscreendata {
    123 	int idx; /* screen index */
    124 	netbsd32_charp screentype;
    125 	netbsd32_charp emul;
    126 };
    127 #define	WSDISPLAYIO_ADDSCREEN32	_IOW('W', 78, struct netbsd32_wsdisplay_addscreendata)
    128 
    129 /* the first member must be matched with struct ifreq */
    130 struct netbsd32_ieee80211req {
    131 	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
    132 	uint16_t	i_type;			/* req type */
    133 	int16_t		i_val;			/* Index or simple value */
    134 	uint16_t	i_len;			/* Index or simple value */
    135 	netbsd32_voidp	i_data;			/* Extra data */
    136 };
    137 #define SIOCS8021132			_IOW('i', 244, struct netbsd32_ieee80211req)
    138 #define SIOCG8021132			_IOWR('i', 245, struct netbsd32_ieee80211req)
    139 
    140 /* the first member must be matched with struct ifreq */
    141 struct netbsd32_ieee80211_nwkey {
    142 	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
    143 	int		i_wepon;		/* wep enabled flag */
    144 	int		i_defkid;		/* default encrypt key id */
    145 	struct {
    146 		int		i_keylen;
    147 		netbsd32_charp	i_keydat;
    148 	}		i_key[IEEE80211_WEP_NKID];
    149 };
    150 #define	SIOCS80211NWKEY32		 _IOW('i', 232, struct netbsd32_ieee80211_nwkey)
    151 #define	SIOCG80211NWKEY32		_IOWR('i', 233, struct netbsd32_ieee80211_nwkey)
    152 
    153 /* for powerd */
    154 #define POWER_EVENT_RECVDICT32	_IOWR('P', 1, struct netbsd32_plistref)
    155 
    156 /* Colormap operations.  Not applicable to all display types. */
    157 struct netbsd32_wsdisplay_cmap {
    158 	u_int	index;				/* first element (0 origin) */
    159 	u_int	count;				/* number of elements */
    160 	netbsd32_charp red;			/* red color map elements */
    161 	netbsd32_charp green;			/* green color map elements */
    162 	netbsd32_charp blue;			/* blue color map elements */
    163 };
    164 
    165 #define	WSDISPLAYIO_GETCMAP32	_IOW('W', 66, struct netbsd32_wsdisplay_cmap)
    166 #define	WSDISPLAYIO_PUTCMAP32	_IOW('W', 67, struct netbsd32_wsdisplay_cmap)
    167 
    168 struct netbsd32_wsdisplay_cursor {
    169 	u_int	which;				/* values to get/set */
    170 	u_int	enable;				/* enable/disable */
    171 	struct wsdisplay_curpos pos;		/* position */
    172 	struct wsdisplay_curpos hot;		/* hot spot */
    173 	struct netbsd32_wsdisplay_cmap cmap;	/* color map info */
    174 	struct wsdisplay_curpos size;		/* bit map size */
    175 	netbsd32_charp image;			/* image data */
    176 	netbsd32_charp mask;			/* mask data */
    177 };
    178 
    179 /* Cursor control: get/set cursor attributes/shape */
    180 #define	WSDISPLAYIO_GCURSOR32	_IOWR('W', 73, struct netbsd32_wsdisplay_cursor)
    181 #define	WSDISPLAYIO_SCURSOR32	_IOW('W', 74, struct netbsd32_wsdisplay_cursor)
    182 
    183 /* can wait! */
    184 #if 0
    185 dev/ccdvar.h:219:#define CCDIOCSET	_IOWR('F', 16, struct ccd_ioctl)   /* enable ccd */
    186 dev/ccdvar.h:220:#define CCDIOCCLR	_IOW('F', 17, struct ccd_ioctl)    /* disable ccd */
    187 
    188 dev/md.h:45:#define MD_GETCONF	_IOR('r', 0, struct md_conf)	/* get unit config */
    189 dev/md.h:46:#define MD_SETCONF	_IOW('r', 1, struct md_conf)	/* set unit config */
    190 
    191 dev/wscons/wsconsio.h:133:#define WSKBDIO_GETMAP		_IOWR('W', 13, struct wskbd_map_data)
    192 dev/wscons/wsconsio.h:134:#define WSKBDIO_SETMAP		_IOW('W', 14, struct wskbd_map_data)
    193 
    194 dev/wscons/wsconsio.h:188:#define WSDISPLAYIO_GETCMAP	_IOW('W', 66, struct wsdisplay_cmap)
    195 dev/wscons/wsconsio.h:189:#define WSDISPLAYIO_PUTCMAP	_IOW('W', 67, struct wsdisplay_cmap)
    196 
    197 dev/wscons/wsconsio.h:241:#define WSDISPLAYIO_SFONT	_IOW('W', 77, struct wsdisplay_font)
    198 
    199 net/if_ppp.h:110:#define PPPIOCSPASS	_IOW('t', 71, struct bpf_program) /* set pass filter */
    200 net/if_ppp.h:111:#define PPPIOCSACTIVE	_IOW('t', 70, struct bpf_program) /* set active filt */
    201 
    202 net/if_atm.h:88:#define SIOCATMENA	_IOWR('a', 123, struct atm_pseudoioctl) /* enable */
    203 net/if_atm.h:89:#define SIOCATMDIS	_IOWR('a', 124, struct atm_pseudoioctl) /* disable */
    204 
    205 net/if_ppp.h:105:#define PPPIOCSCOMPRESS	_IOW('t', 77, struct ppp_option_data)
    206 
    207 netccitt/x25.h:157:#define	SIOCSIFCONF_X25	_IOW('i', 12, struct ifreq_x25)	/* set ifnet config */
    208 netccitt/x25.h:158:#define	SIOCGIFCONF_X25	_IOWR('i',13, struct ifreq_x25)	/* get ifnet config */
    209 
    210 netinet/ip_fil.h:46:#define	SIOCGETFS	_IOR('r', 64, struct friostat)
    211 netinet/ip_fil.h:56:#define	SIOCFRZST	_IOWR('r', 74, struct friostat)
    212 
    213 netinet/ip_fil.h:42:#define	SIOCADAFR	_IOW('r', 60, struct frentry)
    214 netinet/ip_fil.h:43:#define	SIOCRMAFR	_IOW('r', 61, struct frentry)
    215 netinet/ip_fil.h:49:#define	SIOCADIFR	_IOW('r', 67, struct frentry)
    216 netinet/ip_fil.h:50:#define	SIOCRMIFR	_IOW('r', 68, struct frentry)
    217 netinet/ip_fil.h:52:#define	SIOCINAFR	_IOW('r', 70, struct frentry)
    218 netinet/ip_fil.h:53:#define	SIOCINIFR	_IOW('r', 71, struct frentry)
    219 netinet/ip_fil.h:57:#define	SIOCZRLST	_IOWR('r', 75, struct frentry)
    220 
    221 netinet/ip_fil.h:78:#define	SIOCAUTHW	_IOWR(r, 76, struct fr_info)
    222 netinet/ip_fil.h:79:#define	SIOCAUTHR	_IOWR(r, 77, struct fr_info)
    223 
    224 netinet/ip_fil.h:60:#define	SIOCATHST	_IOWR('r', 78, struct fr_authstat)
    225 
    226 netinet/ip_nat.h:22:#define	SIOCADNAT	_IOW('r', 80, struct ipnat)
    227 netinet/ip_nat.h:23:#define	SIOCRMNAT	_IOW('r', 81, struct ipnat)
    228 
    229 netinet/ip_nat.h:24:#define	SIOCGNATS	_IOR('r', 82, struct natstat)
    230 
    231 netinet/ip_nat.h:25:#define	SIOCGNATL	_IOWR('r', 83, struct natlookup)
    232 
    233 netinet/ip_nat.h:26:#define SIOCGFRST	_IOR('r', 84, struct ipfrstat)
    234 
    235 netinet/ip_nat.h:27:#define SIOCGIPST	_IOR('r', 85, struct ips_stat)
    236 
    237 sys/module.h?
    238 
    239 sys/rnd.h:186:#define RNDGETPOOL      _IOR('R',  103, u_char *)  /* get whole pool */
    240 
    241 sys/scanio.h:86:#define SCIOCGET	_IOR('S', 1, struct scan_io) /* retrieve parameters */
    242 sys/scanio.h:87:#define SCIOCSET	_IOW('S', 2, struct scan_io) /* set parameters */
    243 
    244 sys/scsiio.h:43:#define SCIOCCOMMAND	_IOWR('Q', 1, scsireq_t)
    245 #endif
    246 
    247 /* from <net/if.h> */
    248 
    249 typedef netbsd32_pointer_t netbsd32_ifreq_tp_t;
    250 /*
    251  * note that ifr_data is the only one that needs to be changed
    252  */
    253 struct	netbsd32_oifreq {
    254 	char	ifr_name[IFNAMSIZ];		/* if name, e.g. "en0" */
    255 	union {
    256 		struct	sockaddr ifru_addr;
    257 		struct	sockaddr ifru_dstaddr;
    258 		struct	sockaddr ifru_broadaddr;
    259 		short	ifru_flags;
    260 		int	ifru_metric;
    261 		int	ifru_mtu;
    262 		int	ifru_dlt;
    263 		u_int	ifru_value;
    264 		netbsd32_caddr_t ifru_data;
    265 		struct {
    266 			uint32_t	b_buflen;
    267 			netbsd32_caddr_t b_buf;
    268 		} ifru_b;
    269 	} ifr_ifru;
    270 #define	ifr_addr	ifr_ifru.ifru_addr	/* address */
    271 #define	ifr_dstaddr	ifr_ifru.ifru_dstaddr	/* other end of p-to-p link */
    272 #define	ifr_broadaddr	ifr_ifru.ifru_broadaddr	/* broadcast address */
    273 #define	ifr_flags	ifr_ifru.ifru_flags	/* flags */
    274 #define	ifr_metric	ifr_ifru.ifru_metric	/* metric */
    275 #define	ifr_mtu		ifr_ifru.ifru_mtu	/* mtu */
    276 #define	ifr_media	ifr_ifru.ifru_metric	/* media options (overload) */
    277 #define	ifr_data	ifr_ifru.ifru_data	/* for use by interface */
    278 };
    279 struct	netbsd32_ifreq {
    280 	char	ifr_name[IFNAMSIZ];		/* if name, e.g. "en0" */
    281 	union {
    282 		struct	sockaddr ifru_addr;
    283 		struct	sockaddr ifru_dstaddr;
    284 		struct	sockaddr ifru_broadaddr;
    285 		struct	sockaddr_storage ifru_space;
    286 		short	ifru_flags;
    287 		int	ifru_metric;
    288 		int	ifru_mtu;
    289 		int	ifru_dlt;
    290 		u_int	ifru_value;
    291 		netbsd32_caddr_t ifru_data;
    292 		struct {
    293 			uint32_t	b_buflen;
    294 			netbsd32_caddr_t b_buf;
    295 		} ifru_b;
    296 	} ifr_ifru;
    297 };
    298 
    299 struct netbsd32_if_addrprefreq {
    300 	char			ifap_name[IFNAMSIZ];
    301 	uint16_t		ifap_preference;
    302 	struct {
    303 		__uint8_t	ss_len;         /* address length */
    304 		sa_family_t	ss_family;      /* address family */
    305 		char		__ss_pad1[_SS_PAD1SIZE];
    306 		__int32_t	__ss_align[2];
    307 		char		__ss_pad2[_SS_PAD2SIZE];
    308 	} ifap_addr;
    309 };
    310 
    311 struct netbsd32_if_clonereq {
    312 	int	ifcr_total;
    313 	int	ifcr_count;
    314 	netbsd32_charp ifcr_buffer;
    315 };
    316 
    317 /* from <dev/pci/if_devar.h> */
    318 #define	SIOCGADDRROM32		_IOW('i', 240, struct netbsd32_ifreq)	/* get 128 bytes of ROM */
    319 #define	SIOCGCHIPID32		_IOWR('i', 241, struct netbsd32_ifreq)	/* get chipid */
    320 /* from <sys/sockio.h> */
    321 #define	SIOCSIFADDR32	 _IOW('i', 12, struct netbsd32_ifreq)	/* set ifnet address */
    322 #define	OSIOCSIFADDR32	 _IOW('i', 12, struct netbsd32_oifreq)	/* set ifnet address */
    323 #define	OOSIOCGIFADDR32	_IOWR('i', 13, struct netbsd32_oifreq)	/* get ifnet address */
    324 
    325 #define	SIOCGIFADDR32	_IOWR('i', 33, struct netbsd32_ifreq)	/* get ifnet address */
    326 #define	OSIOCGIFADDR32	_IOWR('i', 33, struct netbsd32_oifreq)	/* get ifnet address */
    327 
    328 #define	SIOCSIFDSTADDR32	 _IOW('i', 14, struct netbsd32_ifreq)	/* set p-p address */
    329 #define	OSIOCSIFDSTADDR32	 _IOW('i', 14, struct netbsd32_oifreq)	/* set p-p address */
    330 #define	OOSIOCGIFDSTADDR32	_IOWR('i', 15, struct netbsd32_oifreq)	/* get p-p address */
    331 
    332 #define	SIOCGIFDSTADDR32	_IOWR('i', 34, struct netbsd32_ifreq)	/* get p-p address */
    333 #define	OSIOCGIFDSTADDR32	_IOWR('i', 34, struct netbsd32_oifreq)	/* get p-p address */
    334 
    335 #define	SIOCSIFFLAGS32	 _IOW('i', 16, struct netbsd32_ifreq)	/* set ifnet flags */
    336 #define	OSIOCSIFFLAGS32	 _IOW('i', 16, struct netbsd32_oifreq)	/* set ifnet flags */
    337 
    338 #define	SIOCGIFFLAGS32	_IOWR('i', 17, struct netbsd32_ifreq)	/* get ifnet flags */
    339 #define	OSIOCGIFFLAGS32	_IOWR('i', 17, struct netbsd32_oifreq)	/* get ifnet flags */
    340 
    341 
    342 #define	SIOCSIFBRDADDR32	 _IOW('i', 19, struct netbsd32_ifreq)	/* set broadcast addr */
    343 #define	OSIOCSIFBRDADDR32	 _IOW('i', 19, struct netbsd32_oifreq)	/* set broadcast addr */
    344 #define	OOSIOCGIFBRDADDR32	_IOWR('i', 18, struct netbsd32_oifreq)	/* get broadcast addr */
    345 
    346 #define	SIOCGIFBRDADDR32	_IOWR('i', 35, struct netbsd32_ifreq)	/* get broadcast addr */
    347 #define	OSIOCGIFBRDADDR32	_IOWR('i', 35, struct netbsd32_oifreq)	/* get broadcast addr */
    348 
    349 #define	OOSIOCGIFNETMASK32	_IOWR('i', 21, struct netbsd32_oifreq)	/* get net addr mask */
    350 
    351 #define	SIOCGIFNETMASK32	_IOWR('i', 37, struct netbsd32_ifreq)	/* get net addr mask */
    352 #define	OSIOCGIFNETMASK32	_IOWR('i', 37, struct netbsd32_oifreq)	/* get net addr mask */
    353 
    354 #define	SIOCSIFNETMASK32	 _IOW('i', 22, struct netbsd32_ifreq)	/* set net addr mask */
    355 #define	OSIOCSIFNETMASK32	 _IOW('i', 22, struct netbsd32_oifreq)	/* set net addr mask */
    356 
    357 #define	SIOCGIFMETRIC32	_IOWR('i', 23, struct netbsd32_ifreq)	/* get IF metric */
    358 #define	OSIOCGIFMETRIC32	_IOWR('i', 23, struct netbsd32_oifreq)	/* get IF metric */
    359 
    360 #define	SIOCSIFMETRIC32	 _IOW('i', 24, struct netbsd32_ifreq)	/* set IF metric */
    361 #define	OSIOCSIFMETRIC32	 _IOW('i', 24, struct netbsd32_oifreq)	/* set IF metric */
    362 
    363 #define	SIOCDIFADDR32	 _IOW('i', 25, struct netbsd32_ifreq)	/* delete IF addr */
    364 #define	OSIOCDIFADDR32	 _IOW('i', 25, struct netbsd32_oifreq)	/* delete IF addr */
    365 
    366 #define SIOCSIFADDRPREF32	 _IOW('i', 31, struct netbsd32_if_addrprefreq)
    367 #define SIOCGIFADDRPREF32	_IOWR('i', 32, struct netbsd32_if_addrprefreq)
    368 
    369 #define	SIOCADDMULTI32	 _IOW('i', 49, struct netbsd32_ifreq)	/* add m'cast addr */
    370 #define	OSIOCADDMULTI32	 _IOW('i', 49, struct netbsd32_oifreq)	/* add m'cast addr */
    371 
    372 #define	SIOCDELMULTI32	 _IOW('i', 50, struct netbsd32_ifreq)	/* del m'cast addr */
    373 #define	OSIOCDELMULTI32	 _IOW('i', 50, struct netbsd32_oifreq)	/* del m'cast addr */
    374 
    375 #define	SIOCSIFMEDIA32	_IOWR('i', 53, struct netbsd32_ifreq)	/* set net media */
    376 #define	OSIOCSIFMEDIA32	_IOWR('i', 53, struct netbsd32_oifreq)	/* set net media */
    377 
    378 #define	SIOCSIFGENERIC32 _IOW('i', 57, struct netbsd32_ifreq)	/* generic IF set op */
    379 #define	SIOCGIFGENERIC32 _IOWR('i', 58, struct netbsd32_ifreq)	/* generic IF get op */
    380 
    381 #define	SIOCIFGCLONERS32 _IOWR('i', 120, struct netbsd32_if_clonereq) /* get cloners */
    382 
    383 #define	SIOCSIFMTU32	 _IOW('i', 127, struct netbsd32_ifreq)	/* set ifnet mtu */
    384 #define	OSIOCSIFMTU32	 _IOW('i', 127, struct netbsd32_oifreq)	/* set ifnet mtu */
    385 
    386 #define	SIOCGIFMTU32	_IOWR('i', 126, struct netbsd32_ifreq)	/* get ifnet mtu */
    387 #define	OSIOCGIFMTU32	_IOWR('i', 126, struct netbsd32_oifreq)	/* get ifnet mtu */
    388 /* was 125 SIOCSIFASYNCMAP32 */
    389 /* was 124 SIOCGIFASYNCMAP32 */
    390 /* from <net/bpf.h> */
    391 #define BIOCGETIF32	_IOR('B',107, struct netbsd32_ifreq)
    392 #define BIOCSETIF32	_IOW('B',108, struct netbsd32_ifreq)
    393 /* from <netatalk/phase2.h> */
    394 #define SIOCPHASE1_32	_IOW('i', 100, struct netbsd32_ifreq)	/* AppleTalk phase 1 */
    395 #define SIOCPHASE2_32	_IOW('i', 101, struct netbsd32_ifreq)	/* AppleTalk phase 2 */
    396 
    397 /* from <net/if.h> */
    398 struct	netbsd32_ifconf {
    399 	int	ifc_len;		/* size of associated buffer */
    400 	union {
    401 		netbsd32_caddr_t ifcu_buf;
    402 		netbsd32_ifreq_tp_t ifcu_req;
    403 	} ifc_ifcu;
    404 #define	ifc_buf	ifc_ifcu.ifcu_buf	/* buffer address */
    405 #define	ifc_req	ifc_ifcu.ifcu_req	/* array of structures returned */
    406 };
    407 /* from <sys/sockio.h> */
    408 #define	OOSIOCGIFCONF32	_IOWR('i', 20, struct netbsd32_ifconf)	/* get ifnet list */
    409 #define	OSIOCGIFCONF32	_IOWR('i', 36, struct netbsd32_ifconf)	/* get ifnet list */
    410 #define	SIOCGIFCONF32	_IOWR('i', 38, struct netbsd32_ifconf)	/* get ifnet list */
    411 
    412 /* from <net/if.h> */
    413 struct netbsd32_ifmediareq {
    414 	char	ifm_name[IFNAMSIZ];		/* if name, e.g. "en0" */
    415 	int	ifm_current;			/* current media options */
    416 	int	ifm_mask;			/* don't care mask */
    417 	int	ifm_status;			/* media status */
    418 	int	ifm_active;			/* active options */
    419 	int	ifm_count;			/* # entries in ifm_ulist
    420 						   array */
    421 	netbsd32_intp	ifm_ulist;		/* media words */
    422 };
    423 /* from <sys/sockio.h> */
    424 #define	SIOCGIFMEDIA32	_IOWR('i', 54, struct netbsd32_ifmediareq) /* get net media */
    425 
    426 /* from net/if_pppoe.h */
    427 struct netbsd32_pppoediscparms {
    428 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
    429 	char	eth_ifname[IFNAMSIZ];	/* external ethernet interface name */
    430 	netbsd32_charp ac_name;		/* access concentrator name (or NULL) */
    431 	netbsd32_size_t	ac_name_len;		/* on write: length of buffer for ac_name */
    432 	netbsd32_charp service_name;	/* service name (or NULL) */
    433 	netbsd32_size_t	service_name_len;	/* on write: length of buffer for service name */
    434 };
    435 #define	PPPOESETPARMS32	_IOW('i', 110, struct netbsd32_pppoediscparms)
    436 #define	PPPOEGETPARMS32	_IOWR('i', 111, struct netbsd32_pppoediscparms)
    437 
    438 /* from net/if_sppp.h */
    439 struct netbsd32_spppauthcfg {
    440 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
    441 	u_int	hisauth;		/* one of SPPP_AUTHPROTO_* above */
    442 	u_int	myauth;			/* one of SPPP_AUTHPROTO_* above */
    443 	u_int	myname_length;		/* includes terminating 0 */
    444 	u_int	mysecret_length;	/* includes terminating 0 */
    445 	u_int	hisname_length;		/* includes terminating 0 */
    446 	u_int	hissecret_length;	/* includes terminating 0 */
    447 	u_int	myauthflags;
    448 	u_int	hisauthflags;
    449 	netbsd32_charp	myname;
    450 	netbsd32_charp	mysecret;
    451 	netbsd32_charp	hisname;
    452 	netbsd32_charp	hissecret;
    453 };
    454 #define SPPPGETAUTHCFG32 _IOWR('i', 120, struct netbsd32_spppauthcfg)
    455 #define SPPPSETAUTHCFG32 _IOW('i', 121, struct netbsd32_spppauthcfg)
    456 
    457 /* from <net/if.h> */
    458 struct  netbsd32_ifdrv {
    459 	char		ifd_name[IFNAMSIZ];	/* if name, e.g. "en0" */
    460 	netbsd32_u_long	ifd_cmd;
    461 	netbsd32_size_t	ifd_len;
    462 	netbsd32_voidp	ifd_data;
    463 };
    464 /* from <sys/sockio.h> */
    465 #define SIOCSDRVSPEC32	_IOW('i', 123, struct netbsd32_ifdrv)	/* set driver-specific */
    466 #define SIOCGDRVSPEC32	_IOWR('i', 123, struct netbsd32_ifdrv)	/* get driver-specific */
    467 
    468 /* from <netinet/ip_mroute.h> */
    469 struct netbsd32_sioc_vif_req {
    470 	vifi_t	vifi;			/* vif number */
    471 	netbsd32_u_long	icount;		/* input packet count on vif */
    472 	netbsd32_u_long	ocount;		/* output packet count on vif */
    473 	netbsd32_u_long	ibytes;		/* input byte count on vif */
    474 	netbsd32_u_long	obytes;		/* output byte count on vif */
    475 };
    476 /* from <sys/sockio.h> */
    477 #define	SIOCGETVIFCNT32	_IOWR('u', 51, struct netbsd32_sioc_vif_req)/* vif pkt cnt */
    478 
    479 struct netbsd32_sioc_sg_req {
    480 	struct	in_addr src;
    481 	struct	in_addr grp;
    482 	netbsd32_u_long	pktcnt;
    483 	netbsd32_u_long	bytecnt;
    484 	netbsd32_u_long	wrong_if;
    485 };
    486 /* from <sys/sockio.h> */
    487 #define	SIOCGETSGCNT32	_IOWR('u', 52, struct netbsd32_sioc_sg_req) /* sg pkt cnt */
    488 
    489 /*
    490  * The next two structures are marked "__packed" as they normally end up
    491  * being padded in 64-bit mode.
    492  */
    493 struct netbsd32_vnd_ioctl {
    494 	netbsd32_charp	vnd_file;	/* pathname of file to mount */
    495 	int		vnd_flags;	/* flags; see below */
    496 	struct vndgeom	vnd_geom;	/* geometry to emulate */
    497 	unsigned int	vnd_osize;	/* (returned) size of disk */
    498 	uint64_t	vnd_size;	/* (returned) size of disk */
    499 } __packed;
    500 
    501 struct netbsd32_vnd_user {
    502 	int		vnu_unit;	/* which vnd unit */
    503 	dev_t		vnu_dev;	/* file is on this device... */
    504 	ino_t		vnu_ino;	/* ...at this inode */
    505 } __packed;
    506 
    507 /* from <dev/vndvar.h> */
    508 #define VNDIOCSET32	_IOWR('F', 0, struct netbsd32_vnd_ioctl)	/* enable disk */
    509 #define VNDIOCCLR32	_IOW('F', 1, struct netbsd32_vnd_ioctl)	/* disable disk */
    510 #define VNDIOCGET32	_IOWR('F', 3, struct netbsd32_vnd_user)	/* get list */
    511 
    512 struct netbsd32_vnd_ioctl50 {
    513 	netbsd32_charp	vnd_file;	/* pathname of file to mount */
    514 	int		vnd_flags;	/* flags; see below */
    515 	struct vndgeom	vnd_geom;	/* geometry to emulate */
    516 	unsigned int	vnd_size;	/* (returned) size of disk */
    517 } __packed;
    518 /* from <dev/vnd.c> */
    519 #define VNDIOCSET5032	_IOWR('F', 0, struct netbsd32_vnd_ioctl50)
    520 #define VNDIOCCLR5032	_IOW('F', 1, struct netbsd32_vnd_ioctl50)
    521 
    522 #define ENVSYS_GETDICTIONARY32	_IOWR('E', 0, struct netbsd32_plistref)
    523 #define ENVSYS_SETDICTIONARY32	_IOWR('E', 1, struct netbsd32_plistref)
    524 #define ENVSYS_REMOVEPROPS32	_IOWR('E', 2, struct netbsd32_plistref)
    525 
    526 /* from <sys/wdog.h> */
    527 struct netbsd32_wdog_conf {
    528 	netbsd32_charp	wc_names;
    529 	int		wc_count;
    530 };
    531 #define WDOGIOC_GWDOGS32	_IOWR('w', 5, struct netbsd32_wdog_conf)
    532 
    533 
    534 struct netbsd32_clockctl_settimeofday {
    535 	netbsd32_timevalp_t tv;
    536 	netbsd32_voidp tzp;
    537 };
    538 
    539 #define CLOCKCTL_SETTIMEOFDAY32 _IOW('C', 0x5, \
    540     struct netbsd32_clockctl_settimeofday)
    541 
    542 struct netbsd32_clockctl_adjtime {
    543 	netbsd32_timevalp_t delta;
    544 	netbsd32_timevalp_t olddelta;
    545 };
    546 
    547 #define CLOCKCTL_ADJTIME32 _IOWR('C', 0x6, struct netbsd32_clockctl_adjtime)
    548 
    549 struct netbsd32_clockctl_clock_settime {
    550 	netbsd32_clockid_t clock_id;
    551 	netbsd32_timespecp_t tp;
    552 };
    553 
    554 #define CLOCKCTL_CLOCK_SETTIME32 _IOW('C', 0x7, \
    555     struct netbsd32_clockctl_clock_settime)
    556 
    557 struct netbsd32_clockctl_ntp_adjtime {
    558 	netbsd32_timexp_t tp;
    559 	register32_t retval;
    560 };
    561 
    562 #define CLOCKCTL_NTP_ADJTIME32 _IOWR('C', 0x8, \
    563     struct netbsd32_clockctl_ntp_adjtime)
    564 
    565 #ifdef KIOCGSYMBOL
    566 struct netbsd32_ksyms_gsymbol {
    567 	netbsd32_charp kg_name;
    568 	union {
    569 		Elf_Sym ku_sym;
    570 	} _un;
    571 };
    572 
    573 struct netbsd32_ksyms_gvalue {
    574 	netbsd32_charp kv_name;
    575 	uint64_t kv_value;
    576 };
    577 
    578 #define	KIOCGVALUE32	_IOWR('l', 4, struct netbsd32_ksyms_gvalue)
    579 #define	KIOCGSYMBOL32	_IOWR('l', 5, struct netbsd32_ksyms_gsymbol)
    580 #endif /* KIOCGSYMBOL */
    581 
    582 #include <net/npf/npf.h>
    583 
    584 typedef struct netbsd32_npf_ioctl_buf {
    585 	netbsd32_voidp		buf;
    586 	netbsd32_size_t		len;
    587 } netbsd32_npf_ioctl_buf_t;
    588 
    589 typedef struct netbsd32_npf_ioctl_table {
    590 	int			nct_cmd;
    591 	netbsd32_charp		nct_name;
    592 	union {
    593 		npf_ioctl_ent_t ent;
    594 		netbsd32_npf_ioctl_buf_t buf;
    595 	} nct_data;
    596 } netbsd32_npf_ioctl_table_t;
    597 
    598 #define IOC_NPF_LOAD32          _IOWR('N', 102, struct netbsd32_plistref)
    599 #define IOC_NPF_TABLE32         _IOW('N', 103, struct netbsd32_npf_ioctl_table)
    600 #define IOC_NPF_STATS32         _IOW('N', 104, netbsd32_voidp)
    601 #define IOC_NPF_SAVE32          _IOR('N', 105, struct netbsd32_plistref)
    602 #define IOC_NPF_RULE32          _IOWR('N', 107, struct netbsd32_plistref)
    603 
    604 /* From sys/drvctlio.h */
    605 struct netbsd32_devlistargs {
    606 	char			l_devname[16];
    607 	netbsd32_charpp		l_childname;
    608 	netbsd32_size_t		l_children;
    609 };
    610 
    611 struct netbsd32_devrescanargs {
    612 	char			busname[16];
    613 	char			ifattr[16];
    614 	unsigned int		numlocators;
    615 	netbsd32_intp		locators;
    616 };
    617 
    618 #define	DRVRESCANBUS32		_IOW('D', 124, struct netbsd32_devrescanargs)
    619 #define DRVCTLCOMMAND32		_IOWR('D', 125, struct netbsd32_plistref)
    620 #define	DRVLISTDEV32		_IOWR('D', 127, struct netbsd32_devlistargs)
    621 #define DRVGETEVENT32		_IOR('D', 128, struct netbsd32_plistref)
    622