xdr3.h 7.3 KB

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