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/* 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/nfsd_netlink.h>
13
14/* Common nested types */
15const struct nla_policy nfsd_sock_nl_policy[NFSD_A_SOCK_TRANSPORT_NAME + 1] = {
16 [NFSD_A_SOCK_ADDR] = { .type = NLA_BINARY, },
17 [NFSD_A_SOCK_TRANSPORT_NAME] = { .type = NLA_NUL_STRING, },
18};
19
20const struct nla_policy nfsd_version_nl_policy[NFSD_A_VERSION_ENABLED + 1] = {
21 [NFSD_A_VERSION_MAJOR] = { .type = NLA_U32, },
22 [NFSD_A_VERSION_MINOR] = { .type = NLA_U32, },
23 [NFSD_A_VERSION_ENABLED] = { .type = NLA_FLAG, },
24};
25
26/* NFSD_CMD_THREADS_SET - do */
27static const struct nla_policy nfsd_threads_set_nl_policy[NFSD_A_SERVER_SCOPE + 1] = {
28 [NFSD_A_SERVER_THREADS] = { .type = NLA_U32, },
29 [NFSD_A_SERVER_GRACETIME] = { .type = NLA_U32, },
30 [NFSD_A_SERVER_LEASETIME] = { .type = NLA_U32, },
31 [NFSD_A_SERVER_SCOPE] = { .type = NLA_NUL_STRING, },
32};
33
34/* NFSD_CMD_VERSION_SET - do */
35static const struct nla_policy nfsd_version_set_nl_policy[NFSD_A_SERVER_PROTO_VERSION + 1] = {
36 [NFSD_A_SERVER_PROTO_VERSION] = NLA_POLICY_NESTED(nfsd_version_nl_policy),
37};
38
39/* NFSD_CMD_LISTENER_SET - do */
40static const struct nla_policy nfsd_listener_set_nl_policy[NFSD_A_SERVER_SOCK_ADDR + 1] = {
41 [NFSD_A_SERVER_SOCK_ADDR] = NLA_POLICY_NESTED(nfsd_sock_nl_policy),
42};
43
44/* NFSD_CMD_POOL_MODE_SET - do */
45static const struct nla_policy nfsd_pool_mode_set_nl_policy[NFSD_A_POOL_MODE_MODE + 1] = {
46 [NFSD_A_POOL_MODE_MODE] = { .type = NLA_NUL_STRING, },
47};
48
49/* Ops table for nfsd */
50static const struct genl_split_ops nfsd_nl_ops[] = {
51 {
52 .cmd = NFSD_CMD_RPC_STATUS_GET,
53 .dumpit = nfsd_nl_rpc_status_get_dumpit,
54 .flags = GENL_CMD_CAP_DUMP,
55 },
56 {
57 .cmd = NFSD_CMD_THREADS_SET,
58 .doit = nfsd_nl_threads_set_doit,
59 .policy = nfsd_threads_set_nl_policy,
60 .maxattr = NFSD_A_SERVER_SCOPE,
61 .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
62 },
63 {
64 .cmd = NFSD_CMD_THREADS_GET,
65 .doit = nfsd_nl_threads_get_doit,
66 .flags = GENL_CMD_CAP_DO,
67 },
68 {
69 .cmd = NFSD_CMD_VERSION_SET,
70 .doit = nfsd_nl_version_set_doit,
71 .policy = nfsd_version_set_nl_policy,
72 .maxattr = NFSD_A_SERVER_PROTO_VERSION,
73 .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
74 },
75 {
76 .cmd = NFSD_CMD_VERSION_GET,
77 .doit = nfsd_nl_version_get_doit,
78 .flags = GENL_CMD_CAP_DO,
79 },
80 {
81 .cmd = NFSD_CMD_LISTENER_SET,
82 .doit = nfsd_nl_listener_set_doit,
83 .policy = nfsd_listener_set_nl_policy,
84 .maxattr = NFSD_A_SERVER_SOCK_ADDR,
85 .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
86 },
87 {
88 .cmd = NFSD_CMD_LISTENER_GET,
89 .doit = nfsd_nl_listener_get_doit,
90 .flags = GENL_CMD_CAP_DO,
91 },
92 {
93 .cmd = NFSD_CMD_POOL_MODE_SET,
94 .doit = nfsd_nl_pool_mode_set_doit,
95 .policy = nfsd_pool_mode_set_nl_policy,
96 .maxattr = NFSD_A_POOL_MODE_MODE,
97 .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
98 },
99 {
100 .cmd = NFSD_CMD_POOL_MODE_GET,
101 .doit = nfsd_nl_pool_mode_get_doit,
102 .flags = GENL_CMD_CAP_DO,
103 },
104};
105
106struct genl_family nfsd_nl_family __ro_after_init = {
107 .name = NFSD_FAMILY_NAME,
108 .version = NFSD_FAMILY_VERSION,
109 .netnsok = true,
110 .parallel_ops = true,
111 .module = THIS_MODULE,
112 .split_ops = nfsd_nl_ops,
113 .n_split_ops = ARRAY_SIZE(nfsd_nl_ops),
114};
115

source code of linux/fs/nfsd/netlink.c