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

Re: [libvirt] RFC: Introduce API to return configuration/state paths of the network driver



On 08/13/2013 04:48 PM, Eric Blake wrote:

>>    virNetworkGetDHCPLeaseForMAC(virNetworkPtr network,
>>                                 unsigned char *macaddr,
> 
> I personally think the public API should stick to stringized
> representations.  Yes, it's less friendly to machine code, but
> internally, our src/util/virmacaddr.h helps transfer between stringized
> and binary.  Furthermore, we already have other API that operates on
> stringized versions, but none that operates on raw (see
> virDomainSetInterfaceParameters).  Knowing what representation we are
> targetting impacts how this API will look.

For comparison, look at the API for virDomainLookupByUUID (takes a raw
uuid - fixed number of bytes, unsigned char* argument) vs.
virDomainLookupByUUIDString (takes a stringized uuid, char* argument).
If efficiency were a concern, then I'd propose that we have two API:

virNetworkGetDHCPLeaseForMAC(virNetworkPtr network,
                             unsigned char *macaddr, ...)

virNetworkGetDHCPLeaseForMACString(virNetworkPtr network,
                                   char *macaddr, ...)

But I don't think efficiency is a concern, and rather than add a new API
that has to have dual forms, I'd rather stick with the shorter name but
using the stringized form of MAC.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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