permassert.c 567 B

1234567891011121314151617181920212223242526
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright 2023 Red Hat
  4. */
  5. #include "permassert.h"
  6. #include "errors.h"
  7. #include "logger.h"
  8. int vdo_assertion_failed(const char *expression_string, const char *file_name,
  9. int line_number, const char *format, ...)
  10. {
  11. va_list args;
  12. va_start(args, format);
  13. vdo_log_embedded_message(VDO_LOG_ERR, VDO_LOGGING_MODULE_NAME, "assertion \"",
  14. format, args, "\" (%s) failed at %s:%d",
  15. expression_string, file_name, line_number);
  16. vdo_log_backtrace(VDO_LOG_ERR);
  17. va_end(args);
  18. return UDS_ASSERTION_FAILED;
  19. }