Pull request

-----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAl7zKhcACgkQnKSrs4Gr
 c8gZ4wf/R/1y4DIa5er8qkMp8Sm4cFN262EzpE0xln88+JDP4LJfrWVlrPTL4uxx
 MTWwvwtQQScxglwnnvf3ZGJoRQg96QhT6l4gt20vZ0YCzJBvJf4f0/hg8Fs4n2Pm
 Rs90Jegh6aRkfX/6XmmbLTH0mEoTuaKNssrVACd+MgnKhuGj/j4Blt5xDw0aqp7I
 EVJHCpgUQ1Te0BMEKyimp5Vu9v+5lrx5jni/VW2WDzaLPiUyzZsmAwpPmw8UinWi
 AeezGh6pCXXj4fSZKBpAstV4btAelyqGM3e182F5O0LE1QZKk3xcOoLHi/IyknAQ
 32VTw3l3o6K3JXoS35EB5cRd1PCsVA==
 =ViJc
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging

Pull request

# gpg: Signature made Wed 24 Jun 2020 11:25:27 BST
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/tracing-pull-request:
  trace/simple: Fix unauthorized enable
  scripts/tracetool: Update maintainer email address

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-06-25 14:31:35 +01:00
commit beafab86a3
20 changed files with 33 additions and 25 deletions

View File

@ -10,7 +10,7 @@ __copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version" __license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi" __maintainer__ = "Stefan Hajnoczi"
__email__ = "stefanha@linux.vnet.ibm.com" __email__ = "stefanha@redhat.com"
import sys import sys

View File

@ -9,7 +9,7 @@ __copyright__ = "Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version" __license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi" __maintainer__ = "Stefan Hajnoczi"
__email__ = "stefanha@linux.vnet.ibm.com" __email__ = "stefanha@redhat.com"
import re import re

View File

@ -50,7 +50,7 @@ __copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version" __license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi" __maintainer__ = "Stefan Hajnoczi"
__email__ = "stefanha@linux.vnet.ibm.com" __email__ = "stefanha@redhat.com"
import os import os

View File

@ -9,7 +9,7 @@ __copyright__ = "Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version" __license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi" __maintainer__ = "Stefan Hajnoczi"
__email__ = "stefanha@linux.vnet.ibm.com" __email__ = "stefanha@redhat.com"
from tracetool import out from tracetool import out

View File

@ -9,7 +9,7 @@ __copyright__ = "Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version" __license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi" __maintainer__ = "Stefan Hajnoczi"
__email__ = "stefanha@linux.vnet.ibm.com" __email__ = "stefanha@redhat.com"
from tracetool import out from tracetool import out

View File

@ -9,7 +9,7 @@ __copyright__ = "Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version" __license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi" __maintainer__ = "Stefan Hajnoczi"
__email__ = "stefanha@linux.vnet.ibm.com" __email__ = "stefanha@redhat.com"
from tracetool import out from tracetool import out

View File

@ -9,7 +9,7 @@ __copyright__ = "Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version" __license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi" __maintainer__ = "Stefan Hajnoczi"
__email__ = "stefanha@linux.vnet.ibm.com" __email__ = "stefanha@redhat.com"
from tracetool import out from tracetool import out

View File

@ -32,7 +32,7 @@ __copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version" __license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi" __maintainer__ = "Stefan Hajnoczi"
__email__ = "stefanha@linux.vnet.ibm.com" __email__ = "stefanha@redhat.com"
import os import os

View File

@ -9,7 +9,7 @@ __copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version" __license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi" __maintainer__ = "Stefan Hajnoczi"
__email__ = "stefanha@linux.vnet.ibm.com" __email__ = "stefanha@redhat.com"
from tracetool import out from tracetool import out

View File

@ -9,7 +9,7 @@ __copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version" __license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi" __maintainer__ = "Stefan Hajnoczi"
__email__ = "stefanha@linux.vnet.ibm.com" __email__ = "stefanha@redhat.com"
from tracetool import out from tracetool import out

View File

@ -9,7 +9,7 @@ __copyright__ = "Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version" __license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi" __maintainer__ = "Stefan Hajnoczi"
__email__ = "stefanha@linux.vnet.ibm.com" __email__ = "stefanha@redhat.com"
from tracetool import out from tracetool import out

View File

@ -9,7 +9,7 @@ __copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version" __license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi" __maintainer__ = "Stefan Hajnoczi"
__email__ = "stefanha@linux.vnet.ibm.com" __email__ = "stefanha@redhat.com"
from tracetool import out from tracetool import out

View File

@ -9,7 +9,7 @@ __copyright__ = "Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version" __license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi" __maintainer__ = "Stefan Hajnoczi"
__email__ = "stefanha@linux.vnet.ibm.com" __email__ = "stefanha@redhat.com"
from tracetool import out, Arguments from tracetool import out, Arguments

View File

@ -9,7 +9,7 @@ __copyright__ = "Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version" __license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi" __maintainer__ = "Stefan Hajnoczi"
__email__ = "stefanha@linux.vnet.ibm.com" __email__ = "stefanha@redhat.com"
from tracetool import Arguments, out from tracetool import Arguments, out

View File

@ -9,7 +9,7 @@ __copyright__ = "Copyright 2012-2016, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version" __license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi" __maintainer__ = "Stefan Hajnoczi"
__email__ = "stefanha@linux.vnet.ibm.com" __email__ = "stefanha@redhat.com"
from tracetool import out from tracetool import out

View File

@ -9,7 +9,7 @@ __copyright__ = "Copyright 2012-2016, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version" __license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi" __maintainer__ = "Stefan Hajnoczi"
__email__ = "stefanha@linux.vnet.ibm.com" __email__ = "stefanha@redhat.com"
from tracetool import out from tracetool import out

View File

@ -9,7 +9,7 @@ __copyright__ = "Copyright 2012-2016, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version" __license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi" __maintainer__ = "Stefan Hajnoczi"
__email__ = "stefanha@linux.vnet.ibm.com" __email__ = "stefanha@redhat.com"
def _transform_type(type_, trans): def _transform_type(type_, trans):

View File

@ -10,7 +10,7 @@ __copyright__ = "Copyright 2016, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version" __license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi" __maintainer__ = "Stefan Hajnoczi"
__email__ = "stefanha@linux.vnet.ibm.com" __email__ = "stefanha@redhat.com"
from tracetool import Arguments, try_import from tracetool import Arguments, try_import

View File

@ -302,10 +302,17 @@ static int st_write_event_mapping(void)
return 0; return 0;
} }
void st_set_trace_file_enabled(bool enable) /**
* Enable / disable tracing, return whether it was enabled.
*
* @enable: enable if %true, else disable.
*/
bool st_set_trace_file_enabled(bool enable)
{ {
bool was_enabled = trace_fp;
if (enable == !!trace_fp) { if (enable == !!trace_fp) {
return; /* no change */ return was_enabled; /* no change */
} }
/* Halt trace writeout */ /* Halt trace writeout */
@ -323,14 +330,14 @@ void st_set_trace_file_enabled(bool enable)
trace_fp = fopen(trace_file_name, "wb"); trace_fp = fopen(trace_file_name, "wb");
if (!trace_fp) { if (!trace_fp) {
return; return was_enabled;
} }
if (fwrite(&header, sizeof header, 1, trace_fp) != 1 || if (fwrite(&header, sizeof header, 1, trace_fp) != 1 ||
st_write_event_mapping() < 0) { st_write_event_mapping() < 0) {
fclose(trace_fp); fclose(trace_fp);
trace_fp = NULL; trace_fp = NULL;
return; return was_enabled;
} }
/* Resume trace writeout */ /* Resume trace writeout */
@ -340,6 +347,7 @@ void st_set_trace_file_enabled(bool enable)
fclose(trace_fp); fclose(trace_fp);
trace_fp = NULL; trace_fp = NULL;
} }
return was_enabled;
} }
/** /**
@ -350,7 +358,7 @@ void st_set_trace_file_enabled(bool enable)
*/ */
void st_set_trace_file(const char *file) void st_set_trace_file(const char *file)
{ {
st_set_trace_file_enabled(false); bool saved_enable = st_set_trace_file_enabled(false);
g_free(trace_file_name); g_free(trace_file_name);
@ -361,7 +369,7 @@ void st_set_trace_file(const char *file)
trace_file_name = g_strdup_printf("%s", file); trace_file_name = g_strdup_printf("%s", file);
} }
st_set_trace_file_enabled(true); st_set_trace_file_enabled(saved_enable);
} }
void st_print_trace_file_status(void) void st_print_trace_file_status(void)

View File

@ -12,7 +12,7 @@
#define TRACE_SIMPLE_H #define TRACE_SIMPLE_H
void st_print_trace_file_status(void); void st_print_trace_file_status(void);
void st_set_trace_file_enabled(bool enable); bool st_set_trace_file_enabled(bool enable);
void st_set_trace_file(const char *file); void st_set_trace_file(const char *file);
bool st_init(void); bool st_init(void);
void st_flush_trace_buffer(void); void st_flush_trace_buffer(void);