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_FBIG = 27,
76 NFSERR_NOSPC = 28,
77 NFSERR_ROFS = 30,
78 NFSERR_NAMETOOLONG = 63,
79 NFSERR_NOTEMPTY = 66,
80 NFSERR_DQUOT = 69,
81 NFSERR_STALE = 70,
82 NFSERR_WFLUSH = 99,
83 };
84
85 enum nfs_ftype {
86 NFNON = 0,
87 NFREG = 1,
88 NFDIR = 2,
89 NFBLK = 3,
90 NFCHR = 4,
91 NFLNK = 5,
92 NFSOCK = 6,
93 NFBAD = 7,
94 NFFIFO = 8,
95 };
96
97 #define NFS_PROGRAM 100003
98 #define NFS_VERSION 2
99 #define NFSPROC_NULL 0
100 #define NFSPROC_GETATTR 1
101 #define NFSPROC_SETATTR 2
102 #define NFSPROC_ROOT 3
103 #define NFSPROC_LOOKUP 4
104 #define NFSPROC_READLINK 5
105 #define NFSPROC_READ 6
106 #define NFSPROC_WRITECACHE 7
107 #define NFSPROC_WRITE 8
108 #define NFSPROC_CREATE 9
109 #define NFSPROC_REMOVE 10
110 #define NFSPROC_RENAME 11
111 #define NFSPROC_LINK 12
112 #define NFSPROC_SYMLINK 13
113 #define NFSPROC_MKDIR 14
114 #define NFSPROC_RMDIR 15
115 #define NFSPROC_READDIR 16
116 #define NFSPROC_STATFS 17
117
118 struct nfs_fh {
119 char data[NFS_FHSIZE];
120 };
121
122 struct nfs_time {
123 u_int seconds;
124 u_int useconds;
125 };
126
127 struct nfs_fattr {
128 enum nfs_ftype type;
129 u_int mode;
130 u_int nlink;
131 u_int uid;
132 u_int gid;
133 u_int size;
134 u_int blocksize;
135 u_int rdev;
136 u_int blocks;
137 u_int fsid;
138 u_int fileid;
139 struct nfs_time atime;
140 struct nfs_time mtime;
141 struct nfs_time ctime;
142 };
143
144 struct nfs_sattr {
145 u_int mode;
146 u_int uid;
147 u_int gid;
148 u_int size;
149 struct nfs_time atime;
150 struct nfs_time mtime;
151 };
152
153 struct nfs_entry {
154 u_int fileid;
155 char *name;
156 int cookie;
157 int eof;
158 };
159
160 struct nfs_fsinfo {
161 u_int tsize;
162 u_int bsize;
163 u_int blocks;
164 u_int bfree;
165 u_int bavail;
166 };
167
168 #endif