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