[libvirt] incorrect VIR_DOMAIN_NONE usage

Tóth István stoty at tvnet.hu
Tue Jul 1 20:04:58 UTC 2008


As I was trying to understand exact semantics of the libvirt flags api,
I found an error in the xs_internal.c file.
When it wants to indicate that it cannot report the state of the domain,
it user VIR_DOMAIN_NONE as a return value, which does not, in fact,
refer to a domain state at all, but is a dummy flag for creating
domains, instead of VIR_DOMAIN_NOSTATE.

This patch does not affect the compiled code, only the readability.


On a related note, the defined enum flags seem inconstent to me, half of
them have explicitly named 0 default values, and half of them don't,
it's a bit confusing.

If

enum virStorageVolDeleteFlags {
VIR_STORAGE_VOL_DELETE_NORMAL    =     0    : Delete metadata only (fast)
VIR_STORAGE_VOL_DELETE_ZEROED    =     1    : Clear all data to zeros (slow)
}

then why not

enum virConnectFlags {
VIR_CONNECT_RW    =    0    : A read-write connection
VIR_CONNECT_RO    =     1    : A readonly connection
}

?
It would not affect existing code, and would make the library more
consistent.


regards
István

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: xs_internal_constant_semantics.patch
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20080701/b6fc24f9/attachment-0001.ksh>


More information about the libvir-list mailing list