[Libvir] [PATCH] parse URI once in src/libvirt.c, pass parsed URI to all drivers

Daniel Veillard veillard at redhat.com
Tue Oct 16 10:14:00 UTC 2007


On Tue, Oct 16, 2007 at 11:06:26AM +0100, Richard W.M. Jones wrote:
> The basic change here is that the virDrvOpen call (the internal "open" 
> call for drivers) now takes the parsed xmlURIPtr instead of the raw name 
> string.
> 
>  typedef virDrvOpenStatus
>         (*virDrvOpen)           (virConnectPtr conn,
> -                                const char *name,
> +                     	         xmlURIPtr uri,
>                                  int flags);
> 
> So we avoid the redundant URI parsing which was going on inside all the 
> drivers, and also the ad-hoc "does-it-look-like-a-URI" string comparisons.
> 
> That's straightforward enough except that all of the drivers were saving 
> the name string in their private data so that they could implement the 
> virConnectGetURI call.  I've changed this so that the name is copied and 
> saved in the main virConnect structure, and virConnectGetURI will return 
> that unless the driver wants to override it.

  okay, a very needed code cleanup indeed +1

> You need another patch (coming shortly) to allow URIs like 
> xen://localhost (without the trailing slash) to work, which was IIRC the 
> original point of this discussion.

  Yup, thanks in advance,

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/




More information about the libvir-list mailing list