xdr3.h 7.9 KB

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