This struct was previously defined only within virDomainNetDef where
it was used, but I need to also use it in virDomainHostdevDef, so move
the internal struct out to its own "official" struct and give it the
standard typedef duo and *Free() function.
Signed-off-by: Laine Stump <laine(a)redhat.com>
---
src/conf/domain_conf.c | 11 +++++++++++
src/conf/domain_conf.h | 12 ++++++++----
src/conf/virconftypes.h | 3 +++
src/libvirt_private.syms | 1 +
4 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8f2207bdf6..7d7acb940a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2476,6 +2476,17 @@ virDomainVsockDefFree(virDomainVsockDefPtr vsock)
}
+void
+virDomainNetTeamingInfoFree(virDomainNetTeamingInfoPtr teaming)
+{
+ if (!teaming)
+ return;
+
+ g_free(teaming->persistent);
+ g_free(teaming);
+}
+
+
void
virDomainNetDefFree(virDomainNetDefPtr def)
{
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 8b1c8643be..92fe588b3f 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -956,6 +956,11 @@ typedef enum {
VIR_DOMAIN_NET_TEAMING_TYPE_LAST
} virDomainNetTeamingType;
+struct _virDomainNetTeamingInfo {
+ virDomainNetTeamingType type;
+ char *persistent; /* alias name of persistent device */
+};
+
/* link interface states */
typedef enum {
VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT = 0, /* Default link state (up) */
@@ -1033,10 +1038,7 @@ struct _virDomainNetDef {
char *tap;
char *vhost;
} backend;
- struct {
- virDomainNetTeamingType type;
- char *persistent; /* alias name of persistent device */
- } teaming;
+ virDomainNetTeamingInfo teaming;
union {
virDomainChrSourceDefPtr vhostuser;
struct {
@@ -3100,6 +3102,8 @@ void virDomainActualNetDefFree(virDomainActualNetDefPtr def);
virDomainVsockDefPtr virDomainVsockDefNew(virDomainXMLOptionPtr xmlopt);
void virDomainVsockDefFree(virDomainVsockDefPtr vsock);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainVsockDef, virDomainVsockDefFree);
+void virDomainNetTeamingInfoFree(virDomainNetTeamingInfoPtr teaming);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainNetTeamingInfo, virDomainNetTeamingInfoFree);
void virDomainNetDefFree(virDomainNetDefPtr def);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainNetDef, virDomainNetDefFree);
void virDomainSmartcardDefFree(virDomainSmartcardDefPtr def);
diff --git a/src/conf/virconftypes.h b/src/conf/virconftypes.h
index 9042a2b34f..c51241cfa5 100644
--- a/src/conf/virconftypes.h
+++ b/src/conf/virconftypes.h
@@ -246,6 +246,9 @@ typedef virDomainNVRAMDef *virDomainNVRAMDefPtr;
typedef struct _virDomainNetDef virDomainNetDef;
typedef virDomainNetDef *virDomainNetDefPtr;
+typedef struct _virDomainNetTeamingInfo virDomainNetTeamingInfo;
+typedef virDomainNetTeamingInfo *virDomainNetTeamingInfoPtr;
+
typedef struct _virDomainOSDef virDomainOSDef;
typedef virDomainOSDef *virDomainOSDefPtr;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 837986845f..affa2df323 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -537,6 +537,7 @@ virDomainNetRemove;
virDomainNetRemoveHostdev;
virDomainNetResolveActualType;
virDomainNetSetModelString;
+virDomainNetTeamingInfoFree;
virDomainNetTypeFromString;
virDomainNetTypeSharesHostView;
virDomainNetTypeToString;
--
2.29.2