xref: /linux/net/sunrpc/netlink.c (revision 0eaed89c18aeedf0898baf2dbf5ff027c6795152)
1af81cb24SJeff Layton // SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2af81cb24SJeff Layton /* Do not edit directly, auto-generated from: */
3af81cb24SJeff Layton /*	Documentation/netlink/specs/sunrpc_cache.yaml */
4af81cb24SJeff Layton /* YNL-GEN kernel source */
5af81cb24SJeff Layton /* To regenerate run: tools/net/ynl/ynl-regen.sh */
6af81cb24SJeff Layton 
7af81cb24SJeff Layton #include <net/netlink.h>
8af81cb24SJeff Layton #include <net/genetlink.h>
9af81cb24SJeff Layton 
10af81cb24SJeff Layton #include "netlink.h"
11af81cb24SJeff Layton 
12af81cb24SJeff Layton #include <uapi/linux/sunrpc_netlink.h>
13af81cb24SJeff Layton 
14712bdbb2SJeff Layton /* Common nested types */
15712bdbb2SJeff Layton const struct nla_policy sunrpc_ip_map_nl_policy[SUNRPC_A_IP_MAP_EXPIRY + 1] = {
16712bdbb2SJeff Layton 	[SUNRPC_A_IP_MAP_SEQNO] = { .type = NLA_U64, },
17712bdbb2SJeff Layton 	[SUNRPC_A_IP_MAP_CLASS] = { .type = NLA_NUL_STRING, },
18712bdbb2SJeff Layton 	[SUNRPC_A_IP_MAP_ADDR] = { .type = NLA_NUL_STRING, },
19712bdbb2SJeff Layton 	[SUNRPC_A_IP_MAP_DOMAIN] = { .type = NLA_NUL_STRING, },
20712bdbb2SJeff Layton 	[SUNRPC_A_IP_MAP_NEGATIVE] = { .type = NLA_FLAG, },
21712bdbb2SJeff Layton 	[SUNRPC_A_IP_MAP_EXPIRY] = { .type = NLA_U64, },
22712bdbb2SJeff Layton };
23712bdbb2SJeff Layton 
24912fc994SJeff Layton const struct nla_policy sunrpc_unix_gid_nl_policy[SUNRPC_A_UNIX_GID_EXPIRY + 1] = {
25912fc994SJeff Layton 	[SUNRPC_A_UNIX_GID_SEQNO] = { .type = NLA_U64, },
26912fc994SJeff Layton 	[SUNRPC_A_UNIX_GID_UID] = { .type = NLA_U32, },
27912fc994SJeff Layton 	[SUNRPC_A_UNIX_GID_GIDS] = { .type = NLA_U32, },
28912fc994SJeff Layton 	[SUNRPC_A_UNIX_GID_NEGATIVE] = { .type = NLA_FLAG, },
29912fc994SJeff Layton 	[SUNRPC_A_UNIX_GID_EXPIRY] = { .type = NLA_U64, },
30912fc994SJeff Layton };
31912fc994SJeff Layton 
32712bdbb2SJeff Layton /* SUNRPC_CMD_IP_MAP_SET_REQS - do */
33712bdbb2SJeff Layton static const struct nla_policy sunrpc_ip_map_set_reqs_nl_policy[SUNRPC_A_IP_MAP_REQS_REQUESTS + 1] = {
34712bdbb2SJeff Layton 	[SUNRPC_A_IP_MAP_REQS_REQUESTS] = NLA_POLICY_NESTED(sunrpc_ip_map_nl_policy),
35712bdbb2SJeff Layton };
36712bdbb2SJeff Layton 
370850e860SJeff Layton /* SUNRPC_CMD_UNIX_GID_SET_REQS - do */
380850e860SJeff Layton static const struct nla_policy sunrpc_unix_gid_set_reqs_nl_policy[SUNRPC_A_UNIX_GID_REQS_REQUESTS + 1] = {
390850e860SJeff Layton 	[SUNRPC_A_UNIX_GID_REQS_REQUESTS] = NLA_POLICY_NESTED(sunrpc_unix_gid_nl_policy),
400850e860SJeff Layton };
410850e860SJeff Layton 
42*565ee23eSJeff Layton /* SUNRPC_CMD_CACHE_FLUSH - do */
43*565ee23eSJeff Layton static const struct nla_policy sunrpc_cache_flush_nl_policy[SUNRPC_A_CACHE_FLUSH_MASK + 1] = {
44*565ee23eSJeff Layton 	[SUNRPC_A_CACHE_FLUSH_MASK] = NLA_POLICY_MASK(NLA_U32, 0x3),
45*565ee23eSJeff Layton };
46*565ee23eSJeff Layton 
47af81cb24SJeff Layton /* Ops table for sunrpc */
48af81cb24SJeff Layton static const struct genl_split_ops sunrpc_nl_ops[] = {
49712bdbb2SJeff Layton 	{
50712bdbb2SJeff Layton 		.cmd	= SUNRPC_CMD_IP_MAP_GET_REQS,
51712bdbb2SJeff Layton 		.dumpit	= sunrpc_nl_ip_map_get_reqs_dumpit,
52712bdbb2SJeff Layton 		.flags	= GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
53712bdbb2SJeff Layton 	},
54712bdbb2SJeff Layton 	{
55712bdbb2SJeff Layton 		.cmd		= SUNRPC_CMD_IP_MAP_SET_REQS,
56712bdbb2SJeff Layton 		.doit		= sunrpc_nl_ip_map_set_reqs_doit,
57712bdbb2SJeff Layton 		.policy		= sunrpc_ip_map_set_reqs_nl_policy,
58712bdbb2SJeff Layton 		.maxattr	= SUNRPC_A_IP_MAP_REQS_REQUESTS,
59712bdbb2SJeff Layton 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
60712bdbb2SJeff Layton 	},
610850e860SJeff Layton 	{
620850e860SJeff Layton 		.cmd	= SUNRPC_CMD_UNIX_GID_GET_REQS,
630850e860SJeff Layton 		.dumpit	= sunrpc_nl_unix_gid_get_reqs_dumpit,
640850e860SJeff Layton 		.flags	= GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
650850e860SJeff Layton 	},
660850e860SJeff Layton 	{
670850e860SJeff Layton 		.cmd		= SUNRPC_CMD_UNIX_GID_SET_REQS,
680850e860SJeff Layton 		.doit		= sunrpc_nl_unix_gid_set_reqs_doit,
690850e860SJeff Layton 		.policy		= sunrpc_unix_gid_set_reqs_nl_policy,
700850e860SJeff Layton 		.maxattr	= SUNRPC_A_UNIX_GID_REQS_REQUESTS,
710850e860SJeff Layton 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
720850e860SJeff Layton 	},
73*565ee23eSJeff Layton 	{
74*565ee23eSJeff Layton 		.cmd		= SUNRPC_CMD_CACHE_FLUSH,
75*565ee23eSJeff Layton 		.doit		= sunrpc_nl_cache_flush_doit,
76*565ee23eSJeff Layton 		.policy		= sunrpc_cache_flush_nl_policy,
77*565ee23eSJeff Layton 		.maxattr	= SUNRPC_A_CACHE_FLUSH_MASK,
78*565ee23eSJeff Layton 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
79*565ee23eSJeff Layton 	},
80af81cb24SJeff Layton };
81af81cb24SJeff Layton 
82af81cb24SJeff Layton static const struct genl_multicast_group sunrpc_nl_mcgrps[] = {
83af81cb24SJeff Layton 	[SUNRPC_NLGRP_NONE] = { "none", },
84af81cb24SJeff Layton 	[SUNRPC_NLGRP_EXPORTD] = { "exportd", },
85af81cb24SJeff Layton };
86af81cb24SJeff Layton 
87af81cb24SJeff Layton struct genl_family sunrpc_nl_family __ro_after_init = {
88af81cb24SJeff Layton 	.name		= SUNRPC_FAMILY_NAME,
89af81cb24SJeff Layton 	.version	= SUNRPC_FAMILY_VERSION,
90af81cb24SJeff Layton 	.netnsok	= true,
91af81cb24SJeff Layton 	.parallel_ops	= true,
92af81cb24SJeff Layton 	.module		= THIS_MODULE,
93af81cb24SJeff Layton 	.split_ops	= sunrpc_nl_ops,
94af81cb24SJeff Layton 	.n_split_ops	= ARRAY_SIZE(sunrpc_nl_ops),
95af81cb24SJeff Layton 	.mcgrps		= sunrpc_nl_mcgrps,
96af81cb24SJeff Layton 	.n_mcgrps	= ARRAY_SIZE(sunrpc_nl_mcgrps),
97af81cb24SJeff Layton };
98