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