On Fri, 22 Nov 2013 23:27:57 +0900 Namhyung Kim <namhy...@kernel.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) > > Isn't it better to make these functions static? Yeah, but that was my mistake. Lets keep the fix separate from the backport though. Thanks! > > > > +{ > > + 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. 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. Funny thing is, this patch is irrelevant with todays kernel due to this commit: commit 4862fd6047ed02e2726667c54d35f538eecc56aa Author: Theodore Ts'o <ty...@mit.edu> Date: Sun Jul 10 22:05:08 2011 -0400 jbd2: remove jbd2_dev_to_name() from jbd2 tracepoints Using function calls in TP_printk causes perf heartburn, so print the MAJOR/MINOR device numbers instead. Signed-off-by: "Theodore Ts'o" <ty...@mit.edu> > > > > + "jbd2_dev_to_name", > > + PEVENT_FUNC_ARG_INT, > > + PEVENT_FUNC_ARG_VOID); > > + > > + pevent_register_print_function(pevent, > > + process_jiffies_to_msecs, > > + PEVENT_FUNC_ARG_LONG, > > + "jiffies_to_msecs", > > + PEVENT_FUNC_ARG_LONG, > > + PEVENT_FUNC_ARG_VOID); > > + return 0; > > +} > > Shouldn't it unregister these functions when unloaded? Probably ;-) -- Steve > > Thanks, > Namhyung > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/