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