Re: [PATCH 04/13] tracing/kprobes: Factor out struct trace_probe

From: Masami Hiramatsu
Date: Mon Aug 05 2013 - 02:00:35 EST


(2013/07/31 18:03), Namhyung Kim wrote:
> From: Namhyung Kim <namhyung.kim@xxxxxxx>
>
> There are functions that can be shared to both of kprobes and uprobes.
> Separate common data structure to struct trace_probe and use it from
> the shared functions.

Thanks, basically I'm good at this change.
Could you also rename several functions which handles trace_kprobe
instead of trace_probe? (as you did on trace_probe_XXX())
e.g.

> @@ -107,14 +91,14 @@ static int kretprobe_dispatcher(struct kretprobe_instance *ri,
> /*
> * Allocate new trace_probe and initialize it (including kprobes).
> */
> -static struct trace_probe *alloc_trace_probe(const char *group,
> +static struct trace_kprobe *alloc_trace_probe(const char *group,

Now this allocates trace_kprobe instead of trace_probe, so
this should be called as alloc_trace_kprobe().
Below functions should also be renamed.

> -static void free_trace_probe(struct trace_probe *tp)
> +static void free_trace_probe(struct trace_kprobe *tp)

> -static struct trace_probe *find_trace_probe(const char *event,
> - const char *group)
> +static struct trace_kprobe *find_trace_probe(const char *event,
> + const char *group)

> -enable_trace_probe(struct trace_probe *tp, struct ftrace_event_file *file)
> +enable_trace_probe(struct trace_kprobe *tp, struct ftrace_event_file *file)

> -disable_trace_probe(struct trace_probe *tp, struct ftrace_event_file *file)
> +disable_trace_probe(struct trace_kprobe *tp, struct ftrace_event_file *file)

> /* Internal register function - just handle k*probes and flags */
> -static int __register_trace_probe(struct trace_probe *tp)
> +static int __register_trace_probe(struct trace_kprobe *tp)

> /* Internal unregister function - just handle k*probes and flags */
> -static void __unregister_trace_probe(struct trace_probe *tp)
> +static void __unregister_trace_probe(struct trace_kprobe *tp)

For below two, comments should be updated too.

> /* Unregister a trace_probe and probe_event: call with locking probe_lock */
> -static int unregister_trace_probe(struct trace_probe *tp)
> +static int unregister_trace_probe(struct trace_kprobe *tp)

> /* Register a trace_probe and probe_event */
> -static int register_trace_probe(struct trace_probe *tp)
> +static int register_trace_probe(struct trace_kprobe *tp)

> @@ -399,7 +383,7 @@ static int trace_probe_module_callback(struct notifier_block *nb,
> unsigned long val, void *data)

> @@ -448,7 +432,7 @@ static int create_trace_probe(int argc, char **argv)

> static int release_all_trace_probes(void)

> static struct ftrace_event_file *
> -find_trace_probe_file(struct trace_probe *tp, struct trace_array *tr)
> +find_trace_probe_file(struct trace_kprobe *tp, struct trace_array *tr)

Thank you,

--
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@xxxxxxxxxxx


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