mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 20:33:54 -06:00
util/error: Introduce warn_report_err_once()
Depending on the configuration of the host and VM, a passthrough device may generate recurring DMA mapping errors at runtime. In such cases, reporting the issue once is sufficient. We have already the warn/error_report_once() routines taking a format and arguments. Using the same design pattern, add a new warning variant taking an 'Error *' parameter. Cc: Markus Armbruster <armbru@redhat.com> Reviewed-by: Alex Williamson <alex.williamson@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Link: https://lore.kernel.org/qemu-devel/20250206131438.1505542-2-clg@redhat.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
7b3d5b84cb
commit
96b339cc4c
2 changed files with 23 additions and 0 deletions
|
@ -466,6 +466,18 @@ void warn_reportf_err(Error *err, const char *fmt, ...)
|
|||
void error_reportf_err(Error *err, const char *fmt, ...)
|
||||
G_GNUC_PRINTF(2, 3);
|
||||
|
||||
/*
|
||||
* Similar to warn_report_err(), except it prints the message just once.
|
||||
* Return true when it prints, false otherwise.
|
||||
*/
|
||||
bool warn_report_err_once_cond(bool *printed, Error *err);
|
||||
|
||||
#define warn_report_err_once(err) \
|
||||
({ \
|
||||
static bool print_once_; \
|
||||
warn_report_err_once_cond(&print_once_, err); \
|
||||
})
|
||||
|
||||
/*
|
||||
* Just like error_setg(), except you get to specify the error class.
|
||||
* Note: use of error classes other than ERROR_CLASS_GENERIC_ERROR is
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue