[libvirt] PATCH: 2 of 5: Remove virDomainObjPtr linked list

Daniel Veillard veillard at redhat.com
Mon Oct 6 14:45:13 UTC 2008


On Fri, Oct 03, 2008 at 01:25:17PM +0100, Daniel P. Berrange wrote:
> This patch removes the linked list in the virDomainObjPtr object, and
> adds a new virDomainObjList struct to track domains as an array. The
> QEMU, LXC, OpenVZ and Test drivers get updated to account for this API
> change.

  Hum, the only danger I see is that then you can't garantee the
virDomainObjPtr value for parallel access as the (semi-frequent)
realloc is likely to change them. You then need to take the global
lock before trying to access this structure and never cache its value.
I guess that's fine though considering the expected usage.
  But each driver still need to access those structures directly,
with the future goal of having driver loaded as shared lib modules
maybe that interface should be defined as a few entry points to
add, remove, lookup and iterate (with a callback). The refactoring
here might be a good opportunity to hide the implementation from
driver code. Opinion ?

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list