[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20071009040401.GA3493@tpepper-t42p.dolavim.us>
Date: Mon, 8 Oct 2007 21:04:02 -0700
From: Tim Pepper <lnxninja@...ux.vnet.ibm.com>
To: Al Viro <viro@....linux.org.uk>
Cc: Tim Pepper <lnxninja@...ux.vnet.ibm.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lockdep: Avoid /proc/lockdep & lock_stat infinite
output
On Tue 09 Oct at 02:30:11 +0100 viro@....linux.org.uk said:
> On Mon, Oct 08, 2007 at 06:15:51PM -0700, Tim Pepper wrote:
> >
> > - if (&class->lock_entry == all_lock_classes.next)
> > + if (*pos == 0)
> > seq_printf(m, "all lock classes:\n");
>
> Do not generate output outside of ->show() and you won't have these
> problems. That's where your infinite output crap comes from.
>
> IOW, NAK - fix the underlying problem.
Aaah...OK. Can we add something like the following then:
Document that output must only come from _show() and SEQ_START_TOKEN is how
a _start() indicates a header is to be printed.
Signed-off-by: Tim Pepper <lnxninja@...ux.vnet.ibm.com>
Cc: Al Viro <viro@....linux.org.uk>
---
--- linux-2.6.orig/include/linux/seq_file.h
+++ linux-2.6.23-rc9/include/linux/seq_file.h
@@ -36,9 +36,10 @@ ssize_t seq_read(struct file *, char __u
loff_t seq_lseek(struct file *, loff_t, int);
int seq_release(struct inode *, struct file *);
int seq_escape(struct seq_file *, const char *, const char *);
+
+/* these may only be called from a (*show) function */
int seq_putc(struct seq_file *m, char c);
int seq_puts(struct seq_file *m, const char *s);
-
int seq_printf(struct seq_file *, const char *, ...)
__attribute__ ((format (printf,2,3)));
@@ -48,6 +49,11 @@ int single_open(struct file *, int (*)(s
int single_release(struct inode *, struct file *);
int seq_release_private(struct inode *, struct file *);
+/*
+ * return SEQ_START_TOKEN in your (*start) function and test for
+ * (v == SEQ_START_TOKEN) in * your (*show) funtion in order to
+ * print a header before your seq data
+ */
#define SEQ_START_TOKEN ((void *)1)
/*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists