|
12 | 12 |
|
13 | 13 | #include <uapi/linux/sunrpc_netlink.h> |
14 | 14 |
|
| 15 | +/* Common nested types */ |
| 16 | +const struct nla_policy sunrpc_ip_map_nl_policy[SUNRPC_A_IP_MAP_EXPIRY + 1] = { |
| 17 | + [SUNRPC_A_IP_MAP_SEQNO] = { .type = NLA_U64, }, |
| 18 | + [SUNRPC_A_IP_MAP_CLASS] = { .type = NLA_NUL_STRING, }, |
| 19 | + [SUNRPC_A_IP_MAP_ADDR] = { .type = NLA_NUL_STRING, }, |
| 20 | + [SUNRPC_A_IP_MAP_DOMAIN] = { .type = NLA_NUL_STRING, }, |
| 21 | + [SUNRPC_A_IP_MAP_NEGATIVE] = { .type = NLA_FLAG, }, |
| 22 | + [SUNRPC_A_IP_MAP_EXPIRY] = { .type = NLA_U64, }, |
| 23 | +}; |
| 24 | + |
| 25 | +/* SUNRPC_CMD_IP_MAP_GET_REQS - dump */ |
| 26 | +static const struct nla_policy sunrpc_ip_map_get_reqs_nl_policy[SUNRPC_A_IP_MAP_REQS_REQUESTS + 1] = { |
| 27 | + [SUNRPC_A_IP_MAP_REQS_REQUESTS] = NLA_POLICY_NESTED(sunrpc_ip_map_nl_policy), |
| 28 | +}; |
| 29 | + |
| 30 | +/* SUNRPC_CMD_IP_MAP_SET_REQS - do */ |
| 31 | +static const struct nla_policy sunrpc_ip_map_set_reqs_nl_policy[SUNRPC_A_IP_MAP_REQS_REQUESTS + 1] = { |
| 32 | + [SUNRPC_A_IP_MAP_REQS_REQUESTS] = NLA_POLICY_NESTED(sunrpc_ip_map_nl_policy), |
| 33 | +}; |
| 34 | + |
15 | 35 | /* Ops table for sunrpc */ |
16 | 36 | static const struct genl_split_ops sunrpc_nl_ops[] = { |
| 37 | + { |
| 38 | + .cmd = SUNRPC_CMD_IP_MAP_GET_REQS, |
| 39 | + .dumpit = sunrpc_nl_ip_map_get_reqs_dumpit, |
| 40 | + .policy = sunrpc_ip_map_get_reqs_nl_policy, |
| 41 | + .maxattr = SUNRPC_A_IP_MAP_REQS_REQUESTS, |
| 42 | + .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP, |
| 43 | + }, |
| 44 | + { |
| 45 | + .cmd = SUNRPC_CMD_IP_MAP_SET_REQS, |
| 46 | + .doit = sunrpc_nl_ip_map_set_reqs_doit, |
| 47 | + .policy = sunrpc_ip_map_set_reqs_nl_policy, |
| 48 | + .maxattr = SUNRPC_A_IP_MAP_REQS_REQUESTS, |
| 49 | + .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO, |
| 50 | + }, |
17 | 51 | }; |
18 | 52 |
|
19 | 53 | static const struct genl_multicast_group sunrpc_nl_mcgrps[] = { |
|
0 commit comments