[libvirt] [PATCH v3 2/4] Make virNetDevSetupControl() public.
Eric Blake
eblake at redhat.com
Mon Feb 4 22:56:05 UTC 2013
On 02/04/2013 03:46 PM, Eric Blake wrote:
>>
>> <net/if.h> is a standard header (and therefore guaranteed by gnulib), but...
>>
>>> +
>>> +int virNetDevSetupControl(const char *ifname,
>>> + struct ifreq *ifr)
>>
>> struct ifreq is a non-standard type, and therefore this will cause
>> compilation errors on platforms that lack this struct (hello mingw).
>
> Oddly enough, it also causes compilation errors on Linux; at least with
> the kernel headers present in current Fedora 18:
>
> CC libvirt_util_la-virnetdevmacvlan.lo
> In file included from util/virnetdev.h:31:0,
> from util/virnetdevmacvlan.c:64:
> /usr/include/net/if.h:44:5: error: expected identifier before numeric
> constant
> In file included from util/virnetdev.h:31:0,
> from util/virnetdevmacvlan.c:64:
> /usr/include/net/if.h:111:8: error: redefinition of 'struct ifmap'
> ...
>
> I'm not sure if this is related to the known kernel header bug (see the
> big thread at
> https://www.redhat.com/archives/libvir-list/2013-January/thread.html#00891),
> but it definitely must be resolved before we can hoist 'struct ifreq *'
> into a header that is included in multiple files.
Thankfully, I was able to find a workaround for the Linux compilation
(mingw compilation still needs help, though):
diff --git i/src/util/virnetdevmacvlan.c w/src/util/virnetdevmacvlan.c
index a74db1e..78a37ec 100644
--- i/src/util/virnetdevmacvlan.c
+++ w/src/util/virnetdevmacvlan.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2012 Red Hat, Inc.
+ * Copyright (C) 2010-2013 Red Hat, Inc.
* Copyright (C) 2010-2012 IBM Corporation
*
* This library is free software; you can redistribute it and/or
@@ -48,7 +48,7 @@ VIR_ENUM_IMPL(virNetDevMacVLanMode,
VIR_NETDEV_MACVLAN_MODE_LAST,
# include <sys/socket.h>
# include <sys/ioctl.h>
-# include <linux/if.h>
+# include <net/if.h>
# include <linux/if_tun.h>
/* Older kernels lacked this enum value. */
diff --git i/src/util/virnetdevvportprofile.c
w/src/util/virnetdevvportprofile.c
index bb97e3a..e775ca5 100644
--- i/src/util/virnetdevvportprofile.c
+++ w/src/util/virnetdevvportprofile.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2012 Red Hat, Inc.
+ * Copyright (C) 2009-2013 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -48,7 +48,7 @@ VIR_ENUM_IMPL(virNetDevVPortProfileOp,
VIR_NETDEV_VPORT_PROFILE_OP_LAST,
# include <sys/socket.h>
# include <sys/ioctl.h>
-# include <linux/if.h>
+# include <net/if.h>
# include <linux/if_tun.h>
# include "virnetlink.h"
--
Eric Blake eblake 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: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130204/7b97e045/attachment-0001.sig>
More information about the libvir-list
mailing list