Skip to content

Commit d93f952

Browse files
kuba-moodavem330
authored andcommitted
nfsd: regenerate user space parsers after ynl-gen changes
Commit 8cea95b ("tools: ynl-gen: handle do ops with no input attrs") added support for some of the previously-skipped ops in nfsd. Regenerate the user space parsers to fill them in. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Acked-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0a8e987 commit d93f952

File tree

3 files changed

+156
-14
lines changed

3 files changed

+156
-14
lines changed

include/uapi/linux/nfsd_netlink.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
/* Documentation/netlink/specs/nfsd.yaml */
44
/* YNL-GEN uapi header */
55

6-
#ifndef _UAPI_LINUX_NFSD_H
7-
#define _UAPI_LINUX_NFSD_H
6+
#ifndef _UAPI_LINUX_NFSD_NETLINK_H
7+
#define _UAPI_LINUX_NFSD_NETLINK_H
88

99
#define NFSD_FAMILY_NAME "nfsd"
1010
#define NFSD_FAMILY_VERSION 1
@@ -36,4 +36,4 @@ enum {
3636
NFSD_CMD_MAX = (__NFSD_CMD_MAX - 1)
3737
};
3838

39-
#endif /* _UAPI_LINUX_NFSD_H */
39+
#endif /* _UAPI_LINUX_NFSD_NETLINK_H */

tools/net/ynl/generated/nfsd-user.c

Lines changed: 114 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,116 @@ struct ynl_policy_nest nfsd_rpc_status_nest = {
5050
/* Common nested types */
5151
/* ============== NFSD_CMD_RPC_STATUS_GET ============== */
5252
/* NFSD_CMD_RPC_STATUS_GET - dump */
53-
void nfsd_rpc_status_get_list_free(struct nfsd_rpc_status_get_list *rsp)
53+
int nfsd_rpc_status_get_rsp_dump_parse(const struct nlmsghdr *nlh, void *data)
5454
{
55-
struct nfsd_rpc_status_get_list *next = rsp;
55+
struct nfsd_rpc_status_get_rsp_dump *dst;
56+
struct ynl_parse_arg *yarg = data;
57+
unsigned int n_compound_ops = 0;
58+
const struct nlattr *attr;
59+
int i;
60+
61+
dst = yarg->data;
62+
63+
if (dst->compound_ops)
64+
return ynl_error_parse(yarg, "attribute already present (rpc-status.compound-ops)");
65+
66+
mnl_attr_for_each(attr, nlh, sizeof(struct genlmsghdr)) {
67+
unsigned int type = mnl_attr_get_type(attr);
68+
69+
if (type == NFSD_A_RPC_STATUS_XID) {
70+
if (ynl_attr_validate(yarg, attr))
71+
return MNL_CB_ERROR;
72+
dst->_present.xid = 1;
73+
dst->xid = mnl_attr_get_u32(attr);
74+
} else if (type == NFSD_A_RPC_STATUS_FLAGS) {
75+
if (ynl_attr_validate(yarg, attr))
76+
return MNL_CB_ERROR;
77+
dst->_present.flags = 1;
78+
dst->flags = mnl_attr_get_u32(attr);
79+
} else if (type == NFSD_A_RPC_STATUS_PROG) {
80+
if (ynl_attr_validate(yarg, attr))
81+
return MNL_CB_ERROR;
82+
dst->_present.prog = 1;
83+
dst->prog = mnl_attr_get_u32(attr);
84+
} else if (type == NFSD_A_RPC_STATUS_VERSION) {
85+
if (ynl_attr_validate(yarg, attr))
86+
return MNL_CB_ERROR;
87+
dst->_present.version = 1;
88+
dst->version = mnl_attr_get_u8(attr);
89+
} else if (type == NFSD_A_RPC_STATUS_PROC) {
90+
if (ynl_attr_validate(yarg, attr))
91+
return MNL_CB_ERROR;
92+
dst->_present.proc = 1;
93+
dst->proc = mnl_attr_get_u32(attr);
94+
} else if (type == NFSD_A_RPC_STATUS_SERVICE_TIME) {
95+
if (ynl_attr_validate(yarg, attr))
96+
return MNL_CB_ERROR;
97+
dst->_present.service_time = 1;
98+
dst->service_time = mnl_attr_get_u64(attr);
99+
} else if (type == NFSD_A_RPC_STATUS_SADDR4) {
100+
if (ynl_attr_validate(yarg, attr))
101+
return MNL_CB_ERROR;
102+
dst->_present.saddr4 = 1;
103+
dst->saddr4 = mnl_attr_get_u32(attr);
104+
} else if (type == NFSD_A_RPC_STATUS_DADDR4) {
105+
if (ynl_attr_validate(yarg, attr))
106+
return MNL_CB_ERROR;
107+
dst->_present.daddr4 = 1;
108+
dst->daddr4 = mnl_attr_get_u32(attr);
109+
} else if (type == NFSD_A_RPC_STATUS_SADDR6) {
110+
unsigned int len;
111+
112+
if (ynl_attr_validate(yarg, attr))
113+
return MNL_CB_ERROR;
114+
115+
len = mnl_attr_get_payload_len(attr);
116+
dst->_present.saddr6_len = len;
117+
dst->saddr6 = malloc(len);
118+
memcpy(dst->saddr6, mnl_attr_get_payload(attr), len);
119+
} else if (type == NFSD_A_RPC_STATUS_DADDR6) {
120+
unsigned int len;
121+
122+
if (ynl_attr_validate(yarg, attr))
123+
return MNL_CB_ERROR;
124+
125+
len = mnl_attr_get_payload_len(attr);
126+
dst->_present.daddr6_len = len;
127+
dst->daddr6 = malloc(len);
128+
memcpy(dst->daddr6, mnl_attr_get_payload(attr), len);
129+
} else if (type == NFSD_A_RPC_STATUS_SPORT) {
130+
if (ynl_attr_validate(yarg, attr))
131+
return MNL_CB_ERROR;
132+
dst->_present.sport = 1;
133+
dst->sport = mnl_attr_get_u16(attr);
134+
} else if (type == NFSD_A_RPC_STATUS_DPORT) {
135+
if (ynl_attr_validate(yarg, attr))
136+
return MNL_CB_ERROR;
137+
dst->_present.dport = 1;
138+
dst->dport = mnl_attr_get_u16(attr);
139+
} else if (type == NFSD_A_RPC_STATUS_COMPOUND_OPS) {
140+
n_compound_ops++;
141+
}
142+
}
143+
144+
if (n_compound_ops) {
145+
dst->compound_ops = calloc(n_compound_ops, sizeof(*dst->compound_ops));
146+
dst->n_compound_ops = n_compound_ops;
147+
i = 0;
148+
mnl_attr_for_each(attr, nlh, sizeof(struct genlmsghdr)) {
149+
if (mnl_attr_get_type(attr) == NFSD_A_RPC_STATUS_COMPOUND_OPS) {
150+
dst->compound_ops[i] = mnl_attr_get_u32(attr);
151+
i++;
152+
}
153+
}
154+
}
155+
156+
return MNL_CB_OK;
157+
}
158+
159+
void
160+
nfsd_rpc_status_get_rsp_list_free(struct nfsd_rpc_status_get_rsp_list *rsp)
161+
{
162+
struct nfsd_rpc_status_get_rsp_list *next = rsp;
56163

57164
while ((void *)next != YNL_LIST_END) {
58165
rsp = next;
@@ -65,15 +172,16 @@ void nfsd_rpc_status_get_list_free(struct nfsd_rpc_status_get_list *rsp)
65172
}
66173
}
67174

68-
struct nfsd_rpc_status_get_list *nfsd_rpc_status_get_dump(struct ynl_sock *ys)
175+
struct nfsd_rpc_status_get_rsp_list *
176+
nfsd_rpc_status_get_dump(struct ynl_sock *ys)
69177
{
70178
struct ynl_dump_state yds = {};
71179
struct nlmsghdr *nlh;
72180
int err;
73181

74182
yds.ys = ys;
75-
yds.alloc_sz = sizeof(struct nfsd_rpc_status_get_list);
76-
yds.cb = nfsd_rpc_status_get_rsp_parse;
183+
yds.alloc_sz = sizeof(struct nfsd_rpc_status_get_rsp_list);
184+
yds.cb = nfsd_rpc_status_get_rsp_dump_parse;
77185
yds.rsp_cmd = NFSD_CMD_RPC_STATUS_GET;
78186
yds.rsp_policy = &nfsd_rpc_status_nest;
79187

@@ -86,7 +194,7 @@ struct nfsd_rpc_status_get_list *nfsd_rpc_status_get_dump(struct ynl_sock *ys)
86194
return yds.first;
87195

88196
free_list:
89-
nfsd_rpc_status_get_list_free(yds.first);
197+
nfsd_rpc_status_get_rsp_list_free(yds.first);
90198
return NULL;
91199
}
92200

tools/net/ynl/generated/nfsd-user.h

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,47 @@ const char *nfsd_op_str(int op);
2121
/* Common nested types */
2222
/* ============== NFSD_CMD_RPC_STATUS_GET ============== */
2323
/* NFSD_CMD_RPC_STATUS_GET - dump */
24-
struct nfsd_rpc_status_get_list {
25-
struct nfsd_rpc_status_get_list *next;
26-
struct nfsd_rpc_status_get_rsp obj __attribute__ ((aligned (8)));
24+
struct nfsd_rpc_status_get_rsp_dump {
25+
struct {
26+
__u32 xid:1;
27+
__u32 flags:1;
28+
__u32 prog:1;
29+
__u32 version:1;
30+
__u32 proc:1;
31+
__u32 service_time:1;
32+
__u32 saddr4:1;
33+
__u32 daddr4:1;
34+
__u32 saddr6_len;
35+
__u32 daddr6_len;
36+
__u32 sport:1;
37+
__u32 dport:1;
38+
} _present;
39+
40+
__u32 xid /* big-endian */;
41+
__u32 flags;
42+
__u32 prog;
43+
__u8 version;
44+
__u32 proc;
45+
__s64 service_time;
46+
__u32 saddr4 /* big-endian */;
47+
__u32 daddr4 /* big-endian */;
48+
void *saddr6;
49+
void *daddr6;
50+
__u16 sport /* big-endian */;
51+
__u16 dport /* big-endian */;
52+
unsigned int n_compound_ops;
53+
__u32 *compound_ops;
54+
};
55+
56+
struct nfsd_rpc_status_get_rsp_list {
57+
struct nfsd_rpc_status_get_rsp_list *next;
58+
struct nfsd_rpc_status_get_rsp_dump obj __attribute__((aligned(8)));
2759
};
2860

29-
void nfsd_rpc_status_get_list_free(struct nfsd_rpc_status_get_list *rsp);
61+
void
62+
nfsd_rpc_status_get_rsp_list_free(struct nfsd_rpc_status_get_rsp_list *rsp);
3063

31-
struct nfsd_rpc_status_get_list *nfsd_rpc_status_get_dump(struct ynl_sock *ys);
64+
struct nfsd_rpc_status_get_rsp_list *
65+
nfsd_rpc_status_get_dump(struct ynl_sock *ys);
3266

3367
#endif /* _LINUX_NFSD_GEN_H */

0 commit comments

Comments
 (0)