xdr3.h 8.08 KB
Newer Older
Linus Torvalds's avatar
Linus Torvalds committed
1 2 3 4 5 6 7 8 9
/*
 * 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

10
#include "xdr.h"
Linus Torvalds's avatar
Linus Torvalds committed
11 12 13 14 15 16 17 18 19 20 21

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;
22
	unsigned int		len;
Linus Torvalds's avatar
Linus Torvalds committed
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
};

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;
42
	__u32			len;
Linus Torvalds's avatar
Linus Torvalds committed
43 44 45 46 47 48
	int			vlen;
};

struct nfsd3_createargs {
	struct svc_fh		fh;
	char *			name;
49
	unsigned int		len;
Linus Torvalds's avatar
Linus Torvalds committed
50 51
	int			createmode;
	struct iattr		attrs;
52
	__be32 *		verf;
Linus Torvalds's avatar
Linus Torvalds committed
53 54 55 56 57
};

struct nfsd3_mknodargs {
	struct svc_fh		fh;
	char *			name;
58
	unsigned int		len;
Linus Torvalds's avatar
Linus Torvalds committed
59 60 61 62 63 64 65 66
	__u32			ftype;
	__u32			major, minor;
	struct iattr		attrs;
};

struct nfsd3_renameargs {
	struct svc_fh		ffh;
	char *			fname;
67
	unsigned int		flen;
Linus Torvalds's avatar
Linus Torvalds committed
68 69
	struct svc_fh		tfh;
	char *			tname;
70
	unsigned int		tlen;
Linus Torvalds's avatar
Linus Torvalds committed
71 72 73 74 75 76 77 78 79 80 81
};

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

struct nfsd3_linkargs {
	struct svc_fh		ffh;
	struct svc_fh		tfh;
	char *			tname;
82
	unsigned int		tlen;
Linus Torvalds's avatar
Linus Torvalds committed
83 84 85 86 87
};

struct nfsd3_symlinkargs {
	struct svc_fh		ffh;
	char *			fname;
88
	unsigned int		flen;
Linus Torvalds's avatar
Linus Torvalds committed
89
	char *			tname;
90
	unsigned int		tlen;
Linus Torvalds's avatar
Linus Torvalds committed
91 92 93 94 95 96 97 98
	struct iattr		attrs;
};

struct nfsd3_readdirargs {
	struct svc_fh		fh;
	__u64			cookie;
	__u32			dircount;
	__u32			count;
99 100
	__be32 *		verf;
	__be32 *		buffer;
Linus Torvalds's avatar
Linus Torvalds committed
101 102 103 104 105 106 107 108
};

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

109 110 111 112 113 114 115 116 117 118 119 120 121
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;
};

Linus Torvalds's avatar
Linus Torvalds committed
122
struct nfsd3_attrstat {
123
	__be32			status;
Linus Torvalds's avatar
Linus Torvalds committed
124
	struct svc_fh		fh;
125
	struct kstat            stat;
Linus Torvalds's avatar
Linus Torvalds committed
126 127 128 129
};

/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */
struct nfsd3_diropres  {
130
	__be32			status;
Linus Torvalds's avatar
Linus Torvalds committed
131 132 133 134 135
	struct svc_fh		dirfh;
	struct svc_fh		fh;
};

struct nfsd3_accessres {
136
	__be32			status;
Linus Torvalds's avatar
Linus Torvalds committed
137 138
	struct svc_fh		fh;
	__u32			access;
139
	struct kstat		stat;
Linus Torvalds's avatar
Linus Torvalds committed
140 141 142
};

struct nfsd3_readlinkres {
143
	__be32			status;
Linus Torvalds's avatar
Linus Torvalds committed
144 145 146 147 148
	struct svc_fh		fh;
	__u32			len;
};

struct nfsd3_readres {
149
	__be32			status;
Linus Torvalds's avatar
Linus Torvalds committed
150 151 152 153 154 155
	struct svc_fh		fh;
	unsigned long		count;
	int			eof;
};

struct nfsd3_writeres {
156
	__be32			status;
Linus Torvalds's avatar
Linus Torvalds committed
157 158 159 160 161 162
	struct svc_fh		fh;
	unsigned long		count;
	int			committed;
};

struct nfsd3_renameres {
163
	__be32			status;
Linus Torvalds's avatar
Linus Torvalds committed
164 165 166 167 168
	struct svc_fh		ffh;
	struct svc_fh		tfh;
};

struct nfsd3_linkres {
169
	__be32			status;
Linus Torvalds's avatar
Linus Torvalds committed
170 171 172 173 174
	struct svc_fh		tfh;
	struct svc_fh		fh;
};

struct nfsd3_readdirres {
175
	__be32			status;
Linus Torvalds's avatar
Linus Torvalds committed
176
	struct svc_fh		fh;
177 178 179
	/* Just to save kmalloc on every readdirplus entry (svc_fh is a
	 * little large for the stack): */
	struct svc_fh		scratch;
Linus Torvalds's avatar
Linus Torvalds committed
180
	int			count;
181
	__be32			verf[2];
Linus Torvalds's avatar
Linus Torvalds committed
182 183

	struct readdir_cd	common;
184
	__be32 *		buffer;
Linus Torvalds's avatar
Linus Torvalds committed
185
	int			buflen;
186 187
	__be32 *		offset;
	__be32 *		offset1;
Linus Torvalds's avatar
Linus Torvalds committed
188 189 190 191 192
	struct svc_rqst *	rqstp;

};

struct nfsd3_fsstatres {
193
	__be32			status;
Linus Torvalds's avatar
Linus Torvalds committed
194 195 196 197 198
	struct kstatfs		stats;
	__u32			invarsec;
};

struct nfsd3_fsinfores {
199
	__be32			status;
Linus Torvalds's avatar
Linus Torvalds committed
200 201 202 203 204 205 206 207 208 209 210 211
	__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 {
212
	__be32			status;
Linus Torvalds's avatar
Linus Torvalds committed
213 214 215 216 217 218 219 220 221
	__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 {
222
	__be32			status;
Linus Torvalds's avatar
Linus Torvalds committed
223 224 225
	struct svc_fh		fh;
};

226
struct nfsd3_getaclres {
227
	__be32			status;
228 229 230 231
	struct svc_fh		fh;
	int			mask;
	struct posix_acl	*acl_access;
	struct posix_acl	*acl_default;
232
	struct kstat		stat;
233 234
};

Linus Torvalds's avatar
Linus Torvalds committed
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 264 265 266
/* 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;
267
	struct nfsd3_getaclres		getaclres;
Linus Torvalds's avatar
Linus Torvalds committed
268 269 270 271
};

#define NFS3_SVC_XDRSIZE		sizeof(union nfsd3_xdrstore)

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

333
int nfs3svc_release_fhandle(struct svc_rqst *, __be32 *,
Linus Torvalds's avatar
Linus Torvalds committed
334
				struct nfsd3_attrstat *);
335
int nfs3svc_release_fhandle2(struct svc_rqst *, __be32 *,
Linus Torvalds's avatar
Linus Torvalds committed
336
				struct nfsd3_fhandle_pair *);
337 338
int nfs3svc_encode_entry(void *, const char *name,
				int namlen, loff_t offset, u64 ino,
Linus Torvalds's avatar
Linus Torvalds committed
339
				unsigned int);
340 341
int nfs3svc_encode_entry_plus(void *, const char *name,
				int namlen, loff_t offset, u64 ino,
Linus Torvalds's avatar
Linus Torvalds committed
342
				unsigned int);
343
/* Helper functions for NFSv3 ACL code */
344
__be32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p,
345
				struct svc_fh *fhp);
346
__be32 *nfs3svc_decode_fh(__be32 *p, struct svc_fh *fhp);
Linus Torvalds's avatar
Linus Torvalds committed
347 348 349


#endif /* _LINUX_NFSD_XDR3_H */