xref: /linux/fs/nfsd/netlink.c (revision 001821b0e79716c4e17c71d8e053a23599a7a508)
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/nfsd.yaml */
4 /* YNL-GEN kernel source */
5 
6 #include <net/netlink.h>
7 #include <net/genetlink.h>
8 
9 #include "netlink.h"
10 
11 #include <uapi/linux/nfsd_netlink.h>
12 
13 /* Common nested types */
14 const struct nla_policy nfsd_sock_nl_policy[NFSD_A_SOCK_TRANSPORT_NAME + 1] = {
15 	[NFSD_A_SOCK_ADDR] = { .type = NLA_BINARY, },
16 	[NFSD_A_SOCK_TRANSPORT_NAME] = { .type = NLA_NUL_STRING, },
17 };
18 
19 const struct nla_policy nfsd_version_nl_policy[NFSD_A_VERSION_ENABLED + 1] = {
20 	[NFSD_A_VERSION_MAJOR] = { .type = NLA_U32, },
21 	[NFSD_A_VERSION_MINOR] = { .type = NLA_U32, },
22 	[NFSD_A_VERSION_ENABLED] = { .type = NLA_FLAG, },
23 };
24 
25 /* NFSD_CMD_THREADS_SET - do */
26 static const struct nla_policy nfsd_threads_set_nl_policy[NFSD_A_SERVER_SCOPE + 1] = {
27 	[NFSD_A_SERVER_THREADS] = { .type = NLA_U32, },
28 	[NFSD_A_SERVER_GRACETIME] = { .type = NLA_U32, },
29 	[NFSD_A_SERVER_LEASETIME] = { .type = NLA_U32, },
30 	[NFSD_A_SERVER_SCOPE] = { .type = NLA_NUL_STRING, },
31 };
32 
33 /* NFSD_CMD_VERSION_SET - do */
34 static const struct nla_policy nfsd_version_set_nl_policy[NFSD_A_SERVER_PROTO_VERSION + 1] = {
35 	[NFSD_A_SERVER_PROTO_VERSION] = NLA_POLICY_NESTED(nfsd_version_nl_policy),
36 };
37 
38 /* NFSD_CMD_LISTENER_SET - do */
39 static const struct nla_policy nfsd_listener_set_nl_policy[NFSD_A_SERVER_SOCK_ADDR + 1] = {
40 	[NFSD_A_SERVER_SOCK_ADDR] = NLA_POLICY_NESTED(nfsd_sock_nl_policy),
41 };
42 
43 /* Ops table for nfsd */
44 static const struct genl_split_ops nfsd_nl_ops[] = {
45 	{
46 		.cmd	= NFSD_CMD_RPC_STATUS_GET,
47 		.start	= nfsd_nl_rpc_status_get_start,
48 		.dumpit	= nfsd_nl_rpc_status_get_dumpit,
49 		.done	= nfsd_nl_rpc_status_get_done,
50 		.flags	= GENL_CMD_CAP_DUMP,
51 	},
52 	{
53 		.cmd		= NFSD_CMD_THREADS_SET,
54 		.doit		= nfsd_nl_threads_set_doit,
55 		.policy		= nfsd_threads_set_nl_policy,
56 		.maxattr	= NFSD_A_SERVER_SCOPE,
57 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
58 	},
59 	{
60 		.cmd	= NFSD_CMD_THREADS_GET,
61 		.doit	= nfsd_nl_threads_get_doit,
62 		.flags	= GENL_CMD_CAP_DO,
63 	},
64 	{
65 		.cmd		= NFSD_CMD_VERSION_SET,
66 		.doit		= nfsd_nl_version_set_doit,
67 		.policy		= nfsd_version_set_nl_policy,
68 		.maxattr	= NFSD_A_SERVER_PROTO_VERSION,
69 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
70 	},
71 	{
72 		.cmd	= NFSD_CMD_VERSION_GET,
73 		.doit	= nfsd_nl_version_get_doit,
74 		.flags	= GENL_CMD_CAP_DO,
75 	},
76 	{
77 		.cmd		= NFSD_CMD_LISTENER_SET,
78 		.doit		= nfsd_nl_listener_set_doit,
79 		.policy		= nfsd_listener_set_nl_policy,
80 		.maxattr	= NFSD_A_SERVER_SOCK_ADDR,
81 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
82 	},
83 	{
84 		.cmd	= NFSD_CMD_LISTENER_GET,
85 		.doit	= nfsd_nl_listener_get_doit,
86 		.flags	= GENL_CMD_CAP_DO,
87 	},
88 };
89 
90 struct genl_family nfsd_nl_family __ro_after_init = {
91 	.name		= NFSD_FAMILY_NAME,
92 	.version	= NFSD_FAMILY_VERSION,
93 	.netnsok	= true,
94 	.parallel_ops	= true,
95 	.module		= THIS_MODULE,
96 	.split_ops	= nfsd_nl_ops,
97 	.n_split_ops	= ARRAY_SIZE(nfsd_nl_ops),
98 };
99