lkml.org 
[lkml]   [2015]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] tracing: Apply tracer specific options from kernel command line.
On Sun, 18 Oct 2015 19:58:10 +0800
Jiaxing Wang <hello.wjx@gmail.com> wrote:


> +static int __init apply_trace_boot_options(void)
> +{
> + char *option;
> + char *buf;
> + char *str;
> + size_t len;
> +
> + if (trace_boot_options) {
> + len = strlen(trace_boot_options);
> +
> + buf = str = kmalloc(len + 1, GFP_KERNEL);
> + if (!buf)
> + return -ENOMEM;
> +
> + memcpy(buf, trace_boot_options, len + 1);
> +
> + while (str) {
> + option = strsep(&str, ",");
> + trace_set_options(&global_trace, option);
> + }
> +
> + kfree(buf);

Instead of allocating a buffer, do what I do in early_enable_events()
(see trace_events.c), where I put back the ',' after processing.

-- Steve

> + }
> +
> + return 0;
> +}
> +
> static ssize_t
> tracing_trace_options_write(struct file *filp, const char __user *ubuf,
> size_t cnt, loff_t *ppos)
> @@ -7153,12 +7185,7 @@ __init static int tracer_alloc_buffers(void)
> INIT_LIST_HEAD(&global_trace.events);
> list_add(&global_trace.list, &ftrace_trace_arrays);
>
> - while (trace_boot_options) {
> - char *option;
> -
> - option = strsep(&trace_boot_options, ",");
> - trace_set_options(&global_trace, option);
> - }
> + apply_trace_boot_options();
>
> register_snapshot_cmd();
>



\
 
 \ /
  Last update: 2015-11-02 20:21    [W:0.421 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site