xref: /linux/drivers/md/dm-vdo/permassert.c (revision 40d269c000bda9fcd276a0412a9cebd3f6e344c5)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright 2023 Red Hat
4  */
5 
6 #include "permassert.h"
7 
8 #include "errors.h"
9 #include "logger.h"
10 
11 int vdo_assertion_failed(const char *expression_string, const char *file_name,
12 			 int line_number, const char *format, ...)
13 {
14 	va_list args;
15 
16 	va_start(args, format);
17 
18 	vdo_log_embedded_message(VDO_LOG_ERR, VDO_LOGGING_MODULE_NAME, "assertion \"",
19 				 format, args, "\" (%s) failed at %s:%d",
20 				 expression_string, file_name, line_number);
21 	vdo_log_backtrace(VDO_LOG_ERR);
22 
23 	va_end(args);
24 
25 	return UDS_ASSERTION_FAILED;
26 }
27