From 0da763d22e73c7ac951554117b1e8c751fda6065 Mon Sep 17 00:00:00 2001 From: Tokunori Ikegami Date: Wed, 3 Jun 2026 01:03:33 +0900 Subject: [PATCH] nvme: call nvme_show_finish by closing transport handle Since previously done by closing device for the debug log level. But currently only calls nvme_show_init by opening tranceport handle. Signed-off-by: Tokunori Ikegami --- nvme.c | 8 ++++++++ nvme.h | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/nvme.c b/nvme.c index 81acc38c67..956dd07470 100644 --- a/nvme.c +++ b/nvme.c @@ -337,6 +337,14 @@ static int get_transport_handle(struct libnvme_global_ctx *ctx, int argc, return ret; } +void put_transport_handle(struct libnvme_transport_handle *hdl) +{ + libnvme_close(hdl); + + if (log_level >= LIBNVME_LOG_DEBUG) + nvme_show_finish(); +} + static int parse_args(int argc, char *argv[], const char *desc, struct argconfig_commandline_options *opts) { diff --git a/nvme.h b/nvme.h index d6efd5c575..926546d119 100644 --- a/nvme.h +++ b/nvme.h @@ -135,9 +135,11 @@ int parse_and_open(struct libnvme_global_ctx **ctx, struct libnvme_transport_handle **hdl, int argc, char **argv, const char *desc, struct argconfig_commandline_options *clo); +void put_transport_handle(struct libnvme_transport_handle *hdl); + // TODO: unsure if we need a double ptr here -static inline DEFINE_CLEANUP_FUNC( - cleanup_nvme_transport_handle, struct libnvme_transport_handle *, libnvme_close) +static inline DEFINE_CLEANUP_FUNC(cleanup_nvme_transport_handle, + struct libnvme_transport_handle *, put_transport_handle) #define __cleanup_nvme_transport_handle __cleanup(cleanup_nvme_transport_handle) extern const char *uuid_index;