git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PATCH] deal with the first call of ->show() generating no output
[safe/jmp/linux-2.6]
/
fs
/
seq_file.c
diff --git
a/fs/seq_file.c
b/fs/seq_file.c
index
5d54205
..
bd20f7f
100644
(file)
--- a/
fs/seq_file.c
+++ b/
fs/seq_file.c
@@
-108,9
+108,9
@@
ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
goto Done;
}
/* we need at least one record in buffer */
goto Done;
}
/* we need at least one record in buffer */
+ pos = m->index;
+ p = m->op->start(m, &pos);
while (1) {
while (1) {
- pos = m->index;
- p = m->op->start(m, &pos);
err = PTR_ERR(p);
if (!p || IS_ERR(p))
break;
err = PTR_ERR(p);
if (!p || IS_ERR(p))
break;
@@
-119,6
+119,11
@@
ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
break;
if (unlikely(err))
m->count = 0;
break;
if (unlikely(err))
m->count = 0;
+ if (unlikely(!m->count)) {
+ p = m->op->next(m, p, &pos);
+ m->index = pos;
+ continue;
+ }
if (m->count < m->size)
goto Fill;
m->op->stop(m, p);
if (m->count < m->size)
goto Fill;
m->op->stop(m, p);
@@
-128,6
+133,8
@@
ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
goto Enomem;
m->count = 0;
m->version = 0;
goto Enomem;
m->count = 0;
m->version = 0;
+ pos = m->index;
+ p = m->op->start(m, &pos);
}
m->op->stop(m, p);
m->count = 0;
}
m->op->stop(m, p);
m->count = 0;