qemu-block
[Top][All Lists]
Advanced

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

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


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/4] block/ssh: Convert from DPRINTF() macro to trace events
Date: Mon, 14 Jan 2019 12:23:31 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1

On 1/14/19 12:15 PM, Max Reitz wrote:
> On 13.12.18 17:27, 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
>>
>>  block/ssh.c        | 46 +++++++++++++++++-----------------------------
>>  block/trace-events | 17 +++++++++++++++++
>>  2 files changed, 34 insertions(+), 29 deletions(-)
>>
>> diff --git a/block/ssh.c b/block/ssh.c
>> index 7fbc27abdf..bbc513e095 100644
>> --- a/block/ssh.c
>> +++ b/block/ssh.c
> 
> [...]
> 
>> @@ -1038,9 +1026,9 @@ static coroutine_fn int ssh_read(BDRVSSHState *s, 
>> BlockDriverState *bs,
>>       */
>>      for (got = 0; got < size; ) {
>>      again:
>> -        DPRINTF("sftp_read buf=%p size=%zu", buf, end_of_vec - buf);
>> +        trace_ssh_read_buf(buf, end_of_vec - buf);
>>          r = libssh2_sftp_read(s->sftp_handle, buf, end_of_vec - buf);
>> -        DPRINTF("sftp_read returned %zd", r);
>> +        trace_ssh_read_return(r);
> 
> (Here...
> 
>>  
>>          if (r == LIBSSH2_ERROR_EAGAIN || r == LIBSSH2_ERROR_TIMEOUT) {
>>              co_yield(s, bs);
> 
> [...]
> 
>> @@ -1108,9 +1096,9 @@ static int ssh_write(BDRVSSHState *s, BlockDriverState 
>> *bs,
>>  
>>      for (written = 0; written < size; ) {
>>      again:
>> -        DPRINTF("sftp_write buf=%p size=%zu", buf, end_of_vec - buf);
>> +        trace_ssh_write_buf(buf, end_of_vec - buf);
>>          r = libssh2_sftp_write(s->sftp_handle, buf, end_of_vec - buf);
>> -        DPRINTF("sftp_write returned %zd", r);
>> +        trace_ssh_write_return(r);
> 
> ...and here r is of type ssize_t)
> 
>>  
>>          if (r == LIBSSH2_ERROR_EAGAIN || r == LIBSSH2_ERROR_TIMEOUT) {
>>              co_yield(s, bs);
> 
> [...]
> 
>> diff --git a/block/trace-events b/block/trace-events
>> index 3e8c47bb24..e1dfd9713a 100644
>> --- a/block/trace-events
>> +++ b/block/trace-events
>> @@ -156,3 +156,20 @@ nvme_cmd_map_qiov_iov(void *s, int i, void *page, int 
>> pages) "s %p iov[%d] %p pa
>>  
>>  # block/iscsi.c
>>  iscsi_xcopy(void *src_lun, uint64_t src_off, void *dst_lun, uint64_t 
>> dst_off, uint64_t bytes, int ret) "src_lun %p offset %"PRIu64" dst_lun %p 
>> offset %"PRIu64" bytes %"PRIu64" ret %d"
>> +
>> +# block/ssh.c
>> +ssh_restart_coroutine(void *co) "co=%p"
>> +ssh_flush(void) "fsync"
>> +ssh_check_host_key_knownhosts(const char *key) "host key OK: %s"
>> +ssh_connect_to_ssh(char *path, int flags, int mode) "opening file %s 
>> flags=0x%x creat_mode=0%o"
>> +ssh_co_yield(int sock, void *rd_handler, void *wr_handler) "s->sock=%d 
>> rd_handler=%p wr_handler=%p"
>> +ssh_co_yield_back(int sock) "s->sock=%d - back"
>> +ssh_getlength(int64_t length) "length=%" PRIi64
>> +ssh_co_create_opts(uint64_t size) "total_size=%" PRIu64
>> +ssh_read(int64_t offset, size_t size) "offset=%" PRIi64 " size=%zu"
>> +ssh_read_buf(void *buf, size_t size) "sftp_read buf=%p size=%zu"
>> +ssh_read_return(size_t ret) "sftp_read returned %zu"
> 
> Shouldn't this be ssize_t and %zi/%zd?

Oops good catch.

The codebase uses %zd:

$ git grep '%zi'|wc -l
0
$ git grep '%zd'|wc -l
90

Can you directly fix this when applying?

Thanks,

Phil.

> 
>> +ssh_write(int64_t offset, size_t size) "offset=%" PRIi64 " size=%zu"
>> +ssh_write_buf(void *buf, size_t size) "sftp_write buf=%p size=%zu"
>> +ssh_write_return(size_t ret) "sftp_write returned %zu"
> 
> Same here.
> 
> Max
> 
>> +ssh_seek(int64_t offset) "seeking to offset=%" PRIi6
> 



reply via email to

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