blob: 3f4f7142bbe3920575017f2f42b8f443f06f30b7 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/inxlude/linux/nfsd/xdr.h
3 *
4 * XDR types for nfsd. This is mainly a typing exercise.
5 */
6
7#ifndef LINUX_NFSD_H
8#define LINUX_NFSD_H
9
10#include <linux/fs.h>
11#include <linux/vfs.h>
12#include <linux/nfs.h>
13
14struct nfsd_fhandle {
15 struct svc_fh fh;
16};
17
18struct nfsd_sattrargs {
19 struct svc_fh fh;
20 struct iattr attrs;
21};
22
23struct nfsd_diropargs {
24 struct svc_fh fh;
25 char * name;
26 int len;
27};
28
29struct nfsd_readargs {
30 struct svc_fh fh;
31 __u32 offset;
32 __u32 count;
33 struct kvec vec[RPCSVC_MAXPAGES];
34 int vlen;
35};
36
37struct nfsd_writeargs {
38 svc_fh fh;
39 __u32 offset;
40 int len;
41 struct kvec vec[RPCSVC_MAXPAGES];
42 int vlen;
43};
44
45struct nfsd_createargs {
46 struct svc_fh fh;
47 char * name;
48 int len;
49 struct iattr attrs;
50};
51
52struct nfsd_renameargs {
53 struct svc_fh ffh;
54 char * fname;
55 int flen;
56 struct svc_fh tfh;
57 char * tname;
58 int tlen;
59};
60
61struct nfsd_readlinkargs {
62 struct svc_fh fh;
63 char * buffer;
64};
65
66struct nfsd_linkargs {
67 struct svc_fh ffh;
68 struct svc_fh tfh;
69 char * tname;
70 int tlen;
71};
72
73struct nfsd_symlinkargs {
74 struct svc_fh ffh;
75 char * fname;
76 int flen;
77 char * tname;
78 int tlen;
79 struct iattr attrs;
80};
81
82struct nfsd_readdirargs {
83 struct svc_fh fh;
84 __u32 cookie;
85 __u32 count;
86 u32 * buffer;
87};
88
89struct nfsd_attrstat {
90 struct svc_fh fh;
David Shawa334de22006-01-06 00:19:58 -080091 struct kstat stat;
Linus Torvalds1da177e2005-04-16 15:20:36 -070092};
93
94struct nfsd_diropres {
95 struct svc_fh fh;
David Shawa334de22006-01-06 00:19:58 -080096 struct kstat stat;
Linus Torvalds1da177e2005-04-16 15:20:36 -070097};
98
99struct nfsd_readlinkres {
100 int len;
101};
102
103struct nfsd_readres {
104 struct svc_fh fh;
105 unsigned long count;
David Shawa334de22006-01-06 00:19:58 -0800106 struct kstat stat;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107};
108
109struct nfsd_readdirres {
110 int count;
111
112 struct readdir_cd common;
113 u32 * buffer;
114 int buflen;
115 u32 * offset;
116};
117
118struct nfsd_statfsres {
119 struct kstatfs stats;
120};
121
122/*
123 * Storage requirements for XDR arguments and results.
124 */
125union nfsd_xdrstore {
126 struct nfsd_sattrargs sattr;
127 struct nfsd_diropargs dirop;
128 struct nfsd_readargs read;
129 struct nfsd_writeargs write;
130 struct nfsd_createargs create;
131 struct nfsd_renameargs rename;
132 struct nfsd_linkargs link;
133 struct nfsd_symlinkargs symlink;
134 struct nfsd_readdirargs readdir;
135};
136
137#define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore)
138
139
140int nfssvc_decode_void(struct svc_rqst *, u32 *, void *);
141int nfssvc_decode_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *);
142int nfssvc_decode_sattrargs(struct svc_rqst *, u32 *,
143 struct nfsd_sattrargs *);
144int nfssvc_decode_diropargs(struct svc_rqst *, u32 *,
145 struct nfsd_diropargs *);
146int nfssvc_decode_readargs(struct svc_rqst *, u32 *,
147 struct nfsd_readargs *);
148int nfssvc_decode_writeargs(struct svc_rqst *, u32 *,
149 struct nfsd_writeargs *);
150int nfssvc_decode_createargs(struct svc_rqst *, u32 *,
151 struct nfsd_createargs *);
152int nfssvc_decode_renameargs(struct svc_rqst *, u32 *,
153 struct nfsd_renameargs *);
154int nfssvc_decode_readlinkargs(struct svc_rqst *, u32 *,
155 struct nfsd_readlinkargs *);
156int nfssvc_decode_linkargs(struct svc_rqst *, u32 *,
157 struct nfsd_linkargs *);
158int nfssvc_decode_symlinkargs(struct svc_rqst *, u32 *,
159 struct nfsd_symlinkargs *);
160int nfssvc_decode_readdirargs(struct svc_rqst *, u32 *,
161 struct nfsd_readdirargs *);
162int nfssvc_encode_void(struct svc_rqst *, u32 *, void *);
163int nfssvc_encode_attrstat(struct svc_rqst *, u32 *, struct nfsd_attrstat *);
164int nfssvc_encode_diropres(struct svc_rqst *, u32 *, struct nfsd_diropres *);
165int nfssvc_encode_readlinkres(struct svc_rqst *, u32 *, struct nfsd_readlinkres *);
166int nfssvc_encode_readres(struct svc_rqst *, u32 *, struct nfsd_readres *);
167int nfssvc_encode_statfsres(struct svc_rqst *, u32 *, struct nfsd_statfsres *);
168int nfssvc_encode_readdirres(struct svc_rqst *, u32 *, struct nfsd_readdirres *);
169
170int nfssvc_encode_entry(struct readdir_cd *, const char *name,
171 int namlen, loff_t offset, ino_t ino, unsigned int);
172
173int nfssvc_release_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *);
174
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000175/* Helper functions for NFSv2 ACL code */
176u32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp);
177u32 *nfs2svc_decode_fh(u32 *p, struct svc_fh *fhp);
178
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179#endif /* LINUX_NFSD_H */