Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754202AbbDGQkm (ORCPT ); Tue, 7 Apr 2015 12:40:42 -0400 Received: from smtprelay0253.hostedemail.com ([216.40.44.253]:36409 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752542AbbDGQkk (ORCPT ); Tue, 7 Apr 2015 12:40:40 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::,RULES_HIT:41:69:355:379:541:599:800:960:966:973:988:989:1260:1277:1311:1313:1314:1345:1359:1434:1437:1515:1516:1518:1534:1543:1593:1594:1605:1711:1730:1747:1777:1792:2196:2198:2199:2200:2393:2553:2559:2562:2693:2895:3138:3139:3140:3141:3142:3865:3867:3868:3870:3871:3874:4321:4385:4552:5007:6261:7576:7875:10004:10400:10848:10967:11026:11232:11473:11658:11914:12043:12291:12295:12438:12517:12519:12555:12683:12740:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: time70_7a01db8524e35 X-Filterd-Recvd-Size: 4458 Date: Tue, 7 Apr 2015 12:40:37 -0400 From: Steven Rostedt To: Trond Myklebust Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Andrew Morton , Arnaldo Carvalho de Melo , Namhyung Kim , Masami Hiramatsu , Mathieu Desnoyers Subject: Re: [PATCH 15/18 v3] SUNRPC: Export enums in tracepoints to user space Message-ID: <20150407124037.03675a2d@gandalf.local.home> In-Reply-To: <20150403014125.374549383@goodmis.org> References: <20150403013802.220157513@goodmis.org> <20150403014125.374549383@goodmis.org> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-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: 3487 Lines: 110 Trond, I had your old email that I Cc'd this patch to. I updated this in my git repo for your current email (if this is your current email). -- Steve On Thu, 02 Apr 2015 21:38:17 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Red Hat)" > > The enums used in the tracepoints for __print_symbolic() have their > names shown in the tracepoint format files. User space tools do not know > how to convert those names into their values to be able to convert the > binary data. > > Use TRACE_DEFINE_ENUM() to export the enum names to their values for > userspace to do the parsing correctly. > > Cc: Trond Myklebust > Signed-off-by: Steven Rostedt > --- > include/trace/events/sunrpc.h | 62 ++++++++++++++++++++++++++++++------------- > 1 file changed, 44 insertions(+), 18 deletions(-) > > diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h > index b9c1dc6c825a..fd1a02cb3c82 100644 > --- a/include/trace/events/sunrpc.h > +++ b/include/trace/events/sunrpc.h > @@ -179,27 +179,53 @@ DEFINE_EVENT(rpc_task_queued, rpc_task_wakeup, > > ); > > +/* > + * First define the enums in the below macros to be exported to userspace > + * via TRACE_DEFINE_ENUM(). > + */ > +#undef EM > +#undef EMe > +#define EM(a, b) TRACE_DEFINE_ENUM(a); > +#define EMe(a, b) TRACE_DEFINE_ENUM(a); > + > +#define RPC_SHOW_SOCKET \ > + EM( SS_FREE, "FREE" ) \ > + EM( SS_UNCONNECTED, "UNCONNECTED" ) \ > + EM( SS_CONNECTING, "CONNECTING," ) \ > + EM( SS_CONNECTED, "CONNECTED," ) \ > + EMe(SS_DISCONNECTING, "DISCONNECTING" ) > + > #define rpc_show_socket_state(state) \ > - __print_symbolic(state, \ > - { SS_FREE, "FREE" }, \ > - { SS_UNCONNECTED, "UNCONNECTED" }, \ > - { SS_CONNECTING, "CONNECTING," }, \ > - { SS_CONNECTED, "CONNECTED," }, \ > - { SS_DISCONNECTING, "DISCONNECTING" }) > + __print_symbolic(state, RPC_SHOW_SOCKET) > + > +RPC_SHOW_SOCKET > + > +#define RPC_SHOW_SOCK \ > + EM( TCP_ESTABLISHED, "ESTABLISHED" ) \ > + EM( TCP_SYN_SENT, "SYN_SENT" ) \ > + EM( TCP_SYN_RECV, "SYN_RECV" ) \ > + EM( TCP_FIN_WAIT1, "FIN_WAIT1" ) \ > + EM( TCP_FIN_WAIT2, "FIN_WAIT2" ) \ > + EM( TCP_TIME_WAIT, "TIME_WAIT" ) \ > + EM( TCP_CLOSE, "CLOSE" ) \ > + EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" ) \ > + EM( TCP_LAST_ACK, "LAST_ACK" ) \ > + EM( TCP_LISTEN, "LISTEN" ) \ > + EMe( TCP_CLOSING, "CLOSING" ) > > #define rpc_show_sock_state(state) \ > - __print_symbolic(state, \ > - { TCP_ESTABLISHED, "ESTABLISHED" }, \ > - { TCP_SYN_SENT, "SYN_SENT" }, \ > - { TCP_SYN_RECV, "SYN_RECV" }, \ > - { TCP_FIN_WAIT1, "FIN_WAIT1" }, \ > - { TCP_FIN_WAIT2, "FIN_WAIT2" }, \ > - { TCP_TIME_WAIT, "TIME_WAIT" }, \ > - { TCP_CLOSE, "CLOSE" }, \ > - { TCP_CLOSE_WAIT, "CLOSE_WAIT" }, \ > - { TCP_LAST_ACK, "LAST_ACK" }, \ > - { TCP_LISTEN, "LISTEN" }, \ > - { TCP_CLOSING, "CLOSING" }) > + __print_symbolic(state, RPC_SHOW_SOCK) > + > +RPC_SHOW_SOCK > + > +/* > + * 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} > > DECLARE_EVENT_CLASS(xs_socket_event, > -- 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/