
On 09/02/2013 03:41 AM, Nehal J Wani wrote:
In agreement with Guido's suggestion on 5/5 of the previous version (https://www.redhat.com/archives/libvir-list/2013-August/msg01271.html), the enums are also to exposed to python bindings, for which, /include/libvirt/libvirt.h.in will have to be modified a bit. Diff has been attached.
Yes, the constants need to be exposed in python bindings. However,
typedef enum { - VIR_IP_ADDR_TYPE_IPV4, - VIR_IP_ADDR_TYPE_IPV6, + VIR_IP_ADDR_TYPE_IPV4 = (1 << 0), + VIR_IP_ADDR_TYPE_IPV6 = (1 << 1),
This is not the correct way to do so. These are not bitmasks, but should be sequential: VIR_IP_ADDR_TYPE_IPV4 = 0, VIR_IP_ADDR_TYPE_IPV6 = 1, /* next one would be 2, ... */
#ifdef VIR_ENUM_SENTINELS - VIR_IP_ADDR_TYPE_LAST + VIR_IP_ADDR_TYPE_LAST = (1 << 2),
and this should NOT have an explicit value (the _LAST enum is magic, and should always be 1 more than the previous value; it is also protected behind #ifdef because there are some contexts that should not be exposed to the _LAST value). I don't remember off the top of my head, but think that python bindings are one of the places where we intentionally don't expose _LAST values. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org