Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756199AbbEFC4l (ORCPT ); Tue, 5 May 2015 22:56:41 -0400 Received: from terminus.zytor.com ([198.137.202.10]:35478 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756181AbbEFC4d (ORCPT ); Tue, 5 May 2015 22:56:33 -0400 Date: Tue, 5 May 2015 19:55:54 -0700 From: tip-bot for Jiri Olsa Message-ID: Cc: hekuang@huawei.com, wangnan0@huawei.com, acme@redhat.com, namhyung@kernel.org, fweisbec@gmail.com, paulus@samba.org, tglx@linutronix.de, jgalar@efficios.com, tzanussi@gmail.com, linux-kernel@vger.kernel.org, jolsa@kernel.org, a.p.zijlstra@chello.nl, dsahern@gmail.com, mingo@kernel.org, hpa@zytor.com, rostedt@goodmis.org, bigeasy@linutronix.de Reply-To: tzanussi@gmail.com, a.p.zijlstra@chello.nl, jolsa@kernel.org, linux-kernel@vger.kernel.org, jgalar@efficios.com, rostedt@goodmis.org, bigeasy@linutronix.de, mingo@kernel.org, dsahern@gmail.com, hpa@zytor.com, wangnan0@huawei.com, hekuang@huawei.com, tglx@linutronix.de, namhyung@kernel.org, acme@redhat.com, fweisbec@gmail.com, paulus@samba.org In-Reply-To: <1429372220-6406-6-git-send-email-jolsa@kernel.org> References: <1429372220-6406-6-git-send-email-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] tools lib traceevent: Add alias field to struct format_field Git-Commit-ID: d3542436c9a8d114bf81c0742e67ff8ce8be9324 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3459 Lines: 90 Commit-ID: d3542436c9a8d114bf81c0742e67ff8ce8be9324 Gitweb: http://git.kernel.org/tip/d3542436c9a8d114bf81c0742e67ff8ce8be9324 Author: Jiri Olsa AuthorDate: Sat, 18 Apr 2015 17:50:18 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 29 Apr 2015 10:37:45 -0300 tools lib traceevent: Add alias field to struct format_field Introduce an 'alias' field to 'struct format_field' to be able to use alternative name for the field. It is initialized with same string pointer as 'name' field. The free logic checks the 'alias' pointer being reset by user and frees it. This will be handy when converting data into CTF, where each field within event needs to have a unique name (while this is not required for tracepoint). Converter can easily assign unique name into the format_field struct. Suggested-by: Steven Rostedt Signed-off-by: Jiri Olsa Acked-by: Steven Rostedt Cc: David Ahern Cc: Frederic Weisbecker Cc: He Kuang Cc: Jeremie Galarneau Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Sebastian Andrzej Siewior Cc: Tom Zanussi Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-qwyq8blnfkg6s5vlbrvn1en3@git.kernel.org Link: http://lkml.kernel.org/r/1429372220-6406-6-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/lib/traceevent/event-parse.c | 6 ++++-- tools/lib/traceevent/event-parse.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index 12a7e2a..1ec56b4 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c @@ -1387,7 +1387,7 @@ static int event_read_fields(struct event_format *event, struct format_field **f do_warning_event(event, "%s: no type found", __func__); goto fail; } - field->name = last_token; + field->name = field->alias = last_token; if (test_type(type, EVENT_OP)) goto fail; @@ -1469,7 +1469,7 @@ static int event_read_fields(struct event_format *event, struct format_field **f size_dynamic = type_size(field->name); free_token(field->name); strcat(field->type, brackets); - field->name = token; + field->name = field->alias = token; type = read_token(&token); } else { char *new_type; @@ -6444,6 +6444,8 @@ void pevent_ref(struct pevent *pevent) void pevent_free_format_field(struct format_field *field) { free(field->type); + if (field->alias != field->name) + free(field->alias); free(field->name); free(field); } diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h index 86a5839..063b197 100644 --- a/tools/lib/traceevent/event-parse.h +++ b/tools/lib/traceevent/event-parse.h @@ -191,6 +191,7 @@ struct format_field { struct event_format *event; char *type; char *name; + char *alias; int offset; int size; unsigned int arraylen; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/