Re: [PATCH 2/2] cleanup: make several interface functions commonly available

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

 



On 06/21/2011 10:21 AM, Stefan Berger wrote:
> In a second cleanup step this patch makes several interface functions
> from macvtap.c commonly available by moving them into interface.c and
> prefixing their names with 'iface'. Those functions taking
> Linux-specific structures as parameters are only visible on Linux.
> 
> ifaceRestoreMacAddress returns the return code from the ifaceSetMacAddr
> call and display an error message if setting the MAC address did not
> work. The caller is unchanged and still ignores the return code (which
> is ok).
> 
> Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxxxxxxx>
> 
> ---
>  src/libvirt_private.syms |    8
>  src/util/interface.c     |  590
> +++++++++++++++++++++++++++++++++++++++++++++++
>  src/util/interface.h     |   33 ++
>  src/util/macvtap.c       |  495 ---------------------------------------
>  4 files changed, 640 insertions(+), 486 deletions(-)

Same story about providing stubs on non-Linux platforms, for the purpose
of satisfying the libvirt_private.syms export listings.

> +int
> +ifaceMacvtapLinkDump(bool nltarget_kernel, const char *ifname, int
> ifindex,
> +                     struct nlattr **tb, unsigned char **recvbuf,
> +                     uint32_t (*getPidFunc)(void))

A forward declaration of struct nlattr as an opaque type should be
enough to allow a dummy implementation of this function on non-Linux.

> --- libvirt-acl.orig/src/util/interface.h
> +++ libvirt-acl/src/util/interface.h
> @@ -10,6 +10,13 @@
>  #ifndef __VIR_INTERFACE_H__
>  # define __VIR_INTERFACE_H__
> 
> +# include <stdint.h>
> +
> +# if __linux__
> +#  include <sys/socket.h>
> +#  include <linux/netlink.h>
> +# endif

Here's where you could use an #else to do the forward declaration of
opaque types for non-Linux.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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