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]
Message-ID: <alpine.DEB.2.00.0903251846470.5675@gandalf.stny.rr.com>
Date:	Wed, 25 Mar 2009 18:49:33 -0400 (EDT)
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Frederic Weisbecker <fweisbec@...il.com>
cc:	LKML <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH][GIT PULL] tracing: add handler to trace_stat


On Wed, 25 Mar 2009, Frederic Weisbecker wrote:
> >  
> > diff --git a/kernel/trace/trace_stat.h b/kernel/trace/trace_stat.h
> > index 202274c..f3546a2 100644
> > --- a/kernel/trace/trace_stat.h
> > +++ b/kernel/trace/trace_stat.h
> > @@ -12,7 +12,7 @@ struct tracer_stat {
> >  	/* The name of your stat file */
> >  	const char		*name;
> >  	/* Iteration over statistic entries */
> > -	void			*(*stat_start)(void);
> > +	void			*(*stat_start)(struct tracer_stat *trace);
> 
> 
> 
> In that case, shoudn't we pass another thing than the struct tracer_stat?
> Because nothing really private can be stored in it. Moreover, most of the
> time the handler is dedicated to this tracer_stat so it is able to have
> an access to it.
> 
> May be we could add a void *private inside struct trace_stat and then pass
> it to stat_start() ?
> 


Very few tracers need a private field so adding one would be a waste for 
them. I just used the old container_of trick.


struct ftrace_profile_stat {
        atomic_t                        disabled;
        struct hlist_head               *hash;
        struct ftrace_profile_page      *pages;
        struct ftrace_profile_page      *start;
        struct tracer_stat              stat;
};

static void *function_stat_start(struct tracer_stat *trace)
{
        struct ftrace_profile_stat *stat =
                container_of(trace, struct ftrace_profile_stat, stat);

[...]

And there you have it. I have everything I need unique to the tracer and 
no need of a private pointer.

-- Steve

--
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