nfs.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Masami Komiya <mkomiya@sonare.it> 2004
  4. */
  5. #ifndef __NFS_H__
  6. #define __NFS_H__
  7. #define SUNRPC_PORT 111
  8. #define PROG_PORTMAP 100000
  9. #define PROG_NFS 100003
  10. #define PROG_MOUNT 100005
  11. #define MSG_CALL 0
  12. #define MSG_REPLY 1
  13. #define PORTMAP_GETPORT 3
  14. #define MOUNT_ADDENTRY 1
  15. #define MOUNT_UMOUNTALL 4
  16. #define NFS_LOOKUP 4
  17. #define NFS_READLINK 5
  18. #define NFS_READ 6
  19. #define NFS3PROC_LOOKUP 3
  20. #define NFS_FHSIZE 32
  21. #define NFS3_FHSIZE 64
  22. #define NFSERR_PERM 1
  23. #define NFSERR_NOENT 2
  24. #define NFSERR_ACCES 13
  25. #define NFSERR_ISDIR 21
  26. #define NFSERR_INVAL 22
  27. /*
  28. * Block size used for NFS read accesses. A RPC reply packet (including all
  29. * headers) must fit within a single Ethernet frame to avoid fragmentation.
  30. * However, if CONFIG_IP_DEFRAG is set, a bigger value could be used. In any
  31. * case, most NFS servers are optimized for a power of 2.
  32. */
  33. #define NFS_READ_SIZE 1024 /* biggest power of two that fits Ether frame */
  34. #define NFS_MAX_ATTRS 26
  35. /* Values for Accept State flag on RPC answers (See: rfc1831) */
  36. enum rpc_accept_stat {
  37. NFS_RPC_SUCCESS = 0, /* RPC executed successfully */
  38. NFS_RPC_PROG_UNAVAIL = 1, /* remote hasn't exported program */
  39. NFS_RPC_PROG_MISMATCH = 2, /* remote can't support version # */
  40. NFS_RPC_PROC_UNAVAIL = 3, /* program can't support procedure */
  41. NFS_RPC_GARBAGE_ARGS = 4, /* procedure can't decode params */
  42. NFS_RPC_SYSTEM_ERR = 5 /* errors like memory allocation failure */
  43. };
  44. struct rpc_t {
  45. union {
  46. uint8_t data[NFS_READ_SIZE + (6 + NFS_MAX_ATTRS) *
  47. sizeof(uint32_t)];
  48. struct {
  49. uint32_t id;
  50. uint32_t type;
  51. uint32_t rpcvers;
  52. uint32_t prog;
  53. uint32_t vers;
  54. uint32_t proc;
  55. uint32_t data[1];
  56. } call;
  57. struct {
  58. uint32_t id;
  59. uint32_t type;
  60. uint32_t rstatus;
  61. uint32_t verifier;
  62. uint32_t v2;
  63. uint32_t astatus;
  64. uint32_t data[NFS_READ_SIZE / sizeof(uint32_t) +
  65. NFS_MAX_ATTRS];
  66. } reply;
  67. } u;
  68. };
  69. void nfs_start(void); /* Begin NFS */
  70. /**********************************************************************/
  71. #endif /* __NFS_H__ */