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

Eric Blake eblake at redhat.com
Wed Jul 24 17:05:26 UTC 2019


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20190724/6af0334d/attachment.sig>


More information about the Libguestfs mailing list