/* * modules trace_printk()'s formats are autosaved in struct trace_bprintk_fmt * which are queued on trace_bprintk_fmt_list.
*/ static LIST_HEAD(trace_bprintk_fmt_list);
/* serialize accesses to trace_bprintk_fmt_list */ static DEFINE_MUTEX(btrace_mutex);
if (val == MODULE_STATE_COMING)
hold_module_trace_bprintk_format(start, end);
} return NOTIFY_OK;
}
/* * The debugfs/tracing/printk_formats file maps the addresses with * the ASCII formats that are used in the bprintk events in the * buffer. For userspace tools to be able to decode the events from * the buffer, they need to be able to map the address with the format. * * The addresses of the bprintk formats are in their own section * __trace_printk_fmt. But for modules we copy them into a link list. * The code to print the formats and their addresses passes around the * address of the fmt string. If the fmt address passed into the seq * functions is within the kernel core __trace_printk_fmt section, then * it simply uses the next pointer in the list. * * When the fmt pointer is outside the kernel core __trace_printk_fmt * section, then we need to read the link list pointers. The trick is * we pass the address of the string to the seq function just like * we do for the kernel core formats. To get back the structure that * holds the format, we simply use container_of() and then go to the * next format in the list.
*/ staticconstchar **
find_next_mod_format(int start_index, void *v, constchar **fmt, loff_t *pos)
{ struct trace_bprintk_fmt *mod_fmt;
if (list_empty(&trace_bprintk_fmt_list)) return NULL;
/* * v will point to the address of the fmt record from t_next * v will be NULL from t_start. * If this is the first pointer or called from start * then we need to walk the list.
*/ if (!v || start_index == *pos) { struct trace_bprintk_fmt *p;
/* search the module list */
list_for_each_entry(p, &trace_bprintk_fmt_list, list) { if (start_index == *pos) return &p->fmt;
start_index++;
} /* pos > index */ return NULL;
}
/* * v points to the address of the fmt field in the mod list * structure that holds the module print format.
*/
mod_fmt = container_of(v, typeof(*mod_fmt), fmt); if (mod_fmt->list.next == &trace_bprintk_fmt_list) return NULL;
if (*pos < start_index) return __start___trace_bprintk_fmt + *pos;
/* * The __tracepoint_str section is treated the same as the * __trace_printk_fmt section. The difference is that the * __trace_printk_fmt section should only be used by trace_printk() * in a debugging environment, as if anything exists in that section * the trace_prink() helper buffers are allocated, which would just * waste space in a production environment. * * The __tracepoint_str sections on the other hand are used by * tracepoints which need to map pointers to their strings to * the ASCII text for userspace.
*/
last_index = start_index;
start_index = __stop___tracepoint_str - __start___tracepoint_str;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.