[libvirt] [PATCH 1/1] support libnl-3 (v2)

Eric Blake eblake at redhat.com
Thu May 3 18:50:27 UTC 2012


On 05/03/2012 11:55 AM, Stefan Berger wrote:
>>
>> +#ifdef HAVE_LIBNL1
>> +#define nl_alloc nl_handle_alloc
>> +#define nl_free nl_handle_destroy
>> +typedef struct nl_handle nlhandle_t;
>> +#else
>> +#define nl_alloc nl_socket_alloc
>> +#define nl_free nl_socket_free
>> +typedef struct nl_sock nlhandle_t;
>> +#endif
>> +
> 
> I would not #define in the namespace of that library (nl_*).

Agreed that a vir* namespace is safer.

> What about
> the following:

> #ifdef HAVE_LIBNL1
> 
> static struct nl_handle *
> virNLHandleAlloc(void)
> {
>     return nl_handle_alloc();
> }

One further:

typedef struct nl_handle virNLHandle;

static virNLHandle *
virNLHandleAlloc(void) ...

so that the rest of the code is indeed isolated into virNL wrappers with
no additional #ifdefs.

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120503/249e5c85/attachment-0001.sig>


More information about the libvir-list mailing list