[libvirt] [PATCH v4 1/2] cleanup conf/device_conf.h inclusion from util/virnetdev.h

Ján Tomko jtomko at redhat.com
Wed Mar 25 18:44:14 UTC 2015


On Wed, Mar 25, 2015 at 07:33:41PM +0530, Shivaprasad G Bhat wrote:
> Move the struct and enum definitions from device_conf.h to
> virnetdev.h thus avoiding the file inclusion.
> 
> The wrong reference of conf files from util/ is allowed
> in Makefile.am for now. The reason being,
> The change in Makefile.am for libvirt_util_la_CFLAGS to remove
> conf from the utils would require corresponding inclusion in util files
> to specify the paths explicitly. This would result in syntax-check failures
> (prohibit_cross_inclusion) which need to be worked around until
> there are patches reworking the incorrect inclusion.
> 
> The syntax-check failure workaround seems dangerous as that might mask some
> easily resolvable failures. So dont touch the Makefile.am for now. Resolve
> the wrong inclusions in separate patches.
> 
> Signed-off-by: Shivaprasad G Bhat <sbhat at linux.vnet.ibm.com>
> ---
>  src/conf/device_conf.h |   38 +-------------------------------------
>  src/util/virnetdev.h   |   38 +++++++++++++++++++++++++++++++++++++-
>  2 files changed, 38 insertions(+), 38 deletions(-)

I like the cleanup, but it fails to build for me:
In file included from ./util/virnetdev.h:30:0,
                 from conf/device_conf.h:34,
                 from conf/domain_conf.h:48,
                 from conf/domain_capabilities.h:27,
                 from conf/domain_capabilities.c:25:
./util/virnetlink.h:33:27: fatal error: netlink/msg.h: No such file or directory
 #  include <netlink/msg.h>
                           ^
compilation terminated.
Makefile:7320: recipe for target 'conf/libvirt_conf_la-domain_capabilities.lo' failed


It seems a change in the makefile will be necessary if we want to
include virnetdev in conf/

Jan

> 
> diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
> index 7ea90f6..a650189 100644
> --- a/src/conf/device_conf.h
> +++ b/src/conf/device_conf.h
> @@ -31,19 +31,7 @@
>  # include "virutil.h"
>  # include "virthread.h"
>  # include "virbuffer.h"
> -
> -typedef enum {
> -    VIR_INTERFACE_STATE_UNKNOWN = 1,
> -    VIR_INTERFACE_STATE_NOT_PRESENT,
> -    VIR_INTERFACE_STATE_DOWN,
> -    VIR_INTERFACE_STATE_LOWER_LAYER_DOWN,
> -    VIR_INTERFACE_STATE_TESTING,
> -    VIR_INTERFACE_STATE_DORMANT,
> -    VIR_INTERFACE_STATE_UP,
> -    VIR_INTERFACE_STATE_LAST
> -} virInterfaceState;
> -
> -VIR_ENUM_DECL(virInterfaceState)
> +# include "virnetdev.h"
>  
>  typedef struct _virDevicePCIAddress virDevicePCIAddress;
>  typedef virDevicePCIAddress *virDevicePCIAddressPtr;
> @@ -55,30 +43,6 @@ struct _virDevicePCIAddress {
>      int          multi;  /* virTristateSwitch */
>  };
>  
> -typedef struct _virInterfaceLink virInterfaceLink;
> -typedef virInterfaceLink *virInterfaceLinkPtr;
> -struct _virInterfaceLink {
> -    virInterfaceState state; /* link state */
> -    unsigned int speed;      /* link speed in Mbits per second */
> -};
> -
> -typedef enum {
> -    VIR_NET_DEV_FEAT_GRXCSUM,
> -    VIR_NET_DEV_FEAT_GTXCSUM,
> -    VIR_NET_DEV_FEAT_GSG,
> -    VIR_NET_DEV_FEAT_GTSO,
> -    VIR_NET_DEV_FEAT_GGSO,
> -    VIR_NET_DEV_FEAT_GGRO,
> -    VIR_NET_DEV_FEAT_LRO,
> -    VIR_NET_DEV_FEAT_RXVLAN,
> -    VIR_NET_DEV_FEAT_TXVLAN,
> -    VIR_NET_DEV_FEAT_NTUPLE,
> -    VIR_NET_DEV_FEAT_RXHASH,
> -    VIR_NET_DEV_FEAT_LAST
> -} virNetDevFeature;
> -
> -VIR_ENUM_DECL(virNetDevFeature)
> -
>  int virDevicePCIAddressIsValid(virDevicePCIAddressPtr addr);
>  
>  int virDevicePCIAddressParseXML(xmlNodePtr node,
> diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h
> index 856127b..8aab96b 100644
> --- a/src/util/virnetdev.h
> +++ b/src/util/virnetdev.h
> @@ -30,7 +30,6 @@
>  # include "virnetlink.h"
>  # include "virmacaddr.h"
>  # include "virpci.h"
> -# include "device_conf.h"
>  
>  # ifdef HAVE_STRUCT_IFREQ
>  typedef struct ifreq virIfreq;
> @@ -74,6 +73,43 @@ struct _virNetDevRxFilter {
>      } vlan;
>  };
>  
> +typedef enum {
> +    VIR_NET_DEV_FEAT_GRXCSUM,
> +    VIR_NET_DEV_FEAT_GTXCSUM,
> +    VIR_NET_DEV_FEAT_GSG,
> +    VIR_NET_DEV_FEAT_GTSO,
> +    VIR_NET_DEV_FEAT_GGSO,
> +    VIR_NET_DEV_FEAT_GGRO,
> +    VIR_NET_DEV_FEAT_LRO,
> +    VIR_NET_DEV_FEAT_RXVLAN,
> +    VIR_NET_DEV_FEAT_TXVLAN,
> +    VIR_NET_DEV_FEAT_NTUPLE,
> +    VIR_NET_DEV_FEAT_RXHASH,
> +    VIR_NET_DEV_FEAT_LAST
> +} virNetDevFeature;
> +
> +VIR_ENUM_DECL(virNetDevFeature)
> +
> +typedef enum {
> +    VIR_INTERFACE_STATE_UNKNOWN = 1,
> +    VIR_INTERFACE_STATE_NOT_PRESENT,
> +    VIR_INTERFACE_STATE_DOWN,
> +    VIR_INTERFACE_STATE_LOWER_LAYER_DOWN,
> +    VIR_INTERFACE_STATE_TESTING,
> +    VIR_INTERFACE_STATE_DORMANT,
> +    VIR_INTERFACE_STATE_UP,
> +    VIR_INTERFACE_STATE_LAST
> +} virInterfaceState;
> +
> +VIR_ENUM_DECL(virInterfaceState)
> +
> +typedef struct _virInterfaceLink virInterfaceLink;
> +typedef virInterfaceLink *virInterfaceLinkPtr;
> +struct _virInterfaceLink {
> +    virInterfaceState state; /* link state */
> +    unsigned int speed;      /* link speed in Mbits per second */
> +};
> +
>  int virNetDevSetupControl(const char *ifname,
>                            virIfreq *ifr)
>      ATTRIBUTE_RETURN_CHECK;
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150325/d6b1951d/attachment-0001.sig>


More information about the libvir-list mailing list