xref: /linux/net/sunrpc/netlink.c (revision 912fc994b920a24543725d981e9cd082d1376ed7)
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 
10 #include "netlink.h"
11 
12 #include <uapi/linux/sunrpc_netlink.h>
13 
14 /* Common nested types */
15 const struct nla_policy sunrpc_ip_map_nl_policy[SUNRPC_A_IP_MAP_EXPIRY + 1] = {
16 	[SUNRPC_A_IP_MAP_SEQNO] = { .type = NLA_U64, },
17 	[SUNRPC_A_IP_MAP_CLASS] = { .type = NLA_NUL_STRING, },
18 	[SUNRPC_A_IP_MAP_ADDR] = { .type = NLA_NUL_STRING, },
19 	[SUNRPC_A_IP_MAP_DOMAIN] = { .type = NLA_NUL_STRING, },
20 	[SUNRPC_A_IP_MAP_NEGATIVE] = { .type = NLA_FLAG, },
21 	[SUNRPC_A_IP_MAP_EXPIRY] = { .type = NLA_U64, },
22 };
23 
24 const struct nla_policy sunrpc_unix_gid_nl_policy[SUNRPC_A_UNIX_GID_EXPIRY + 1] = {
25 	[SUNRPC_A_UNIX_GID_SEQNO] = { .type = NLA_U64, },
26 	[SUNRPC_A_UNIX_GID_UID] = { .type = NLA_U32, },
27 	[SUNRPC_A_UNIX_GID_GIDS] = { .type = NLA_U32, },
28 	[SUNRPC_A_UNIX_GID_NEGATIVE] = { .type = NLA_FLAG, },
29 	[SUNRPC_A_UNIX_GID_EXPIRY] = { .type = NLA_U64, },
30 };
31 
32 /* SUNRPC_CMD_IP_MAP_GET_REQS - dump */
33 static const struct nla_policy sunrpc_ip_map_get_reqs_nl_policy[SUNRPC_A_IP_MAP_REQS_REQUESTS + 1] = {
34 	[SUNRPC_A_IP_MAP_REQS_REQUESTS] = NLA_POLICY_NESTED(sunrpc_ip_map_nl_policy),
35 };
36 
37 /* SUNRPC_CMD_IP_MAP_SET_REQS - do */
38 static const struct nla_policy sunrpc_ip_map_set_reqs_nl_policy[SUNRPC_A_IP_MAP_REQS_REQUESTS + 1] = {
39 	[SUNRPC_A_IP_MAP_REQS_REQUESTS] = NLA_POLICY_NESTED(sunrpc_ip_map_nl_policy),
40 };
41 
42 /* SUNRPC_CMD_UNIX_GID_GET_REQS - dump */
43 static const struct nla_policy sunrpc_unix_gid_get_reqs_nl_policy[SUNRPC_A_UNIX_GID_REQS_REQUESTS + 1] = {
44 	[SUNRPC_A_UNIX_GID_REQS_REQUESTS] = NLA_POLICY_NESTED(sunrpc_unix_gid_nl_policy),
45 };
46 
47 /* SUNRPC_CMD_UNIX_GID_SET_REQS - do */
48 static const struct nla_policy sunrpc_unix_gid_set_reqs_nl_policy[SUNRPC_A_UNIX_GID_REQS_REQUESTS + 1] = {
49 	[SUNRPC_A_UNIX_GID_REQS_REQUESTS] = NLA_POLICY_NESTED(sunrpc_unix_gid_nl_policy),
50 };
51 
52 /* Ops table for sunrpc */
53 static const struct genl_split_ops sunrpc_nl_ops[] = {
54 	{
55 		.cmd		= SUNRPC_CMD_IP_MAP_GET_REQS,
56 		.dumpit		= sunrpc_nl_ip_map_get_reqs_dumpit,
57 		.policy		= sunrpc_ip_map_get_reqs_nl_policy,
58 		.maxattr	= SUNRPC_A_IP_MAP_REQS_REQUESTS,
59 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
60 	},
61 	{
62 		.cmd		= SUNRPC_CMD_IP_MAP_SET_REQS,
63 		.doit		= sunrpc_nl_ip_map_set_reqs_doit,
64 		.policy		= sunrpc_ip_map_set_reqs_nl_policy,
65 		.maxattr	= SUNRPC_A_IP_MAP_REQS_REQUESTS,
66 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
67 	},
68 	{
69 		.cmd		= SUNRPC_CMD_UNIX_GID_GET_REQS,
70 		.dumpit		= sunrpc_nl_unix_gid_get_reqs_dumpit,
71 		.policy		= sunrpc_unix_gid_get_reqs_nl_policy,
72 		.maxattr	= SUNRPC_A_UNIX_GID_REQS_REQUESTS,
73 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
74 	},
75 	{
76 		.cmd		= SUNRPC_CMD_UNIX_GID_SET_REQS,
77 		.doit		= sunrpc_nl_unix_gid_set_reqs_doit,
78 		.policy		= sunrpc_unix_gid_set_reqs_nl_policy,
79 		.maxattr	= SUNRPC_A_UNIX_GID_REQS_REQUESTS,
80 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
81 	},
82 };
83 
84 static const struct genl_multicast_group sunrpc_nl_mcgrps[] = {
85 	[SUNRPC_NLGRP_NONE] = { "none", },
86 	[SUNRPC_NLGRP_EXPORTD] = { "exportd", },
87 };
88 
89 struct genl_family sunrpc_nl_family __ro_after_init = {
90 	.name		= SUNRPC_FAMILY_NAME,
91 	.version	= SUNRPC_FAMILY_VERSION,
92 	.netnsok	= true,
93 	.parallel_ops	= true,
94 	.module		= THIS_MODULE,
95 	.split_ops	= sunrpc_nl_ops,
96 	.n_split_ops	= ARRAY_SIZE(sunrpc_nl_ops),
97 	.mcgrps		= sunrpc_nl_mcgrps,
98 	.n_mcgrps	= ARRAY_SIZE(sunrpc_nl_mcgrps),
99 };
100