linux/drivers/md/dm-vdo/logger.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright 2023 Red Hat
 */

#ifndef VDO_LOGGER_H
#define VDO_LOGGER_H

#include <linux/kern_levels.h>
#include <linux/module.h>
#include <linux/ratelimit.h>
#include <linux/device-mapper.h>

/* Custom logging utilities for UDS */

enum {};

extern int vdo_log_level;

#define DM_MSG_PREFIX
#define VDO_LOGGING_MODULE_NAME

/* Apply a rate limiter to a log method call. */
#define vdo_log_ratelimit(log_fn, ...)

int vdo_get_log_level(void);

void vdo_log_embedded_message(int priority, const char *module, const char *prefix,
			      const char *fmt1, va_list args1, const char *fmt2, ...)
	__printf(4, 0) __printf(6, 7);

void vdo_log_backtrace(int priority);

/* All log functions will preserve the caller's value of errno. */

#define vdo_log_strerror(priority, errnum, ...)

int __vdo_log_strerror(int priority, int errnum, const char *module,
		       const char *format, ...)
	__printf(4, 5);

int vdo_vlog_strerror(int priority, int errnum, const char *module, const char *format,
		      va_list args)
	__printf(4, 0);

/* Log an error prefixed with the string associated with the errnum. */
#define vdo_log_error_strerror(errnum, ...)

#define vdo_log_debug_strerror(errnum, ...)

#define vdo_log_info_strerror(errnum, ...)

#define vdo_log_warning_strerror(errnum, ...)

#define vdo_log_fatal_strerror(errnum, ...)

#define vdo_log_message(priority, ...)

void __vdo_log_message(int priority, const char *module, const char *format, ...)
	__printf(3, 4);

#define vdo_log_debug(...)

#define vdo_log_info(...)

#define vdo_log_warning(...)

#define vdo_log_error(...)

#define vdo_log_fatal(...)

void vdo_pause_for_logger(void);
#endif /* VDO_LOGGER_H */