Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[sfrench/cifs-2.6.git] / kernel / trace / trace_events.c
index 6f965864cc029ad47f63c67f6713cb79a519599e..b7b0760ba6ee9984521691704aa9483c034f54d6 100644 (file)
@@ -204,6 +204,24 @@ static void trace_destroy_fields(struct trace_event_call *call)
        }
 }
 
+/*
+ * run-time version of trace_event_get_offsets_<call>() that returns the last
+ * accessible offset of trace fields excluding __dynamic_array bytes
+ */
+int trace_event_get_offsets(struct trace_event_call *call)
+{
+       struct ftrace_event_field *tail;
+       struct list_head *head;
+
+       head = trace_get_fields(call);
+       /*
+        * head->next points to the last field with the largest offset,
+        * since it was added last by trace_define_field()
+        */
+       tail = list_first_entry(head, struct ftrace_event_field, link);
+       return tail->offset + tail->size;
+}
+
 int trace_event_raw_init(struct trace_event_call *call)
 {
        int id;