[Libguestfs] [libnbd RFC PATCH 9/8] wip: generator: Add ReadStatus enum type

Eric Blake eblake at redhat.com
Fri Jun 21 00:09:35 UTC 2019


On 6/20/19 6:42 PM, Richard W.M. Jones wrote:
> On Mon, Jun 17, 2019 at 08:39:43PM -0500, Eric Blake wrote:
>> Exploration of what it would take to treat the nbd_pread_callback
>> status parameter as a language-appropriate enum rather than a bare
>> integer.  While I've identified a rough set of the places to change, I
>> have not actually got it working with Python or OCaml bindings.
>> ---
>>
>> Posting this more for an idea of whether we want to pursue it
>> further. I have no hard feelings if we decide to ditch it; what's
>> more, compilers don't necessarily guarantee ABI stability with enum
>> types in public headers, so sticking to Int may be better after all.
> 
> I believe there are ABI problems with enums (something about
> how they change ABI if there are more than 256 cases?)

Yes, that's part of what I'm worried about. For comparison, libvirt
specifically chose that all enum-like values in the public API are
passed as native integers, precisely to avoid these types of problems.

At any rate, I'm not convinced this patch adds much value, so I'm
probably not going to pursue it further.

-- 
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/20190620/c4b056d5/attachment.sig>


More information about the Libguestfs mailing list