qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Alex Williamson" <alex.williamson@redhat.com>,
	"Cédric Le Goater" <clg@redhat.com>,
	"Mads Ynddal" <mads@ynddal.dk>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Yoshinori Sato" <ysato@users.sourceforge.jp>,
	"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH 1/5] backends/tpm: Remove newline character in trace event
Date: Thu,  6 Jun 2024 12:39:39 +0200	[thread overview]
Message-ID: <20240606103943.79116-2-philmd@linaro.org> (raw)
In-Reply-To: <20240606103943.79116-1-philmd@linaro.org>

Split the 'tpm_util_show_buffer' event in two to avoid
using a newline character.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 backends/tpm/tpm_util.c   | 5 +++--
 backends/tpm/trace-events | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/backends/tpm/tpm_util.c b/backends/tpm/tpm_util.c
index 1856589c3b..cf138551df 100644
--- a/backends/tpm/tpm_util.c
+++ b/backends/tpm/tpm_util.c
@@ -339,10 +339,11 @@ void tpm_util_show_buffer(const unsigned char *buffer,
     size_t len, i;
     char *line_buffer, *p;
 
-    if (!trace_event_get_state_backends(TRACE_TPM_UTIL_SHOW_BUFFER)) {
+    if (!trace_event_get_state_backends(TRACE_TPM_UTIL_SHOW_BUFFER_CONTENT)) {
         return;
     }
     len = MIN(tpm_cmd_get_size(buffer), buffer_size);
+    trace_tpm_util_show_buffer_header(string, len);
 
     /*
      * allocate enough room for 3 chars per buffer entry plus a
@@ -356,7 +357,7 @@ void tpm_util_show_buffer(const unsigned char *buffer,
         }
         p += sprintf(p, "%.2X ", buffer[i]);
     }
-    trace_tpm_util_show_buffer(string, len, line_buffer);
+    trace_tpm_util_show_buffer_content(line_buffer);
 
     g_free(line_buffer);
 }
diff --git a/backends/tpm/trace-events b/backends/tpm/trace-events
index 1ecef42a07..cb5cfa6510 100644
--- a/backends/tpm/trace-events
+++ b/backends/tpm/trace-events
@@ -10,7 +10,8 @@ tpm_util_get_buffer_size_len(uint32_t len, size_t expected) "tpm_resp->len = %u,
 tpm_util_get_buffer_size_hdr_len2(uint32_t len, size_t expected) "tpm2_resp->hdr.len = %u, expected = %zu"
 tpm_util_get_buffer_size_len2(uint32_t len, size_t expected) "tpm2_resp->len = %u, expected = %zu"
 tpm_util_get_buffer_size(size_t len) "buffersize of device: %zu"
-tpm_util_show_buffer(const char *direction, size_t len, const char *buf) "direction: %s len: %zu\n%s"
+tpm_util_show_buffer_header(const char *direction, size_t len) "direction: %s len: %zu"
+tpm_util_show_buffer_content(const char *buf) "%s"
 
 # tpm_emulator.c
 tpm_emulator_set_locality(uint8_t locty) "setting locality to %d"
-- 
2.41.0



  reply	other threads:[~2024-06-06 10:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-06 10:39 [PATCH 0/5] trace: Remove and forbid newline characters in event format Philippe Mathieu-Daudé
2024-06-06 10:39 ` Philippe Mathieu-Daudé [this message]
2024-06-06 11:20   ` [PATCH 1/5] backends/tpm: Remove newline character in trace event Daniel P. Berrangé
2024-06-07 15:15   ` Stefan Berger
2024-06-06 10:39 ` [PATCH 2/5] hw/sh4: Remove newline character in trace events Philippe Mathieu-Daudé
2024-06-06 11:21   ` Daniel P. Berrangé
2024-06-06 10:39 ` [PATCH 3/5] hw/usb: " Philippe Mathieu-Daudé
2024-06-06 11:21   ` Daniel P. Berrangé
2024-06-06 10:39 ` [PATCH 4/5] hw/vfio: " Philippe Mathieu-Daudé
2024-06-06 11:22   ` Daniel P. Berrangé
2024-06-06 10:39 ` [PATCH 5/5] tracetool: Forbid newline character in event format Philippe Mathieu-Daudé
2024-06-06 11:22   ` Daniel P. Berrangé
2024-06-07 10:46 ` [PATCH 0/5] trace: Remove and forbid newline characters " Mads Ynddal
2024-06-10 17:05 ` Stefan Hajnoczi
2024-06-10 17:59   ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240606103943.79116-2-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=alex.williamson@redhat.com \
    --cc=clg@redhat.com \
    --cc=mads@ynddal.dk \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=stefanha@redhat.com \
    --cc=ysato@users.sourceforge.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).