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
8 changes: 8 additions & 0 deletions nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
6 changes: 4 additions & 2 deletions nvme.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading