From 41fc57e44ed64cd4ab5393d83624afd897dabd4f Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 7 Jan 2016 16:55:24 +0300 Subject: trace: split trace_init_file out of trace_init_backends This is cleaner, and improves error reporting with -daemonize. Signed-off-by: Paolo Bonzini Signed-off-by: Denis V. Lunev Acked-by: Christian Borntraeger Message-id: 1452174932-28657-4-git-send-email-den@openvz.org Signed-off-by: Stefan Hajnoczi --- trace/control.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'trace/control.c') diff --git a/trace/control.c b/trace/control.c index 931d64c0c8..f5a497a391 100644 --- a/trace/control.c +++ b/trace/control.c @@ -145,17 +145,24 @@ void trace_init_events(const char *fname) loc_pop(&loc); } -bool trace_init_backends(const char *file) +void trace_init_file(const char *file) { #ifdef CONFIG_TRACE_SIMPLE - if (!st_init(file)) { - fprintf(stderr, "failed to initialize simple tracing backend.\n"); - return false; - } + st_set_trace_file(file); #else if (file) { fprintf(stderr, "error: -trace file=...: " "option not supported by the selected tracing backends\n"); + exit(1); + } +#endif +} + +bool trace_init_backends(void) +{ +#ifdef CONFIG_TRACE_SIMPLE + if (!st_init()) { + fprintf(stderr, "failed to initialize simple tracing backend.\n"); return false; } #endif -- cgit 1.4.1