ethtool: wire up get policies to ops
Wire up policies for get commands in struct nla_policy of the ethtool family. Make use of genetlink code attr validation and parsing, as well as allow dumping policies to user space. For every ETHTOOL_MSG_*_GET: - add 'ethnl_' prefix to policy name - add extern declaration in net/ethtool/netlink.h - wire up the policy & attr in ethtool_genl_ops[]. - remove .request_policy and .max_attr from ethnl_request_ops. Obviously core only records the first "layer" of parsed attrs so we still need to parse the sub-attrs of the nested header attribute. v2: - merge of patches 1 and 2 from v1 - remove stray empty lines in ops - also remove .max_attr Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
02da0b615b
commit
4f30974feb
@@ -99,7 +99,7 @@ struct strset_reply_data {
|
||||
#define STRSET_REPDATA(__reply_base) \
|
||||
container_of(__reply_base, struct strset_reply_data, base)
|
||||
|
||||
static const struct nla_policy strset_get_policy[ETHTOOL_A_STRSET_MAX + 1] = {
|
||||
const struct nla_policy ethnl_strset_get_policy[ETHTOOL_A_STRSET_MAX + 1] = {
|
||||
[ETHTOOL_A_STRSET_UNSPEC] = { .type = NLA_REJECT },
|
||||
[ETHTOOL_A_STRSET_HEADER] = { .type = NLA_NESTED },
|
||||
[ETHTOOL_A_STRSET_STRINGSETS] = { .type = NLA_NESTED },
|
||||
@@ -445,10 +445,8 @@ const struct ethnl_request_ops ethnl_strset_request_ops = {
|
||||
.request_cmd = ETHTOOL_MSG_STRSET_GET,
|
||||
.reply_cmd = ETHTOOL_MSG_STRSET_GET_REPLY,
|
||||
.hdr_attr = ETHTOOL_A_STRSET_HEADER,
|
||||
.max_attr = ETHTOOL_A_STRSET_MAX,
|
||||
.req_info_size = sizeof(struct strset_req_info),
|
||||
.reply_data_size = sizeof(struct strset_reply_data),
|
||||
.request_policy = strset_get_policy,
|
||||
.allow_nodev_do = true,
|
||||
|
||||
.parse_request = strset_parse_request,
|
||||
|
Reference in New Issue
Block a user