Re: [PATCH] virDomainDiskDef: Turn @device into enum

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

 



On 09/17/2015 11:37 AM, Michal Privoznik wrote:
It's used as enum everywhere, so why store its value in an int?

There are a lot of these. I *think* the only reason this was done anywhere in the first place was because the size of an enum isn't guaranteed to be the same across different platforms, so you can't use an enum type in any wire protocol (e.g. libvirt client to server), and somehow this usage leaked over into the internal-only data structures; after that the general "that works! Copy it!" cargo cult generation of new code meant that we now have lots of instances of this (there may also be cases where someone chose to use -1 to indicate "not specified" rather than 0/the first enum value).

Or it could be there's some other reason for using int instead of an enum type in the internal config objects that I've forgotten.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]