xdr3.h 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  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. struct kstat stat;
  120. };
  121. struct nfsd3_readlinkres {
  122. __be32 status;
  123. struct svc_fh fh;
  124. __u32 len;
  125. };
  126. struct nfsd3_readres {
  127. __be32 status;
  128. struct svc_fh fh;
  129. unsigned long count;
  130. int eof;
  131. };
  132. struct nfsd3_writeres {
  133. __be32 status;
  134. struct svc_fh fh;
  135. unsigned long count;
  136. int committed;
  137. };
  138. struct nfsd3_renameres {
  139. __be32 status;
  140. struct svc_fh ffh;
  141. struct svc_fh tfh;
  142. };
  143. struct nfsd3_linkres {
  144. __be32 status;
  145. struct svc_fh tfh;
  146. struct svc_fh fh;
  147. };
  148. struct nfsd3_readdirres {
  149. __be32 status;
  150. struct svc_fh fh;
  151. /* Just to save kmalloc on every readdirplus entry (svc_fh is a
  152. * little large for the stack): */
  153. struct svc_fh scratch;
  154. int count;
  155. __be32 verf[2];
  156. struct readdir_cd common;
  157. __be32 * buffer;
  158. int buflen;
  159. __be32 * offset;
  160. __be32 * offset1;
  161. struct svc_rqst * rqstp;
  162. };
  163. struct nfsd3_fsstatres {
  164. __be32 status;
  165. struct kstatfs stats;
  166. __u32 invarsec;
  167. };
  168. struct nfsd3_fsinfores {
  169. __be32 status;
  170. __u32 f_rtmax;
  171. __u32 f_rtpref;
  172. __u32 f_rtmult;
  173. __u32 f_wtmax;
  174. __u32 f_wtpref;
  175. __u32 f_wtmult;
  176. __u32 f_dtpref;
  177. __u64 f_maxfilesize;
  178. __u32 f_properties;
  179. };
  180. struct nfsd3_pathconfres {
  181. __be32 status;
  182. __u32 p_link_max;
  183. __u32 p_name_max;
  184. __u32 p_no_trunc;
  185. __u32 p_chown_restricted;
  186. __u32 p_case_insensitive;
  187. __u32 p_case_preserving;
  188. };
  189. struct nfsd3_commitres {
  190. __be32 status;
  191. struct svc_fh fh;
  192. };
  193. struct nfsd3_getaclres {
  194. __be32 status;
  195. struct svc_fh fh;
  196. int mask;
  197. struct posix_acl *acl_access;
  198. struct posix_acl *acl_default;
  199. struct kstat stat;
  200. };
  201. /* dummy type for release */
  202. struct nfsd3_fhandle_pair {
  203. __u32 dummy;
  204. struct svc_fh fh1;
  205. struct svc_fh fh2;
  206. };
  207. /*
  208. * Storage requirements for XDR arguments and results.
  209. */
  210. union nfsd3_xdrstore {
  211. struct nfsd3_sattrargs sattrargs;
  212. struct nfsd3_diropargs diropargs;
  213. struct nfsd3_readargs readargs;
  214. struct nfsd3_writeargs writeargs;
  215. struct nfsd3_createargs createargs;
  216. struct nfsd3_renameargs renameargs;
  217. struct nfsd3_linkargs linkargs;
  218. struct nfsd3_symlinkargs symlinkargs;
  219. struct nfsd3_readdirargs readdirargs;
  220. struct nfsd3_diropres diropres;
  221. struct nfsd3_accessres accessres;
  222. struct nfsd3_readlinkres readlinkres;
  223. struct nfsd3_readres readres;
  224. struct nfsd3_writeres writeres;
  225. struct nfsd3_renameres renameres;
  226. struct nfsd3_linkres linkres;
  227. struct nfsd3_readdirres readdirres;
  228. struct nfsd3_fsstatres fsstatres;
  229. struct nfsd3_fsinfores fsinfores;
  230. struct nfsd3_pathconfres pathconfres;
  231. struct nfsd3_commitres commitres;
  232. struct nfsd3_getaclres getaclres;
  233. };
  234. #define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore)
  235. int nfs3svc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
  236. int nfs3svc_decode_sattrargs(struct svc_rqst *, __be32 *,
  237. struct nfsd3_sattrargs *);
  238. int nfs3svc_decode_diropargs(struct svc_rqst *, __be32 *,
  239. struct nfsd3_diropargs *);
  240. int nfs3svc_decode_accessargs(struct svc_rqst *, __be32 *,
  241. struct nfsd3_accessargs *);
  242. int nfs3svc_decode_readargs(struct svc_rqst *, __be32 *,
  243. struct nfsd3_readargs *);
  244. int nfs3svc_decode_writeargs(struct svc_rqst *, __be32 *,
  245. struct nfsd3_writeargs *);
  246. int nfs3svc_decode_createargs(struct svc_rqst *, __be32 *,
  247. struct nfsd3_createargs *);
  248. int nfs3svc_decode_mkdirargs(struct svc_rqst *, __be32 *,
  249. struct nfsd3_createargs *);
  250. int nfs3svc_decode_mknodargs(struct svc_rqst *, __be32 *,
  251. struct nfsd3_mknodargs *);
  252. int nfs3svc_decode_renameargs(struct svc_rqst *, __be32 *,
  253. struct nfsd3_renameargs *);
  254. int nfs3svc_decode_readlinkargs(struct svc_rqst *, __be32 *,
  255. struct nfsd3_readlinkargs *);
  256. int nfs3svc_decode_linkargs(struct svc_rqst *, __be32 *,
  257. struct nfsd3_linkargs *);
  258. int nfs3svc_decode_symlinkargs(struct svc_rqst *, __be32 *,
  259. struct nfsd3_symlinkargs *);
  260. int nfs3svc_decode_readdirargs(struct svc_rqst *, __be32 *,
  261. struct nfsd3_readdirargs *);
  262. int nfs3svc_decode_readdirplusargs(struct svc_rqst *, __be32 *,
  263. struct nfsd3_readdirargs *);
  264. int nfs3svc_decode_commitargs(struct svc_rqst *, __be32 *,
  265. struct nfsd3_commitargs *);
  266. int nfs3svc_encode_voidres(struct svc_rqst *, __be32 *, void *);
  267. int nfs3svc_encode_attrstat(struct svc_rqst *, __be32 *,
  268. struct nfsd3_attrstat *);
  269. int nfs3svc_encode_wccstat(struct svc_rqst *, __be32 *,
  270. struct nfsd3_attrstat *);
  271. int nfs3svc_encode_diropres(struct svc_rqst *, __be32 *,
  272. struct nfsd3_diropres *);
  273. int nfs3svc_encode_accessres(struct svc_rqst *, __be32 *,
  274. struct nfsd3_accessres *);
  275. int nfs3svc_encode_readlinkres(struct svc_rqst *, __be32 *,
  276. struct nfsd3_readlinkres *);
  277. int nfs3svc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd3_readres *);
  278. int nfs3svc_encode_writeres(struct svc_rqst *, __be32 *, struct nfsd3_writeres *);
  279. int nfs3svc_encode_createres(struct svc_rqst *, __be32 *,
  280. struct nfsd3_diropres *);
  281. int nfs3svc_encode_renameres(struct svc_rqst *, __be32 *,
  282. struct nfsd3_renameres *);
  283. int nfs3svc_encode_linkres(struct svc_rqst *, __be32 *,
  284. struct nfsd3_linkres *);
  285. int nfs3svc_encode_readdirres(struct svc_rqst *, __be32 *,
  286. struct nfsd3_readdirres *);
  287. int nfs3svc_encode_fsstatres(struct svc_rqst *, __be32 *,
  288. struct nfsd3_fsstatres *);
  289. int nfs3svc_encode_fsinfores(struct svc_rqst *, __be32 *,
  290. struct nfsd3_fsinfores *);
  291. int nfs3svc_encode_pathconfres(struct svc_rqst *, __be32 *,
  292. struct nfsd3_pathconfres *);
  293. int nfs3svc_encode_commitres(struct svc_rqst *, __be32 *,
  294. struct nfsd3_commitres *);
  295. int nfs3svc_release_fhandle(struct svc_rqst *, __be32 *,
  296. struct nfsd3_attrstat *);
  297. int nfs3svc_release_fhandle2(struct svc_rqst *, __be32 *,
  298. struct nfsd3_fhandle_pair *);
  299. int nfs3svc_encode_entry(void *, const char *name,
  300. int namlen, loff_t offset, u64 ino,
  301. unsigned int);
  302. int nfs3svc_encode_entry_plus(void *, const char *name,
  303. int namlen, loff_t offset, u64 ino,
  304. unsigned int);
  305. /* Helper functions for NFSv3 ACL code */
  306. __be32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p,
  307. struct svc_fh *fhp);
  308. __be32 *nfs3svc_decode_fh(__be32 *p, struct svc_fh *fhp);
  309. #endif /* _LINUX_NFSD_XDR3_H */