From 0a6a5edadeeef5aba03a0ca5544bc11436832a5a Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Tue, 5 Mar 2024 15:18:01 +0100 Subject: [PATCH] log: move nvme_{set|get}_debug to log.c Let's group all logging related function into one location. Signed-off-by: Daniel Wagner --- src/nvme/ioctl.c | 13 +------------ src/nvme/ioctl.h | 12 ------------ src/nvme/log.c | 11 +++++++++++ src/nvme/log.h | 13 +++++++++++++ 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/nvme/ioctl.c b/src/nvme/ioctl.c index 9090b7e6..04dc8894 100644 --- a/src/nvme/ioctl.c +++ b/src/nvme/ioctl.c @@ -24,8 +24,7 @@ #include "ioctl.h" #include "util.h" - -static bool nvme_debug; +#include "log.h" static int nvme_verify_chr(int fd) { @@ -116,16 +115,6 @@ static void nvme_show_command(struct nvme_passthru_cmd *cmd, int err, struct tim (end.tv_sec - start.tv_sec) * 1000000 + (end.tv_usec - start.tv_usec)); } -void nvme_set_debug(bool debug) -{ - nvme_debug = debug; -} - -bool nvme_get_debug(void) -{ - return nvme_debug; -} - static int nvme_submit_passthru(int fd, unsigned long ioctl_cmd, struct nvme_passthru_cmd *cmd, __u32 *result) { diff --git a/src/nvme/ioctl.h b/src/nvme/ioctl.h index 4a0698fc..f0ae9bb1 100644 --- a/src/nvme/ioctl.h +++ b/src/nvme/ioctl.h @@ -4047,16 +4047,4 @@ int nvme_zns_append(struct nvme_zns_append_args *args); */ int nvme_dim_send(struct nvme_dim_args *args); -/** - * nvme_set_debug - Set NVMe command debugging output - * @debug: true to enable or false to disable - */ -void nvme_set_debug(bool debug); - -/** - * nvme_get_debug - Get NVMe command debugging output - * - * Return: false if disabled or true if enabled. - */ -bool nvme_get_debug(void); #endif /* _LIBNVME_IOCTL_H */ diff --git a/src/nvme/log.c b/src/nvme/log.c index 2ffca3eb..f1a7eaee 100644 --- a/src/nvme/log.c +++ b/src/nvme/log.c @@ -27,6 +27,7 @@ #endif static nvme_root_t root; +static bool nvme_debug; void __attribute__((format(printf, 4, 5))) __nvme_msg(nvme_root_t r, int lvl, @@ -103,3 +104,13 @@ void nvme_set_root(nvme_root_t r) { root = r; } + +void nvme_set_debug(bool debug) +{ + nvme_debug = debug; +} + +bool nvme_get_debug(void) +{ + return nvme_debug; +} diff --git a/src/nvme/log.h b/src/nvme/log.h index 7c345f6b..dea94290 100644 --- a/src/nvme/log.h +++ b/src/nvme/log.h @@ -48,4 +48,17 @@ void nvme_init_logging(nvme_root_t r, int lvl, bool log_pid, bool log_tstamp); */ void nvme_set_root(nvme_root_t r); +/** + * nvme_set_debug - Set NVMe command debugging output + * @debug: true to enable or false to disable + */ +void nvme_set_debug(bool debug); + +/** + * nvme_get_debug - Get NVMe command debugging output + * + * Return: false if disabled or true if enabled. + */ +bool nvme_get_debug(void); + #endif /* _LOG_H */ -- 2.51.0