Peter Krempa wrote: > On Wed, Apr 22, 2015 at 12:19:51 +0400, Roman Bogorodskiy wrote: > > Build fails on non-Linux systems with this error: > > > > CC util/libvirt_util_la-virnetdev.lo > > util/virnetdev.c:364:1: error: unused function 'virNetDevReplaceMacAddress' [-Werror,-Wunused-function] > > virNetDevReplaceMacAddress(const char *linkdev, > > ^ > > util/virnetdev.c:406:1: error: unused function 'virNetDevRestoreMacAddress' [-Werror,-Wunused-function] > > virNetDevRestoreMacAddress(const char *linkdev, > > ^ > > 2 errors generated. > > > > The virNetDev{Restore,Replace}MacAddress() functions are only used > > by VF-related routines that are available on Linux only. So move these > > functions under the same #ifdef. > > --- > > src/util/virnetdev.c | 176 ++++++++++++++++++++++++++------------------------- > > 1 file changed, 89 insertions(+), 87 deletions(-) > > > > diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c > > index b7ea524..5069064 100644 > > --- a/src/util/virnetdev.c > > +++ b/src/util/virnetdev.c > > @@ -351,93 +351,6 @@ int virNetDevGetMAC(const char *ifname, > > > > > > > > A few too many empty lines will remain here. > > > -/** > > - * virNetDevReplaceMacAddress: > > - * @macaddress: new MAC address for interface > > - * @linkdev: name of interface > > - * @stateDir: directory to store old MAC address > > - * > > - * Returns 0 on success, -1 on failure > > - * > > - */ > > ... > > > +static int > > +virNetDevRestoreMacAddress(const char *linkdev, > > + const char *stateDir) > > +{ > > + int rc = -1; > > + char *oldmacname = NULL; > > + char *macstr = NULL; > > + char *path = NULL; > > + virMacAddr oldmac; > > + > > + if (virAsprintf(&path, "%s/%s", > > + stateDir, > > + linkdev) < 0) > > + return -1; > > + > > + if (virFileReadAll(path, VIR_MAC_STRING_BUFLEN, &macstr) < 0) > > + goto cleanup; > > + > > + if (virMacAddrParse(macstr, &oldmac) != 0) { > > + virReportError(VIR_ERR_INTERNAL_ERROR, > > + _("Cannot parse MAC address from '%s'"), > > + oldmacname); > > + goto cleanup; > > + } > > + > > + /*reset mac and remove file-ignore results*/ > > + rc = virNetDevSetMAC(linkdev, &oldmac); > > + ignore_value(unlink(path)); > > + > > + cleanup: > > + VIR_FREE(macstr); > > + VIR_FREE(path); > > + return rc; > > +} > > + > > + > > + > > And a few too many empty lines are added here. > > > static struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = { > > [IFLA_VF_MAC] = { .type = NLA_UNSPEC, > > .maxlen = sizeof(struct ifla_vf_mac) }, > > ACK, Extra blank lines dropped and pushed. Thanks! Roman Bogorodskiy -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list