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; virNetDevVPortProfileAssociate;
virNetDevVPortProfileCheckComplete; virNetDevVPortProfileCheckComplete;
virNetDevVPortProfileCheckNoExtras; virNetDevVPortProfileCheckNoExtras;
virNetDevVPortProfileCopy;
virNetDevVPortProfileDisassociate; virNetDevVPortProfileDisassociate;
virNetDevVPortProfileEqual; virNetDevVPortProfileEqual;
virNetDevVPortProfileMerge3; virNetDevVPortProfileMerge3;

View File

@ -127,6 +127,22 @@ virNetDevVPortProfileEqual(virNetDevVPortProfilePtr a, virNetDevVPortProfilePtr
return true; 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 /* virNetDevVPortProfileCheckComplete() checks that all attributes
* required for the type of virtport are specified. When * required for the type of virtport are specified. When
* generateMissing is true, any missing attribute that can be * generateMissing is true, any missing attribute that can be

View File

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