]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ftrace: state that all functions are enabled in set_ftrace_filter
authorSteven Rostedt <srostedt@redhat.com>
Mon, 16 Feb 2009 16:21:52 +0000 (11:21 -0500)
committerSteven Rostedt <srostedt@redhat.com>
Mon, 16 Feb 2009 21:21:35 +0000 (16:21 -0500)
Impact: clean up, make set_ftrace_filter less confusing

The set_ftrace_filter shows only the functions that will be traced.
But when it is empty, it will trace all functions. This can be a bit
confusing.

This patch makes set_ftrace_filter show:

  #### all functions enabled ####

When all functions will be traced, and we do not filter only a select
few.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
kernel/trace/ftrace.c

index 1796e018fbff40b62fd4b793a0f5291bcef0067d..369fb78bd4abbc80e269de4de50a8bfd23276dd1 100644 (file)
@@ -773,6 +773,7 @@ enum {
        FTRACE_ITER_CONT        = (1 << 1),
        FTRACE_ITER_NOTRACE     = (1 << 2),
        FTRACE_ITER_FAILURES    = (1 << 3),
+       FTRACE_ITER_PRINTALL    = (1 << 4),
 };
 
 #define FTRACE_BUFF_MAX (KSYM_SYMBOL_LEN+4) /* room for wildcards */
@@ -794,6 +795,9 @@ t_next(struct seq_file *m, void *v, loff_t *pos)
 
        (*pos)++;
 
+       if (iter->flags & FTRACE_ITER_PRINTALL)
+               return NULL;
+
        /* should not be called from interrupt context */
        spin_lock(&ftrace_lock);
  retry:
@@ -834,6 +838,19 @@ static void *t_start(struct seq_file *m, loff_t *pos)
        struct ftrace_iterator *iter = m->private;
        void *p = NULL;
 
+       /*
+        * For set_ftrace_filter reading, if we have the filter
+        * off, we can short cut and just print out that all
+        * functions are enabled.
+        */
+       if (iter->flags & FTRACE_ITER_FILTER && !ftrace_filtered) {
+               if (*pos > 0)
+                       return NULL;
+               iter->flags |= FTRACE_ITER_PRINTALL;
+               (*pos)++;
+               return iter;
+       }
+
        if (*pos > 0) {
                if (iter->idx < 0)
                        return p;
@@ -852,9 +869,15 @@ static void t_stop(struct seq_file *m, void *p)
 
 static int t_show(struct seq_file *m, void *v)
 {
+       struct ftrace_iterator *iter = m->private;
        struct dyn_ftrace *rec = v;
        char str[KSYM_SYMBOL_LEN];
 
+       if (iter->flags & FTRACE_ITER_PRINTALL) {
+               seq_printf(m, "#### all functions enabled ####\n");
+               return 0;
+       }
+
        if (!rec)
                return 0;