2023-11-16 17:44:01 -07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
/*
|
|
|
|
* Copyright 2023 Red Hat
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "permassert.h"
|
|
|
|
|
|
|
|
#include "errors.h"
|
|
|
|
#include "logger.h"
|
|
|
|
|
2024-02-27 22:00:45 -07:00
|
|
|
int vdo_assertion_failed(const char *expression_string, const char *file_name,
|
2023-11-16 17:44:01 -07:00
|
|
|
int line_number, const char *format, ...)
|
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
va_start(args, format);
|
|
|
|
|
2024-02-14 08:22:04 -07:00
|
|
|
vdo_log_embedded_message(VDO_LOG_ERR, VDO_LOGGING_MODULE_NAME, "assertion \"",
|
2023-11-16 17:44:01 -07:00
|
|
|
format, args, "\" (%s) failed at %s:%d",
|
|
|
|
expression_string, file_name, line_number);
|
2024-02-14 08:22:04 -07:00
|
|
|
vdo_log_backtrace(VDO_LOG_ERR);
|
2023-11-16 17:44:01 -07:00
|
|
|
|
|
|
|
va_end(args);
|
|
|
|
|
|
|
|
return UDS_ASSERTION_FAILED;
|
|
|
|
}
|