qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [Qemu-devel] [PATCH v2 1/4] block/ssh: Convert from D


From: Laurent Vivier
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH v2 1/4] block/ssh: Convert from DPRINTF() macro to trace events
Date: Thu, 13 Dec 2018 17:49:35 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 13/12/2018 17:34, Eric Blake wrote:
> On 12/13/18 10:27 AM, Laurent Vivier wrote:
>> Signed-off-by: Laurent Vivier <address@hidden>
>> Reviewed-by: Richard W.M. Jones <address@hidden>
>> Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
>> ---
>>
>> Notes:
>>      v2: use %zu with size_t
>>          change an uint64_t to int64_t to match % PRIi64
> 
> Why PRIi64?  It's identical to PRId64, but the sources show a strong
> preference for %d over %i:
> 
> $ git grep PRIi[0-9] | wc
>      25     172    1885
> $ git grep PRId[0-9] | wc
>     415    3991   40345
> 
> $ git grep '%i' | wc
>     231    1664   18269
> $ git grep '%d' | wc
>    5492   46211  498225
> 

Yes, you're right but I have only moved the existing format string[1] to
trace-event:

diff --git a/block/ssh.c b/block/ssh.c
--- a/block/ssh.c
+++ b/block/ssh.c
@@ -1003,7 +991,7 @@ static void ssh_seek(BDRVSSHState *s, int64_t
offset, int flags)
     bool force = (flags & SSH_SEEK_FORCE) != 0;

     if (force || op_read != s->offset_op_read || offset != s->offset) {
-        DPRINTF("seeking to offset=%" PRIi64, offset);
+        trace_ssh_seek(offset);

diff --git a/block/trace-events b/block/trace-events
--- a/block/trace-events
+++ b/block/trace-events
...
+ssh_seek(int64_t offset) "seeking to offset=%" PRIi64

Thanks,
Laurent
[1] in fact, I have a coccinelle script to do that automatically.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]