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

Re: [libvirt] [PATCH 1/2] cleanup: make nlComm commonly available



On 06/21/2011 10:08 AM, Stefan Berger wrote:
> In a first cleanup step, make nlComm from macvtap.c commonly available
> for other code to use. Since nlComm uses Linux-specific structures as
> parameters it's prototype is only visible on Linux.
> 
> Signed-off-by: Stefan Berger <stefanb linux vnet ibm com>
> 
> ---
>  src/Makefile.am          |    1
>  src/libvirt_private.syms |    4 +

The code motion looks okay to me.  However:

Exporting the private symbols says the symbols must be available
everywhere...

> +#if __linux__
> +int nlComm(struct nl_msg *nl_msg,
> +           unsigned char **respbuf, unsigned int *respbuflen,
> +           int nl_pid)
> +{

> +
> +#endif /* __linux__ */

so you should provide an #else clause with a dummy implementation that
always fails, as well as a dummy:

struct nl_msg;

forward prototype to allow compilation on non-Linux.

> +
> Index: libvirt-acl/src/util/netlink.h
> ===================================================================
> --- /dev/null
> +++ libvirt-acl/src/util/netlink.h
> @@ -0,0 +1,14 @@
> +#ifndef __VIR_NETLINK_H__
> +# define __VIR_NETLINK_H__
> +
> +# if __linux__
> +
> +#  include <netlink/msg.h>
> +
> +int nlComm(struct nl_msg *nl_msg,
> +           unsigned char **respbuf, unsigned int *respbuflen,
> +           int nl_pid);
> +
> +#endif /* __linux__ */

at which point this header can be unconditional.

> +++ libvirt-acl/src/libvirt_private.syms
> @@ -668,6 +668,10 @@ virResizeN;
>  virShrinkN;
> 
> 
> +#netlink.h
> +nlComm;
> +

An alternative would be finding a way to only conditionally export
nlComm on Linux, by sticking it in a separate .syms file only when
actually used.

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
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]