util: add API for copying virtual port profile data

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2018-09-03 17:02:35 +01:00
parent 4bdce1219f
commit 80772a58b6
3 changed files with 19 additions and 0 deletions

View File

@ -2510,6 +2510,7 @@ virNetDevVlanFree;
virNetDevVPortProfileAssociate;
virNetDevVPortProfileCheckComplete;
virNetDevVPortProfileCheckNoExtras;
virNetDevVPortProfileCopy;
virNetDevVPortProfileDisassociate;
virNetDevVPortProfileEqual;
virNetDevVPortProfileMerge3;

View File

@ -127,6 +127,22 @@ virNetDevVPortProfileEqual(virNetDevVPortProfilePtr a, virNetDevVPortProfilePtr
return true;
}
int virNetDevVPortProfileCopy(virNetDevVPortProfilePtr *dst, const virNetDevVPortProfile *src)
{
if (!src) {
*dst = NULL;
return 0;
}
if (VIR_ALLOC(*dst) < 0)
return -1;
memcpy(*dst, src, sizeof(*src));
return 0;
}
/* virNetDevVPortProfileCheckComplete() checks that all attributes
* required for the type of virtport are specified. When
* generateMissing is true, any missing attribute that can be

View File

@ -80,6 +80,8 @@ struct _virNetDevVPortProfile {
bool virNetDevVPortProfileEqual(virNetDevVPortProfilePtr a,
virNetDevVPortProfilePtr b);
int virNetDevVPortProfileCopy(virNetDevVPortProfilePtr *dst,
const virNetDevVPortProfile *src);
int virNetDevVPortProfileCheckComplete(virNetDevVPortProfilePtr virtport,
bool generateMissing);