mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 06:01:23 +00:00
modpost: rework and consolidate logging interface
Rework modpost's logging interface by consolidating merror(), warn(), and fatal() to use a single function, modpost_log(). Introduce different logging levels (WARN, ERROR, FATAL) as well. The purpose of this cleanup is to reduce code duplication when deciding whether or not to warn or error out based on a condition. Signed-off-by: Jessica Yu <jeyu@kernel.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
parent
9dffecc133
commit
93c95e526a
2 changed files with 41 additions and 44 deletions
|
@ -198,6 +198,14 @@ void *grab_file(const char *filename, unsigned long *size);
|
|||
char* get_next_line(unsigned long *pos, void *file, unsigned long size);
|
||||
void release_file(void *file, unsigned long size);
|
||||
|
||||
void fatal(const char *fmt, ...);
|
||||
void warn(const char *fmt, ...);
|
||||
void merror(const char *fmt, ...);
|
||||
enum loglevel {
|
||||
LOG_WARN,
|
||||
LOG_ERROR,
|
||||
LOG_FATAL
|
||||
};
|
||||
|
||||
void modpost_log(enum loglevel loglevel, const char *fmt, ...);
|
||||
|
||||
#define warn(fmt, args...) modpost_log(LOG_WARN, fmt, ##args)
|
||||
#define merror(fmt, args...) modpost_log(LOG_ERROR, fmt, ##args)
|
||||
#define fatal(fmt, args...) modpost_log(LOG_FATAL, fmt, ##args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue