Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/include/linux/nfsd/xdr3.h |
| 3 | * |
| 4 | * XDR types for NFSv3 in nfsd. |
| 5 | * |
| 6 | * Copyright (C) 1996-1998, Olaf Kirch <okir@monad.swb.de> |
| 7 | */ |
| 8 | |
| 9 | #ifndef _LINUX_NFSD_XDR3_H |
| 10 | #define _LINUX_NFSD_XDR3_H |
| 11 | |
| 12 | #include <linux/nfsd/xdr.h> |
| 13 | |
| 14 | struct nfsd3_sattrargs { |
| 15 | struct svc_fh fh; |
| 16 | struct iattr attrs; |
| 17 | int check_guard; |
| 18 | time_t guardtime; |
| 19 | }; |
| 20 | |
| 21 | struct nfsd3_diropargs { |
| 22 | struct svc_fh fh; |
| 23 | char * name; |
| 24 | int len; |
| 25 | }; |
| 26 | |
| 27 | struct nfsd3_accessargs { |
| 28 | struct svc_fh fh; |
| 29 | unsigned int access; |
| 30 | }; |
| 31 | |
| 32 | struct nfsd3_readargs { |
| 33 | struct svc_fh fh; |
| 34 | __u64 offset; |
| 35 | __u32 count; |
| 36 | struct kvec vec[RPCSVC_MAXPAGES]; |
| 37 | int vlen; |
| 38 | }; |
| 39 | |
| 40 | struct nfsd3_writeargs { |
| 41 | svc_fh fh; |
| 42 | __u64 offset; |
| 43 | __u32 count; |
| 44 | int stable; |
NeilBrown | 0ba7536 | 2005-11-07 01:00:26 -0800 | [diff] [blame] | 45 | __u32 len; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | struct kvec vec[RPCSVC_MAXPAGES]; |
| 47 | int vlen; |
| 48 | }; |
| 49 | |
| 50 | struct nfsd3_createargs { |
| 51 | struct svc_fh fh; |
| 52 | char * name; |
| 53 | int len; |
| 54 | int createmode; |
| 55 | struct iattr attrs; |
| 56 | __u32 * verf; |
| 57 | }; |
| 58 | |
| 59 | struct nfsd3_mknodargs { |
| 60 | struct svc_fh fh; |
| 61 | char * name; |
| 62 | int len; |
| 63 | __u32 ftype; |
| 64 | __u32 major, minor; |
| 65 | struct iattr attrs; |
| 66 | }; |
| 67 | |
| 68 | struct nfsd3_renameargs { |
| 69 | struct svc_fh ffh; |
| 70 | char * fname; |
| 71 | int flen; |
| 72 | struct svc_fh tfh; |
| 73 | char * tname; |
| 74 | int tlen; |
| 75 | }; |
| 76 | |
| 77 | struct nfsd3_readlinkargs { |
| 78 | struct svc_fh fh; |
| 79 | char * buffer; |
| 80 | }; |
| 81 | |
| 82 | struct nfsd3_linkargs { |
| 83 | struct svc_fh ffh; |
| 84 | struct svc_fh tfh; |
| 85 | char * tname; |
| 86 | int tlen; |
| 87 | }; |
| 88 | |
| 89 | struct nfsd3_symlinkargs { |
| 90 | struct svc_fh ffh; |
| 91 | char * fname; |
| 92 | int flen; |
| 93 | char * tname; |
| 94 | int tlen; |
| 95 | struct iattr attrs; |
| 96 | }; |
| 97 | |
| 98 | struct nfsd3_readdirargs { |
| 99 | struct svc_fh fh; |
| 100 | __u64 cookie; |
| 101 | __u32 dircount; |
| 102 | __u32 count; |
| 103 | __u32 * verf; |
| 104 | u32 * buffer; |
| 105 | }; |
| 106 | |
| 107 | struct nfsd3_commitargs { |
| 108 | struct svc_fh fh; |
| 109 | __u64 offset; |
| 110 | __u32 count; |
| 111 | }; |
| 112 | |
Andreas Gruenbacher | a257cdd | 2005-06-22 17:16:26 +0000 | [diff] [blame] | 113 | struct nfsd3_getaclargs { |
| 114 | struct svc_fh fh; |
| 115 | int mask; |
| 116 | }; |
| 117 | |
| 118 | struct posix_acl; |
| 119 | struct nfsd3_setaclargs { |
| 120 | struct svc_fh fh; |
| 121 | int mask; |
| 122 | struct posix_acl *acl_access; |
| 123 | struct posix_acl *acl_default; |
| 124 | }; |
| 125 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | struct nfsd3_attrstat { |
| 127 | __u32 status; |
| 128 | struct svc_fh fh; |
David Shaw | a334de2 | 2006-01-06 00:19:58 -0800 | [diff] [blame] | 129 | struct kstat stat; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | }; |
| 131 | |
| 132 | /* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */ |
| 133 | struct nfsd3_diropres { |
| 134 | __u32 status; |
| 135 | struct svc_fh dirfh; |
| 136 | struct svc_fh fh; |
| 137 | }; |
| 138 | |
| 139 | struct nfsd3_accessres { |
| 140 | __u32 status; |
| 141 | struct svc_fh fh; |
| 142 | __u32 access; |
| 143 | }; |
| 144 | |
| 145 | struct nfsd3_readlinkres { |
| 146 | __u32 status; |
| 147 | struct svc_fh fh; |
| 148 | __u32 len; |
| 149 | }; |
| 150 | |
| 151 | struct nfsd3_readres { |
| 152 | __u32 status; |
| 153 | struct svc_fh fh; |
| 154 | unsigned long count; |
| 155 | int eof; |
| 156 | }; |
| 157 | |
| 158 | struct nfsd3_writeres { |
| 159 | __u32 status; |
| 160 | struct svc_fh fh; |
| 161 | unsigned long count; |
| 162 | int committed; |
| 163 | }; |
| 164 | |
| 165 | struct nfsd3_renameres { |
| 166 | __u32 status; |
| 167 | struct svc_fh ffh; |
| 168 | struct svc_fh tfh; |
| 169 | }; |
| 170 | |
| 171 | struct nfsd3_linkres { |
| 172 | __u32 status; |
| 173 | struct svc_fh tfh; |
| 174 | struct svc_fh fh; |
| 175 | }; |
| 176 | |
| 177 | struct nfsd3_readdirres { |
| 178 | __u32 status; |
| 179 | struct svc_fh fh; |
| 180 | int count; |
| 181 | __u32 verf[2]; |
| 182 | |
| 183 | struct readdir_cd common; |
| 184 | u32 * buffer; |
| 185 | int buflen; |
| 186 | u32 * offset; |
| 187 | u32 * offset1; |
| 188 | struct svc_rqst * rqstp; |
| 189 | |
| 190 | }; |
| 191 | |
| 192 | struct nfsd3_fsstatres { |
| 193 | __u32 status; |
| 194 | struct kstatfs stats; |
| 195 | __u32 invarsec; |
| 196 | }; |
| 197 | |
| 198 | struct nfsd3_fsinfores { |
| 199 | __u32 status; |
| 200 | __u32 f_rtmax; |
| 201 | __u32 f_rtpref; |
| 202 | __u32 f_rtmult; |
| 203 | __u32 f_wtmax; |
| 204 | __u32 f_wtpref; |
| 205 | __u32 f_wtmult; |
| 206 | __u32 f_dtpref; |
| 207 | __u64 f_maxfilesize; |
| 208 | __u32 f_properties; |
| 209 | }; |
| 210 | |
| 211 | struct nfsd3_pathconfres { |
| 212 | __u32 status; |
| 213 | __u32 p_link_max; |
| 214 | __u32 p_name_max; |
| 215 | __u32 p_no_trunc; |
| 216 | __u32 p_chown_restricted; |
| 217 | __u32 p_case_insensitive; |
| 218 | __u32 p_case_preserving; |
| 219 | }; |
| 220 | |
| 221 | struct nfsd3_commitres { |
| 222 | __u32 status; |
| 223 | struct svc_fh fh; |
| 224 | }; |
| 225 | |
Andreas Gruenbacher | a257cdd | 2005-06-22 17:16:26 +0000 | [diff] [blame] | 226 | struct nfsd3_getaclres { |
| 227 | __u32 status; |
| 228 | struct svc_fh fh; |
| 229 | int mask; |
| 230 | struct posix_acl *acl_access; |
| 231 | struct posix_acl *acl_default; |
| 232 | }; |
| 233 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | /* dummy type for release */ |
| 235 | struct nfsd3_fhandle_pair { |
| 236 | __u32 dummy; |
| 237 | struct svc_fh fh1; |
| 238 | struct svc_fh fh2; |
| 239 | }; |
| 240 | |
| 241 | /* |
| 242 | * Storage requirements for XDR arguments and results. |
| 243 | */ |
| 244 | union nfsd3_xdrstore { |
| 245 | struct nfsd3_sattrargs sattrargs; |
| 246 | struct nfsd3_diropargs diropargs; |
| 247 | struct nfsd3_readargs readargs; |
| 248 | struct nfsd3_writeargs writeargs; |
| 249 | struct nfsd3_createargs createargs; |
| 250 | struct nfsd3_renameargs renameargs; |
| 251 | struct nfsd3_linkargs linkargs; |
| 252 | struct nfsd3_symlinkargs symlinkargs; |
| 253 | struct nfsd3_readdirargs readdirargs; |
| 254 | struct nfsd3_diropres diropres; |
| 255 | struct nfsd3_accessres accessres; |
| 256 | struct nfsd3_readlinkres readlinkres; |
| 257 | struct nfsd3_readres readres; |
| 258 | struct nfsd3_writeres writeres; |
| 259 | struct nfsd3_renameres renameres; |
| 260 | struct nfsd3_linkres linkres; |
| 261 | struct nfsd3_readdirres readdirres; |
| 262 | struct nfsd3_fsstatres fsstatres; |
| 263 | struct nfsd3_fsinfores fsinfores; |
| 264 | struct nfsd3_pathconfres pathconfres; |
| 265 | struct nfsd3_commitres commitres; |
Andreas Gruenbacher | a257cdd | 2005-06-22 17:16:26 +0000 | [diff] [blame] | 266 | struct nfsd3_getaclres getaclres; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | }; |
| 268 | |
| 269 | #define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore) |
| 270 | |
| 271 | int nfs3svc_decode_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *); |
| 272 | int nfs3svc_decode_sattrargs(struct svc_rqst *, u32 *, |
| 273 | struct nfsd3_sattrargs *); |
| 274 | int nfs3svc_decode_diropargs(struct svc_rqst *, u32 *, |
| 275 | struct nfsd3_diropargs *); |
| 276 | int nfs3svc_decode_accessargs(struct svc_rqst *, u32 *, |
| 277 | struct nfsd3_accessargs *); |
| 278 | int nfs3svc_decode_readargs(struct svc_rqst *, u32 *, |
| 279 | struct nfsd3_readargs *); |
| 280 | int nfs3svc_decode_writeargs(struct svc_rqst *, u32 *, |
| 281 | struct nfsd3_writeargs *); |
| 282 | int nfs3svc_decode_createargs(struct svc_rqst *, u32 *, |
| 283 | struct nfsd3_createargs *); |
| 284 | int nfs3svc_decode_mkdirargs(struct svc_rqst *, u32 *, |
| 285 | struct nfsd3_createargs *); |
| 286 | int nfs3svc_decode_mknodargs(struct svc_rqst *, u32 *, |
| 287 | struct nfsd3_mknodargs *); |
| 288 | int nfs3svc_decode_renameargs(struct svc_rqst *, u32 *, |
| 289 | struct nfsd3_renameargs *); |
| 290 | int nfs3svc_decode_readlinkargs(struct svc_rqst *, u32 *, |
| 291 | struct nfsd3_readlinkargs *); |
| 292 | int nfs3svc_decode_linkargs(struct svc_rqst *, u32 *, |
| 293 | struct nfsd3_linkargs *); |
| 294 | int nfs3svc_decode_symlinkargs(struct svc_rqst *, u32 *, |
| 295 | struct nfsd3_symlinkargs *); |
| 296 | int nfs3svc_decode_readdirargs(struct svc_rqst *, u32 *, |
| 297 | struct nfsd3_readdirargs *); |
| 298 | int nfs3svc_decode_readdirplusargs(struct svc_rqst *, u32 *, |
| 299 | struct nfsd3_readdirargs *); |
| 300 | int nfs3svc_decode_commitargs(struct svc_rqst *, u32 *, |
| 301 | struct nfsd3_commitargs *); |
| 302 | int nfs3svc_encode_voidres(struct svc_rqst *, u32 *, void *); |
| 303 | int nfs3svc_encode_attrstat(struct svc_rqst *, u32 *, |
| 304 | struct nfsd3_attrstat *); |
| 305 | int nfs3svc_encode_wccstat(struct svc_rqst *, u32 *, |
| 306 | struct nfsd3_attrstat *); |
| 307 | int nfs3svc_encode_diropres(struct svc_rqst *, u32 *, |
| 308 | struct nfsd3_diropres *); |
| 309 | int nfs3svc_encode_accessres(struct svc_rqst *, u32 *, |
| 310 | struct nfsd3_accessres *); |
| 311 | int nfs3svc_encode_readlinkres(struct svc_rqst *, u32 *, |
| 312 | struct nfsd3_readlinkres *); |
| 313 | int nfs3svc_encode_readres(struct svc_rqst *, u32 *, struct nfsd3_readres *); |
| 314 | int nfs3svc_encode_writeres(struct svc_rqst *, u32 *, struct nfsd3_writeres *); |
| 315 | int nfs3svc_encode_createres(struct svc_rqst *, u32 *, |
| 316 | struct nfsd3_diropres *); |
| 317 | int nfs3svc_encode_renameres(struct svc_rqst *, u32 *, |
| 318 | struct nfsd3_renameres *); |
| 319 | int nfs3svc_encode_linkres(struct svc_rqst *, u32 *, |
| 320 | struct nfsd3_linkres *); |
| 321 | int nfs3svc_encode_readdirres(struct svc_rqst *, u32 *, |
| 322 | struct nfsd3_readdirres *); |
| 323 | int nfs3svc_encode_fsstatres(struct svc_rqst *, u32 *, |
| 324 | struct nfsd3_fsstatres *); |
| 325 | int nfs3svc_encode_fsinfores(struct svc_rqst *, u32 *, |
| 326 | struct nfsd3_fsinfores *); |
| 327 | int nfs3svc_encode_pathconfres(struct svc_rqst *, u32 *, |
| 328 | struct nfsd3_pathconfres *); |
| 329 | int nfs3svc_encode_commitres(struct svc_rqst *, u32 *, |
| 330 | struct nfsd3_commitres *); |
| 331 | |
| 332 | int nfs3svc_release_fhandle(struct svc_rqst *, u32 *, |
| 333 | struct nfsd3_attrstat *); |
| 334 | int nfs3svc_release_fhandle2(struct svc_rqst *, u32 *, |
| 335 | struct nfsd3_fhandle_pair *); |
| 336 | int nfs3svc_encode_entry(struct readdir_cd *, const char *name, |
| 337 | int namlen, loff_t offset, ino_t ino, |
| 338 | unsigned int); |
| 339 | int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name, |
| 340 | int namlen, loff_t offset, ino_t ino, |
| 341 | unsigned int); |
Andreas Gruenbacher | a257cdd | 2005-06-22 17:16:26 +0000 | [diff] [blame] | 342 | /* Helper functions for NFSv3 ACL code */ |
| 343 | u32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, |
| 344 | struct svc_fh *fhp); |
| 345 | u32 *nfs3svc_decode_fh(u32 *p, struct svc_fh *fhp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | |
| 347 | |
| 348 | #endif /* _LINUX_NFSD_XDR3_H */ |