conf: make teaming info an official type

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@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Laine Stump 2021-02-10 20:08:29 -05:00
parent 114e3b4232
commit 5d74e2f168
4 changed files with 23 additions and 4 deletions

View File

@ -2476,6 +2476,17 @@ virDomainVsockDefFree(virDomainVsockDefPtr vsock)
} }
void
virDomainNetTeamingInfoFree(virDomainNetTeamingInfoPtr teaming)
{
if (!teaming)
return;
g_free(teaming->persistent);
g_free(teaming);
}
void void
virDomainNetDefFree(virDomainNetDefPtr def) virDomainNetDefFree(virDomainNetDefPtr def)
{ {

View File

@ -956,6 +956,11 @@ typedef enum {
VIR_DOMAIN_NET_TEAMING_TYPE_LAST VIR_DOMAIN_NET_TEAMING_TYPE_LAST
} virDomainNetTeamingType; } virDomainNetTeamingType;
struct _virDomainNetTeamingInfo {
virDomainNetTeamingType type;
char *persistent; /* alias name of persistent device */
};
/* link interface states */ /* link interface states */
typedef enum { typedef enum {
VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT = 0, /* Default link state (up) */ VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT = 0, /* Default link state (up) */
@ -1033,10 +1038,7 @@ struct _virDomainNetDef {
char *tap; char *tap;
char *vhost; char *vhost;
} backend; } backend;
struct { virDomainNetTeamingInfo teaming;
virDomainNetTeamingType type;
char *persistent; /* alias name of persistent device */
} teaming;
union { union {
virDomainChrSourceDefPtr vhostuser; virDomainChrSourceDefPtr vhostuser;
struct { struct {
@ -3100,6 +3102,8 @@ void virDomainActualNetDefFree(virDomainActualNetDefPtr def);
virDomainVsockDefPtr virDomainVsockDefNew(virDomainXMLOptionPtr xmlopt); virDomainVsockDefPtr virDomainVsockDefNew(virDomainXMLOptionPtr xmlopt);
void virDomainVsockDefFree(virDomainVsockDefPtr vsock); void virDomainVsockDefFree(virDomainVsockDefPtr vsock);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainVsockDef, virDomainVsockDefFree); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainVsockDef, virDomainVsockDefFree);
void virDomainNetTeamingInfoFree(virDomainNetTeamingInfoPtr teaming);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainNetTeamingInfo, virDomainNetTeamingInfoFree);
void virDomainNetDefFree(virDomainNetDefPtr def); void virDomainNetDefFree(virDomainNetDefPtr def);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainNetDef, virDomainNetDefFree); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainNetDef, virDomainNetDefFree);
void virDomainSmartcardDefFree(virDomainSmartcardDefPtr def); void virDomainSmartcardDefFree(virDomainSmartcardDefPtr def);

View File

@ -246,6 +246,9 @@ typedef virDomainNVRAMDef *virDomainNVRAMDefPtr;
typedef struct _virDomainNetDef virDomainNetDef; typedef struct _virDomainNetDef virDomainNetDef;
typedef virDomainNetDef *virDomainNetDefPtr; typedef virDomainNetDef *virDomainNetDefPtr;
typedef struct _virDomainNetTeamingInfo virDomainNetTeamingInfo;
typedef virDomainNetTeamingInfo *virDomainNetTeamingInfoPtr;
typedef struct _virDomainOSDef virDomainOSDef; typedef struct _virDomainOSDef virDomainOSDef;
typedef virDomainOSDef *virDomainOSDefPtr; typedef virDomainOSDef *virDomainOSDefPtr;

View File

@ -537,6 +537,7 @@ virDomainNetRemove;
virDomainNetRemoveHostdev; virDomainNetRemoveHostdev;
virDomainNetResolveActualType; virDomainNetResolveActualType;
virDomainNetSetModelString; virDomainNetSetModelString;
virDomainNetTeamingInfoFree;
virDomainNetTypeFromString; virDomainNetTypeFromString;
virDomainNetTypeSharesHostView; virDomainNetTypeSharesHostView;
virDomainNetTypeToString; virDomainNetTypeToString;