a9794e85fe51015383736e290ad4b57e44658c89
[linux-2.6.git] / fs / 9p / error.h
1 /*
2  * linux/fs/9p/error.h
3  *
4  * Huge Nasty Error Table
5  *
6  * Plan 9 uses error strings, Unix uses error numbers.  This table tries to
7  * match UNIX strings and Plan 9 strings to unix error numbers.  It is used
8  * to preload the dynamic error table which can also track user-specific error
9  * strings.
10  *
11  *  Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
12  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
13  *
14  *  This program is free software; you can redistribute it and/or modify
15  *  it under the terms of the GNU General Public License as published by
16  *  the Free Software Foundation; either version 2 of the License, or
17  *  (at your option) any later version.
18  *
19  *  This program is distributed in the hope that it will be useful,
20  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  *  GNU General Public License for more details.
23  *
24  *  You should have received a copy of the GNU General Public License
25  *  along with this program; if not, write to:
26  *  Free Software Foundation
27  *  51 Franklin Street, Fifth Floor
28  *  Boston, MA  02111-1301  USA
29  *
30  */
31
32 #include <linux/errno.h>
33 #include <asm/errno.h>
34
35 struct errormap {
36         char *name;
37         int val;
38
39         int namelen;
40         struct hlist_node list;
41 };
42
43 #define ERRHASHSZ               32
44 static struct hlist_head hash_errmap[ERRHASHSZ];
45
46 /* FixMe - reduce to a reasonable size */
47 static struct errormap errmap[] = {
48         {"Operation not permitted", EPERM},
49         {"wstat prohibited", EPERM},
50         {"No such file or directory", ENOENT},
51         {"directory entry not found", ENOENT},
52         {"file not found", ENOENT},
53         {"Interrupted system call", EINTR},
54         {"Input/output error", EIO},
55         {"No such device or address", ENXIO},
56         {"Argument list too long", E2BIG},
57         {"Bad file descriptor", EBADF},
58         {"Resource temporarily unavailable", EAGAIN},
59         {"Cannot allocate memory", ENOMEM},
60         {"Permission denied", EACCES},
61         {"Bad address", EFAULT},
62         {"Block device required", ENOTBLK},
63         {"Device or resource busy", EBUSY},
64         {"File exists", EEXIST},
65         {"Invalid cross-device link", EXDEV},
66         {"No such device", ENODEV},
67         {"Not a directory", ENOTDIR},
68         {"Is a directory", EISDIR},
69         {"Invalid argument", EINVAL},
70         {"Too many open files in system", ENFILE},
71         {"Too many open files", EMFILE},
72         {"Text file busy", ETXTBSY},
73         {"File too large", EFBIG},
74         {"No space left on device", ENOSPC},
75         {"Illegal seek", ESPIPE},
76         {"Read-only file system", EROFS},
77         {"Too many links", EMLINK},
78         {"Broken pipe", EPIPE},
79         {"Numerical argument out of domain", EDOM},
80         {"Numerical result out of range", ERANGE},
81         {"Resource deadlock avoided", EDEADLK},
82         {"File name too long", ENAMETOOLONG},
83         {"No locks available", ENOLCK},
84         {"Function not implemented", ENOSYS},
85         {"Directory not empty", ENOTEMPTY},
86         {"Too many levels of symbolic links", ELOOP},
87         {"No message of desired type", ENOMSG},
88         {"Identifier removed", EIDRM},
89         {"No data available", ENODATA},
90         {"Machine is not on the network", ENONET},
91         {"Package not installed", ENOPKG},
92         {"Object is remote", EREMOTE},
93         {"Link has been severed", ENOLINK},
94         {"Communication error on send", ECOMM},
95         {"Protocol error", EPROTO},
96         {"Bad message", EBADMSG},
97         {"File descriptor in bad state", EBADFD},
98         {"Streams pipe error", ESTRPIPE},
99         {"Too many users", EUSERS},
100         {"Socket operation on non-socket", ENOTSOCK},
101         {"Message too long", EMSGSIZE},
102         {"Protocol not available", ENOPROTOOPT},
103         {"Protocol not supported", EPROTONOSUPPORT},
104         {"Socket type not supported", ESOCKTNOSUPPORT},
105         {"Operation not supported", EOPNOTSUPP},
106         {"Protocol family not supported", EPFNOSUPPORT},
107         {"Network is down", ENETDOWN},
108         {"Network is unreachable", ENETUNREACH},
109         {"Network dropped connection on reset", ENETRESET},
110         {"Software caused connection abort", ECONNABORTED},
111         {"Connection reset by peer", ECONNRESET},
112         {"No buffer space available", ENOBUFS},
113         {"Transport endpoint is already connected", EISCONN},
114         {"Transport endpoint is not connected", ENOTCONN},
115         {"Cannot send after transport endpoint shutdown", ESHUTDOWN},
116         {"Connection timed out", ETIMEDOUT},
117         {"Connection refused", ECONNREFUSED},
118         {"Host is down", EHOSTDOWN},
119         {"No route to host", EHOSTUNREACH},
120         {"Operation already in progress", EALREADY},
121         {"Operation now in progress", EINPROGRESS},
122         {"Is a named type file", EISNAM},
123         {"Remote I/O error", EREMOTEIO},
124         {"Disk quota exceeded", EDQUOT},
125 /* errors from fossil, vacfs, and u9fs */
126         {"fid unknown or out of range", EBADF},
127         {"permission denied", EACCES},
128         {"file does not exist", ENOENT},
129         {"authentication failed", ECONNREFUSED},
130         {"bad offset in directory read", ESPIPE},
131         {"bad use of fid", EBADF},
132         {"wstat can't convert between files and directories", EPERM},
133         {"directory is not empty", ENOTEMPTY},
134         {"file exists", EEXIST},
135         {"file already exists", EEXIST},
136         {"file or directory already exists", EEXIST},
137         {"fid already in use", EBADF},
138         {"file in use", ETXTBSY},
139         {"i/o error", EIO},
140         {"file already open for I/O", ETXTBSY},
141         {"illegal mode", EINVAL},
142         {"illegal name", ENAMETOOLONG},
143         {"not a directory", ENOTDIR},
144         {"not a member of proposed group", EPERM},
145         {"not owner", EACCES},
146         {"only owner can change group in wstat", EACCES},
147         {"read only file system", EROFS},
148         {"no access to special file", EPERM},
149         {"i/o count too large", EIO},
150         {"unknown group", EINVAL},
151         {"unknown user", EINVAL},
152         {"bogus wstat buffer", EPROTO},
153         {"exclusive use file already open", EAGAIN},
154         {"corrupted directory entry", EIO},
155         {"corrupted file entry", EIO},
156         {"corrupted block label", EIO},
157         {"corrupted meta data", EIO},
158         {"illegal offset", EINVAL},
159         {"illegal path element", ENOENT},
160         {"root of file system is corrupted", EIO},
161         {"corrupted super block", EIO},
162         {"protocol botch", EPROTO},
163         {"file system is full", ENOSPC},
164         {"file is in use", EAGAIN},
165         {"directory entry is not allocated", ENOENT},
166         {"file is read only", EROFS},
167         {"file has been removed", EIDRM},
168         {"only support truncation to zero length", EPERM},
169         {"cannot remove root", EPERM},
170         {"file too big", EFBIG},
171         {"venti i/o error", EIO},
172         /* these are not errors */
173         {"u9fs rhostsauth: no authentication required", 0},
174         {"u9fs authnone: no authentication required", 0},
175         {NULL, -1}
176 };
177
178 extern int v9fs_error_init(void);