[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 1/9] util/error: Introduce warn_report_once_err()
From: |
Cédric Le Goater |
Subject: |
[PATCH v2 1/9] util/error: Introduce warn_report_once_err() |
Date: |
Thu, 30 Jan 2025 14:43:38 +0100 |
Depending on the configuration, a passthrough device may produce
recurring DMA mapping errors at runtime and produce a lot of
output. It is useful to report only once.
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
include/qapi/error.h | 5 +++++
util/error.c | 9 +++++++++
2 files changed, 14 insertions(+)
diff --git a/include/qapi/error.h b/include/qapi/error.h
index
71f8fb2c50eee9a544992d0c05263c9793956fe1..b6ea274882b9788b64d4bb213c3458d7c674a881
100644
--- a/include/qapi/error.h
+++ b/include/qapi/error.h
@@ -448,6 +448,11 @@ void error_free_or_abort(Error **errp);
*/
void warn_report_err(Error *err);
+/*
+ * Convenience function to call warn_report_err() once.
+ */
+void warn_report_once_err(Error *err);
+
/*
* Convenience function to error_report() and free @err.
* The report includes hints added with error_append_hint().
diff --git a/util/error.c b/util/error.c
index
e5e247209a9e0796074a9794f5598325f22f8d35..b8a211cccaa609a93091b86316144a0ad0a02662
100644
--- a/util/error.c
+++ b/util/error.c
@@ -247,6 +247,15 @@ void warn_report_err(Error *err)
error_free(err);
}
+void warn_report_once_err(Error *err)
+{
+ static bool print_once_;
+ if (!print_once_) {
+ warn_report_err(err);
+ print_once_ = true;
+ }
+}
+
void error_reportf_err(Error *err, const char *fmt, ...)
{
va_list ap;
--
2.48.1
- [PATCH v2 0/9]vfio: Improve error reporting when MMIO region mapping fails, Cédric Le Goater, 2025/01/30
- [PATCH v2 2/9] vfio/pci: Replace "iommu_device" by "vIOMMU", Cédric Le Goater, 2025/01/30
- [PATCH v2 3/9] vfio: Rephrase comment in vfio_listener_region_add() error path, Cédric Le Goater, 2025/01/30
- [PATCH v2 5/9] vfio: Improve error reporting when MMIO region mapping fails, Cédric Le Goater, 2025/01/30
- [PATCH v2 6/9] vfio: Remove reports of DMA mapping errors in backends, Cédric Le Goater, 2025/01/30
- [PATCH v2 4/9] vfio: Introduce vfio_get_vfio_device(), Cédric Le Goater, 2025/01/30