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

Re: [Libguestfs] [PATCH libnbd 2/3] lib: Implement closure lifetimes.

On 7/24/19 11:52 AM, Richard W.M. Jones wrote:

>>> +  if valid_flag then (
>>> +    if !comma then pr ", ";
>>> +    comma := true;
>>> +    if types then pr "int ";
>>> +    pr "valid_flag";
>> Should this be 'unsigned int valid_flag', as bitmasks over signed values
>> have awkward semantics if you touch the sign bit?  But I'm okay with int
>> for now, as it matches 'int nbd_aio_get_direction(...)' and
>> nbd_pread_structured using 'int status' in its callback.
> Yes I can change it to unsigned - using a signed type was a mistake.
> I think we can change nbd_pread_structured (and friends) to use either
> unsigned or uint32_t which is consistent with other flag parameters.
> However we can't easily change nbd_aio_get_direction as that needs to
> be a signed type to indicate errors, at least without awkward casting.
> I'll come up with a separate patch.

nbd_aio_get_direction is currently documented as 'can't fail', which
means it never returns negative. So that return type could perhaps be
fixed too.

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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