From 3d2c54b0624ad8a8eceafeab8a705d1adc113139 Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Fri, 23 Apr 2021 12:37:36 +0200 Subject: [PATCH] virDomainActualNetDef: Change type of type to virDomainNetType MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tim Wiederhake Reviewed-by: Ján Tomko Signed-off-by: Ján Tomko --- src/conf/domain_conf.c | 30 ++++++++++++++++++++++++++---- src/conf/domain_conf.h | 2 +- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 33e79b20e6..5827bb8a8e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2468,7 +2468,16 @@ virDomainActualNetDefFree(virDomainActualNetDef *def) case VIR_DOMAIN_NET_TYPE_HOSTDEV: virDomainHostdevDefClear(&def->data.hostdev.def); break; - default: + case VIR_DOMAIN_NET_TYPE_USER: + case VIR_DOMAIN_NET_TYPE_ETHERNET: + case VIR_DOMAIN_NET_TYPE_VHOSTUSER: + case VIR_DOMAIN_NET_TYPE_SERVER: + case VIR_DOMAIN_NET_TYPE_CLIENT: + case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_INTERNAL: + case VIR_DOMAIN_NET_TYPE_UDP: + case VIR_DOMAIN_NET_TYPE_VDPA: + case VIR_DOMAIN_NET_TYPE_LAST: break; } @@ -10137,6 +10146,7 @@ virDomainActualNetDefParseXML(xmlNodePtr node, g_autofree char *addrtype = NULL; g_autofree char *trustGuestRxFilters = NULL; g_autofree char *macTableManager = NULL; + int type_value; actual = g_new0(virDomainActualNetDef, 1); @@ -10148,11 +10158,12 @@ virDomainActualNetDefParseXML(xmlNodePtr node, _("missing type attribute in interface's element")); goto error; } - if ((actual->type = virDomainNetTypeFromString(type)) < 0) { + if ((type_value = virDomainNetTypeFromString(type)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown type '%s' in interface's element"), type); goto error; } + actual->type = type_value; if (actual->type != VIR_DOMAIN_NET_TYPE_BRIDGE && actual->type != VIR_DOMAIN_NET_TYPE_DIRECT && actual->type != VIR_DOMAIN_NET_TYPE_HOSTDEV && @@ -30189,9 +30200,20 @@ virDomainNetGetActualVirtPortProfile(const virDomainNetDef *iface) case VIR_DOMAIN_NET_TYPE_BRIDGE: case VIR_DOMAIN_NET_TYPE_HOSTDEV: return iface->data.network.actual->virtPortProfile; - default: - return NULL; + case VIR_DOMAIN_NET_TYPE_USER: + case VIR_DOMAIN_NET_TYPE_ETHERNET: + case VIR_DOMAIN_NET_TYPE_VHOSTUSER: + case VIR_DOMAIN_NET_TYPE_SERVER: + case VIR_DOMAIN_NET_TYPE_CLIENT: + case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_NETWORK: + case VIR_DOMAIN_NET_TYPE_INTERNAL: + case VIR_DOMAIN_NET_TYPE_UDP: + case VIR_DOMAIN_NET_TYPE_VDPA: + case VIR_DOMAIN_NET_TYPE_LAST: + break; } + return NULL; case VIR_DOMAIN_NET_TYPE_USER: case VIR_DOMAIN_NET_TYPE_ETHERNET: case VIR_DOMAIN_NET_TYPE_VHOSTUSER: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 336b76aa5c..cb21ee7872 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -990,7 +990,7 @@ typedef enum { * different versions of libvirt may read the same data file. */ struct _virDomainActualNetDef { - int type; /* enum virDomainNetType */ + virDomainNetType type; union { struct { char *brname;