diff --git a/src/libnvme.map b/src/libnvme.map index e8bd9f10..254e8b06 100644 --- a/src/libnvme.map +++ b/src/libnvme.map @@ -1,6 +1,7 @@ # SPDX-License-Identifier: LGPL-2.1-or-later LIBNVME_1.9 { global: + nvme_get_logging_level; nvme_submit_passthru; nvme_submit_passthru64; }; diff --git a/src/nvme/log.c b/src/nvme/log.c index 5a18bb97..8df411cd 100644 --- a/src/nvme/log.c +++ b/src/nvme/log.c @@ -99,6 +99,19 @@ void nvme_init_logging(nvme_root_t r, int lvl, bool log_pid, bool log_tstamp) r->log_timestamp = log_tstamp; } +int nvme_get_logging_level(nvme_root_t r, bool *log_pid, bool *log_tstamp) +{ + if (!r) + r = root; + if (!r) + return DEFAULT_LOGLEVEL; + if (log_pid) + *log_pid = r->log_pid; + if (log_tstamp) + *log_tstamp = r->log_timestamp; + return r->log_level; +} + void nvme_set_root(nvme_root_t r) { root = r; diff --git a/src/nvme/log.h b/src/nvme/log.h index 829b76ab..cd243ea9 100644 --- a/src/nvme/log.h +++ b/src/nvme/log.h @@ -35,6 +35,20 @@ */ void nvme_init_logging(nvme_root_t r, int lvl, bool log_pid, bool log_tstamp); +/** + * nvme_get_logging_level() - Get current logging level + * @r: nvme_root_t context + * @log_pid: Pointer to store a current value of logging of + * the PID flag at (optional). + * @log_tstamp: Pointer to store a current value of logging of + * the timestamp flag at (optional). + * + * Retrieves current values of logging variables. + * + * Return: current log level value or DEFAULT_LOGLEVEL if not initialized. + */ +int nvme_get_logging_level(nvme_root_t r, bool *log_pid, bool *log_tstamp); + /** * nvme_set_root() - Set nvme_root_t context * @r: nvme_root_t context