xdr3.h 8.0 KB

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