xref: /linux/net/sunrpc/netlink.c (revision 712bdbb2153bdb99d4a9d0cdcae24b484610147f)
1 // SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2 /* Do not edit directly, auto-generated from: */
3 /*	Documentation/netlink/specs/sunrpc_cache.yaml */
4 /* YNL-GEN kernel source */
5 /* To regenerate run: tools/net/ynl/ynl-regen.sh */
6 
7 #include <net/netlink.h>
8 #include <net/genetlink.h>
9 #include <linux/sunrpc/cache.h>
10 
11 #include "netlink.h"
12 
13 #include <uapi/linux/sunrpc_netlink.h>
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 
35 /* Ops table for sunrpc */
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 	},
51 };
52 
53 static const struct genl_multicast_group sunrpc_nl_mcgrps[] = {
54 	[SUNRPC_NLGRP_NONE] = { "none", },
55 	[SUNRPC_NLGRP_EXPORTD] = { "exportd", },
56 };
57 
58 struct genl_family sunrpc_nl_family __ro_after_init = {
59 	.name		= SUNRPC_FAMILY_NAME,
60 	.version	= SUNRPC_FAMILY_VERSION,
61 	.netnsok	= true,
62 	.parallel_ops	= true,
63 	.module		= THIS_MODULE,
64 	.split_ops	= sunrpc_nl_ops,
65 	.n_split_ops	= ARRAY_SIZE(sunrpc_nl_ops),
66 	.mcgrps		= sunrpc_nl_mcgrps,
67 	.n_mcgrps	= ARRAY_SIZE(sunrpc_nl_mcgrps),
68 };
69