nfs.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. /* Values for Accept State flag on RPC answers (See: rfc1831) */
  35. enum rpc_accept_stat {
  36. NFS_RPC_SUCCESS = 0, /* RPC executed successfully */
  37. NFS_RPC_PROG_UNAVAIL = 1, /* remote hasn't exported program */
  38. NFS_RPC_PROG_MISMATCH = 2, /* remote can't support version # */
  39. NFS_RPC_PROC_UNAVAIL = 3, /* program can't support procedure */
  40. NFS_RPC_GARBAGE_ARGS = 4, /* procedure can't decode params */
  41. NFS_RPC_SYSTEM_ERR = 5 /* errors like memory allocation failure */
  42. };
  43. struct rpc_t {
  44. union {
  45. uint8_t data[2048];
  46. struct {
  47. uint32_t id;
  48. uint32_t type;
  49. uint32_t rpcvers;
  50. uint32_t prog;
  51. uint32_t vers;
  52. uint32_t proc;
  53. uint32_t data[1];
  54. } call;
  55. struct {
  56. uint32_t id;
  57. uint32_t type;
  58. uint32_t rstatus;
  59. uint32_t verifier;
  60. uint32_t v2;
  61. uint32_t astatus;
  62. uint32_t data[NFS_READ_SIZE];
  63. } reply;
  64. } u;
  65. } __attribute__((packed));
  66. void nfs_start(void); /* Begin NFS */
  67. /**********************************************************************/
  68. #endif /* __NFS_H__ */