1 #ifndef _LINUX_NFS_H
2 #define _LINUX_NFS_H
3
4 #define NFS_PORT 2049
5 #define NFS_MAXDATA 8192
6 #define NFS_MAXPATHLEN 1024
7 #define NFS_MAXNAMLEN 255
8 #define NFS_MAXGROUPS 16
9 #define NFS_FHSIZE 32
10 #define NFS_COOKIESIZE 4
11 #define NFS_FIFO_DEV (-1)
12 #define NFSMODE_FMT 0170000
13 #define NFSMODE_DIR 0040000
14 #define NFSMODE_CHR 0020000
15 #define NFSMODE_BLK 0060000
16 #define NFSMODE_REG 0100000
17 #define NFSMODE_LNK 0120000
18 #define NFSMODE_SOCK 0140000
19 #define NFSMODE_FIFO 0010000
20
21 #ifdef __KERNEL__
22
23 #define RPC_VERSION 2
24
25 enum rpc_auth_flavor {
26 RPC_AUTH_NULL = 0,
27 RPC_AUTH_UNIX = 1,
28 RPC_AUTH_SHORT = 2,
29 };
30
31 enum rpc_msg_type {
32 RPC_CALL = 0,
33 RPC_REPLY = 1,
34 };
35
36 enum rpc_reply_stat {
37 RPC_MSG_ACCEPTED = 0,
38 RPC_MSG_DENIED = 1,
39 };
40
41 enum rpc_accept_stat {
42 RPC_SUCCESS = 0,
43 RPC_PROG_UNAVAIL = 1,
44 RPC_PROG_MISMATCH = 2,
45 RPC_PROC_UNAVAIL = 3,
46 RPC_GARBAGE_ARGS = 4,
47 };
48
49 enum rpc_reject_stat {
50 RPC_MISMATCH = 0,
51 RPC_AUTH_ERROR = 1,
52 };
53
54 enum rpc_auth_stat {
55 RPC_AUTH_BADCRED = 1,
56 RPC_AUTH_REJECTEDCRED = 2,
57 RPC_AUTH_BADVERF = 3,
58 RPC_AUTH_REJECTEDVERF = 4,
59 RPC_AUTH_TOOWEAK = 5,
60 };
61
62 #endif
63
64 enum nfs_stat {
65 NFS_OK = 0,
66 NFSERR_PERM = 1,
67 NFSERR_NOENT = 2,
68 NFSERR_IO = 5,
69 NFSERR_NXIO = 6,
70 NFSERR_ACCES = 13,
71 NFSERR_EXIST = 17,
72 NFSERR_NODEV = 19,
73 NFSERR_NOTDIR = 20,
74 NFSERR_ISDIR = 21,
75 NFSERR_INVAL = 22,
76 NFSERR_FBIG = 27,
77 NFSERR_NOSPC = 28,
78 NFSERR_ROFS = 30,
79 NFSERR_NAMETOOLONG = 63,
80 NFSERR_NOTEMPTY = 66,
81 NFSERR_DQUOT = 69,
82 NFSERR_STALE = 70,
83 NFSERR_WFLUSH = 99,
84 };
85
86 enum nfs_ftype {
87 NFNON = 0,
88 NFREG = 1,
89 NFDIR = 2,
90 NFBLK = 3,
91 NFCHR = 4,
92 NFLNK = 5,
93 NFSOCK = 6,
94 NFBAD = 7,
95 NFFIFO = 8,
96 };
97
98 #define NFS_PROGRAM 100003
99 #define NFS_VERSION 2
100 #define NFSPROC_NULL 0
101 #define NFSPROC_GETATTR 1
102 #define NFSPROC_SETATTR 2
103 #define NFSPROC_ROOT 3
104 #define NFSPROC_LOOKUP 4
105 #define NFSPROC_READLINK 5
106 #define NFSPROC_READ 6
107 #define NFSPROC_WRITECACHE 7
108 #define NFSPROC_WRITE 8
109 #define NFSPROC_CREATE 9
110 #define NFSPROC_REMOVE 10
111 #define NFSPROC_RENAME 11
112 #define NFSPROC_LINK 12
113 #define NFSPROC_SYMLINK 13
114 #define NFSPROC_MKDIR 14
115 #define NFSPROC_RMDIR 15
116 #define NFSPROC_READDIR 16
117 #define NFSPROC_STATFS 17
118
119 struct nfs_fh {
120 char data[NFS_FHSIZE];
121 };
122
123 struct nfs_time {
124 u_int seconds;
125 u_int useconds;
126 };
127
128 struct nfs_fattr {
129 enum nfs_ftype type;
130 u_int mode;
131 u_int nlink;
132 u_int uid;
133 u_int gid;
134 u_int size;
135 u_int blocksize;
136 u_int rdev;
137 u_int blocks;
138 u_int fsid;
139 u_int fileid;
140 struct nfs_time atime;
141 struct nfs_time mtime;
142 struct nfs_time ctime;
143 };
144
145 struct nfs_sattr {
146 u_int mode;
147 u_int uid;
148 u_int gid;
149 u_int size;
150 struct nfs_time atime;
151 struct nfs_time mtime;
152 };
153
154 struct nfs_entry {
155 u_int fileid;
156 char *name;
157 int cookie;
158 int eof;
159 };
160
161 struct nfs_fsinfo {
162 u_int tsize;
163 u_int bsize;
164 u_int blocks;
165 u_int bfree;
166 u_int bavail;
167 };
168
169 #endif