xdr.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. int len;
  30. int vlen;
  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. };
  64. struct nfsd_readdirargs {
  65. struct svc_fh fh;
  66. __u32 cookie;
  67. __u32 count;
  68. __be32 * buffer;
  69. };
  70. struct nfsd_attrstat {
  71. struct svc_fh fh;
  72. struct kstat stat;
  73. };
  74. struct nfsd_diropres {
  75. struct svc_fh fh;
  76. struct kstat stat;
  77. };
  78. struct nfsd_readlinkres {
  79. int len;
  80. };
  81. struct nfsd_readres {
  82. struct svc_fh fh;
  83. unsigned long count;
  84. struct kstat stat;
  85. };
  86. struct nfsd_readdirres {
  87. int count;
  88. struct readdir_cd common;
  89. __be32 * buffer;
  90. int buflen;
  91. __be32 * offset;
  92. };
  93. struct nfsd_statfsres {
  94. struct kstatfs stats;
  95. };
  96. /*
  97. * Storage requirements for XDR arguments and results.
  98. */
  99. union nfsd_xdrstore {
  100. struct nfsd_sattrargs sattr;
  101. struct nfsd_diropargs dirop;
  102. struct nfsd_readargs read;
  103. struct nfsd_writeargs write;
  104. struct nfsd_createargs create;
  105. struct nfsd_renameargs rename;
  106. struct nfsd_linkargs link;
  107. struct nfsd_symlinkargs symlink;
  108. struct nfsd_readdirargs readdir;
  109. };
  110. #define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore)
  111. int nfssvc_decode_void(struct svc_rqst *, __be32 *);
  112. int nfssvc_decode_fhandle(struct svc_rqst *, __be32 *);
  113. int nfssvc_decode_sattrargs(struct svc_rqst *, __be32 *);
  114. int nfssvc_decode_diropargs(struct svc_rqst *, __be32 *);
  115. int nfssvc_decode_readargs(struct svc_rqst *, __be32 *);
  116. int nfssvc_decode_writeargs(struct svc_rqst *, __be32 *);
  117. int nfssvc_decode_createargs(struct svc_rqst *, __be32 *);
  118. int nfssvc_decode_renameargs(struct svc_rqst *, __be32 *);
  119. int nfssvc_decode_readlinkargs(struct svc_rqst *, __be32 *);
  120. int nfssvc_decode_linkargs(struct svc_rqst *, __be32 *);
  121. int nfssvc_decode_symlinkargs(struct svc_rqst *, __be32 *);
  122. int nfssvc_decode_readdirargs(struct svc_rqst *, __be32 *);
  123. int nfssvc_encode_void(struct svc_rqst *, __be32 *);
  124. int nfssvc_encode_attrstat(struct svc_rqst *, __be32 *);
  125. int nfssvc_encode_diropres(struct svc_rqst *, __be32 *);
  126. int nfssvc_encode_readlinkres(struct svc_rqst *, __be32 *);
  127. int nfssvc_encode_readres(struct svc_rqst *, __be32 *);
  128. int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *);
  129. int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *);
  130. int nfssvc_encode_entry(void *, const char *name,
  131. int namlen, loff_t offset, u64 ino, unsigned int);
  132. void nfssvc_release_fhandle(struct svc_rqst *);
  133. /* Helper functions for NFSv2 ACL code */
  134. __be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, struct kstat *stat);
  135. __be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp);
  136. #endif /* LINUX_NFSD_H */