From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> Rename virFormatMacAddr, virGenerateMacAddr and virParseMacAddr to virMacAddrFormat, virMacAddrGenerate and virMacAddrParse respectively --- src/conf/capabilities.c | 2 +- src/conf/domain_audit.c | 6 +++--- src/conf/domain_conf.c | 4 ++-- src/conf/network_conf.c | 8 ++++---- src/conf/nwfilter_conf.c | 2 +- src/libvirt_private.syms | 6 +++--- src/nwfilter/nwfilter_ebiptables_driver.c | 6 +++--- src/nwfilter/nwfilter_gentech_driver.c | 2 +- src/nwfilter/nwfilter_learnipaddr.c | 2 +- src/openvz/openvz_conf.c | 2 +- src/openvz/openvz_driver.c | 4 ++-- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_driver.c | 6 +++--- src/util/util.c | 8 ++++---- src/util/util.h | 6 +++--- src/util/virnetdev.c | 4 ++-- src/vbox/vbox_tmpl.c | 4 ++-- src/vmx/vmx.c | 6 +++--- src/xen/xend_internal.c | 2 +- src/xenapi/xenapi_driver.c | 2 +- src/xenapi/xenapi_utils.c | 2 +- src/xenxs/xen_sxpr.c | 2 +- src/xenxs/xen_xm.c | 2 +- tools/virsh.c | 6 +++--- 24 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index ed0ae99..d44ce1b 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -848,7 +848,7 @@ extern void virCapabilitiesGenerateMac(virCapsPtr caps, unsigned char *mac) { - virGenerateMacAddr(caps->macPrefix, mac); + virMacAddrGenerate(caps->macPrefix, mac); } extern void diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c index eb85ec7..7d766a2 100644 --- a/src/conf/domain_audit.c +++ b/src/conf/domain_audit.c @@ -161,9 +161,9 @@ virDomainAuditNet(virDomainObjPtr vm, virUUIDFormat(vm->def->uuid, uuidstr); if (oldDef) - virFormatMacAddr(oldDef->mac, oldMacstr); + virMacAddrFormat(oldDef->mac, oldMacstr); if (newDef) - virFormatMacAddr(newDef->mac, newMacstr); + virMacAddrFormat(newDef->mac, newMacstr); if (!(vmname = virAuditEncode("vm", vm->def->name))) { VIR_WARN("OOM while encoding audit message"); return; @@ -207,7 +207,7 @@ virDomainAuditNetDevice(virDomainDefPtr vmDef, virDomainNetDefPtr netDef, const char *virt; virUUIDFormat(vmDef->uuid, uuidstr); - virFormatMacAddr(netDef->mac, macstr); + virMacAddrFormat(netDef->mac, macstr); rdev = virDomainAuditGetRdev(device); if (!(vmname = virAuditEncode("vm", vmDef->name)) || diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 978e91c..6551a79 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3810,7 +3810,7 @@ virDomainNetDefParseXML(virCapsPtr caps, } if (macaddr) { - if (virParseMacAddr((const char *)macaddr, def->mac) < 0) { + if (virMacAddrParse((const char *)macaddr, def->mac) < 0) { virDomainReportError(VIR_ERR_INTERNAL_ERROR, _("unable to parse mac address '%s'"), (const char *)macaddr); @@ -13904,7 +13904,7 @@ virDomainNetFind(virDomainDefPtr def, const char *device) unsigned char mac[VIR_MAC_BUFLEN]; int i; - if (virParseMacAddr(device, mac) == 0) + if (virMacAddrParse(device, mac) == 0) isMac = true; if (isMac) { diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index c03ceaf..c65c75c 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -425,7 +425,7 @@ virNetworkDHCPRangeDefParseXML(const char *networkName, mac = virXMLPropString(cur, "mac"); if ((mac != NULL) && - (virParseMacAddr(mac, &addr[0]) != 0)) { + (virMacAddrParse(mac, &addr[0]) != 0)) { virNetworkReportError(VIR_ERR_INTERNAL_ERROR, _("Cannot parse MAC address '%s' in network '%s'"), mac, networkName); @@ -989,7 +989,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt) tmp = virXPathString("string(./mac[1]/@address)", ctxt); if (tmp) { - if (virParseMacAddr(tmp, def->mac) < 0) { + if (virMacAddrParse(tmp, def->mac) < 0) { virNetworkReportError(VIR_ERR_XML_ERROR, _("Invalid bridge mac address '%s' in network '%s'"), tmp, def->name); @@ -1513,7 +1513,7 @@ char *virNetworkDefFormat(const virNetworkDefPtr def, unsigned int flags) if (def->mac_specified) { char macaddr[VIR_MAC_STRING_BUFLEN]; - virFormatMacAddr(def->mac, macaddr); + virMacAddrFormat(def->mac, macaddr); virBufferAsprintf(&buf, " <mac address='%s'/>\n", macaddr); } @@ -1840,7 +1840,7 @@ void virNetworkSetBridgeMacAddr(virNetworkDefPtr def) /* if the bridge doesn't have a mac address explicitly defined, * autogenerate a random one. */ - virGenerateMacAddr((unsigned char[]){ 0x52, 0x54, 0 }, + virMacAddrGenerate((unsigned char[]){ 0x52, 0x54, 0 }, def->mac); def->mac_specified = true; } diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c index e2d8f23..5811592 100644 --- a/src/conf/nwfilter_conf.c +++ b/src/conf/nwfilter_conf.c @@ -1670,7 +1670,7 @@ static int virNWMACAddressParser(const char *input, nwMACAddressPtr output) { - return virParseMacAddr(input, &output->addr[0]); + return virMacAddrParse(input, &output->addr[0]); } diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index e1ee23f..4e50fa8 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1110,8 +1110,6 @@ virFileUnlock; virFileWaitForDevices; virFileWriteStr; virFindFileInPath; -virFormatMacAddr; -virGenerateMacAddr; virGetGroupID; virGetGroupName; virGetHostname; @@ -1123,7 +1121,9 @@ virIndexToDiskName; virIsDevMapperDevice; virKillProcess; virMacAddrCompare; -virParseMacAddr; +virMacAddrFormat; +virMacAddrGenerate; +virMacAddrParse; virParseNumber; virParseVersionString; virPipeReadUntilEOF; diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c index 8ddc2d5..b3b60b4 100644 --- a/src/nwfilter/nwfilter_ebiptables_driver.c +++ b/src/nwfilter/nwfilter_ebiptables_driver.c @@ -303,7 +303,7 @@ _printDataType(virNWFilterVarCombIterPtr vars, return -1; } - virFormatMacAddr(item->u.macaddr.addr, buf); + virMacAddrFormat(item->u.macaddr.addr, buf); break; case DATATYPE_IPV6MASK: @@ -3129,7 +3129,7 @@ ebtablesApplyBasicRules(const char *ifname, return -1; } - virFormatMacAddr(macaddr, macaddr_str); + virMacAddrFormat(macaddr, macaddr_str); ebiptablesAllTeardown(ifname); @@ -3234,7 +3234,7 @@ ebtablesApplyDHCPOnlyRules(const char *ifname, srcIPParam = virBufferContentAndReset(&buf); } - virFormatMacAddr(macaddr, macaddr_str); + virMacAddrFormat(macaddr, macaddr_str); ebiptablesAllTeardown(ifname); diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c index c35b749..fc71e7b 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -831,7 +831,7 @@ __virNWFilterInstantiateFilter(const unsigned char *vmuuid, goto err_exit; } - virFormatMacAddr(macaddr, vmmacaddr); + virMacAddrFormat(macaddr, vmmacaddr); str_macaddr = strdup(vmmacaddr); if (!str_macaddr) { virReportOOMError(); diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c index 93f8f6e..140aea8 100644 --- a/src/nwfilter/nwfilter_learnipaddr.c +++ b/src/nwfilter/nwfilter_learnipaddr.c @@ -511,7 +511,7 @@ learnIPAddressThread(void *arg) goto done; } - virFormatMacAddr(req->macaddr, macaddr); + virMacAddrFormat(req->macaddr, macaddr); switch (req->howDetect) { case DETECT_DHCP: diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index c0517db..28f86ff 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -295,7 +295,7 @@ openvzReadNetworkConf(virDomainDefPtr def, _("MAC address %s too long for destination"), p); goto error; } - if (virParseMacAddr(cpy_temp, net->mac) < 0) { + if (virMacAddrParse(cpy_temp, net->mac) < 0) { openvzError(VIR_ERR_INTERNAL_ERROR, "%s", _("Wrong MAC address")); goto error; diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index b848a88..833a98d 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -763,9 +763,9 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid, ADD_ARG_LIT(vpsid); } - virFormatMacAddr(net->mac, macaddr); + virMacAddrFormat(net->mac, macaddr); virCapabilitiesGenerateMac(driver->caps, host_mac); - virFormatMacAddr(host_mac, host_macaddr); + virMacAddrFormat(host_mac, host_macaddr); if (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE || (net->type == VIR_DOMAIN_NET_TYPE_ETHERNET && diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 7b9328f..9bfbada 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6479,7 +6479,7 @@ qemuParseCommandLineNet(virCapsPtr caps, for (i = 0 ; i < nkeywords ; i++) { if (STREQ(keywords[i], "macaddr")) { genmac = 0; - if (virParseMacAddr(values[i], def->mac) < 0) { + if (virMacAddrParse(values[i], def->mac) < 0) { qemuReportError(VIR_ERR_INTERNAL_ERROR, _("unable to parse mac address '%s'"), values[i]); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ab69dca..196fd23 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5361,7 +5361,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, net = dev->data.net; if (virDomainNetIndexByMac(vmdef, net->mac) >= 0) { char macbuf[VIR_MAC_STRING_BUFLEN]; - virFormatMacAddr(net->mac, macbuf); + virMacAddrFormat(net->mac, macbuf); qemuReportError(VIR_ERR_INVALID_ARG, _("mac %s already exists"), macbuf); return -1; @@ -5422,7 +5422,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, if (virDomainNetRemoveByMac(vmdef, net->mac)) { char macbuf[VIR_MAC_STRING_BUFLEN]; - virFormatMacAddr(net->mac, macbuf); + virMacAddrFormat(net->mac, macbuf); qemuReportError(VIR_ERR_INVALID_ARG, _("no nic of mac %s"), macbuf); return -1; @@ -5496,7 +5496,7 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef, net = dev->data.net; if ((pos = virDomainNetIndexByMac(vmdef, net->mac)) < 0) { char macbuf[VIR_MAC_STRING_BUFLEN]; - virFormatMacAddr(net->mac, macbuf); + virMacAddrFormat(net->mac, macbuf); qemuReportError(VIR_ERR_INVALID_ARG, _("mac %s doesn't exist"), macbuf); return -1; diff --git a/src/util/util.c b/src/util/util.c index f1c3346..28b608d 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -1794,7 +1794,7 @@ virMacAddrCompare (const char *p, const char *q) } /** - * virParseMacAddr: + * virMacAddrParse: * @str: string representation of MAC address, e.g., "0:1E:FC:E:3a:CB" * @addr: 6-byte MAC address * @@ -1803,7 +1803,7 @@ virMacAddrCompare (const char *p, const char *q) * Return 0 upon success, or -1 in case of error. */ int -virParseMacAddr(const char* str, unsigned char *addr) +virMacAddrParse(const char* str, unsigned char *addr) { int i; @@ -1838,7 +1838,7 @@ virParseMacAddr(const char* str, unsigned char *addr) return -1; } -void virFormatMacAddr(const unsigned char *addr, +void virMacAddrFormat(const unsigned char *addr, char *str) { snprintf(str, VIR_MAC_STRING_BUFLEN, @@ -1848,7 +1848,7 @@ void virFormatMacAddr(const unsigned char *addr, str[VIR_MAC_STRING_BUFLEN-1] = '\0'; } -void virGenerateMacAddr(const unsigned char *prefix, +void virMacAddrGenerate(const unsigned char *prefix, unsigned char *addr) { addr[0] = prefix[0]; diff --git a/src/util/util.h b/src/util/util.h index 91cae47..3b31182 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -182,11 +182,11 @@ char *virStrcpy(char *dest, const char *src, size_t destbytes) # define VIR_MAC_PREFIX_BUFLEN 3 # define VIR_MAC_STRING_BUFLEN VIR_MAC_BUFLEN * 3 -int virParseMacAddr(const char* str, +int virMacAddrParse(const char* str, unsigned char *addr) ATTRIBUTE_RETURN_CHECK; -void virFormatMacAddr(const unsigned char *addr, +void virMacAddrFormat(const unsigned char *addr, char *str); -void virGenerateMacAddr(const unsigned char *prefix, +void virMacAddrGenerate(const unsigned char *prefix, unsigned char *addr); int virDiskNameToIndex(const char* str); diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 06c825d..eafb47b 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -264,7 +264,7 @@ virNetDevReplaceMacAddress(const char *linkdev, virReportOOMError(); return -1; } - virFormatMacAddr(oldmac, macstr); + virMacAddrFormat(oldmac, macstr); if (virFileWriteStr(path, macstr, O_CREAT|O_TRUNC|O_WRONLY) < 0) { virReportSystemError(errno, _("Unable to preserve mac for %s"), linkdev); @@ -305,7 +305,7 @@ virNetDevRestoreMacAddress(const char *linkdev, if (virFileReadAll(path, VIR_MAC_STRING_BUFLEN, &macstr) < 0) return -1; - if (virParseMacAddr(macstr, &oldmac[0]) != 0) { + if (virMacAddrParse(macstr, &oldmac[0]) != 0) { virNetDevError(VIR_ERR_INTERNAL_ERROR, _("Cannot parse MAC address from '%s'"), oldmacname); diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index d720432..b168c7d 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -3000,7 +3000,7 @@ sharedFoldersCleanup: MACAddress[8], MACAddress[9], MACAddress[10], MACAddress[11]); /* XXX some real error handling here some day ... */ - if (virParseMacAddr(macaddr, def->nets[netAdpIncCnt]->mac) < 0) + if (virMacAddrParse(macaddr, def->nets[netAdpIncCnt]->mac) < 0) {} netAdpIncCnt++; @@ -4349,7 +4349,7 @@ vboxAttachNetwork(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) char macaddr[VIR_MAC_STRING_BUFLEN] = {0}; char macaddrvbox[VIR_MAC_STRING_BUFLEN - 5] = {0}; - virFormatMacAddr(def->nets[i]->mac, macaddr); + virMacAddrFormat(def->nets[i]->mac, macaddr); snprintf(macaddrvbox, VIR_MAC_STRING_BUFLEN - 5, "%02X%02X%02X%02X%02X%02X", def->nets[i]->mac[0], diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 5ebd92a..1fdbd50 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -2365,7 +2365,7 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def) if (addressType == NULL || STRCASEEQ(addressType, "generated") || STRCASEEQ(addressType, "vpx")) { if (generatedAddress != NULL) { - if (virParseMacAddr(generatedAddress, (*def)->mac) < 0) { + if (virMacAddrParse(generatedAddress, (*def)->mac) < 0) { VMX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Expecting VMX entry '%s' to be MAC address but " "found '%s'"), generatedAddress_name, @@ -2375,7 +2375,7 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def) } } else if (STRCASEEQ(addressType, "static")) { if (address != NULL) { - if (virParseMacAddr(address, (*def)->mac) < 0) { + if (virMacAddrParse(address, (*def)->mac) < 0) { VMX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Expecting VMX entry '%s' to be MAC address but " "found '%s'"), address_name, address); @@ -3557,7 +3557,7 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int controller, } /* def:mac -> vmx:addressType, vmx:(generated)Address, vmx:checkMACAddress */ - virFormatMacAddr(def->mac, mac_string); + virMacAddrFormat(def->mac, mac_string); prefix = (def->mac[0] << 16) | (def->mac[1] << 8) | def->mac[2]; suffix = (def->mac[3] << 16) | (def->mac[4] << 8) | def->mac[5]; diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index 1d8e035..b754eca 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -2713,7 +2713,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml, goto cleanup; char macStr[VIR_MAC_STRING_BUFLEN]; - virFormatMacAddr(dev->data.net->mac, macStr); + virMacAddrFormat(dev->data.net->mac, macStr); if (!(target = strdup(macStr))) { virReportOOMError(); diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c index 68017bc..f877f67 100644 --- a/src/xenapi/xenapi_driver.c +++ b/src/xenapi/xenapi_driver.c @@ -1513,7 +1513,7 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) } xen_vif_get_record(session, &vif_rec, vif); if (vif_rec != NULL) { - if (virParseMacAddr((const char *)vif_rec->mac,defPtr->nets[i]->mac) < 0) + if (virMacAddrParse((const char *)vif_rec->mac,defPtr->nets[i]->mac) < 0) xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, _("Unable to parse given mac address")); xen_vif_record_free(vif_rec); diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c index 79fd946..ddc7736 100644 --- a/src/xenapi/xenapi_utils.c +++ b/src/xenapi/xenapi_utils.c @@ -562,7 +562,7 @@ createVMRecordFromXml (virConnectPtr conn, virDomainDefPtr def, goto error_cleanup; if (def->nets[i]->mac) { char macStr[VIR_MAC_STRING_BUFLEN]; - virFormatMacAddr(def->nets[i]->mac, macStr); + virMacAddrFormat(def->nets[i]->mac, macStr); if (!(mac = strdup(macStr))) { VIR_FREE(bridge); goto error_cleanup; diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c index 04ba5aa..7a53f94 100644 --- a/src/xenxs/xen_sxpr.c +++ b/src/xenxs/xen_sxpr.c @@ -580,7 +580,7 @@ xenParseSxprNets(virDomainDefPtr def, tmp = sexpr_node(node, "device/vif/mac"); if (tmp) { - if (virParseMacAddr(tmp, net->mac) < 0) { + if (virMacAddrParse(tmp, net->mac) < 0) { XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, _("malformed mac address '%s'"), tmp); goto cleanup; diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c index 0aa04f3..a0d4806 100644 --- a/src/xenxs/xen_xm.c +++ b/src/xenxs/xen_xm.c @@ -690,7 +690,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, goto no_memory; if (mac[0]) { - if (virParseMacAddr(mac, net->mac) < 0) { + if (virMacAddrParse(mac, net->mac) < 0) { XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, _("malformed mac address '%s'"), mac); goto cleanup; diff --git a/tools/virsh.c b/tools/virsh.c index 74655c2..9b37dc0 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -1408,7 +1408,7 @@ cmdDomIfSetLink (vshControl *ctl, const vshCmd *cmd) goto cleanup; } - if (virParseMacAddr(iface, macaddr) == 0) { + if (virMacAddrParse(iface, macaddr) == 0) { element = "mac"; attr = "address"; } else { @@ -1566,7 +1566,7 @@ cmdDomIfGetLink (vshControl *ctl, const vshCmd *cmd) goto cleanup; } - if (virParseMacAddr(iface, macaddr) == 0) { + if (virMacAddrParse(iface, macaddr) == 0) { element = "mac"; attr = "address"; } else { @@ -13473,7 +13473,7 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd) if (cur->type == XML_ELEMENT_NODE && xmlStrEqual(cur->name, BAD_CAST "mac")) { char *tmp_mac = virXMLPropString(cur, "address"); - diff_mac = virMacAddrCompare (tmp_mac, mac); + diff_mac = virMacAddrCompare(tmp_mac, mac); VIR_FREE(tmp_mac); if (!diff_mac) { goto hit; -- 1.7.7.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list