o wireless: make the ioctl tables more resilient to errors using C99 style init

parent 5b8e9042
...@@ -84,98 +84,167 @@ ...@@ -84,98 +84,167 @@
* know about. * know about.
*/ */
static const struct iw_ioctl_description standard_ioctl[] = { static const struct iw_ioctl_description standard_ioctl[] = {
/* SIOCSIWCOMMIT */ [SIOCSIWCOMMIT - SIOCIWFIRST] = {
{ IW_HEADER_TYPE_NULL, 0, 0, 0, 0, 0}, .header_type = IW_HEADER_TYPE_NULL,
/* SIOCGIWNAME */ },
{ IW_HEADER_TYPE_CHAR, 0, 0, 0, 0, IW_DESCR_FLAG_DUMP}, [SIOCGIWNAME - SIOCIWFIRST] = {
/* SIOCSIWNWID */ .header_type = IW_HEADER_TYPE_CHAR,
{ IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, IW_DESCR_FLAG_EVENT}, .flags = IW_DESCR_FLAG_DUMP,
/* SIOCGIWNWID */ },
{ IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, IW_DESCR_FLAG_DUMP}, [SIOCSIWNWID - SIOCIWFIRST] = {
/* SIOCSIWFREQ */ .header_type = IW_HEADER_TYPE_PARAM,
{ IW_HEADER_TYPE_FREQ, 0, 0, 0, 0, IW_DESCR_FLAG_EVENT}, .flags = IW_DESCR_FLAG_EVENT,
/* SIOCGIWFREQ */ },
{ IW_HEADER_TYPE_FREQ, 0, 0, 0, 0, IW_DESCR_FLAG_DUMP}, [SIOCGIWNWID - SIOCIWFIRST] = {
/* SIOCSIWMODE */ .header_type = IW_HEADER_TYPE_PARAM,
{ IW_HEADER_TYPE_UINT, 0, 0, 0, 0, IW_DESCR_FLAG_EVENT}, .flags = IW_DESCR_FLAG_DUMP,
/* SIOCGIWMODE */ },
{ IW_HEADER_TYPE_UINT, 0, 0, 0, 0, IW_DESCR_FLAG_DUMP}, [SIOCSIWFREQ - SIOCIWFIRST] = {
/* SIOCSIWSENS */ .header_type = IW_HEADER_TYPE_FREQ,
{ IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, 0}, .flags = IW_DESCR_FLAG_EVENT,
/* SIOCGIWSENS */ },
{ IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, 0}, [SIOCGIWFREQ - SIOCIWFIRST] = {
/* SIOCSIWRANGE */ .header_type = IW_HEADER_TYPE_FREQ,
{ IW_HEADER_TYPE_NULL, 0, 0, 0, 0, 0}, .flags = IW_DESCR_FLAG_DUMP,
/* SIOCGIWRANGE */ },
{ IW_HEADER_TYPE_POINT, 0, 1, 0, sizeof(struct iw_range), IW_DESCR_FLAG_DUMP}, [SIOCSIWMODE - SIOCIWFIRST] = {
/* SIOCSIWPRIV */ .header_type = IW_HEADER_TYPE_UINT,
{ IW_HEADER_TYPE_NULL, 0, 0, 0, 0, 0}, .flags = IW_DESCR_FLAG_EVENT,
/* SIOCGIWPRIV (handled directly by us) */ },
{ IW_HEADER_TYPE_NULL, 0, 0, 0, 0, 0}, [SIOCGIWMODE - SIOCIWFIRST] = {
/* SIOCSIWSTATS */ .header_type = IW_HEADER_TYPE_UINT,
{ IW_HEADER_TYPE_NULL, 0, 0, 0, 0, 0}, .flags = IW_DESCR_FLAG_DUMP,
/* SIOCGIWSTATS (handled directly by us) */ },
{ IW_HEADER_TYPE_NULL, 0, 0, 0, 0, IW_DESCR_FLAG_DUMP}, [SIOCSIWSENS - SIOCIWFIRST] = {
/* SIOCSIWSPY */ .header_type = IW_HEADER_TYPE_PARAM,
{ IW_HEADER_TYPE_POINT, 0, sizeof(struct sockaddr), 0, IW_MAX_SPY, 0}, },
/* SIOCGIWSPY */ [SIOCGIWSENS - SIOCIWFIRST] = {
{ IW_HEADER_TYPE_POINT, 0, (sizeof(struct sockaddr) + sizeof(struct iw_quality)), 0, IW_MAX_GET_SPY, 0}, .header_type = IW_HEADER_TYPE_PARAM,
/* -- hole -- */ },
{ IW_HEADER_TYPE_NULL, 0, 0, 0, 0, 0}, [SIOCSIWRANGE - SIOCIWFIRST] = {
/* -- hole -- */ .header_type = IW_HEADER_TYPE_NULL,
{ IW_HEADER_TYPE_NULL, 0, 0, 0, 0, 0}, },
/* SIOCSIWAP */ [SIOCGIWRANGE - SIOCIWFIRST] = {
{ IW_HEADER_TYPE_ADDR, 0, 0, 0, 0, 0}, .header_type = IW_HEADER_TYPE_POINT,
/* SIOCGIWAP */ .token_size = 1,
{ IW_HEADER_TYPE_ADDR, 0, 0, 0, 0, IW_DESCR_FLAG_DUMP}, .max_tokens = sizeof(struct iw_range),
/* -- hole -- */ .flags = IW_DESCR_FLAG_DUMP,
{ IW_HEADER_TYPE_NULL, 0, 0, 0, 0, 0}, },
/* SIOCGIWAPLIST */ [SIOCSIWPRIV - SIOCIWFIRST] = {
{ IW_HEADER_TYPE_POINT, 0, (sizeof(struct sockaddr) + sizeof(struct iw_quality)), 0, IW_MAX_AP, 0}, .header_type = IW_HEADER_TYPE_NULL,
/* SIOCSIWSCAN */ },
{ IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, 0}, [SIOCGIWPRIV - SIOCIWFIRST] = { /* (handled directly by us) */
/* SIOCGIWSCAN */ .header_type = IW_HEADER_TYPE_NULL,
{ IW_HEADER_TYPE_POINT, 0, 1, 0, IW_SCAN_MAX_DATA, 0}, },
/* SIOCSIWESSID */ [SIOCSIWSTATS - SIOCIWFIRST] = {
{ IW_HEADER_TYPE_POINT, 0, 1, 0, IW_ESSID_MAX_SIZE + 1, IW_DESCR_FLAG_EVENT}, .header_type = IW_HEADER_TYPE_NULL,
/* SIOCGIWESSID */ },
{ IW_HEADER_TYPE_POINT, 0, 1, 0, IW_ESSID_MAX_SIZE + 1, IW_DESCR_FLAG_DUMP}, [SIOCGIWSTATS - SIOCIWFIRST] = { /* (handled directly by us) */
/* SIOCSIWNICKN */ .header_type = IW_HEADER_TYPE_NULL,
{ IW_HEADER_TYPE_POINT, 0, 1, 0, IW_ESSID_MAX_SIZE + 1, 0}, .flags = IW_DESCR_FLAG_DUMP,
/* SIOCGIWNICKN */ },
{ IW_HEADER_TYPE_POINT, 0, 1, 0, IW_ESSID_MAX_SIZE + 1, 0}, [SIOCSIWSPY - SIOCIWFIRST] = {
/* -- hole -- */ .header_type = IW_HEADER_TYPE_POINT,
{ IW_HEADER_TYPE_NULL, 0, 0, 0, 0, 0}, .token_size = sizeof(struct sockaddr),
/* -- hole -- */ .max_tokens = IW_MAX_SPY,
{ IW_HEADER_TYPE_NULL, 0, 0, 0, 0, 0}, },
/* SIOCSIWRATE */ [SIOCGIWSPY - SIOCIWFIRST] = {
{ IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, 0}, .header_type = IW_HEADER_TYPE_POINT,
/* SIOCGIWRATE */ .token_size = sizeof(struct sockaddr) +
{ IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, 0}, sizeof(struct iw_quality),
/* SIOCSIWRTS */ .max_tokens = IW_MAX_GET_SPY,
{ IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, 0}, },
/* SIOCGIWRTS */ [SIOCSIWAP - SIOCIWFIRST] = {
{ IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, 0}, .header_type = IW_HEADER_TYPE_ADDR,
/* SIOCSIWFRAG */ },
{ IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, 0}, [SIOCGIWAP - SIOCIWFIRST] = {
/* SIOCGIWFRAG */ .header_type = IW_HEADER_TYPE_ADDR,
{ IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, 0}, .flags = IW_DESCR_FLAG_DUMP,
/* SIOCSIWTXPOW */ },
{ IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, 0}, [SIOCGIWAPLIST - SIOCIWFIRST] = {
/* SIOCGIWTXPOW */ .header_type = IW_HEADER_TYPE_POINT,
{ IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, 0}, .token_size = sizeof(struct sockaddr) +
/* SIOCSIWRETRY */ sizeof(struct iw_quality),
{ IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, 0}, .max_tokens = IW_MAX_AP,
/* SIOCGIWRETRY */ },
{ IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, 0}, [SIOCSIWSCAN - SIOCIWFIRST] = {
/* SIOCSIWENCODE */ .header_type = IW_HEADER_TYPE_PARAM,
{ IW_HEADER_TYPE_POINT, 0, 1, 0, IW_ENCODING_TOKEN_MAX, IW_DESCR_FLAG_EVENT | IW_DESCR_FLAG_RESTRICT}, },
/* SIOCGIWENCODE */ [SIOCGIWSCAN - SIOCIWFIRST] = {
{ IW_HEADER_TYPE_POINT, 0, 1, 0, IW_ENCODING_TOKEN_MAX, IW_DESCR_FLAG_DUMP | IW_DESCR_FLAG_RESTRICT}, .header_type = IW_HEADER_TYPE_POINT,
/* SIOCSIWPOWER */ .token_size = 1,
{ IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, 0}, .max_tokens = IW_SCAN_MAX_DATA,
/* SIOCGIWPOWER */ },
{ IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, 0}, [SIOCSIWESSID - SIOCIWFIRST] = {
.header_type = IW_HEADER_TYPE_POINT,
.token_size = 1,
.max_tokens = IW_ESSID_MAX_SIZE + 1,
.flags = IW_DESCR_FLAG_EVENT,
},
[SIOCGIWESSID - SIOCIWFIRST] = {
.header_type = IW_HEADER_TYPE_POINT,
.token_size = 1,
.max_tokens = IW_ESSID_MAX_SIZE + 1,
.flags = IW_DESCR_FLAG_DUMP,
},
[SIOCSIWNICKN - SIOCIWFIRST] = {
.header_type = IW_HEADER_TYPE_POINT,
.token_size = 1,
.max_tokens = IW_ESSID_MAX_SIZE + 1,
},
[SIOCGIWNICKN - SIOCIWFIRST] = {
.header_type = IW_HEADER_TYPE_POINT,
.token_size = 1,
.max_tokens = IW_ESSID_MAX_SIZE + 1,
},
[SIOCSIWRATE - SIOCIWFIRST] = {
.header_type = IW_HEADER_TYPE_PARAM,
},
[SIOCGIWRATE - SIOCIWFIRST] = {
.header_type = IW_HEADER_TYPE_PARAM,
},
[SIOCSIWRTS - SIOCIWFIRST] = {
.header_type = IW_HEADER_TYPE_PARAM,
},
[SIOCGIWRTS - SIOCIWFIRST] = {
.header_type = IW_HEADER_TYPE_PARAM,
},
[SIOCSIWFRAG - SIOCIWFIRST] = {
.header_type = IW_HEADER_TYPE_PARAM,
},
[SIOCGIWFRAG - SIOCIWFIRST] = {
.header_type = IW_HEADER_TYPE_PARAM,
},
[SIOCSIWTXPOW - SIOCIWFIRST] = {
.header_type = IW_HEADER_TYPE_PARAM,
},
[SIOCGIWTXPOW - SIOCIWFIRST] = {
.header_type = IW_HEADER_TYPE_PARAM,
},
[SIOCSIWRETRY - SIOCIWFIRST] = {
.header_type = IW_HEADER_TYPE_PARAM,
},
[SIOCGIWRETRY - SIOCIWFIRST] = {
.header_type = IW_HEADER_TYPE_PARAM,
},
[SIOCSIWENCODE - SIOCIWFIRST] = {
.header_type = IW_HEADER_TYPE_POINT,
.token_size = 1,
.max_tokens = IW_ENCODING_TOKEN_MAX,
.flags = IW_DESCR_FLAG_EVENT | IW_DESCR_FLAG_RESTRICT,
},
[SIOCGIWENCODE - SIOCIWFIRST] = {
.header_type = IW_HEADER_TYPE_POINT,
.token_size = 1,
.max_tokens = IW_ENCODING_TOKEN_MAX,
.flags = IW_DESCR_FLAG_DUMP | IW_DESCR_FLAG_RESTRICT,
},
[SIOCSIWPOWER - SIOCIWFIRST] = {
.header_type = IW_HEADER_TYPE_PARAM,
},
[SIOCGIWPOWER - SIOCIWFIRST] = {
.header_type = IW_HEADER_TYPE_PARAM,
},
}; };
static const int standard_ioctl_num = (sizeof(standard_ioctl) / static const int standard_ioctl_num = (sizeof(standard_ioctl) /
sizeof(struct iw_ioctl_description)); sizeof(struct iw_ioctl_description));
...@@ -185,16 +254,23 @@ static const int standard_ioctl_num = (sizeof(standard_ioctl) / ...@@ -185,16 +254,23 @@ static const int standard_ioctl_num = (sizeof(standard_ioctl) /
* we know about. * we know about.
*/ */
static const struct iw_ioctl_description standard_event[] = { static const struct iw_ioctl_description standard_event[] = {
/* IWEVTXDROP */ [IWEVTXDROP - IWEVFIRST] = {
{ IW_HEADER_TYPE_ADDR, 0, 0, 0, 0, 0}, .header_type = IW_HEADER_TYPE_ADDR,
/* IWEVQUAL */ },
{ IW_HEADER_TYPE_QUAL, 0, 0, 0, 0, 0}, [IWEVQUAL - IWEVFIRST] = {
/* IWEVCUSTOM */ .header_type = IW_HEADER_TYPE_QUAL,
{ IW_HEADER_TYPE_POINT, 0, 1, 0, IW_CUSTOM_MAX, 0}, },
/* IWEVREGISTERED */ [IWEVCUSTOM - IWEVFIRST] = {
{ IW_HEADER_TYPE_ADDR, 0, 0, 0, 0, 0}, .header_type = IW_HEADER_TYPE_POINT,
/* IWEVEXPIRED */ .token_size = 1,
{ IW_HEADER_TYPE_ADDR, 0, 0, 0, 0, 0}, .max_tokens = IW_CUSTOM_MAX,
},
[IWEVREGISTERED - IWEVFIRST] = {
.header_type = IW_HEADER_TYPE_ADDR,
},
[IWEVEXPIRED - IWEVFIRST] = {
.header_type = IW_HEADER_TYPE_ADDR,
},
}; };
static const int standard_event_num = (sizeof(standard_event) / static const int standard_event_num = (sizeof(standard_event) /
sizeof(struct iw_ioctl_description)); sizeof(struct iw_ioctl_description));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment