xdr.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* XDR types for nfsd. This is mainly a typing exercise. */
  3. #ifndef LINUX_NFSD_H
  4. #define LINUX_NFSD_H
  5. #include <linux/vfs.h>
  6. #include "nfsd.h"
  7. #include "nfsfh.h"
  8. struct nfsd_fhandle {
  9. struct svc_fh fh;
  10. };
  11. struct nfsd_sattrargs {
  12. struct svc_fh fh;
  13. struct iattr attrs;
  14. };
  15. struct nfsd_diropargs {
  16. struct svc_fh fh;
  17. char * name;
  18. unsigned int len;
  19. };
  20. struct nfsd_readargs {
  21. struct svc_fh fh;
  22. __u32 offset;
  23. __u32 count;
  24. int vlen;
  25. };
  26. struct nfsd_writeargs {
  27. svc_fh fh;
  28. __u32 offset;
  29. __u32 len;
  30. struct kvec first;
  31. };
  32. struct nfsd_createargs {
  33. struct svc_fh fh;
  34. char * name;
  35. unsigned int len;
  36. struct iattr attrs;
  37. };
  38. struct nfsd_renameargs {
  39. struct svc_fh ffh;
  40. char * fname;
  41. unsigned int flen;
  42. struct svc_fh tfh;
  43. char * tname;
  44. unsigned int tlen;
  45. };
  46. struct nfsd_readlinkargs {
  47. struct svc_fh fh;
  48. char * buffer;
  49. };
  50. struct nfsd_linkargs {
  51. struct svc_fh ffh;
  52. struct svc_fh tfh;
  53. char * tname;
  54. unsigned int tlen;
  55. };
  56. struct nfsd_symlinkargs {
  57. struct svc_fh ffh;
  58. char * fname;
  59. unsigned int flen;
  60. char * tname;
  61. unsigned int tlen;
  62. struct iattr attrs;
  63. struct kvec first;
  64. };
  65. struct nfsd_readdirargs {
  66. struct svc_fh fh;
  67. __u32 cookie;
  68. __u32 count;
  69. __be32 * buffer;
  70. };
  71. struct nfsd_stat {
  72. __be32 status;
  73. };
  74. struct nfsd_attrstat {
  75. __be32 status;
  76. struct svc_fh fh;
  77. struct kstat stat;
  78. };
  79. struct nfsd_diropres {
  80. __be32 status;
  81. struct svc_fh fh;
  82. struct kstat stat;
  83. };
  84. struct nfsd_readlinkres {
  85. __be32 status;
  86. int len;
  87. };
  88. struct nfsd_readres {
  89. __be32 status;
  90. struct svc_fh fh;
  91. unsigned long count;
  92. struct kstat stat;
  93. };
  94. struct nfsd_readdirres {
  95. __be32 status;
  96. int count;
  97. struct readdir_cd common;
  98. __be32 * buffer;
  99. int buflen;
  100. __be32 * offset;
  101. };
  102. struct nfsd_statfsres {
  103. __be32 status;
  104. struct kstatfs stats;
  105. };
  106. /*
  107. * Storage requirements for XDR arguments and results.
  108. */
  109. union nfsd_xdrstore {
  110. struct nfsd_sattrargs sattr;
  111. struct nfsd_diropargs dirop;
  112. struct nfsd_readargs read;
  113. struct nfsd_writeargs write;
  114. struct nfsd_createargs create;
  115. struct nfsd_renameargs rename;
  116. struct nfsd_linkargs link;
  117. struct nfsd_symlinkargs symlink;
  118. struct nfsd_readdirargs readdir;
  119. };
  120. #define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore)
  121. int nfssvc_decode_void(struct svc_rqst *, __be32 *);
  122. int nfssvc_decode_fhandle(struct svc_rqst *, __be32 *);
  123. int nfssvc_decode_sattrargs(struct svc_rqst *, __be32 *);
  124. int nfssvc_decode_diropargs(struct svc_rqst *, __be32 *);
  125. int nfssvc_decode_readargs(struct svc_rqst *, __be32 *);
  126. int nfssvc_decode_writeargs(struct svc_rqst *, __be32 *);
  127. int nfssvc_decode_createargs(struct svc_rqst *, __be32 *);
  128. int nfssvc_decode_renameargs(struct svc_rqst *, __be32 *);
  129. int nfssvc_decode_readlinkargs(struct svc_rqst *, __be32 *);
  130. int nfssvc_decode_linkargs(struct svc_rqst *, __be32 *);
  131. int nfssvc_decode_symlinkargs(struct svc_rqst *, __be32 *);
  132. int nfssvc_decode_readdirargs(struct svc_rqst *, __be32 *);
  133. int nfssvc_encode_void(struct svc_rqst *, __be32 *);
  134. int nfssvc_encode_stat(struct svc_rqst *, __be32 *);
  135. int nfssvc_encode_attrstat(struct svc_rqst *, __be32 *);
  136. int nfssvc_encode_diropres(struct svc_rqst *, __be32 *);
  137. int nfssvc_encode_readlinkres(struct svc_rqst *, __be32 *);
  138. int nfssvc_encode_readres(struct svc_rqst *, __be32 *);
  139. int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *);
  140. int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *);
  141. int nfssvc_encode_entry(void *, const char *name,
  142. int namlen, loff_t offset, u64 ino, unsigned int);
  143. void nfssvc_release_attrstat(struct svc_rqst *rqstp);
  144. void nfssvc_release_diropres(struct svc_rqst *rqstp);
  145. void nfssvc_release_readres(struct svc_rqst *rqstp);
  146. /* Helper functions for NFSv2 ACL code */
  147. __be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, struct kstat *stat);
  148. __be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp);
  149. #endif /* LINUX_NFSD_H */