blob: 45da246aa1e1bfa6ad8d7b267ab0a41fde8e231d [file] [log] [blame]
wdenkcbd8a352004-02-24 02:00:03 +00001/*
2 * (C) Masami Komiya <mkomiya@sonare.it> 2004
3 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02004 * SPDX-License-Identifier: GPL-2.0+
wdenkcbd8a352004-02-24 02:00:03 +00005 */
6
7#ifndef __NFS_H__
8#define __NFS_H__
9
10#define SUNRPC_PORT 111
11
12#define PROG_PORTMAP 100000
13#define PROG_NFS 100003
14#define PROG_MOUNT 100005
15
16#define MSG_CALL 0
17#define MSG_REPLY 1
18
19#define PORTMAP_GETPORT 3
20
21#define MOUNT_ADDENTRY 1
22#define MOUNT_UMOUNTALL 4
23
24#define NFS_LOOKUP 4
25#define NFS_READLINK 5
26#define NFS_READ 6
27
Guillaume GARDETb0baca92016-07-29 11:31:00 +020028#define NFS3PROC_LOOKUP 3
29
wdenkcbd8a352004-02-24 02:00:03 +000030#define NFS_FHSIZE 32
Guillaume GARDETb0baca92016-07-29 11:31:00 +020031#define NFS3_FHSIZE 64
wdenkcbd8a352004-02-24 02:00:03 +000032
33#define NFSERR_PERM 1
34#define NFSERR_NOENT 2
35#define NFSERR_ACCES 13
36#define NFSERR_ISDIR 21
37#define NFSERR_INVAL 22
38
39/* Block size used for NFS read accesses. A RPC reply packet (including all
40 * headers) must fit within a single Ethernet frame to avoid fragmentation.
Alessandro Rubinibd931ca2009-08-07 13:59:16 +020041 * However, if CONFIG_IP_DEFRAG is set, the config file may want to use a
42 * bigger value. In any case, most NFS servers are optimized for a power of 2.
43 */
44#ifdef CONFIG_NFS_READ_SIZE
45#define NFS_READ_SIZE CONFIG_NFS_READ_SIZE
46#else
47#define NFS_READ_SIZE 1024 /* biggest power of two that fits Ether frame */
48#endif
wdenkcbd8a352004-02-24 02:00:03 +000049
Guillaume GARDETb0baca92016-07-29 11:31:00 +020050/* Values for Accept State flag on RPC answers (See: rfc1831) */
51enum rpc_accept_stat {
52 NFS_RPC_SUCCESS = 0, /* RPC executed successfully */
53 NFS_RPC_PROG_UNAVAIL = 1, /* remote hasn't exported program */
54 NFS_RPC_PROG_MISMATCH = 2, /* remote can't support version # */
55 NFS_RPC_PROC_UNAVAIL = 3, /* program can't support procedure */
56 NFS_RPC_GARBAGE_ARGS = 4, /* procedure can't decode params */
57 NFS_RPC_SYSTEM_ERR = 5 /* errors like memory allocation failure */
58};
59
wdenkcbd8a352004-02-24 02:00:03 +000060struct rpc_t {
61 union {
62 uint8_t data[2048];
63 struct {
64 uint32_t id;
65 uint32_t type;
66 uint32_t rpcvers;
67 uint32_t prog;
68 uint32_t vers;
69 uint32_t proc;
70 uint32_t data[1];
71 } call;
72 struct {
73 uint32_t id;
74 uint32_t type;
75 uint32_t rstatus;
76 uint32_t verifier;
77 uint32_t v2;
78 uint32_t astatus;
Joe Hershberger11e8ec92016-09-09 13:01:24 -050079 uint32_t data[NFS_READ_SIZE];
wdenkcbd8a352004-02-24 02:00:03 +000080 } reply;
81 } u;
82};
Joe Hershberger68c76a32015-04-08 01:41:10 -050083void nfs_start(void); /* Begin NFS */
wdenkcbd8a352004-02-24 02:00:03 +000084
85
86/**********************************************************************/
87
88#endif /* __NFS_H__ */