xdr3.h 8.0 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
 * linux/include/linux/nfsd/xdr3.h
 *
 * XDR types for NFSv3 in nfsd.
 *
 * Copyright (C) 1996-1998, Olaf Kirch <okir@monad.swb.de>
 */

#ifndef _LINUX_NFSD_XDR3_H
#define _LINUX_NFSD_XDR3_H

#include <linux/nfsd/xdr.h>

struct nfsd3_sattrargs {
	struct svc_fh		fh;
	struct iattr		attrs;
	int			check_guard;
	time_t			guardtime;
};

struct nfsd3_diropargs {
	struct svc_fh		fh;
	char *			name;
24
	unsigned int		len;
L
Linus Torvalds 已提交
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
};

struct nfsd3_accessargs {
	struct svc_fh		fh;
	unsigned int		access;
};

struct nfsd3_readargs {
	struct svc_fh		fh;
	__u64			offset;
	__u32			count;
	int			vlen;
};

struct nfsd3_writeargs {
	svc_fh			fh;
	__u64			offset;
	__u32			count;
	int			stable;
44
	__u32			len;
L
Linus Torvalds 已提交
45 46 47 48 49 50
	int			vlen;
};

struct nfsd3_createargs {
	struct svc_fh		fh;
	char *			name;
51
	unsigned int		len;
L
Linus Torvalds 已提交
52 53
	int			createmode;
	struct iattr		attrs;
A
Al Viro 已提交
54
	__be32 *		verf;
L
Linus Torvalds 已提交
55 56 57 58 59
};

struct nfsd3_mknodargs {
	struct svc_fh		fh;
	char *			name;
60
	unsigned int		len;
L
Linus Torvalds 已提交
61 62 63 64 65 66 67 68
	__u32			ftype;
	__u32			major, minor;
	struct iattr		attrs;
};

struct nfsd3_renameargs {
	struct svc_fh		ffh;
	char *			fname;
69
	unsigned int		flen;
L
Linus Torvalds 已提交
70 71
	struct svc_fh		tfh;
	char *			tname;
72
	unsigned int		tlen;
L
Linus Torvalds 已提交
73 74 75 76 77 78 79 80 81 82 83
};

struct nfsd3_readlinkargs {
	struct svc_fh		fh;
	char *			buffer;
};

struct nfsd3_linkargs {
	struct svc_fh		ffh;
	struct svc_fh		tfh;
	char *			tname;
84
	unsigned int		tlen;
L
Linus Torvalds 已提交
85 86 87 88 89
};

struct nfsd3_symlinkargs {
	struct svc_fh		ffh;
	char *			fname;
90
	unsigned int		flen;
L
Linus Torvalds 已提交
91
	char *			tname;
92
	unsigned int		tlen;
L
Linus Torvalds 已提交
93 94 95 96 97 98 99 100
	struct iattr		attrs;
};

struct nfsd3_readdirargs {
	struct svc_fh		fh;
	__u64			cookie;
	__u32			dircount;
	__u32			count;
A
Al Viro 已提交
101 102
	__be32 *		verf;
	__be32 *		buffer;
L
Linus Torvalds 已提交
103 104 105 106 107 108 109 110
};

struct nfsd3_commitargs {
	struct svc_fh		fh;
	__u64			offset;
	__u32			count;
};

111 112 113 114 115 116 117 118 119 120 121 122 123
struct nfsd3_getaclargs {
	struct svc_fh		fh;
	int			mask;
};

struct posix_acl;
struct nfsd3_setaclargs {
	struct svc_fh		fh;
	int			mask;
	struct posix_acl	*acl_access;
	struct posix_acl	*acl_default;
};

L
Linus Torvalds 已提交
124
struct nfsd3_attrstat {
A
Al Viro 已提交
125
	__be32			status;
L
Linus Torvalds 已提交
126
	struct svc_fh		fh;
127
	struct kstat            stat;
L
Linus Torvalds 已提交
128 129 130 131
};

/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */
struct nfsd3_diropres  {
A
Al Viro 已提交
132
	__be32			status;
L
Linus Torvalds 已提交
133 134 135 136 137
	struct svc_fh		dirfh;
	struct svc_fh		fh;
};

struct nfsd3_accessres {
A
Al Viro 已提交
138
	__be32			status;
L
Linus Torvalds 已提交
139 140 141 142 143
	struct svc_fh		fh;
	__u32			access;
};

struct nfsd3_readlinkres {
A
Al Viro 已提交
144
	__be32			status;
L
Linus Torvalds 已提交
145 146 147 148 149
	struct svc_fh		fh;
	__u32			len;
};

struct nfsd3_readres {
A
Al Viro 已提交
150
	__be32			status;
L
Linus Torvalds 已提交
151 152 153 154 155 156
	struct svc_fh		fh;
	unsigned long		count;
	int			eof;
};

struct nfsd3_writeres {
A
Al Viro 已提交
157
	__be32			status;
L
Linus Torvalds 已提交
158 159 160 161 162 163
	struct svc_fh		fh;
	unsigned long		count;
	int			committed;
};

struct nfsd3_renameres {
A
Al Viro 已提交
164
	__be32			status;
L
Linus Torvalds 已提交
165 166 167 168 169
	struct svc_fh		ffh;
	struct svc_fh		tfh;
};

struct nfsd3_linkres {
A
Al Viro 已提交
170
	__be32			status;
L
Linus Torvalds 已提交
171 172 173 174 175
	struct svc_fh		tfh;
	struct svc_fh		fh;
};

struct nfsd3_readdirres {
A
Al Viro 已提交
176
	__be32			status;
L
Linus Torvalds 已提交
177 178
	struct svc_fh		fh;
	int			count;
A
Al Viro 已提交
179
	__be32			verf[2];
L
Linus Torvalds 已提交
180 181

	struct readdir_cd	common;
A
Al Viro 已提交
182
	__be32 *		buffer;
L
Linus Torvalds 已提交
183
	int			buflen;
A
Al Viro 已提交
184 185
	__be32 *		offset;
	__be32 *		offset1;
L
Linus Torvalds 已提交
186 187 188 189 190
	struct svc_rqst *	rqstp;

};

struct nfsd3_fsstatres {
A
Al Viro 已提交
191
	__be32			status;
L
Linus Torvalds 已提交
192 193 194 195 196
	struct kstatfs		stats;
	__u32			invarsec;
};

struct nfsd3_fsinfores {
A
Al Viro 已提交
197
	__be32			status;
L
Linus Torvalds 已提交
198 199 200 201 202 203 204 205 206 207 208 209
	__u32			f_rtmax;
	__u32			f_rtpref;
	__u32			f_rtmult;
	__u32			f_wtmax;
	__u32			f_wtpref;
	__u32			f_wtmult;
	__u32			f_dtpref;
	__u64			f_maxfilesize;
	__u32			f_properties;
};

struct nfsd3_pathconfres {
A
Al Viro 已提交
210
	__be32			status;
L
Linus Torvalds 已提交
211 212 213 214 215 216 217 218 219
	__u32			p_link_max;
	__u32			p_name_max;
	__u32			p_no_trunc;
	__u32			p_chown_restricted;
	__u32			p_case_insensitive;
	__u32			p_case_preserving;
};

struct nfsd3_commitres {
A
Al Viro 已提交
220
	__be32			status;
L
Linus Torvalds 已提交
221 222 223
	struct svc_fh		fh;
};

224
struct nfsd3_getaclres {
A
Al Viro 已提交
225
	__be32			status;
226 227 228 229 230 231
	struct svc_fh		fh;
	int			mask;
	struct posix_acl	*acl_access;
	struct posix_acl	*acl_default;
};

L
Linus Torvalds 已提交
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
/* dummy type for release */
struct nfsd3_fhandle_pair {
	__u32			dummy;
	struct svc_fh		fh1;
	struct svc_fh		fh2;
};

/*
 * Storage requirements for XDR arguments and results.
 */
union nfsd3_xdrstore {
	struct nfsd3_sattrargs		sattrargs;
	struct nfsd3_diropargs		diropargs;
	struct nfsd3_readargs		readargs;
	struct nfsd3_writeargs		writeargs;
	struct nfsd3_createargs		createargs;
	struct nfsd3_renameargs		renameargs;
	struct nfsd3_linkargs		linkargs;
	struct nfsd3_symlinkargs	symlinkargs;
	struct nfsd3_readdirargs	readdirargs;
	struct nfsd3_diropres 		diropres;
	struct nfsd3_accessres		accessres;
	struct nfsd3_readlinkres	readlinkres;
	struct nfsd3_readres		readres;
	struct nfsd3_writeres		writeres;
	struct nfsd3_renameres		renameres;
	struct nfsd3_linkres		linkres;
	struct nfsd3_readdirres		readdirres;
	struct nfsd3_fsstatres		fsstatres;
	struct nfsd3_fsinfores		fsinfores;
	struct nfsd3_pathconfres	pathconfres;
	struct nfsd3_commitres		commitres;
264
	struct nfsd3_getaclres		getaclres;
L
Linus Torvalds 已提交
265 266 267 268
};

#define NFS3_SVC_XDRSIZE		sizeof(union nfsd3_xdrstore)

A
Al Viro 已提交
269 270
int nfs3svc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
int nfs3svc_decode_sattrargs(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
271
				struct nfsd3_sattrargs *);
A
Al Viro 已提交
272
int nfs3svc_decode_diropargs(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
273
				struct nfsd3_diropargs *);
A
Al Viro 已提交
274
int nfs3svc_decode_accessargs(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
275
				struct nfsd3_accessargs *);
A
Al Viro 已提交
276
int nfs3svc_decode_readargs(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
277
				struct nfsd3_readargs *);
A
Al Viro 已提交
278
int nfs3svc_decode_writeargs(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
279
				struct nfsd3_writeargs *);
A
Al Viro 已提交
280
int nfs3svc_decode_createargs(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
281
				struct nfsd3_createargs *);
A
Al Viro 已提交
282
int nfs3svc_decode_mkdirargs(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
283
				struct nfsd3_createargs *);
A
Al Viro 已提交
284
int nfs3svc_decode_mknodargs(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
285
				struct nfsd3_mknodargs *);
A
Al Viro 已提交
286
int nfs3svc_decode_renameargs(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
287
				struct nfsd3_renameargs *);
A
Al Viro 已提交
288
int nfs3svc_decode_readlinkargs(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
289
				struct nfsd3_readlinkargs *);
A
Al Viro 已提交
290
int nfs3svc_decode_linkargs(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
291
				struct nfsd3_linkargs *);
A
Al Viro 已提交
292
int nfs3svc_decode_symlinkargs(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
293
				struct nfsd3_symlinkargs *);
A
Al Viro 已提交
294
int nfs3svc_decode_readdirargs(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
295
				struct nfsd3_readdirargs *);
A
Al Viro 已提交
296
int nfs3svc_decode_readdirplusargs(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
297
				struct nfsd3_readdirargs *);
A
Al Viro 已提交
298
int nfs3svc_decode_commitargs(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
299
				struct nfsd3_commitargs *);
A
Al Viro 已提交
300 301
int nfs3svc_encode_voidres(struct svc_rqst *, __be32 *, void *);
int nfs3svc_encode_attrstat(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
302
				struct nfsd3_attrstat *);
A
Al Viro 已提交
303
int nfs3svc_encode_wccstat(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
304
				struct nfsd3_attrstat *);
A
Al Viro 已提交
305
int nfs3svc_encode_diropres(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
306
				struct nfsd3_diropres *);
A
Al Viro 已提交
307
int nfs3svc_encode_accessres(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
308
				struct nfsd3_accessres *);
A
Al Viro 已提交
309
int nfs3svc_encode_readlinkres(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
310
				struct nfsd3_readlinkres *);
A
Al Viro 已提交
311 312 313
int nfs3svc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd3_readres *);
int nfs3svc_encode_writeres(struct svc_rqst *, __be32 *, struct nfsd3_writeres *);
int nfs3svc_encode_createres(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
314
				struct nfsd3_diropres *);
A
Al Viro 已提交
315
int nfs3svc_encode_renameres(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
316
				struct nfsd3_renameres *);
A
Al Viro 已提交
317
int nfs3svc_encode_linkres(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
318
				struct nfsd3_linkres *);
A
Al Viro 已提交
319
int nfs3svc_encode_readdirres(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
320
				struct nfsd3_readdirres *);
A
Al Viro 已提交
321
int nfs3svc_encode_fsstatres(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
322
				struct nfsd3_fsstatres *);
A
Al Viro 已提交
323
int nfs3svc_encode_fsinfores(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
324
				struct nfsd3_fsinfores *);
A
Al Viro 已提交
325
int nfs3svc_encode_pathconfres(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
326
				struct nfsd3_pathconfres *);
A
Al Viro 已提交
327
int nfs3svc_encode_commitres(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
328 329
				struct nfsd3_commitres *);

A
Al Viro 已提交
330
int nfs3svc_release_fhandle(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
331
				struct nfsd3_attrstat *);
A
Al Viro 已提交
332
int nfs3svc_release_fhandle2(struct svc_rqst *, __be32 *,
L
Linus Torvalds 已提交
333
				struct nfsd3_fhandle_pair *);
334 335
int nfs3svc_encode_entry(void *, const char *name,
				int namlen, loff_t offset, u64 ino,
L
Linus Torvalds 已提交
336
				unsigned int);
337 338
int nfs3svc_encode_entry_plus(void *, const char *name,
				int namlen, loff_t offset, u64 ino,
L
Linus Torvalds 已提交
339
				unsigned int);
340
/* Helper functions for NFSv3 ACL code */
A
Al Viro 已提交
341
__be32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p,
342
				struct svc_fh *fhp);
A
Al Viro 已提交
343
__be32 *nfs3svc_decode_fh(__be32 *p, struct svc_fh *fhp);
L
Linus Torvalds 已提交
344 345 346


#endif /* _LINUX_NFSD_XDR3_H */