From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> Rename the virVirtualPortProfileParams struct to be virNetDevVPortProfile, and rename the APIs to match this prefix. * src/util/network.c, src/util/network.h: Rename port profile APIs * src/conf/domain_conf.c, src/conf/domain_conf.h, src/conf/network_conf.c, src/conf/network_conf.h, src/network/bridge_driver.c, src/qemu/qemu_hotplug.c, src/util/macvtap.c, src/util/macvtap.h: Update for renamed APIs/structs --- src/conf/domain_conf.c | 16 +++++++------- src/conf/domain_conf.h | 8 +++--- src/conf/network_conf.c | 12 +++++----- src/conf/network_conf.h | 4 +- src/libvirt_private.syms | 6 ++-- src/network/bridge_driver.c | 6 ++-- src/qemu/qemu_hotplug.c | 4 +- src/util/macvtap.c | 36 ++++++++++++++++---------------- src/util/macvtap.h | 8 +++--- src/util/network.c | 48 +++++++++++++++++++++--------------------- src/util/network.h | 33 +++++++++++++++-------------- 11 files changed, 91 insertions(+), 90 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ab7853d..c1f8950 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3112,8 +3112,8 @@ virDomainActualNetDefParseXML(xmlNodePtr node, virtPortNode = virXPathNode("./virtualport", ctxt); if (virtPortNode && - virVirtualPortProfileParseXML(virtPortNode, - &actual->data.direct.virtPortProfile) < 0) { + virNetDevVPortProfileParse(virtPortNode, + &actual->data.direct.virtPortProfile) < 0) { goto error; } } @@ -3169,7 +3169,7 @@ virDomainNetDefParseXML(virCapsPtr caps, char *mode = NULL; char *linkstate = NULL; virNWFilterHashTablePtr filterparams = NULL; - virVirtualPortProfileParamsPtr virtPort = NULL; + virNetDevVPortProfilePtr virtPort = NULL; virDomainActualNetDefPtr actual = NULL; xmlNodePtr oldnode = ctxt->node; int ret; @@ -3221,7 +3221,7 @@ virDomainNetDefParseXML(virCapsPtr caps, ((def->type == VIR_DOMAIN_NET_TYPE_DIRECT) || (def->type == VIR_DOMAIN_NET_TYPE_NETWORK)) && xmlStrEqual(cur->name, BAD_CAST "virtualport")) { - if (virVirtualPortProfileParseXML(cur, &virtPort) < 0) + if (virNetDevVPortProfileParse(cur, &virtPort) < 0) goto error; } else if ((network == NULL) && ((def->type == VIR_DOMAIN_NET_TYPE_SERVER) || @@ -9721,7 +9721,7 @@ virDomainActualNetDefFormat(virBufferPtr buf, } virBufferAsprintf(buf, " mode='%s'/>\n", mode); virBufferAdjustIndent(buf, 8); - virVirtualPortProfileFormat(buf, def->data.direct.virtPortProfile); + virNetDevVPortProfileFormat(def->data.direct.virtPortProfile, buf); virBufferAdjustIndent(buf, -8); break; default: @@ -9768,7 +9768,7 @@ virDomainNetDefFormat(virBufferPtr buf, def->data.network.portgroup); virBufferAddLit(buf, "/>\n"); virBufferAdjustIndent(buf, 6); - virVirtualPortProfileFormat(buf, def->data.network.virtPortProfile); + virNetDevVPortProfileFormat(def->data.network.virtPortProfile, buf); virBufferAdjustIndent(buf, -6); if ((flags & VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET) && (virDomainActualNetDefFormat(buf, def->data.network.actual) < 0)) @@ -9818,7 +9818,7 @@ virDomainNetDefFormat(virBufferPtr buf, virMacvtapModeTypeToString(def->data.direct.mode)); virBufferAddLit(buf, "/>\n"); virBufferAdjustIndent(buf, 6); - virVirtualPortProfileFormat(buf, def->data.direct.virtPortProfile); + virNetDevVPortProfileFormat(def->data.direct.virtPortProfile, buf); virBufferAdjustIndent(buf, -6); break; @@ -13078,7 +13078,7 @@ virDomainNetGetActualDirectMode(virDomainNetDefPtr iface) return iface->data.network.actual->data.direct.mode; } -virVirtualPortProfileParamsPtr +virNetDevVPortProfilePtr virDomainNetGetActualDirectVirtPortProfile(virDomainNetDefPtr iface) { if (iface->type == VIR_DOMAIN_NET_TYPE_DIRECT) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index a3cb834..255d8fd 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -508,7 +508,7 @@ struct _virDomainActualNetDef { struct { char *linkdev; int mode; /* enum virMacvtapMode from util/macvtap.h */ - virVirtualPortProfileParamsPtr virtPortProfile; + virNetDevVPortProfilePtr virtPortProfile; } direct; } data; virNetDevBandwidthPtr bandwidth; @@ -542,7 +542,7 @@ struct _virDomainNetDef { struct { char *name; char *portgroup; - virVirtualPortProfileParamsPtr virtPortProfile; + virNetDevVPortProfilePtr virtPortProfile; /* actual has info about the currently used physical * device (if the network is of type * bridge/private/vepa/passthrough). This is saved in the @@ -564,7 +564,7 @@ struct _virDomainNetDef { struct { char *linkdev; int mode; /* enum virMacvtapMode from util/macvtap.h */ - virVirtualPortProfileParamsPtr virtPortProfile; + virNetDevVPortProfilePtr virtPortProfile; } direct; } data; struct { @@ -1795,7 +1795,7 @@ int virDomainNetGetActualType(virDomainNetDefPtr iface); char *virDomainNetGetActualBridgeName(virDomainNetDefPtr iface); char *virDomainNetGetActualDirectDev(virDomainNetDefPtr iface); int virDomainNetGetActualDirectMode(virDomainNetDefPtr iface); -virVirtualPortProfileParamsPtr +virNetDevVPortProfilePtr virDomainNetGetActualDirectVirtPortProfile(virDomainNetDefPtr iface); virNetDevBandwidthPtr virDomainNetGetActualBandwidth(virDomainNetDefPtr iface); diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index a70b5a2..023eb9f 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -790,8 +790,8 @@ virNetworkPortGroupParseXML(virPortGroupDefPtr def, virtPortNode = virXPathNode("./virtualport", ctxt); if (virtPortNode && - (virVirtualPortProfileParseXML(virtPortNode, - &def->virtPortProfile) < 0)) { + (virNetDevVPortProfileParse(virtPortNode, + &def->virtPortProfile) < 0)) { goto error; } @@ -894,8 +894,8 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt) virtPortNode = virXPathNode("./virtualport", ctxt); if (virtPortNode && - (virVirtualPortProfileParseXML(virtPortNode, - &def->virtPortProfile) < 0)) { + (virNetDevVPortProfileParse(virtPortNode, + &def->virtPortProfile) < 0)) { goto error; } @@ -1268,7 +1268,7 @@ virPortGroupDefFormat(virBufferPtr buf, } virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 4); - virVirtualPortProfileFormat(buf, def->virtPortProfile); + virNetDevVPortProfileFormat(def->virtPortProfile, buf); virNetDevBandwidthFormat(def->bandwidth, buf); virBufferAdjustIndent(buf, -4); virBufferAddLit(buf, " </portgroup>\n"); @@ -1354,7 +1354,7 @@ char *virNetworkDefFormat(const virNetworkDefPtr def) } virBufferAdjustIndent(&buf, 2); - virVirtualPortProfileFormat(&buf, def->virtPortProfile); + virNetDevVPortProfileFormat(def->virtPortProfile, &buf); virBufferAdjustIndent(&buf, -2); for (ii = 0; ii < def->nPortGroups; ii++) diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h index 2cfbe46..57ad637 100644 --- a/src/conf/network_conf.h +++ b/src/conf/network_conf.h @@ -122,7 +122,7 @@ typedef virPortGroupDef *virPortGroupDefPtr; struct _virPortGroupDef { char *name; bool isDefault; - virVirtualPortProfileParamsPtr virtPortProfile; + virNetDevVPortProfilePtr virtPortProfile; virNetDevBandwidthPtr bandwidth; }; @@ -151,7 +151,7 @@ struct _virNetworkDef { virNetworkIpDefPtr ips; /* ptr to array of IP addresses on this network */ virNetworkDNSDefPtr dns; /* ptr to dns related configuration */ - virVirtualPortProfileParamsPtr virtPortProfile; + virNetDevVPortProfilePtr virtPortProfile; size_t nPortGroups; virPortGroupDefPtr portGroups; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 81de6b4..4bc9217 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -786,9 +786,9 @@ virSocketAddrParseIPv4; virSocketAddrParseIPv6; virSocketAddrPrefixToNetmask; virSocketAddrSetPort; -virVirtualPortProfileEqual; -virVirtualPortProfileFormat; -virVirtualPortProfileParseXML; +virNetDevVPortProfileEqual; +virNetDevVPortProfileFormat; +virNetDevVPortProfileParse; # network_conf.h diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index d213642..b297f47 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -2765,7 +2765,7 @@ networkAllocateActualDevice(virDomainNetDefPtr iface) (netdef->forwardType == VIR_NETWORK_FORWARD_PRIVATE) || (netdef->forwardType == VIR_NETWORK_FORWARD_VEPA) || (netdef->forwardType == VIR_NETWORK_FORWARD_PASSTHROUGH)) { - virVirtualPortProfileParamsPtr virtport = NULL; + virNetDevVPortProfilePtr virtport = NULL; /* <forward type='bridge|private|vepa|passthrough'> are all * VIR_DOMAIN_NET_TYPE_DIRECT. @@ -2837,7 +2837,7 @@ networkAllocateActualDevice(virDomainNetDefPtr iface) ((netdef->forwardType == VIR_NETWORK_FORWARD_PRIVATE) && iface->data.network.actual->data.direct.virtPortProfile && (iface->data.network.actual->data.direct.virtPortProfile->virtPortType - == VIR_VIRTUALPORT_8021QBH))) { + == VIR_NETDEV_VPORT_PROFILE_8021QBH))) { /* pick first dev with 0 usageCount */ for (ii = 0; ii < netdef->nForwardIfs; ii++) { @@ -2964,7 +2964,7 @@ networkNotifyActualDevice(virDomainNetDefPtr iface) ((netdef->forwardType == VIR_NETWORK_FORWARD_PRIVATE) && iface->data.network.actual->data.direct.virtPortProfile && (iface->data.network.actual->data.direct.virtPortProfile->virtPortType - == VIR_VIRTUALPORT_8021QBH)))) { + == VIR_NETDEV_VPORT_PROFILE_8021QBH)))) { networkReportError(VIR_ERR_INTERNAL_ERROR, _("network '%s' claims dev='%s' is already in use by a different domain"), netdef->name, actualDev); diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index fb95ab1..ab26e57 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1238,7 +1238,7 @@ int qemuDomainChangeNet(struct qemud_driver *driver, case VIR_DOMAIN_NET_TYPE_NETWORK: if (STRNEQ_NULLABLE(olddev->data.network.name, dev->data.network.name) || STRNEQ_NULLABLE(olddev->data.network.portgroup, dev->data.network.portgroup) || - !virVirtualPortProfileEqual(olddev->data.network.virtPortProfile, dev->data.network.virtPortProfile)) { + !virNetDevVPortProfileEqual(olddev->data.network.virtPortProfile, dev->data.network.virtPortProfile)) { qemuReportError(VIR_ERR_NO_SUPPORT, _("cannot modify network device configuration")); return -1; @@ -1257,7 +1257,7 @@ int qemuDomainChangeNet(struct qemud_driver *driver, case VIR_DOMAIN_NET_TYPE_DIRECT: if (STRNEQ_NULLABLE(olddev->data.direct.linkdev, dev->data.direct.linkdev) || olddev->data.direct.mode != dev->data.direct.mode || - !virVirtualPortProfileEqual(olddev->data.direct.virtPortProfile, dev->data.direct.virtPortProfile)) { + !virNetDevVPortProfileEqual(olddev->data.direct.virtPortProfile, dev->data.direct.virtPortProfile)) { qemuReportError(VIR_ERR_NO_SUPPORT, _("cannot modify direct network device configuration")); return -1; diff --git a/src/util/macvtap.c b/src/util/macvtap.c index cb13d2b..71243b8 100644 --- a/src/util/macvtap.c +++ b/src/util/macvtap.c @@ -89,7 +89,7 @@ VIR_ENUM_IMPL(virMacvtapMode, VIR_MACVTAP_MODE_LAST, # define LLDPAD_PID_FILE "/var/run/lldpad.pid" -enum virVirtualPortOp { +enum virNetDevVPortOp { ASSOCIATE = 0x1, DISASSOCIATE = 0x2, PREASSOCIATE = 0x3, @@ -267,7 +267,7 @@ openMacvtapTap(const char *tgifname, enum virMacvtapMode mode, int vnet_hdr, const unsigned char *vmuuid, - virVirtualPortProfileParamsPtr virtPortProfile, + virNetDevVPortProfilePtr virtPortProfile, char **res_ifname, enum virVMOperationType vmOp, char *stateDir, @@ -404,7 +404,7 @@ delMacvtap(const char *ifname, const unsigned char *macaddr, const char *linkdev, int mode, - virVirtualPortProfileParamsPtr virtPortProfile, + virNetDevVPortProfilePtr virtPortProfile, char *stateDir) { if (mode == VIR_MACVTAP_MODE_PASSTHRU) { @@ -866,8 +866,8 @@ getPhysdevAndVlan(const char *ifname, int *root_ifindex, char *root_ifname, static int doPortProfileOp8021Qbg(const char *ifname, const unsigned char *macaddr, - const virVirtualPortProfileParamsPtr virtPort, - enum virVirtualPortOp virtPortOp) + const virNetDevVPortProfilePtr virtPort, + enum virNetDevVPortOp virtPortOp) { int rc = 0; @@ -983,9 +983,9 @@ err_exit: static int doPortProfileOp8021Qbh(const char *ifname, const unsigned char *macaddr, - const virVirtualPortProfileParamsPtr virtPort, + const virNetDevVPortProfilePtr virtPort, const unsigned char *vm_uuid, - enum virVirtualPortOp virtPortOp) + enum virNetDevVPortOp virtPortOp) { int rc = 0; @@ -1097,7 +1097,7 @@ int vpAssociatePortProfileId(const char *macvtap_ifname, const unsigned char *macvtap_macaddr, const char *linkdev, - const virVirtualPortProfileParamsPtr virtPort, + const virNetDevVPortProfilePtr virtPort, const unsigned char *vmuuid, enum virVMOperationType vmOp) { @@ -1112,11 +1112,11 @@ vpAssociatePortProfileId(const char *macvtap_ifname, return 0; switch (virtPort->virtPortType) { - case VIR_VIRTUALPORT_NONE: - case VIR_VIRTUALPORT_TYPE_LAST: + case VIR_NETDEV_VPORT_PROFILE_NONE: + case VIR_NETDEV_VPORT_PROFILE_LAST: break; - case VIR_VIRTUALPORT_8021QBG: + case VIR_NETDEV_VPORT_PROFILE_8021QBG: rc = doPortProfileOp8021Qbg(macvtap_ifname, macvtap_macaddr, virtPort, (vmOp == VIR_VM_OP_MIGRATE_IN_START) @@ -1124,7 +1124,7 @@ vpAssociatePortProfileId(const char *macvtap_ifname, : ASSOCIATE); break; - case VIR_VIRTUALPORT_8021QBH: + case VIR_NETDEV_VPORT_PROFILE_8021QBH: rc = doPortProfileOp8021Qbh(linkdev, macvtap_macaddr, virtPort, vmuuid, (vmOp == VIR_VM_OP_MIGRATE_IN_START) @@ -1154,7 +1154,7 @@ int vpDisassociatePortProfileId(const char *macvtap_ifname, const unsigned char *macvtap_macaddr, const char *linkdev, - const virVirtualPortProfileParamsPtr virtPort, + const virNetDevVPortProfilePtr virtPort, enum virVMOperationType vmOp) { int rc = 0; @@ -1168,16 +1168,16 @@ vpDisassociatePortProfileId(const char *macvtap_ifname, return 0; switch (virtPort->virtPortType) { - case VIR_VIRTUALPORT_NONE: - case VIR_VIRTUALPORT_TYPE_LAST: + case VIR_NETDEV_VPORT_PROFILE_NONE: + case VIR_NETDEV_VPORT_PROFILE_LAST: break; - case VIR_VIRTUALPORT_8021QBG: + case VIR_NETDEV_VPORT_PROFILE_8021QBG: rc = doPortProfileOp8021Qbg(macvtap_ifname, macvtap_macaddr, virtPort, DISASSOCIATE); break; - case VIR_VIRTUALPORT_8021QBH: + case VIR_NETDEV_VPORT_PROFILE_8021QBH: /* avoid disassociating twice */ if (vmOp == VIR_VM_OP_MIGRATE_IN_FINISH) break; @@ -1190,7 +1190,7 @@ vpDisassociatePortProfileId(const char *macvtap_ifname, return rc; } -#endif /* WITH_MACVTAP || WITH_VIRTUALPORT */ +#endif /* WITH_MACVTAP || WITH_NETDEV_VPORT_PROFILE */ VIR_ENUM_IMPL(virVMOperation, VIR_VM_OP_LAST, "create", diff --git a/src/util/macvtap.h b/src/util/macvtap.h index 330e5e2..d685ab9 100644 --- a/src/util/macvtap.h +++ b/src/util/macvtap.h @@ -59,7 +59,7 @@ int openMacvtapTap(const char *ifname, enum virMacvtapMode mode, int vnet_hdr, const unsigned char *vmuuid, - virVirtualPortProfileParamsPtr virtPortProfile, + virNetDevVPortProfilePtr virtPortProfile, char **res_ifname, enum virVMOperationType vmop, char *stateDir, @@ -69,20 +69,20 @@ void delMacvtap(const char *ifname, const unsigned char *macaddress, const char *linkdev, int mode, - virVirtualPortProfileParamsPtr virtPortProfile, + virNetDevVPortProfilePtr virtPortProfile, char *stateDir); int vpAssociatePortProfileId(const char *macvtap_ifname, const unsigned char *macvtap_macaddr, const char *linkdev, - const virVirtualPortProfileParamsPtr virtPort, + const virNetDevVPortProfilePtr virtPort, const unsigned char *vmuuid, enum virVMOperationType vmOp); int vpDisassociatePortProfileId(const char *macvtap_ifname, const unsigned char *macvtap_macaddr, const char *linkdev, - const virVirtualPortProfileParamsPtr virtPort, + const virNetDevVPortProfilePtr virtPort, enum virVMOperationType vmOp); # endif /* WITH_MACVTAP */ diff --git a/src/util/network.c b/src/util/network.c index 1ecbce3..f7f5d6c 100644 --- a/src/util/network.c +++ b/src/util/network.c @@ -679,14 +679,14 @@ error: /* virtualPortProfile utilities */ -VIR_ENUM_IMPL(virVirtualPort, VIR_VIRTUALPORT_TYPE_LAST, +VIR_ENUM_IMPL(virNetDevVPort, VIR_NETDEV_VPORT_PROFILE_LAST, "none", "802.1Qbg", "802.1Qbh") int -virVirtualPortProfileParseXML(xmlNodePtr node, - virVirtualPortProfileParamsPtr *def) +virNetDevVPortProfileParse(xmlNodePtr node, + virNetDevVPortProfilePtr *def) { int ret = -1; char *virtPortType; @@ -695,7 +695,7 @@ virVirtualPortProfileParseXML(xmlNodePtr node, char *virtPortTypeIDVersion = NULL; char *virtPortInstanceID = NULL; char *virtPortProfileID = NULL; - virVirtualPortProfileParamsPtr virtPort = NULL; + virNetDevVPortProfilePtr virtPort = NULL; xmlNodePtr cur = node->children; if (VIR_ALLOC(virtPort) < 0) { @@ -725,11 +725,11 @@ virVirtualPortProfileParseXML(xmlNodePtr node, cur = cur->next; } - virtPort->virtPortType = VIR_VIRTUALPORT_NONE; + virtPort->virtPortType = VIR_NETDEV_VPORT_PROFILE_NONE; - switch (virVirtualPortTypeFromString(virtPortType)) { + switch (virNetDevVPortTypeFromString(virtPortType)) { - case VIR_VIRTUALPORT_8021QBG: + case VIR_NETDEV_VPORT_PROFILE_8021QBG: if (virtPortManagerID != NULL && virtPortTypeID != NULL && virtPortTypeIDVersion != NULL) { unsigned int val; @@ -791,7 +791,7 @@ virVirtualPortProfileParseXML(xmlNodePtr node, } } - virtPort->virtPortType = VIR_VIRTUALPORT_8021QBG; + virtPort->virtPortType = VIR_NETDEV_VPORT_PROFILE_8021QBG; } else { virSocketError(VIR_ERR_XML_ERROR, "%s", @@ -800,11 +800,11 @@ virVirtualPortProfileParseXML(xmlNodePtr node, } break; - case VIR_VIRTUALPORT_8021QBH: + case VIR_NETDEV_VPORT_PROFILE_8021QBH: if (virtPortProfileID != NULL) { if (virStrcpyStatic(virtPort->u.virtPort8021Qbh.profileID, virtPortProfileID) != NULL) { - virtPort->virtPortType = VIR_VIRTUALPORT_8021QBH; + virtPort->virtPortType = VIR_NETDEV_VPORT_PROFILE_8021QBH; } else { virSocketError(VIR_ERR_XML_ERROR, "%s", _("profileid parameter too long")); @@ -819,8 +819,8 @@ virVirtualPortProfileParseXML(xmlNodePtr node, default: - case VIR_VIRTUALPORT_NONE: - case VIR_VIRTUALPORT_TYPE_LAST: + case VIR_NETDEV_VPORT_PROFILE_NONE: + case VIR_NETDEV_VPORT_PROFILE_LAST: virSocketError(VIR_ERR_XML_ERROR, "%s", _("unknown virtualport type")); goto error; @@ -843,7 +843,7 @@ error: } bool -virVirtualPortProfileEqual(virVirtualPortProfileParamsPtr a, virVirtualPortProfileParamsPtr b) +virNetDevVPortProfileEqual(virNetDevVPortProfilePtr a, virNetDevVPortProfilePtr b) { /* NULL resistant */ if (!a && !b) @@ -856,10 +856,10 @@ virVirtualPortProfileEqual(virVirtualPortProfileParamsPtr a, virVirtualPortProfi return false; switch (a->virtPortType) { - case VIR_VIRTUALPORT_NONE: + case VIR_NETDEV_VPORT_PROFILE_NONE: break; - case VIR_VIRTUALPORT_8021QBG: + case VIR_NETDEV_VPORT_PROFILE_8021QBG: if (a->u.virtPort8021Qbg.managerID != b->u.virtPort8021Qbg.managerID || a->u.virtPort8021Qbg.typeID != b->u.virtPort8021Qbg.typeID || a->u.virtPort8021Qbg.typeIDVersion != b->u.virtPort8021Qbg.typeIDVersion || @@ -867,7 +867,7 @@ virVirtualPortProfileEqual(virVirtualPortProfileParamsPtr a, virVirtualPortProfi return false; break; - case VIR_VIRTUALPORT_8021QBH: + case VIR_NETDEV_VPORT_PROFILE_8021QBH: if (STRNEQ(a->u.virtPort8021Qbh.profileID, b->u.virtPort8021Qbh.profileID)) return false; break; @@ -880,23 +880,23 @@ virVirtualPortProfileEqual(virVirtualPortProfileParamsPtr a, virVirtualPortProfi } void -virVirtualPortProfileFormat(virBufferPtr buf, - virVirtualPortProfileParamsPtr virtPort) +virNetDevVPortProfileFormat(virNetDevVPortProfilePtr virtPort, + virBufferPtr buf) { char uuidstr[VIR_UUID_STRING_BUFLEN]; - if (!virtPort || virtPort->virtPortType == VIR_VIRTUALPORT_NONE) + if (!virtPort || virtPort->virtPortType == VIR_NETDEV_VPORT_PROFILE_NONE) return; virBufferAsprintf(buf, "<virtualport type='%s'>\n", - virVirtualPortTypeToString(virtPort->virtPortType)); + virNetDevVPortTypeToString(virtPort->virtPortType)); switch (virtPort->virtPortType) { - case VIR_VIRTUALPORT_NONE: - case VIR_VIRTUALPORT_TYPE_LAST: + case VIR_NETDEV_VPORT_PROFILE_NONE: + case VIR_NETDEV_VPORT_PROFILE_LAST: break; - case VIR_VIRTUALPORT_8021QBG: + case VIR_NETDEV_VPORT_PROFILE_8021QBG: virUUIDFormat(virtPort->u.virtPort8021Qbg.instanceID, uuidstr); virBufferAsprintf(buf, @@ -908,7 +908,7 @@ virVirtualPortProfileFormat(virBufferPtr buf, uuidstr); break; - case VIR_VIRTUALPORT_8021QBH: + case VIR_NETDEV_VPORT_PROFILE_8021QBH: virBufferAsprintf(buf, " <parameters profileid='%s'/>\n", virtPort->u.virtPort8021Qbh.profileID); diff --git a/src/util/network.h b/src/util/network.h index 1f3a53f..c3ab623 100644 --- a/src/util/network.h +++ b/src/util/network.h @@ -114,21 +114,21 @@ int virSocketAddrPrefixToNetmask(unsigned int prefix, # define LIBVIRT_IFLA_VF_PORT_PROFILE_MAX 40 # endif -enum virVirtualPortType { - VIR_VIRTUALPORT_NONE, - VIR_VIRTUALPORT_8021QBG, - VIR_VIRTUALPORT_8021QBH, +enum virNetDevVPortProfile { + VIR_NETDEV_VPORT_PROFILE_NONE, + VIR_NETDEV_VPORT_PROFILE_8021QBG, + VIR_NETDEV_VPORT_PROFILE_8021QBH, - VIR_VIRTUALPORT_TYPE_LAST, + VIR_NETDEV_VPORT_PROFILE_LAST, }; -VIR_ENUM_DECL(virVirtualPort) +VIR_ENUM_DECL(virNetDevVPort) /* profile data for macvtap (VEPA) */ -typedef struct _virVirtualPortProfileParams virVirtualPortProfileParams; -typedef virVirtualPortProfileParams *virVirtualPortProfileParamsPtr; -struct _virVirtualPortProfileParams { - enum virVirtualPortType virtPortType; +typedef struct _virNetDevVPortProfile virNetDevVPortProfile; +typedef virNetDevVPortProfile *virNetDevVPortProfilePtr; +struct _virNetDevVPortProfile { + enum virNetDevVPortProfile virtPortType; union { struct { uint8_t managerID; @@ -143,14 +143,15 @@ struct _virVirtualPortProfileParams { }; int -virVirtualPortProfileParseXML(xmlNodePtr node, - virVirtualPortProfileParamsPtr *virtPort); +virNetDevVPortProfileParse(xmlNodePtr node, + virNetDevVPortProfilePtr *def); + void -virVirtualPortProfileFormat(virBufferPtr buf, - virVirtualPortProfileParamsPtr virtPort); +virNetDevVPortProfileFormat(virNetDevVPortProfilePtr virtPort, + virBufferPtr buf); -bool virVirtualPortProfileEqual(virVirtualPortProfileParamsPtr a, - virVirtualPortProfileParamsPtr b); +bool virNetDevVPortProfileEqual(virNetDevVPortProfilePtr a, + virNetDevVPortProfilePtr b); virNetDevBandwidthPtr virNetDevBandwidthParse(xmlNodePtr node) ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK; -- 1.7.6.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list