]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: new internal function to permit silent failure of virNetDevSetMAC()
authorLaine Stump <laine@laine.org>
Thu, 9 Mar 2017 19:04:16 +0000 (14:04 -0500)
committerLaine Stump <laine@laine.org>
Fri, 24 Mar 2017 04:39:08 +0000 (00:39 -0400)
commitf4ef3a71f8abc83771952604d309b39ca3ea64cf
tree81f8baa8e991cc476ee01f7a684d420bee49259d
parent251d179bf2c10c7d7fb594c68f1aac56a9b0d932
util: new internal function to permit silent failure of virNetDevSetMAC()

We will want to allow silent failure of virNetDevSetMAC() in the case
that the SIOSIFHWADDR ioctl fails with errno == EADDRNOTAVAIL. (Yes,
that is very specific, but we really *do* want a logged failure in all
other circumstances, and don't want to duplicate code in the caller
for the other possibilities).

This patch renames the 3 different virNetDevSetMAC() functions to
virNetDevSetMACInternal(), adding a 3rd arg called "quiet" and making
them static (because this extra control will only be needed within
virnetdev.c). A new global virNetDevSetMAC() is defined that calls
whichever of the three *Internal() functions gets compiled with quiet
= false. Callers in virnetdev.c that want to notice a failure with
errno == EADDRNOTAVAIL and retry with a different strategy rather than
immediately failing, can call virNetDevSetMACInternal(..., true).
src/util/virnetdev.c