linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Namhyung Kim <namhyung@kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung.kim@lge.com>,
	LKML <linux-kernel@vger.kernel.org>, Jiri Olsa <jolsa@redhat.com>
Subject: Re: [PATCH 06/17] tools lib traceevent: Add pevent_unregister_event_handler()
Date: Wed, 15 Jan 2014 15:12:14 -0300	[thread overview]
Message-ID: <20140115181214.GA9750@ghostprotocols.net> (raw)
In-Reply-To: <20140115111839.73d85422@gandalf.local.home>

Em Wed, Jan 15, 2014 at 11:18:39AM -0500, Steven Rostedt escreveu:
> On Wed, 15 Jan 2014 10:45:29 +0900
> Namhyung Kim <namhyung@kernel.org> wrote:
>   
> >  	pr_stat("overriding event (%d) %s:%s with new print handler",
> >  		event->id, event->system, event->name);
> > @@ -5637,6 +5649,79 @@ int pevent_register_event_handler(struct pevent *pevent, int id,
> >  	return -1;
> >  }
> >  
> > +static int handle_matches(struct event_handler *handler, int id,
> > +			  const char *sys_name, const char *event_name,
> > +			  pevent_event_handler_func func, void *context)
> > +{
> > +	if (id >= 0 && id != handler->id)
> > +		return 0;
> > +
> > +	if (event_name && (strcmp(event_name, handler->event_name) != 0))
> > +		return 0;
> > +
> > +	if (sys_name && (strcmp(sys_name, handler->sys_name) != 0))
> > +		return 0;
> > +
> > +	if (func != handler->func || context != handler->context)
> > +		return 0;
> > +
> > +	return 1;
> > +}
> > +
> > +/**
> > + * pevent_unregister_event_handler - unregister an existing event handler
> > + * @pevent: the handle to the pevent
> > + * @id: the id of the event to unregister
> > + * @sys_name: the system name the handler belongs to
> > + * @event_name: the name of the event handler
> > + * @func: the function to call to parse the event information
> > + * @context: the data to be passed to @func
> > + *
> > + * This function removes existing event handler (parser).
> > + *
> > + * If @id is >= 0, then it is used to find the event.
> > + * else @sys_name and @event_name are used.
> > + *
> > + * Returns 0 if handler was removed successfully, -1 if event was not found.
> > + */
> > +int pevent_unregister_event_handler(struct pevent *pevent, int id,
> > +				    const char *sys_name, const char *event_name,
> > +				    pevent_event_handler_func func, void *context)
> > +{
> > +	struct event_format *event;
> > +	struct event_handler *handle;
> > +	struct event_handler **next;
> > +
> > +	event = pevent_search_event(pevent, id, sys_name, event_name);
> > +	if (event == NULL)
> > +		goto not_found;
> > +
> > +	if (event->handler == func && event->context == context) {
> > +		pr_stat("overriding event (%d) %s:%s with default print handler",
> 
> Should we use the word "overriding" again? Perhaps saying:
> 
> "removing override print handler (%d) %s:%s. Going back to default handler."
> 
> Or something?

Applied up to the patch just before this one, waiting for a resolution.
 
> -- Steve
> 
> > +			event->id, event->system, event->name);
> > +
> > +		event->handler = NULL;
> > +		event->context = NULL;
> > +		return 0;
> > +	}
> > +
> > +not_found:
> > +	for (next = &pevent->handlers; *next; next = &(*next)->next) {
> > +		handle = *next;
> > +		if (handle_matches(handle, id, sys_name, event_name,
> > +				   func, context))
> > +			break;
> > +	}
> > +
> > +	if (!(*next))
> > +		return -1;
> > +
> > +	*next = handle->next;
> > +	free_handler(handle);
> > +
> > +	return 0;
> > +}
> > +

  reply	other threads:[~2014-01-15 18:12 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-15  1:45 [PATCHSET 00/17] tools lib traceevent: Plugin unload enhancement Namhyung Kim
2014-01-15  1:45 ` [PATCH 01/17] tools lib traceevent: Add state member to struct trace_seq Namhyung Kim
2014-01-15  2:00   ` Steven Rostedt
2014-01-15  2:49     ` Namhyung Kim
2014-01-15  2:56       ` Steven Rostedt
2014-01-15  5:03         ` Namhyung Kim
2014-01-15 14:15           ` Arnaldo Carvalho de Melo
2014-01-15 14:25             ` Steven Rostedt
2014-01-16 13:37           ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-01-15  1:45 ` [PATCH 02/17] tools lib traceevent: Check return value of realloc() Namhyung Kim
2014-01-15  2:03   ` Steven Rostedt
2014-01-16 13:37   ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-01-15  1:45 ` [PATCH 03/17] tools lib traceevent: Get rid of malloc_or_die() in trace_seq_init() Namhyung Kim
2014-01-15  2:05   ` Steven Rostedt
2014-01-16 13:37   ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-01-15  1:45 ` [PATCH 04/17] tools lib traceevent: Get rid of die() finally!! Namhyung Kim
2014-01-16 13:38   ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-01-15  1:45 ` [PATCH 05/17] tools lib traceevent: Make plugin unload function receive pevent Namhyung Kim
2014-01-15  2:24   ` Steven Rostedt
2014-01-16 13:38   ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-01-15  1:45 ` [PATCH 06/17] tools lib traceevent: Add pevent_unregister_event_handler() Namhyung Kim
2014-01-15 16:18   ` Steven Rostedt
2014-01-15 18:12     ` Arnaldo Carvalho de Melo [this message]
2014-01-16  0:00     ` Namhyung Kim
2014-01-16  1:52       ` Steven Rostedt
2014-01-16  1:58         ` Namhyung Kim
2014-01-16  2:05           ` Steven Rostedt
2014-01-15  1:45 ` [PATCH 07/17] tools lib traceevent: Add pevent_unregister_print_function() Namhyung Kim
2014-01-15 16:19   ` Steven Rostedt
2014-01-15  1:45 ` [PATCH 08/17] tools lib traceevent: Unregister handler when function plugin unloaded Namhyung Kim
2014-01-15 16:21   ` Steven Rostedt
2014-01-15  1:45 ` [PATCH 09/17] tools lib traceevent: Unregister handler when hrtimer " Namhyung Kim
2014-01-15 16:21   ` Steven Rostedt
2014-01-15  1:45 ` [PATCH 10/17] tools lib traceevent: Unregister handler when kmem " Namhyung Kim
2014-01-15  1:45 ` [PATCH 11/17] tools lib traceevent: Unregister handler when kvm " Namhyung Kim
2014-01-15  1:45 ` [PATCH 12/17] tools lib traceevent: Unregister handler when sched_switch " Namhyung Kim
2014-01-15  1:45 ` [PATCH 13/17] tools lib traceevent: Unregister handler when mac80211 " Namhyung Kim
2014-01-15 20:32   ` Steven Rostedt
2014-01-15  1:45 ` [PATCH 14/17] tools lib traceevent: Unregister handler when cfg80211 " Namhyung Kim
2014-01-15 20:34   ` Steven Rostedt
2014-01-15  1:45 ` [PATCH 15/17] tools lib traceevent: Unregister handler when jbd2 " Namhyung Kim
2014-01-15 20:35   ` Steven Rostedt
2014-01-15  1:45 ` [PATCH 16/17] tools lib traceevent: Unregister handler when scsi " Namhyung Kim
2014-01-15 20:36   ` Steven Rostedt
2014-01-15  1:45 ` [PATCH 17/17] tools lib traceevent: Unregister handler when xen " Namhyung Kim
2014-01-15 13:39 ` [PATCHSET 00/17] tools lib traceevent: Plugin unload enhancement Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140115181214.GA9750@ghostprotocols.net \
    --to=acme@ghostprotocols.net \
    --cc=a.p.zijlstra@chello.nl \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=namhyung@kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).