From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753190AbdK3NVa (ORCPT ); Thu, 30 Nov 2017 08:21:30 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34704 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753018AbdK3NUn (ORCPT ); Thu, 30 Nov 2017 08:20:43 -0500 X-Google-Smtp-Source: AGs4zMaOCk15UPHMuU3a8NZce/CoU5I+CEq0yMdJ3YaNgC+HwgSzZFPzBJj3nHRlSjl/CrPZKdtMEQ== From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-kernel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 07/10] trace-cmd: Mov init_common_record_context in parse_record_options Date: Thu, 30 Nov 2017 15:19:54 +0200 Message-Id: <20171130131957.21617-8-vladislav.valtchev@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171130131957.21617-1-vladislav.valtchev@gmail.com> References: <20171130131957.21617-1-vladislav.valtchev@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This short patch moves init_common_record_context() into parse_record_option() after checking that no trace_* function in trace-record.c really needs to do work after init_common_record_context() but before parse_record_option(). In particular, two statements in trace_profile() have been moved after the call of parse_record_option(), since they did not actually affect it. Signed-off-by: Vladislav Valtchev (VMware) --- trace-record.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/trace-record.c b/trace-record.c index 55e81cf..7688565 100644 --- a/trace-record.c +++ b/trace-record.c @@ -4405,6 +4405,7 @@ static void init_common_record_context(struct common_record_context *ctx, static void parse_record_options(int argc, char **argv, + enum trace_cmd curr_cmd, struct common_record_context *ctx) { const char *plugin = NULL; @@ -4416,6 +4417,8 @@ static void parse_record_options(int argc, char *sav; int neg_event = 0; + init_common_record_context(ctx, curr_cmd); + for (;;) { int option_index = 0; int ret; @@ -4925,8 +4928,7 @@ void trace_start(int argc, char **argv) { struct common_record_context ctx; - init_common_record_context(&ctx, CMD_start); - parse_record_options(argc, argv, &ctx); + parse_record_options(argc, argv, CMD_start, &ctx); record_trace(argc, argv, &ctx); exit(0); } @@ -4935,8 +4937,7 @@ void trace_extract(int argc, char **argv) { struct common_record_context ctx; - init_common_record_context(&ctx, CMD_extract); - parse_record_options(argc, argv, &ctx); + parse_record_options(argc, argv, CMD_extract, &ctx); record_trace(argc, argv, &ctx); exit(0); } @@ -4945,8 +4946,7 @@ void trace_stream(int argc, char **argv) { struct common_record_context ctx; - init_common_record_context(&ctx, CMD_stream); - parse_record_options(argc, argv, &ctx); + parse_record_options(argc, argv, CMD_stream, &ctx); record_trace(argc, argv, &ctx); exit(0); } @@ -4955,13 +4955,11 @@ void trace_profile(int argc, char **argv) { struct common_record_context ctx; - init_common_record_context(&ctx, CMD_profile); + parse_record_options(argc, argv, CMD_profile, &ctx); handle_init = trace_init_profile; ctx.events = 1; - parse_record_options(argc, argv, &ctx); - /* * If no instances were set, then enable profiling on the top instance. */ @@ -4977,8 +4975,7 @@ void trace_record(int argc, char **argv) { struct common_record_context ctx; - init_common_record_context(&ctx, CMD_record); - parse_record_options(argc, argv, &ctx); + parse_record_options(argc, argv, CMD_record, &ctx); record_trace(argc, argv, &ctx); exit(0); } -- 2.14.1