History

NFSD: introduce netlink stubs

Generate stubs and uAPI for nfsd netlink protocol. For the moment, the new protocol has one operation: rpc_status. The generated header and source files are created by running: tools/net/ynl/ynl-regen.sh

Lorenzo Bianconi committed 3 years ago

Commit 13727f81 parent 6c41d9a6 files · +201 −1Browse files

Unified · Split

6 files
  1. Documentation/netlink/specs/nfsd.yaml +89 −0
  2. fs/nfsd/Makefile +2 −1
  3. fs/nfsd/netlink.c +32 −0
  4. fs/nfsd/netlink.h +22 −0
  5. fs/nfsd/nfsctl.c +17 −0
  6. include/uapi/linux/nfsd_netlink.h +39 −0
Documentation/netlink/specs/nfsd.yaml+89−0
@@ -0,0 +1,89 @@
1# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2
3name: nfsd
4protocol: genetlink
5uapi-header: linux/nfsd_netlink.h
6
7doc: NFSD configuration over generic netlink.
8
9attribute-sets:
10 -
11 name: rpc-status
12 attributes:
13 -
14 name: xid
15 type: u32
16 byte-order: big-endian
17 -
18 name: flags
19 type: u32
20 -
21 name: prog
22 type: u32
23 -
24 name: version
25 type: u8
26 -
27 name: proc
28 type: u32
29 -
30 name: service_time
31 type: s64
32 -
33 name: pad
34 type: pad
35 -
36 name: saddr4
37 type: u32
38 byte-order: big-endian
39 display-hint: ipv4
40 -
41 name: daddr4
42 type: u32
43 byte-order: big-endian
44 display-hint: ipv4
45 -
46 name: saddr6
47 type: binary
48 display-hint: ipv6
49 -
50 name: daddr6
51 type: binary
52 display-hint: ipv6
53 -
54 name: sport
55 type: u16
56 byte-order: big-endian
57 -
58 name: dport
59 type: u16
60 byte-order: big-endian
61 -
62 name: compound-ops
63 type: u32
64 multi-attr: true
65
66operations:
67 list:
68 -
69 name: rpc-status-get
70 doc: dump pending nfsd rpc
71 attribute-set: rpc-status
72 dump:
73 pre: nfsd-nl-rpc-status-get-start
74 post: nfsd-nl-rpc-status-get-done
75 reply:
76 attributes:
77 - xid
78 - flags
79 - prog
80 - version
81 - proc
82 - service_time
83 - saddr4
84 - daddr4
85 - saddr6
86 - daddr6
87 - sport
88 - dport
89 - compound-ops
fs/nfsd/Makefile+2−1
@@ -12,7 +12,8 @@ nfsd-y += trace.o · 11 unmodified lines
12 12
13nfsd-y += nfssvc.o nfsctl.o nfsfh.o vfs.o \13nfsd-y += nfssvc.o nfsctl.o nfsfh.o vfs.o \
14 export.o auth.o lockd.o nfscache.o \14 export.o auth.o lockd.o nfscache.o \
15 stats.o filecache.o nfs3proc.o nfs3xdr.o15 stats.o filecache.o nfs3proc.o nfs3xdr.o \
16 netlink.o
16nfsd-$(CONFIG_NFSD_V2) += nfsproc.o nfsxdr.o17nfsd-$(CONFIG_NFSD_V2) += nfsproc.o nfsxdr.o
17nfsd-$(CONFIG_NFSD_V2_ACL) += nfs2acl.o18nfsd-$(CONFIG_NFSD_V2_ACL) += nfs2acl.o
18nfsd-$(CONFIG_NFSD_V3_ACL) += nfs3acl.o19nfsd-$(CONFIG_NFSD_V3_ACL) += nfs3acl.o
fs/nfsd/netlink.c+32−0
@@ -0,0 +1,32 @@
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/* Ops table for nfsd */
14static const struct genl_split_ops nfsd_nl_ops[] = {
15 {
16 .cmd = NFSD_CMD_RPC_STATUS_GET,
17 .start = nfsd_nl_rpc_status_get_start,
18 .dumpit = nfsd_nl_rpc_status_get_dumpit,
19 .done = nfsd_nl_rpc_status_get_done,
20 .flags = GENL_CMD_CAP_DUMP,
21 },
22};
23
24struct genl_family nfsd_nl_family __ro_after_init = {
25 .name = NFSD_FAMILY_NAME,
26 .version = NFSD_FAMILY_VERSION,
27 .netnsok = true,
28 .parallel_ops = true,
29 .module = THIS_MODULE,
30 .split_ops = nfsd_nl_ops,
31 .n_split_ops = ARRAY_SIZE(nfsd_nl_ops),
32};
fs/nfsd/netlink.h+22−0
@@ -0,0 +1,22 @@
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 header */
5
6#ifndef _LINUX_NFSD_GEN_H
7#define _LINUX_NFSD_GEN_H
8
9#include <net/netlink.h>
10#include <net/genetlink.h>
11
12#include <uapi/linux/nfsd_netlink.h>
13
14int nfsd_nl_rpc_status_get_start(struct netlink_callback *cb);
15int nfsd_nl_rpc_status_get_done(struct netlink_callback *cb);
16
17int nfsd_nl_rpc_status_get_dumpit(struct sk_buff *skb,
18 struct netlink_callback *cb);
19
20extern struct genl_family nfsd_nl_family;
21
22#endif /* _LINUX_NFSD_GEN_H */
fs/nfsd/nfsctl.c+17−0
@@ -26,6 +26,7 @@ · 25 unmodified lines
26#include "pnfs.h"26#include "pnfs.h"
27#include "filecache.h"27#include "filecache.h"
28#include "trace.h"28#include "trace.h"
29#include "netlink.h"
29 30
30/*31/*
31 * We have a single directory with several nodes in it.32 * We have a single directory with several nodes in it.
@@ -1495,6 +1496,22 @@ static int create_proc_exports_entry(void) · 1463 unmodified lines
1495 1496
1496unsigned int nfsd_net_id;1497unsigned int nfsd_net_id;
1497 1498
1499int nfsd_nl_rpc_status_get_start(struct netlink_callback *cb)
1500{
1501 return 0;
1502}
1503
1504int nfsd_nl_rpc_status_get_dumpit(struct sk_buff *skb,
1505 struct netlink_callback *cb)
1506{
1507 return 0;
1508}
1509
1510int nfsd_nl_rpc_status_get_done(struct netlink_callback *cb)
1511{
1512 return 0;
1513}
1514
1498/**1515/**
1499 * nfsd_net_init - Prepare the nfsd_net portion of a new net namespace1516 * nfsd_net_init - Prepare the nfsd_net portion of a new net namespace
1500 * @net: a freshly-created network namespace1517 * @net: a freshly-created network namespace
include/uapi/linux/nfsd_netlink.h+39−0
@@ -0,0 +1,39 @@
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 uapi header */
5
6#ifndef _UAPI_LINUX_NFSD_H
7#define _UAPI_LINUX_NFSD_H
8
9#define NFSD_FAMILY_NAME "nfsd"
10#define NFSD_FAMILY_VERSION 1
11
12enum {
13 NFSD_A_RPC_STATUS_XID = 1,
14 NFSD_A_RPC_STATUS_FLAGS,
15 NFSD_A_RPC_STATUS_PROG,
16 NFSD_A_RPC_STATUS_VERSION,
17 NFSD_A_RPC_STATUS_PROC,
18 NFSD_A_RPC_STATUS_SERVICE_TIME,
19 NFSD_A_RPC_STATUS_PAD,
20 NFSD_A_RPC_STATUS_SADDR4,
21 NFSD_A_RPC_STATUS_DADDR4,
22 NFSD_A_RPC_STATUS_SADDR6,
23 NFSD_A_RPC_STATUS_DADDR6,
24 NFSD_A_RPC_STATUS_SPORT,
25 NFSD_A_RPC_STATUS_DPORT,
26 NFSD_A_RPC_STATUS_COMPOUND_OPS,
27
28 __NFSD_A_RPC_STATUS_MAX,
29 NFSD_A_RPC_STATUS_MAX = (__NFSD_A_RPC_STATUS_MAX - 1)
30};
31
32enum {
33 NFSD_CMD_RPC_STATUS_GET = 1,
34
35 __NFSD_CMD_MAX,
36 NFSD_CMD_MAX = (__NFSD_CMD_MAX - 1)
37};
38
39#endif /* _UAPI_LINUX_NFSD_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t