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