]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
log: move nvme_{set|get}_debug to log.c
authorDaniel Wagner <dwagner@suse.de>
Tue, 5 Mar 2024 14:18:01 +0000 (15:18 +0100)
committerDaniel Wagner <wagi@monom.org>
Wed, 6 Mar 2024 09:56:14 +0000 (10:56 +0100)
Let's group all logging related function into one location.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
src/nvme/ioctl.c
src/nvme/ioctl.h
src/nvme/log.c
src/nvme/log.h

index 9090b7e6d5ca00e22408e31928fa984c0de1528a..04dc8894ebfc8ba17083be48638dd73b2b4ffd4f 100644 (file)
@@ -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)
 {
index 4a0698fc266485a1c1b38c058528bcb1377240a3..f0ae9bb1c8febfd2e01c801b1f38fb740376368c 100644 (file)
@@ -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 */
index 2ffca3eb93f0963fdc3af75e46dcfcab0ca1faa5..f1a7eaee7cd3acbfaccec469a2f65c32ae045708 100644 (file)
@@ -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;
+}
index 7c345f6bd3937bb2df2786bf20885a8fe6061933..dea942907217a483b8b7e472c4854ea6afd98339 100644 (file)
@@ -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 */