qemu-block
[Top][All Lists]
Advanced

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

Re: [PATCH v2 02/17] block: use int64_t as bytes type in tracked request


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [PATCH v2 02/17] block: use int64_t as bytes type in tracked requests
Date: Mon, 27 Apr 2020 14:26:14 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

27.04.2020 13:11, Philippe Mathieu-Daudé wrote:
On 4/27/20 10:23 AM, Vladimir Sementsov-Ogievskiy wrote:
We are generally moving to int64_t for both offset and bytes parameters
on all io paths. Convert tracked requests now.

This doesn't seem a strong justification... If I understand correctly this 
patch, it is safer to use positive signed type rather than unsigned type. OK it 
might make sense to better catch overflow, but it should be explained in the 
function prototypes, else commit message, else the series cover IMHO.

First time I decided to follow the tendency not to copy the whole cover-letter 
from previous series, but just give a link to it :) It's chosen not for safety..

My reason is the fact that some functions may return int64_t offset/bytes, and 
negative values are used to indicate an error. It seems good to use same type 
always, making it simple to reuse local variables for storing return value and 
as arguments (if it is appropriate in the context).

Eric also added (in v1 thread), that off_t is signed too.

So the aim of the series is not signed type, the aim is 64bit. And for 
consistency, we should use same type for all io functions. And my proposal is 
int64_t, for these two reasons above. May be good to add them to the first 
commit message.

--
Best regards,
Vladimir



reply via email to

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