lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 25 Nov 2013 16:38:48 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	Jiri Olsa <jolsa@...hat.com>, linux-kernel@...r.kernel.org,
	Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...e.hu>, Paul Mackerras <paulus@...ba.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	David Ahern <dsahern@...il.com>,
	"Theodore Ts'o" <tytso@....edu>
Subject: Re: [PATCH 04/22] tools lib traceevent: Add jbd2 plugin

On Sat, 23 Nov 2013 03:52:21 -0500, Steven Rostedt wrote:
> On Fri, 22 Nov 2013 23:27:57 +0900
> Namhyung Kim <namhyung@...nel.org> wrote:
>
>> [SNIP]
>> > +#define MINORBITS	20
>> > +#define MINORMASK	((1U << MINORBITS) - 1)
>> > +
>> > +#define MAJOR(dev)	((unsigned int) ((dev) >> MINORBITS))
>> > +#define MINOR(dev)	((unsigned int) ((dev) & MINORMASK))
>> > +
>> > +unsigned long long process_jbd2_dev_to_name(struct trace_seq *s,
>> > +					    unsigned long long *args)
>> > +{
>> > +	unsigned int dev = args[0];
>> > +
>> > +	trace_seq_printf(s, "%d:%d", MAJOR(dev), MINOR(dev));
>> > +	return 0;
>> > +}
>> > +
>> > +unsigned long long process_jiffies_to_msecs(struct trace_seq *s,
>> > +					    unsigned long long *args)
>> > +{
>> > +	unsigned long long jiffies = args[0];
>> > +
>> > +	trace_seq_printf(s, "%lld", jiffies);
>> > +	return jiffies;
>> > +}
>> > +
>> > +int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
>> > +{
>> > +	pevent_register_print_function(pevent,
>> > +				       process_jbd2_dev_to_name,
>> > +				       PEVENT_FUNC_ARG_STRING,
>> 
>> Actually the function returns long long not string.  But it seems the
>> current code doesn't care about the return type.
>
> Actually it's not representing what process_jbd2_dev_to_name() returns
> (which will always return unsigned long long), but what
> "jbd2_dev_to_name()" returns that is (was) defined in the kernel. That
> was:
>
> 	const char *jbd2_dev_to_name(dev_t device)
>
> When registering a function to handle, you need to express the
> prototype of that function (not the handler). The third argument is the
> ret_type of that function.

Aha, got it.  Thank you for the explanation.


> But this is interesting, the ret_type doesn't seem to be used in
> event_parse.c. The return value of the callback is only done in
> eval_num_arg() where we could put a warning if the ret_type is not a
> number.

Yes. :)

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ