diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-15 19:44:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-15 19:44:53 -0400 |
commit | d2a9a8ded48bec153f08ee87a40626c8d0737f79 (patch) | |
tree | e4a90a4f2f65632506e3e04613891cb602843523 /fs/9p/error.c | |
parent | 2d896c780db9cda5dc102bf7a0a2cd4394c1342e (diff) | |
parent | 0af8887ebf4556a76680a61b0bb156d934702c63 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
9p: fix a race condition bug in umount which caused a segfault
9p: re-enable mount time debug option
9p: cache meta-data when cache=loose
net/9p: set error to EREMOTEIO if trans->write returns zero
net/9p: change net/9p module name to 9pnet
9p: Reorganization of 9p file system code
Diffstat (limited to 'fs/9p/error.c')
-rw-r--r-- | fs/9p/error.c | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/fs/9p/error.c b/fs/9p/error.c deleted file mode 100644 index 0d7fa4e08812..000000000000 --- a/fs/9p/error.c +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | /* | ||
2 | * linux/fs/9p/error.c | ||
3 | * | ||
4 | * Error string handling | ||
5 | * | ||
6 | * Plan 9 uses error strings, Unix uses error numbers. These functions | ||
7 | * try to help manage that and provide for dynamically adding error | ||
8 | * mappings. | ||
9 | * | ||
10 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> | ||
11 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License version 2 | ||
15 | * as published by the Free Software Foundation. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to: | ||
24 | * Free Software Foundation | ||
25 | * 51 Franklin Street, Fifth Floor | ||
26 | * Boston, MA 02111-1301 USA | ||
27 | * | ||
28 | */ | ||
29 | |||
30 | #include <linux/module.h> | ||
31 | |||
32 | #include <linux/list.h> | ||
33 | #include <linux/jhash.h> | ||
34 | |||
35 | #include "debug.h" | ||
36 | #include "error.h" | ||
37 | |||
38 | /** | ||
39 | * v9fs_error_init - preload | ||
40 | * @errstr: error string | ||
41 | * | ||
42 | */ | ||
43 | |||
44 | int v9fs_error_init(void) | ||
45 | { | ||
46 | struct errormap *c; | ||
47 | int bucket; | ||
48 | |||
49 | /* initialize hash table */ | ||
50 | for (bucket = 0; bucket < ERRHASHSZ; bucket++) | ||
51 | INIT_HLIST_HEAD(&hash_errmap[bucket]); | ||
52 | |||
53 | /* load initial error map into hash table */ | ||
54 | for (c = errmap; c->name != NULL; c++) { | ||
55 | c->namelen = strlen(c->name); | ||
56 | bucket = jhash(c->name, c->namelen, 0) % ERRHASHSZ; | ||
57 | INIT_HLIST_NODE(&c->list); | ||
58 | hlist_add_head(&c->list, &hash_errmap[bucket]); | ||
59 | } | ||
60 | |||
61 | return 1; | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * errstr2errno - convert error string to error number | ||
66 | * @errstr: error string | ||
67 | * | ||
68 | */ | ||
69 | |||
70 | int v9fs_errstr2errno(char *errstr, int len) | ||
71 | { | ||
72 | int errno = 0; | ||
73 | struct hlist_node *p = NULL; | ||
74 | struct errormap *c = NULL; | ||
75 | int bucket = jhash(errstr, len, 0) % ERRHASHSZ; | ||
76 | |||
77 | hlist_for_each_entry(c, p, &hash_errmap[bucket], list) { | ||
78 | if (c->namelen==len && !memcmp(c->name, errstr, len)) { | ||
79 | errno = c->val; | ||
80 | break; | ||
81 | } | ||
82 | } | ||
83 | |||
84 | if (errno == 0) { | ||
85 | /* TODO: if error isn't found, add it dynamically */ | ||
86 | errstr[len] = 0; | ||
87 | printk(KERN_ERR "%s: errstr :%s: not found\n", __FUNCTION__, | ||
88 | errstr); | ||
89 | errno = 1; | ||
90 | } | ||
91 | |||
92 | return -errno; | ||
93 | } | ||