root / lab4 / .minix-src / include / minix / if.h @ 14
History | View | Annotate | Download (1.95 KB)
1 |
#ifndef _MINIX_IF_H
|
---|---|
2 |
#define _MINIX_IF_H
|
3 |
|
4 |
#include <net/if.h> |
5 |
#include <net/if_media.h> |
6 |
|
7 |
/*
|
8 |
* MINIX3-specific extensions to the network interface headers. These
|
9 |
* extensions are necessary because NetBSD IF uses a few ioctl(2) structure
|
10 |
* formats that contain pointers--something that MINIX3 has to avoid, due to
|
11 |
* its memory granting mechanisms. Thus, those ioctl(2) calls have to be
|
12 |
* converted from NetBSD to MINIX3 format. We currently do that in libc.
|
13 |
* This header specifies the numbers and formats for the MINIX3 versions.
|
14 |
*
|
15 |
* The general idea is that we rewrite the ioctl request data to include both
|
16 |
* the original structure and a buffer for the array of values to which the
|
17 |
* original structure uses a pointer. Important: in those cases, the original
|
18 |
* structure is expected to be the first element of the replacement structure.
|
19 |
*
|
20 |
* There is typically no configured upper bound for the maximum number of
|
21 |
* values in the array, and so we pick size values that are hopefully always
|
22 |
* oversized and yet keep the ioctl sizes within the range of regular ioctls
|
23 |
* (4095 bytes, as per sys/ioccom.h). If there may be larger amounts of data,
|
24 |
* we have to use "big" ioctls.
|
25 |
*
|
26 |
* For the replacement ioctl codes, we use the original ioctl class and number
|
27 |
* with a different size. That should virtually eliminate the possibility of
|
28 |
* accidental collisions.
|
29 |
*/
|
30 |
|
31 |
/* SIOCGIFMEDIA: retrieve interface media status and types. */
|
32 |
#define MINIX_IF_MAXMEDIA 256 |
33 |
|
34 |
struct minix_ifmediareq {
|
35 |
struct ifmediareq mifm_ifm; /* MUST be first */ |
36 |
int mifm_list[MINIX_IF_MAXMEDIA];
|
37 |
}; |
38 |
|
39 |
#define MINIX_SIOCGIFMEDIA _IOWR('i', 54, struct minix_ifmediareq) |
40 |
|
41 |
/* SIOCIFGCLONERS: retrieve interface "cloners" (virtual types). */
|
42 |
#define MINIX_IF_MAXCLONERS 128 |
43 |
|
44 |
struct minix_if_clonereq {
|
45 |
struct if_clonereq mifcr_ifcr; /* MUST be first */ |
46 |
char mifcr_buffer[MINIX_IF_MAXCLONERS * IFNAMSIZ];
|
47 |
}; |
48 |
|
49 |
#define MINIX_SIOCIFGCLONERS _IOWR('i', 120, struct minix_if_clonereq) |
50 |
|
51 |
#endif /* !_MINIX_IF_H */ |