Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 23054
b: refs/heads/master
c: 0ac1759
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar authored and Linus Torvalds committed Mar 23, 2006
1 parent 3b8d479 commit 6839899
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7cf34c761db8827818a27e23c50756f8b821a9b0
refs/heads/master: 0ac1759abc69fb62438c30a7e422f628a1120d67
10 changes: 5 additions & 5 deletions trunk/fs/seq_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int seq_open(struct file *file, struct seq_operations *op)
file->private_data = p;
}
memset(p, 0, sizeof(*p));
sema_init(&p->sem, 1);
mutex_init(&p->lock);
p->op = op;

/*
Expand Down Expand Up @@ -71,7 +71,7 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
void *p;
int err = 0;

down(&m->sem);
mutex_lock(&m->lock);
/*
* seq_file->op->..m_start/m_stop/m_next may do special actions
* or optimisations based on the file->f_version, so we want to
Expand Down Expand Up @@ -164,7 +164,7 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
else
*ppos += copied;
file->f_version = m->version;
up(&m->sem);
mutex_unlock(&m->lock);
return copied;
Enomem:
err = -ENOMEM;
Expand Down Expand Up @@ -237,7 +237,7 @@ loff_t seq_lseek(struct file *file, loff_t offset, int origin)
struct seq_file *m = (struct seq_file *)file->private_data;
long long retval = -EINVAL;

down(&m->sem);
mutex_lock(&m->lock);
m->version = file->f_version;
switch (origin) {
case 1:
Expand All @@ -260,7 +260,7 @@ loff_t seq_lseek(struct file *file, loff_t offset, int origin)
}
}
}
up(&m->sem);
mutex_unlock(&m->lock);
file->f_version = m->version;
return retval;
}
Expand Down
4 changes: 2 additions & 2 deletions trunk/include/linux/seq_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <linux/types.h>
#include <linux/string.h>
#include <asm/semaphore.h>
#include <linux/mutex.h>

struct seq_operations;
struct file;
Expand All @@ -19,7 +19,7 @@ struct seq_file {
size_t count;
loff_t index;
loff_t version;
struct semaphore sem;
struct mutex lock;
struct seq_operations *op;
void *private;
};
Expand Down

0 comments on commit 6839899

Please sign in to comment.