Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932417AbbDHOnO (ORCPT ); Wed, 8 Apr 2015 10:43:14 -0400 Received: from lists.s-osg.org ([54.187.51.154]:52159 "EHLO lists.s-osg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754158AbbDHOnJ (ORCPT ); Wed, 8 Apr 2015 10:43:09 -0400 Date: Wed, 8 Apr 2015 11:43:02 -0300 From: Mauro Carvalho Chehab To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Andrew Morton , Arnaldo Carvalho de Melo , Masami Hiramatsu Subject: Re: [for-next][PATCH 19/21] v4l: Export enums used by tracepoints to user space Message-ID: <20150408114302.1cb02a24@recife.lan> In-Reply-To: <20150408134927.583123685@goodmis.org> References: <20150408134804.225653449@goodmis.org> <20150408134927.583123685@goodmis.org> Organization: Samsung X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.27; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4966 Lines: 120 Em Wed, 08 Apr 2015 09:48:23 -0400 Steven Rostedt escreveu: > From: "Steven Rostedt (Red Hat)" > > Enums used by tracepoints for __print_symbolic() are shown in the > tracepoint format files with just their names and not their values. > This makes it difficult for user space tools to know how to convert the > binary data into their string representations. > > By adding the use of TRACE_DEFINE_ENUM(), the enum names will be mapped > to their values and shown in the tracing file system to let tools > convert the data as necessary. > > Link: http://lkml.kernel.org/r/20150403013802.220157513@goodmis.org > > Cc: Mauro Carvalho Chehab Acked-by: Mauro Carvalho Chehab > Reviewed-by: Masami Hiramatsu > Tested-by: Masami Hiramatsu > Signed-off-by: Steven Rostedt > --- > include/trace/events/v4l2.h | 75 ++++++++++++++++++++++++++++++--------------- > 1 file changed, 50 insertions(+), 25 deletions(-) > > diff --git a/include/trace/events/v4l2.h b/include/trace/events/v4l2.h > index b9bb1f204693..20112170ff11 100644 > --- a/include/trace/events/v4l2.h > +++ b/include/trace/events/v4l2.h > @@ -6,33 +6,58 @@ > > #include > > -#define show_type(type) \ > - __print_symbolic(type, \ > - { V4L2_BUF_TYPE_VIDEO_CAPTURE, "VIDEO_CAPTURE" }, \ > - { V4L2_BUF_TYPE_VIDEO_OUTPUT, "VIDEO_OUTPUT" }, \ > - { V4L2_BUF_TYPE_VIDEO_OVERLAY, "VIDEO_OVERLAY" }, \ > - { V4L2_BUF_TYPE_VBI_CAPTURE, "VBI_CAPTURE" }, \ > - { V4L2_BUF_TYPE_VBI_OUTPUT, "VBI_OUTPUT" }, \ > - { V4L2_BUF_TYPE_SLICED_VBI_CAPTURE, "SLICED_VBI_CAPTURE" }, \ > - { V4L2_BUF_TYPE_SLICED_VBI_OUTPUT, "SLICED_VBI_OUTPUT" }, \ > - { V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, "VIDEO_OUTPUT_OVERLAY" },\ > - { V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, "VIDEO_CAPTURE_MPLANE" },\ > - { V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, "VIDEO_OUTPUT_MPLANE" }, \ > - { V4L2_BUF_TYPE_SDR_CAPTURE, "SDR_CAPTURE" }, \ > - { V4L2_BUF_TYPE_PRIVATE, "PRIVATE" }) > +/* Enums require being exported to userspace, for user tool parsing */ > +#undef EM > +#undef EMe > +#define EM(a, b) TRACE_DEFINE_ENUM(a); > +#define EMe(a, b) TRACE_DEFINE_ENUM(a); > + > +#define show_type(type) \ > + __print_symbolic(type, SHOW_TYPE) > + > +#define SHOW_TYPE \ > + EM( V4L2_BUF_TYPE_VIDEO_CAPTURE, "VIDEO_CAPTURE" ) \ > + EM( V4L2_BUF_TYPE_VIDEO_OUTPUT, "VIDEO_OUTPUT" ) \ > + EM( V4L2_BUF_TYPE_VIDEO_OVERLAY, "VIDEO_OVERLAY" ) \ > + EM( V4L2_BUF_TYPE_VBI_CAPTURE, "VBI_CAPTURE" ) \ > + EM( V4L2_BUF_TYPE_VBI_OUTPUT, "VBI_OUTPUT" ) \ > + EM( V4L2_BUF_TYPE_SLICED_VBI_CAPTURE, "SLICED_VBI_CAPTURE" ) \ > + EM( V4L2_BUF_TYPE_SLICED_VBI_OUTPUT, "SLICED_VBI_OUTPUT" ) \ > + EM( V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, "VIDEO_OUTPUT_OVERLAY" ) \ > + EM( V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, "VIDEO_CAPTURE_MPLANE" ) \ > + EM( V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, "VIDEO_OUTPUT_MPLANE" ) \ > + EM( V4L2_BUF_TYPE_SDR_CAPTURE, "SDR_CAPTURE" ) \ > + EMe(V4L2_BUF_TYPE_PRIVATE, "PRIVATE" ) > + > +SHOW_TYPE > > #define show_field(field) \ > - __print_symbolic(field, \ > - { V4L2_FIELD_ANY, "ANY" }, \ > - { V4L2_FIELD_NONE, "NONE" }, \ > - { V4L2_FIELD_TOP, "TOP" }, \ > - { V4L2_FIELD_BOTTOM, "BOTTOM" }, \ > - { V4L2_FIELD_INTERLACED, "INTERLACED" }, \ > - { V4L2_FIELD_SEQ_TB, "SEQ_TB" }, \ > - { V4L2_FIELD_SEQ_BT, "SEQ_BT" }, \ > - { V4L2_FIELD_ALTERNATE, "ALTERNATE" }, \ > - { V4L2_FIELD_INTERLACED_TB, "INTERLACED_TB" }, \ > - { V4L2_FIELD_INTERLACED_BT, "INTERLACED_BT" }) > + __print_symbolic(field, SHOW_FIELD) > + > +#define SHOW_FIELD \ > + EM( V4L2_FIELD_ANY, "ANY" ) \ > + EM( V4L2_FIELD_NONE, "NONE" ) \ > + EM( V4L2_FIELD_TOP, "TOP" ) \ > + EM( V4L2_FIELD_BOTTOM, "BOTTOM" ) \ > + EM( V4L2_FIELD_INTERLACED, "INTERLACED" ) \ > + EM( V4L2_FIELD_SEQ_TB, "SEQ_TB" ) \ > + EM( V4L2_FIELD_SEQ_BT, "SEQ_BT" ) \ > + EM( V4L2_FIELD_ALTERNATE, "ALTERNATE" ) \ > + EM( V4L2_FIELD_INTERLACED_TB, "INTERLACED_TB" ) \ > + EMe( V4L2_FIELD_INTERLACED_BT, "INTERLACED_BT" ) > + > +SHOW_FIELD > + > +/* > + * Now redefine the EM() and EMe() macros to map the enums to the strings > + * that will be printed in the output. > + */ > +#undef EM > +#undef EMe > +#define EM(a, b) {a, b}, > +#define EMe(a, b) {a, b} > + > +/* V4L2_TC_TYPE_* are macros, not defines, they do not need processing */ > > #define show_timecode_type(type) \ > __print_symbolic(type, \ -- 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/