Skip to content

Commit

Permalink
tools/virtiofsd: add G_GNUC_PRINTF for logging functions
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20221219130205.687815-4-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
berrange authored and bonzini committed Jan 11, 2023
1 parent d62449d commit e441835
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions tools/virtiofsd/fuse_log.c
Expand Up @@ -12,6 +12,7 @@
#include "fuse_log.h"


G_GNUC_PRINTF(2, 0)
static void default_log_func(__attribute__((unused)) enum fuse_log_level level,
const char *fmt, va_list ap)
{
Expand Down
6 changes: 4 additions & 2 deletions tools/virtiofsd/fuse_log.h
Expand Up @@ -45,7 +45,8 @@ enum fuse_log_level {
* @param ap format string arguments
*/
typedef void (*fuse_log_func_t)(enum fuse_log_level level, const char *fmt,
va_list ap);
va_list ap)
G_GNUC_PRINTF(2, 0);

/**
* Install a custom log handler function.
Expand All @@ -68,6 +69,7 @@ void fuse_set_log_func(fuse_log_func_t func);
* @param level severity level (FUSE_LOG_ERR, FUSE_LOG_DEBUG, etc)
* @param fmt sprintf-style format string including newline
*/
void fuse_log(enum fuse_log_level level, const char *fmt, ...);
void fuse_log(enum fuse_log_level level, const char *fmt, ...)
G_GNUC_PRINTF(2, 3);

#endif /* FUSE_LOG_H_ */
1 change: 1 addition & 0 deletions tools/virtiofsd/passthrough_ll.c
Expand Up @@ -4182,6 +4182,7 @@ static void setup_nofile_rlimit(unsigned long rlimit_nofile)
}
}

G_GNUC_PRINTF(2, 0)
static void log_func(enum fuse_log_level level, const char *fmt, va_list ap)
{
g_autofree char *localfmt = NULL;
Expand Down

0 comments on commit e441835

Please sign in to comment.