Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1260888

Re: [PATCH 3/3] tracing: Apply tracer specific options from kernel command line.

From Steven Rostedt <rostedt@goodmis.org>
Newsgroups linux.kernel
Subject Re: [PATCH 3/3] tracing: Apply tracer specific options from kernel command line.
Date 2015-11-02 20:10 +0100
Message-ID <qqsEq-Gy-9@gated-at.bofh.it> (permalink)
References <qkUWK-4JV-13@gated-at.bofh.it> <qkUWL-4JV-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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();
>  

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH 3/3] tracing: Apply tracer specific options from kernel  command line. Steven Rostedt <rostedt@goodmis.org> - 2015-11-02 20:10 +0100
  [PATCH v2] tracing: Apply tracer specific options from kernel command line. Jiaxing Wang <hello.wjx@gmail.com> - 2015-11-04 02:20 +0100

csiph-web