[PATCH] util: re-add conditional for ifi_iqdrops field for macOS

Daniel P. Berrangé posted 1 patch 3 years, 7 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20200904101957.734173-1-berrange@redhat.com
src/util/virnetdevtap.c | 8 ++++++++
1 file changed, 8 insertions(+)
[PATCH] util: re-add conditional for ifi_iqdrops field for macOS
Posted by Daniel P. Berrangé 3 years, 7 months ago
The conditional was removed in

  commit ebbf8ebe4fa6f9d43b40673f0f2dad6bf50e2085
  Author: Ján Tomko <jtomko@redhat.com>
  Date:   Tue Sep 1 22:56:37 2020 +0200

    util: virnetdevtap: stats: fix txdrop on FreeBSD

That commit was correct about this no longer being required for FreeBSD,
but missed that the code is also built on macOS.

Rather than testing for this field in meson though, we can simply use
a platform conditional test in the code.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---

Pushed to fix macOS CI build jobs

 src/util/virnetdevtap.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c
index cc6f254aa1..ab5959c646 100644
--- a/src/util/virnetdevtap.c
+++ b/src/util/virnetdevtap.c
@@ -974,12 +974,20 @@ virNetDevTapInterfaceStats(const char *ifname,
                 stats->rx_bytes = ifd->ifi_obytes;
                 stats->rx_packets = ifd->ifi_opackets;
                 stats->rx_errs = ifd->ifi_oerrors;
+# ifndef __APPLE__
                 stats->rx_drop = ifd->ifi_oqdrops;
+# else
+                stats->rx_drop = 0;
+# endif
             } else {
                 stats->tx_bytes = ifd->ifi_obytes;
                 stats->tx_packets = ifd->ifi_opackets;
                 stats->tx_errs = ifd->ifi_oerrors;
+# ifndef __APPLE__
                 stats->tx_drop = ifd->ifi_oqdrops;
+# else
+                stats->tx_drop = 0;
+# endif
                 stats->rx_bytes = ifd->ifi_ibytes;
                 stats->rx_packets = ifd->ifi_ipackets;
                 stats->rx_errs = ifd->ifi_ierrors;
-- 
2.26.2

Re: [PATCH] util: re-add conditional for ifi_iqdrops field for macOS
Posted by Ján Tomko 3 years, 7 months ago
On a Friday in 2020, Daniel P. Berrangé wrote:
>The conditional was removed in
>
>  commit ebbf8ebe4fa6f9d43b40673f0f2dad6bf50e2085
>  Author: Ján Tomko <jtomko@redhat.com>
>  Date:   Tue Sep 1 22:56:37 2020 +0200
>
>    util: virnetdevtap: stats: fix txdrop on FreeBSD
>
>That commit was correct about this no longer being required for FreeBSD,
>but missed that the code is also built on macOS.
>
>Rather than testing for this field in meson though, we can simply use
>a platform conditional test in the code.
>
>Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
>---
>
>Pushed to fix macOS CI build jobs
>

Thank you.

Jano

> src/util/virnetdevtap.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>