]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
7663dacd | 2 | /* XDR types for nfsd. This is mainly a typing exercise. */ |
1da177e4 LT |
3 | |
4 | #ifndef LINUX_NFSD_H | |
5 | #define LINUX_NFSD_H | |
6 | ||
1da177e4 | 7 | #include <linux/vfs.h> |
9a74af21 | 8 | #include "nfsd.h" |
1557aca7 | 9 | #include "nfsfh.h" |
1da177e4 LT |
10 | |
11 | struct nfsd_fhandle { | |
12 | struct svc_fh fh; | |
13 | }; | |
14 | ||
15 | struct nfsd_sattrargs { | |
16 | struct svc_fh fh; | |
17 | struct iattr attrs; | |
18 | }; | |
19 | ||
20 | struct nfsd_diropargs { | |
21 | struct svc_fh fh; | |
22 | char * name; | |
29d5e555 | 23 | unsigned int len; |
1da177e4 LT |
24 | }; |
25 | ||
26 | struct nfsd_readargs { | |
27 | struct svc_fh fh; | |
28 | __u32 offset; | |
29 | __u32 count; | |
1da177e4 LT |
30 | int vlen; |
31 | }; | |
32 | ||
33 | struct nfsd_writeargs { | |
34 | svc_fh fh; | |
35 | __u32 offset; | |
36 | int len; | |
8154ef27 | 37 | struct kvec first; |
1da177e4 LT |
38 | }; |
39 | ||
40 | struct nfsd_createargs { | |
41 | struct svc_fh fh; | |
42 | char * name; | |
29d5e555 | 43 | unsigned int len; |
1da177e4 LT |
44 | struct iattr attrs; |
45 | }; | |
46 | ||
47 | struct nfsd_renameargs { | |
48 | struct svc_fh ffh; | |
49 | char * fname; | |
29d5e555 | 50 | unsigned int flen; |
1da177e4 LT |
51 | struct svc_fh tfh; |
52 | char * tname; | |
29d5e555 | 53 | unsigned int tlen; |
1da177e4 LT |
54 | }; |
55 | ||
56 | struct nfsd_readlinkargs { | |
57 | struct svc_fh fh; | |
58 | char * buffer; | |
59 | }; | |
60 | ||
61 | struct nfsd_linkargs { | |
62 | struct svc_fh ffh; | |
63 | struct svc_fh tfh; | |
64 | char * tname; | |
29d5e555 | 65 | unsigned int tlen; |
1da177e4 LT |
66 | }; |
67 | ||
68 | struct nfsd_symlinkargs { | |
69 | struct svc_fh ffh; | |
70 | char * fname; | |
29d5e555 | 71 | unsigned int flen; |
1da177e4 | 72 | char * tname; |
48b4ba3f | 73 | unsigned int tlen; |
1da177e4 | 74 | struct iattr attrs; |
38a70315 | 75 | struct kvec first; |
1da177e4 LT |
76 | }; |
77 | ||
78 | struct nfsd_readdirargs { | |
79 | struct svc_fh fh; | |
80 | __u32 cookie; | |
81 | __u32 count; | |
131a21c2 | 82 | __be32 * buffer; |
1da177e4 LT |
83 | }; |
84 | ||
85 | struct nfsd_attrstat { | |
86 | struct svc_fh fh; | |
a334de28 | 87 | struct kstat stat; |
1da177e4 LT |
88 | }; |
89 | ||
90 | struct nfsd_diropres { | |
91 | struct svc_fh fh; | |
a334de28 | 92 | struct kstat stat; |
1da177e4 LT |
93 | }; |
94 | ||
95 | struct nfsd_readlinkres { | |
96 | int len; | |
97 | }; | |
98 | ||
99 | struct nfsd_readres { | |
100 | struct svc_fh fh; | |
101 | unsigned long count; | |
a334de28 | 102 | struct kstat stat; |
1da177e4 LT |
103 | }; |
104 | ||
105 | struct nfsd_readdirres { | |
106 | int count; | |
107 | ||
108 | struct readdir_cd common; | |
131a21c2 | 109 | __be32 * buffer; |
1da177e4 | 110 | int buflen; |
131a21c2 | 111 | __be32 * offset; |
1da177e4 LT |
112 | }; |
113 | ||
114 | struct nfsd_statfsres { | |
115 | struct kstatfs stats; | |
116 | }; | |
117 | ||
118 | /* | |
119 | * Storage requirements for XDR arguments and results. | |
120 | */ | |
121 | union nfsd_xdrstore { | |
122 | struct nfsd_sattrargs sattr; | |
123 | struct nfsd_diropargs dirop; | |
124 | struct nfsd_readargs read; | |
125 | struct nfsd_writeargs write; | |
126 | struct nfsd_createargs create; | |
127 | struct nfsd_renameargs rename; | |
128 | struct nfsd_linkargs link; | |
129 | struct nfsd_symlinkargs symlink; | |
130 | struct nfsd_readdirargs readdir; | |
131 | }; | |
132 | ||
133 | #define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore) | |
134 | ||
135 | ||
026fec7e CH |
136 | int nfssvc_decode_void(struct svc_rqst *, __be32 *); |
137 | int nfssvc_decode_fhandle(struct svc_rqst *, __be32 *); | |
138 | int nfssvc_decode_sattrargs(struct svc_rqst *, __be32 *); | |
139 | int nfssvc_decode_diropargs(struct svc_rqst *, __be32 *); | |
140 | int nfssvc_decode_readargs(struct svc_rqst *, __be32 *); | |
141 | int nfssvc_decode_writeargs(struct svc_rqst *, __be32 *); | |
142 | int nfssvc_decode_createargs(struct svc_rqst *, __be32 *); | |
143 | int nfssvc_decode_renameargs(struct svc_rqst *, __be32 *); | |
144 | int nfssvc_decode_readlinkargs(struct svc_rqst *, __be32 *); | |
145 | int nfssvc_decode_linkargs(struct svc_rqst *, __be32 *); | |
146 | int nfssvc_decode_symlinkargs(struct svc_rqst *, __be32 *); | |
147 | int nfssvc_decode_readdirargs(struct svc_rqst *, __be32 *); | |
63f8de37 CH |
148 | int nfssvc_encode_void(struct svc_rqst *, __be32 *); |
149 | int nfssvc_encode_attrstat(struct svc_rqst *, __be32 *); | |
150 | int nfssvc_encode_diropres(struct svc_rqst *, __be32 *); | |
151 | int nfssvc_encode_readlinkres(struct svc_rqst *, __be32 *); | |
152 | int nfssvc_encode_readres(struct svc_rqst *, __be32 *); | |
153 | int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *); | |
154 | int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *); | |
1da177e4 | 155 | |
a0ad13ef N |
156 | int nfssvc_encode_entry(void *, const char *name, |
157 | int namlen, loff_t offset, u64 ino, unsigned int); | |
1da177e4 | 158 | |
8537488b | 159 | void nfssvc_release_fhandle(struct svc_rqst *); |
1da177e4 | 160 | |
a257cdd0 | 161 | /* Helper functions for NFSv2 ACL code */ |
4f4a4fad | 162 | __be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, struct kstat *stat); |
131a21c2 | 163 | __be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp); |
a257cdd0 | 164 | |
1da177e4 | 165 | #endif /* LINUX_NFSD_H */ |