diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-26 04:37:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-26 11:56:55 -0500 |
commit | 353ab6e97b8f209dbecc9f650f1f84e3da2a7bb1 (patch) | |
tree | bffabd9a5a493ffd2b41dd825e71e848ca6ba6d7 /fs/dcookies.c | |
parent | e655a250d5fc12b6dfe0d436180ba4a3bfffdc9f (diff) |
[PATCH] sem2mutex: fs/
Semaphore to mutex conversion.
The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Eric Van Hensbergen <ericvh@ericvh.myip.org>
Cc: Robert Love <rml@tech9.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/dcookies.c')
-rw-r--r-- | fs/dcookies.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/fs/dcookies.c b/fs/dcookies.c index f8274a8f83bd..ef758cfa5565 100644 --- a/fs/dcookies.c +++ b/fs/dcookies.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
24 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
25 | #include <linux/dcookies.h> | 25 | #include <linux/dcookies.h> |
26 | #include <linux/mutex.h> | ||
26 | #include <asm/uaccess.h> | 27 | #include <asm/uaccess.h> |
27 | 28 | ||
28 | /* The dcookies are allocated from a kmem_cache and | 29 | /* The dcookies are allocated from a kmem_cache and |
@@ -36,7 +37,7 @@ struct dcookie_struct { | |||
36 | }; | 37 | }; |
37 | 38 | ||
38 | static LIST_HEAD(dcookie_users); | 39 | static LIST_HEAD(dcookie_users); |
39 | static DECLARE_MUTEX(dcookie_sem); | 40 | static DEFINE_MUTEX(dcookie_mutex); |
40 | static kmem_cache_t * dcookie_cache; | 41 | static kmem_cache_t * dcookie_cache; |
41 | static struct list_head * dcookie_hashtable; | 42 | static struct list_head * dcookie_hashtable; |
42 | static size_t hash_size; | 43 | static size_t hash_size; |
@@ -114,7 +115,7 @@ int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt, | |||
114 | int err = 0; | 115 | int err = 0; |
115 | struct dcookie_struct * dcs; | 116 | struct dcookie_struct * dcs; |
116 | 117 | ||
117 | down(&dcookie_sem); | 118 | mutex_lock(&dcookie_mutex); |
118 | 119 | ||
119 | if (!is_live()) { | 120 | if (!is_live()) { |
120 | err = -EINVAL; | 121 | err = -EINVAL; |
@@ -134,7 +135,7 @@ int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt, | |||
134 | *cookie = dcookie_value(dcs); | 135 | *cookie = dcookie_value(dcs); |
135 | 136 | ||
136 | out: | 137 | out: |
137 | up(&dcookie_sem); | 138 | mutex_unlock(&dcookie_mutex); |
138 | return err; | 139 | return err; |
139 | } | 140 | } |
140 | 141 | ||
@@ -157,7 +158,7 @@ asmlinkage long sys_lookup_dcookie(u64 cookie64, char __user * buf, size_t len) | |||
157 | if (!capable(CAP_SYS_ADMIN)) | 158 | if (!capable(CAP_SYS_ADMIN)) |
158 | return -EPERM; | 159 | return -EPERM; |
159 | 160 | ||
160 | down(&dcookie_sem); | 161 | mutex_lock(&dcookie_mutex); |
161 | 162 | ||
162 | if (!is_live()) { | 163 | if (!is_live()) { |
163 | err = -EINVAL; | 164 | err = -EINVAL; |
@@ -192,7 +193,7 @@ asmlinkage long sys_lookup_dcookie(u64 cookie64, char __user * buf, size_t len) | |||
192 | out_free: | 193 | out_free: |
193 | kfree(kbuf); | 194 | kfree(kbuf); |
194 | out: | 195 | out: |
195 | up(&dcookie_sem); | 196 | mutex_unlock(&dcookie_mutex); |
196 | return err; | 197 | return err; |
197 | } | 198 | } |
198 | 199 | ||
@@ -290,7 +291,7 @@ struct dcookie_user * dcookie_register(void) | |||
290 | { | 291 | { |
291 | struct dcookie_user * user; | 292 | struct dcookie_user * user; |
292 | 293 | ||
293 | down(&dcookie_sem); | 294 | mutex_lock(&dcookie_mutex); |
294 | 295 | ||
295 | user = kmalloc(sizeof(struct dcookie_user), GFP_KERNEL); | 296 | user = kmalloc(sizeof(struct dcookie_user), GFP_KERNEL); |
296 | if (!user) | 297 | if (!user) |
@@ -302,7 +303,7 @@ struct dcookie_user * dcookie_register(void) | |||
302 | list_add(&user->next, &dcookie_users); | 303 | list_add(&user->next, &dcookie_users); |
303 | 304 | ||
304 | out: | 305 | out: |
305 | up(&dcookie_sem); | 306 | mutex_unlock(&dcookie_mutex); |
306 | return user; | 307 | return user; |
307 | out_free: | 308 | out_free: |
308 | kfree(user); | 309 | kfree(user); |
@@ -313,7 +314,7 @@ out_free: | |||
313 | 314 | ||
314 | void dcookie_unregister(struct dcookie_user * user) | 315 | void dcookie_unregister(struct dcookie_user * user) |
315 | { | 316 | { |
316 | down(&dcookie_sem); | 317 | mutex_lock(&dcookie_mutex); |
317 | 318 | ||
318 | list_del(&user->next); | 319 | list_del(&user->next); |
319 | kfree(user); | 320 | kfree(user); |
@@ -321,7 +322,7 @@ void dcookie_unregister(struct dcookie_user * user) | |||
321 | if (!is_live()) | 322 | if (!is_live()) |
322 | dcookie_exit(); | 323 | dcookie_exit(); |
323 | 324 | ||
324 | up(&dcookie_sem); | 325 | mutex_unlock(&dcookie_mutex); |
325 | } | 326 | } |
326 | 327 | ||
327 | EXPORT_SYMBOL_GPL(dcookie_register); | 328 | EXPORT_SYMBOL_GPL(dcookie_register); |