Re: 1/4 Additions to the public API

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

 



On Thu, Feb 21, 2008 at 08:56:17PM +0000, Richard W.M. Jones wrote:
> This just adds the four new functions to the public API.
[...]
> +/**
> + * virNetworkDHCPHostMapping:
> + *
> + * hostname mappings are returned by virNetworkListDHCPHostMapping.
> + */
> +typedef struct _virNetworkDHCPHostMapping {
> +  char *hwaddr;
> +  char *ipaddr;
> +  char *hostname;
> +} virNetworkDHCPHostMapping;
> +
> +typedef virNetworkDHCPHostMapping *virNetworkDHCPHostMappingPtr;
> +
[...]
> +int                     virNetworkListDHCPHostMappings
> +                                                (virNetworkPtr network,
> +				  virNetworkDHCPHostMappingPtr *const mappings,
> +			          int maxmappings);
> +int                     virNetworkFreeDHCPHostMappings
> +                                 (virNetworkDHCPHostMappingPtr *const mappings,
> +			          int maxmappings);

  Hum, do we really need to expose this structure at the API level, since we
use it only for listing. Since everything is provided as strings why not 
use something like

     int virNetworkListDHCPHostMappings (virNetworkPtr network,
                                         int maxmappings,
                                         char **hwaddrtab,
					 char **ipaddrtab,
					 char **hostnametab);

  This also avoids the free function too, same functionality, quite a simpler
interface.
  Also I don't understand the 'const' in that function and what 
virNetworkFreeDHCPHostMappings is supposed to be used for. If mappings 
is allocated by the user, it doesn't need a library deallocator, if it's
allocated by the library I can't see how it's const, the API confuses me 
I must admit.


Daniel

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

--
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]