Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,12 @@ static int open_blkdev_direct(char *dev, int flags, __u32 nsid)

if (blkdev) {
fd = open(blkdev, flags);
print_info("blkdev: %s, fd: %d\n", blkdev, fd);
print_debug("blkdev: %s, fd: %d\n", blkdev, fd);
}

if (fd < 0) {
fd = open(dev, flags);
print_info("dev: %s, fd: %d\n", dev, fd);
print_debug("dev: %s, fd: %d\n", dev, fd);
}

return fd;
Expand Down
14 changes: 10 additions & 4 deletions util/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@

#include <stdbool.h>

#define print_info(...) \
do { \
if (log_level >= LOG_INFO) \
printf(__VA_ARGS__); \
#define print_info(...) \
do { \
if (log_level >= LOG_INFO) \
printf(__VA_ARGS__); \
} while (false)

#define print_debug(...) \
do { \
if (log_level >= LOG_DEBUG) \
printf(__VA_ARGS__); \
} while (false)

extern int log_level;
Expand Down