aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_events.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/trace_events.c')
-rw-r--r--kernel/trace/trace_events.c60
1 files changed, 22 insertions, 38 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 7a75cb22eab7..76defd91f9b4 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -826,59 +826,33 @@ enum {
826static void *f_next(struct seq_file *m, void *v, loff_t *pos) 826static void *f_next(struct seq_file *m, void *v, loff_t *pos)
827{ 827{
828 struct ftrace_event_call *call = m->private; 828 struct ftrace_event_call *call = m->private;
829 struct ftrace_event_field *field;
830 struct list_head *common_head = &ftrace_common_fields; 829 struct list_head *common_head = &ftrace_common_fields;
831 struct list_head *head = trace_get_fields(call); 830 struct list_head *head = trace_get_fields(call);
831 struct list_head *node = v;
832 832
833 (*pos)++; 833 (*pos)++;
834 834
835 switch ((unsigned long)v) { 835 switch ((unsigned long)v) {
836 case FORMAT_HEADER: 836 case FORMAT_HEADER:
837 if (unlikely(list_empty(common_head))) 837 node = common_head;
838 return NULL; 838 break;
839
840 field = list_entry(common_head->prev,
841 struct ftrace_event_field, link);
842 return field;
843 839
844 case FORMAT_FIELD_SEPERATOR: 840 case FORMAT_FIELD_SEPERATOR:
845 if (unlikely(list_empty(head))) 841 node = head;
846 return NULL; 842 break;
847
848 field = list_entry(head->prev, struct ftrace_event_field, link);
849 return field;
850 843
851 case FORMAT_PRINTFMT: 844 case FORMAT_PRINTFMT:
852 /* all done */ 845 /* all done */
853 return NULL; 846 return NULL;
854 } 847 }
855 848
856 field = v; 849 node = node->prev;
857 if (field->link.prev == common_head) 850 if (node == common_head)
858 return (void *)FORMAT_FIELD_SEPERATOR; 851 return (void *)FORMAT_FIELD_SEPERATOR;
859 else if (field->link.prev == head) 852 else if (node == head)
860 return (void *)FORMAT_PRINTFMT; 853 return (void *)FORMAT_PRINTFMT;
861 854 else
862 field = list_entry(field->link.prev, struct ftrace_event_field, link); 855 return node;
863
864 return field;
865}
866
867static void *f_start(struct seq_file *m, loff_t *pos)
868{
869 loff_t l = 0;
870 void *p;
871
872 /* Start by showing the header */
873 if (!*pos)
874 return (void *)FORMAT_HEADER;
875
876 p = (void *)FORMAT_HEADER;
877 do {
878 p = f_next(m, p, &l);
879 } while (p && l < *pos);
880
881 return p;
882} 856}
883 857
884static int f_show(struct seq_file *m, void *v) 858static int f_show(struct seq_file *m, void *v)
@@ -904,8 +878,7 @@ static int f_show(struct seq_file *m, void *v)
904 return 0; 878 return 0;
905 } 879 }
906 880
907 field = v; 881 field = list_entry(v, struct ftrace_event_field, link);
908
909 /* 882 /*
910 * Smartly shows the array type(except dynamic array). 883 * Smartly shows the array type(except dynamic array).
911 * Normal: 884 * Normal:
@@ -932,6 +905,17 @@ static int f_show(struct seq_file *m, void *v)
932 return 0; 905 return 0;
933} 906}
934 907
908static void *f_start(struct seq_file *m, loff_t *pos)
909{
910 void *p = (void *)FORMAT_HEADER;
911 loff_t l = 0;
912
913 while (l < *pos && p)
914 p = f_next(m, p, &l);
915
916 return p;
917}
918
935static void f_stop(struct seq_file *m, void *p) 919static void f_stop(struct seq_file *m, void *p)
936{ 920{
937} 921}