diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-23 06:00:37 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-23 10:38:12 -0500 |
commit | 0ac1759abc69fb62438c30a7e422f628a1120d67 (patch) | |
tree | 953fd417cc63bae48245ab03c04123a45e21125e | |
parent | 7cf34c761db8827818a27e23c50756f8b821a9b0 (diff) |
[PATCH] sem2mutex: fs/seq_file.c
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>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/seq_file.c | 10 | ||||
-rw-r--r-- | include/linux/seq_file.h | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/fs/seq_file.c b/fs/seq_file.c index 7c40570b71dc..555b9ac04c25 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c | |||
@@ -37,7 +37,7 @@ int seq_open(struct file *file, struct seq_operations *op) | |||
37 | file->private_data = p; | 37 | file->private_data = p; |
38 | } | 38 | } |
39 | memset(p, 0, sizeof(*p)); | 39 | memset(p, 0, sizeof(*p)); |
40 | sema_init(&p->sem, 1); | 40 | mutex_init(&p->lock); |
41 | p->op = op; | 41 | p->op = op; |
42 | 42 | ||
43 | /* | 43 | /* |
@@ -71,7 +71,7 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) | |||
71 | void *p; | 71 | void *p; |
72 | int err = 0; | 72 | int err = 0; |
73 | 73 | ||
74 | down(&m->sem); | 74 | mutex_lock(&m->lock); |
75 | /* | 75 | /* |
76 | * seq_file->op->..m_start/m_stop/m_next may do special actions | 76 | * seq_file->op->..m_start/m_stop/m_next may do special actions |
77 | * or optimisations based on the file->f_version, so we want to | 77 | * or optimisations based on the file->f_version, so we want to |
@@ -164,7 +164,7 @@ Done: | |||
164 | else | 164 | else |
165 | *ppos += copied; | 165 | *ppos += copied; |
166 | file->f_version = m->version; | 166 | file->f_version = m->version; |
167 | up(&m->sem); | 167 | mutex_unlock(&m->lock); |
168 | return copied; | 168 | return copied; |
169 | Enomem: | 169 | Enomem: |
170 | err = -ENOMEM; | 170 | err = -ENOMEM; |
@@ -237,7 +237,7 @@ loff_t seq_lseek(struct file *file, loff_t offset, int origin) | |||
237 | struct seq_file *m = (struct seq_file *)file->private_data; | 237 | struct seq_file *m = (struct seq_file *)file->private_data; |
238 | long long retval = -EINVAL; | 238 | long long retval = -EINVAL; |
239 | 239 | ||
240 | down(&m->sem); | 240 | mutex_lock(&m->lock); |
241 | m->version = file->f_version; | 241 | m->version = file->f_version; |
242 | switch (origin) { | 242 | switch (origin) { |
243 | case 1: | 243 | case 1: |
@@ -260,7 +260,7 @@ loff_t seq_lseek(struct file *file, loff_t offset, int origin) | |||
260 | } | 260 | } |
261 | } | 261 | } |
262 | } | 262 | } |
263 | up(&m->sem); | 263 | mutex_unlock(&m->lock); |
264 | file->f_version = m->version; | 264 | file->f_version = m->version; |
265 | return retval; | 265 | return retval; |
266 | } | 266 | } |
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 850a974ee505..b95f6eb7254c 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | #include <linux/string.h> | 6 | #include <linux/string.h> |
7 | #include <asm/semaphore.h> | 7 | #include <linux/mutex.h> |
8 | 8 | ||
9 | struct seq_operations; | 9 | struct seq_operations; |
10 | struct file; | 10 | struct file; |
@@ -19,7 +19,7 @@ struct seq_file { | |||
19 | size_t count; | 19 | size_t count; |
20 | loff_t index; | 20 | loff_t index; |
21 | loff_t version; | 21 | loff_t version; |
22 | struct semaphore sem; | 22 | struct mutex lock; |
23 | struct seq_operations *op; | 23 | struct seq_operations *op; |
24 | void *private; | 24 | void *private; |
25 | }; | 25 | }; |