1 /*
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/nfs.h>
12 
13 struct nfsd_fhandle {
14 	struct svc_fh		fh;
15 };
16 
17 struct nfsd_sattrargs {
18 	struct svc_fh		fh;
19 	struct iattr		attrs;
20 };
21 
22 struct nfsd_diropargs {
23 	struct svc_fh		fh;
24 	char *			name;
25 	int			len;
26 };
27 
28 struct nfsd_readargs {
29 	struct svc_fh		fh;
30 	__u32			offset;
31 	__u32			count;
32 	__u32			totalsize;
33 };
34 
35 struct nfsd_writeargs {
36 	svc_fh			fh;
37 	__u32			beginoffset;
38 	__u32			offset;
39 	__u32			totalcount;
40 	__u8 *			data;
41 	int			len;
42 };
43 
44 struct nfsd_createargs {
45 	struct svc_fh		fh;
46 	char *			name;
47 	int			len;
48 	struct iattr		attrs;
49 };
50 
51 struct nfsd_renameargs {
52 	struct svc_fh		ffh;
53 	char *			fname;
54 	int			flen;
55 	struct svc_fh		tfh;
56 	char *			tname;
57 	int			tlen;
58 };
59 
60 struct nfsd_linkargs {
61 	struct svc_fh		ffh;
62 	struct svc_fh		tfh;
63 	char *			tname;
64 	int			tlen;
65 };
66 
67 struct nfsd_symlinkargs {
68 	struct svc_fh		ffh;
69 	char *			fname;
70 	int			flen;
71 	char *			tname;
72 	int			tlen;
73 	struct iattr		attrs;
74 };
75 
76 struct nfsd_readdirargs {
77 	struct svc_fh		fh;
78 	__u32			cookie;
79 	__u32			count;
80 };
81 
82 struct nfsd_attrstat {
83 	struct svc_fh		fh;
84 };
85 
86 struct nfsd_diropres  {
87 	struct svc_fh		fh;
88 };
89 
90 struct nfsd_readlinkres {
91 	int			len;
92 };
93 
94 struct nfsd_readres {
95 	struct svc_fh		fh;
96 	unsigned long		count;
97 };
98 
99 struct nfsd_readdirres {
100 	int			count;
101 };
102 
103 struct nfsd_statfsres {
104 	struct statfs		stats;
105 };
106 
107 /*
108  * Storage requirements for XDR arguments and results.
109  */
110 union nfsd_xdrstore {
111 	struct nfsd_sattrargs	sattr;
112 	struct nfsd_diropargs	dirop;
113 	struct nfsd_readargs	read;
114 	struct nfsd_writeargs	write;
115 	struct nfsd_createargs	create;
116 	struct nfsd_renameargs	rename;
117 	struct nfsd_linkargs	link;
118 	struct nfsd_symlinkargs	symlink;
119 	struct nfsd_readdirargs	readdir;
120 };
121 
122 #define NFSSVC_XDRSIZE		sizeof(union nfsd_xdrstore)
123 
124 
125 int nfssvc_decode_void(struct svc_rqst *, u32 *, void *);
126 int nfssvc_decode_fhandle(struct svc_rqst *, u32 *, struct svc_fh *);
127 int nfssvc_decode_sattrargs(struct svc_rqst *, u32 *,
128 				struct nfsd_sattrargs *);
129 int nfssvc_decode_diropargs(struct svc_rqst *, u32 *,
130 				struct nfsd_diropargs *);
131 int nfssvc_decode_readargs(struct svc_rqst *, u32 *,
132 				struct nfsd_readargs *);
133 int nfssvc_decode_writeargs(struct svc_rqst *, u32 *,
134 				struct nfsd_writeargs *);
135 int nfssvc_decode_createargs(struct svc_rqst *, u32 *,
136 				struct nfsd_createargs *);
137 int nfssvc_decode_renameargs(struct svc_rqst *, u32 *,
138 				struct nfsd_renameargs *);
139 int nfssvc_decode_linkargs(struct svc_rqst *, u32 *,
140 				struct nfsd_linkargs *);
141 int nfssvc_decode_symlinkargs(struct svc_rqst *, u32 *,
142 				struct nfsd_symlinkargs *);
143 int nfssvc_decode_readdirargs(struct svc_rqst *, u32 *,
144 				struct nfsd_readdirargs *);
145 int nfssvc_encode_void(struct svc_rqst *, u32 *, void *);
146 int nfssvc_encode_attrstat(struct svc_rqst *, u32 *, struct nfsd_attrstat *);
147 int nfssvc_encode_diropres(struct svc_rqst *, u32 *, struct nfsd_diropres *);
148 int nfssvc_encode_readlinkres(struct svc_rqst *, u32 *, struct nfsd_readlinkres *);
149 int nfssvc_encode_readres(struct svc_rqst *, u32 *, struct nfsd_readres *);
150 int nfssvc_encode_statfsres(struct svc_rqst *, u32 *, struct nfsd_statfsres *);
151 int nfssvc_encode_readdirres(struct svc_rqst *, u32 *, struct nfsd_readdirres *);
152 
153 int nfssvc_encode_entry(struct readdir_cd *, const char *name,
154 				int namlen, loff_t offset, ino_t ino, unsigned int);
155 
156 int nfssvc_release_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *);
157 
158 #endif /* LINUX_NFSD_H */
159