lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171130131957.21617-10-vladislav.valtchev@gmail.com>
Date:   Thu, 30 Nov 2017 15:19:56 +0200
From:   "Vladislav Valtchev (VMware)" <vladislav.valtchev@...il.com>
To:     rostedt@...dmis.org
Cc:     linux-kernel@...r.kernel.org, y.karadz@...il.com,
        "Vladislav Valtchev (VMware)" <vladislav.valtchev@...il.com>
Subject: [PATCH v2 09/10] trace-cmd: Extract finalize_record_trace()

This patch splits record_trace() in two parts by moving its finalization part
in a separate function. This will also allow splitting out trace-cmd extract
code from trace-cmd record code, by using a shared function.

Signed-off-by: Vladislav Valtchev (VMware) <vladislav.valtchev@...il.com>
---
 trace-record.c | 48 ++++++++++++++++++++++++++----------------------
 1 file changed, 26 insertions(+), 22 deletions(-)

diff --git a/trace-record.c b/trace-record.c
index ec0eaed..749c205 100644
--- a/trace-record.c
+++ b/trace-record.c
@@ -4767,6 +4767,31 @@ static enum trace_type get_trace_cmd_type(enum trace_cmd cmd)
 	die("Trace type UNKNOWN for the given cmd_fun");
 }
 
+static void finalize_record_trace(struct common_record_context *ctx)
+{
+	if (keep)
+		return;
+
+	update_reset_files();
+	update_reset_triggers();
+	if (clear_function_filters)
+		clear_func_filters();
+
+	set_plugin("nop");
+
+	tracecmd_remove_instances();
+
+	/* If tracing_on was enabled before we started, set it on now */
+	for_all_instances(ctx->instance) {
+		if (ctx->instance->keep)
+			write_tracing_on(ctx->instance,
+					 ctx->instance->tracing_on_init_val);
+	}
+
+	if (host)
+		tracecmd_output_close(network_handle);
+}
+
 /*
  * This function contains common code for the following commands:
  * record, start, extract, stream, profile.
@@ -4910,28 +4935,7 @@ static void record_trace(int argc, char **argv,
 		print_stats();
 
 	destroy_stats();
-
-	if (keep)
-		return;
-
-	update_reset_files();
-	update_reset_triggers();
-	if (clear_function_filters)
-		clear_func_filters();
-
-	set_plugin("nop");
-
-	tracecmd_remove_instances();
-
-	/* If tracing_on was enabled before we started, set it on now */
-	for_all_instances(ctx->instance) {
-		if (ctx->instance->keep)
-			write_tracing_on(ctx->instance,
-					 ctx->instance->tracing_on_init_val);
-	}
-
-	if (host)
-		tracecmd_output_close(network_handle);
+	finalize_record_trace(ctx);
 }
 
 void trace_start(int argc, char **argv)
-- 
2.14.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ