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

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



Quoting Eric Blake (eblake redhat com):
> 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.

Yup, I like it, thanks guys.

I don't know whether I'll have time to send a new patch tomorrow.  If not
I'll aim to write one over the weekend, but if someone else wants to make
the (somewhat trivial) updates I won't feel upstaged :)

thanks,
-serge


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