From c522da3300fe855a3c175366513c9fc0a8abfb1a Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 28 Mar 2008 00:46:41 -0400 Subject: [PATCH] --- yaml --- r: 91919 b: refs/heads/master c: 521b5d0c40386f4a9805cdec7bd979fc96a86aeb h: refs/heads/master i: 91917: 2703413bc30c72dae5616837d79473f72c29677b 91915: 0d9db2130da52598d4fc00bef52e3173b842d0aa 91911: a1a0c9f24f914dba961c63fb2aea263ee4b82160 91903: b08a5a544a8df79600644ebacf09a37c04715bb0 v: v3 --- [refs] | 2 +- trunk/fs/pnode.h | 1 + trunk/fs/seq_file.c | 16 ++++++++++++---- trunk/include/linux/seq_file.h | 2 ++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 27aaff783c7c..2322435dfe38 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4e1b36fb485dd81b0818ef1bc8fb5c0f2923a283 +refs/heads/master: 521b5d0c40386f4a9805cdec7bd979fc96a86aeb diff --git a/trunk/fs/pnode.h b/trunk/fs/pnode.h index f249be2fee7a..973c3f825e7d 100644 --- a/trunk/fs/pnode.h +++ b/trunk/fs/pnode.h @@ -35,4 +35,5 @@ int propagate_mnt(struct vfsmount *, struct dentry *, struct vfsmount *, struct list_head *); int propagate_umount(struct list_head *); int propagate_mount_busy(struct vfsmount *, int); +void mnt_release_group_id(struct vfsmount *); #endif /* _LINUX_PNODE_H */ diff --git a/trunk/fs/seq_file.c b/trunk/fs/seq_file.c index 853770274f20..bf2bcfd4bcfb 100644 --- a/trunk/fs/seq_file.c +++ b/trunk/fs/seq_file.c @@ -25,6 +25,7 @@ * into the buffer. In case of error ->start() and ->next() return * ERR_PTR(error). In the end of sequence they return %NULL. ->show() * returns 0 in case of success and negative number in case of error. + * Returning SEQ_SKIP means "discard this element and move on". */ int seq_open(struct file *file, const struct seq_operations *op) { @@ -114,8 +115,10 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) if (!p || IS_ERR(p)) break; err = m->op->show(m, p); - if (err) + if (err < 0) break; + if (unlikely(err)) + m->count = 0; if (m->count < m->size) goto Fill; m->op->stop(m, p); @@ -140,9 +143,10 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) break; } err = m->op->show(m, p); - if (err || m->count == m->size) { + if (m->count == m->size || err) { m->count = offs; - break; + if (likely(err <= 0)) + break; } pos = next; } @@ -199,8 +203,12 @@ static int traverse(struct seq_file *m, loff_t offset) if (IS_ERR(p)) break; error = m->op->show(m, p); - if (error) + if (error < 0) break; + if (unlikely(error)) { + error = 0; + m->count = 0; + } if (m->count == m->size) goto Eoverflow; if (pos + m->count > offset) { diff --git a/trunk/include/linux/seq_file.h b/trunk/include/linux/seq_file.h index 1da1e6208a0a..d65796dc26d9 100644 --- a/trunk/include/linux/seq_file.h +++ b/trunk/include/linux/seq_file.h @@ -30,6 +30,8 @@ struct seq_operations { int (*show) (struct seq_file *m, void *v); }; +#define SEQ_SKIP 1 + int seq_open(struct file *, const struct seq_operations *); ssize_t seq_read(struct file *, char __user *, size_t, loff_t *); loff_t seq_lseek(struct file *, loff_t, int);