On 25/9/25 12:01, Philippe Mathieu-Daudé wrote:
> On 25/9/25 11:44, Daniel P. Berrangé wrote:
>> The message context can optionally include the guest name if the
>> argument '-msg guest-name=on' is given. The formatting, however,
>> does not look good if the guest name contains whitespace. Change
>> the output to include square brackets to demarcate the name.
>>
>> Before:
>>
>> # qemu-system-x86_64 -object tls-creds-x509,id=t0,dir=fish -d
>> 'trace:qcrypto*' -msg guest-name=on -name "fish food"
>> fish food qemu-system-x86_64: (1146846:main):
>> qcrypto_tls_creds_x509_load TLS creds x509 load creds=0x55657e94e690
>> dir=fish
>> fish food qemu-system-x86_64: (1146846:main):
>> qcrypto_tls_creds_get_path TLS creds path creds=0x55657e94e690
>> filename=ca-cert.pem path=<none>
>> fish food qemu-system-x86_64: (1146846:main): Unable to access
>> credentials fish/ca-cert.pem: No such file or directory
>>
>> After:
>>
>> # qemu-system-x86_64 -object tls-creds-x509,id=t0,dir=fish -d
>> 'trace:qcrypto*' -msg guest-name=on -name "fish food"
>> [fish food] qemu-system-x86_64: (1144713:main):
>> qcrypto_tls_creds_x509_load TLS creds x509 load creds=0x5604ada2c950
>> dir=fish
>> [fish food] qemu-system-x86_64: (1144713:main):
>> qcrypto_tls_creds_get_path TLS creds path creds=0x5604ada2c950
>> filename=ca-cert.pem path=<none>
>> [fish food] qemu-system-x86_64: (1144713:main): Unable to access
>> credentials fish/ca-cert.pem: No such file or directory
>>
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
>> ---
>> util/message.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/util/message.c b/util/message.c
>> index 814ca0316e..7d94b9d970 100644
>> --- a/util/message.c
>> +++ b/util/message.c
>> @@ -28,7 +28,7 @@ void qmessage_context_print(FILE *fp)
>> if ((message_format & QMESSAGE_FORMAT_WORKLOAD_NAME) &&
>> message_workloadname) {
>> - fprintf(fp, "%s ", message_workloadname);
>> + fprintf(fp, "[%s] ", message_workloadname);
No formatting -> fputs?
>
> Squash with patch #20 "util: add support for formatting a workload
> name in messages"? Anyhow,
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>