Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755950AbcCBRjf (ORCPT ); Wed, 2 Mar 2016 12:39:35 -0500 Received: from smtprelay0218.hostedemail.com ([216.40.44.218]:39076 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751062AbcCBRje (ORCPT ); Wed, 2 Mar 2016 12:39:34 -0500 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::,RULES_HIT:41:334:355:379:541:599:960:966:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:1981:2194:2196:2199:2200:2393:2553:2559:2562:3138:3139:3140:3141:3142:3353:3622:3865:3867:3870:3871:3872:3874:4385:5007:6261:7875:10004:10400:10848:10967:11026:11232:11473:11658:11914:12296:12438:12517:12519:12740:13069:13161:13229:13311:13357:13439:14096:14097:14659:21080:21088:21324:30029:30054:30056:30090:30091,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,LFtime:2,LUA_SUMMARY:none X-HE-Tag: pie72_3627979721a4d X-Filterd-Recvd-Size: 2681 Date: Wed, 2 Mar 2016 12:39:31 -0500 From: Steven Rostedt To: Tom Zanussi Cc: masami.hiramatsu.pt@hitachi.com, namhyung@kernel.org, josh@joshtriplett.org, andi@firstfloor.org, mathieu.desnoyers@efficios.com, peterz@infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v15 10/23] tracing: Add hist trigger 'execname' modifier Message-ID: <20160302123931.37f28d4a@gandalf.local.home> In-Reply-To: <733e60a8acc79f777502cbe6c98d5abd2c33a17e.1456501855.git.tom.zanussi@linux.intel.com> References: <733e60a8acc79f777502cbe6c98d5abd2c33a17e.1456501855.git.tom.zanussi@linux.intel.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; 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: 1534 Lines: 54 On Fri, 26 Feb 2016 10:01:13 -0600 Tom Zanussi wrote: > +static void hist_trigger_elt_copy(struct tracing_map_elt *to, > + struct tracing_map_elt *from) > +{ > + char *comm_from = from->private_data; > + char *comm_to = to->private_data; > + > + if (comm_from) > + memcpy(comm_to, comm_from, TASK_COMM_LEN + 1); > +} > + > +static void hist_trigger_elt_init(struct tracing_map_elt *elt) > +{ > + char *comm = elt->private_data; > + > + if (comm) > + save_comm(comm, current); > +} > + > +static const struct tracing_map_ops hist_trigger_ops = { > + .elt_alloc = hist_trigger_elt_alloc, > + .elt_copy = hist_trigger_elt_copy, > + .elt_free = hist_trigger_elt_free, > + .elt_init = hist_trigger_elt_init, These are only used for saving or displaying comm. Wouldn't adding that in the name be better. Otherwise it looks like they are more generic. I find that dangerous, especially since they just assume that the private_data is a string. What about hist_trigger_elt_comm_* ? -- Steve > +}; > + > static void destroy_hist_field(struct hist_field *hist_field) > { > kfree(hist_field); > @@ -399,6 +467,9 @@ static int create_key_field(struct hist_trigger_data *hist_data, > flags |= HIST_FIELD_FL_SYM; > else if (strcmp(field_str, "sym-offset") == 0) > flags |= HIST_FIELD_FL_SYM_OFFSET; > + else if ((strcmp(field_str, "execname") == 0) && > + (strcmp(field_name, "common_pid") == 0)) > + flags |= HIST_FIELD_FL_EXECNAME; > else { > ret = -EINVAL; > goto out;