Skip to content

Commit e80be76

Browse files
committed
[WIP] tree: get global context from handle
The transport handle always contains the global context, thus there is no need to walk the tree to access the host. TODO: the handle might not be present because during discovering we don't have a transport handle yet. Thus we should have a global context pointer per object? Signed-off-by: Daniel Wagner <[email protected]>
1 parent c16be1f commit e80be76

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

libnvme/src/nvme/private.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,8 @@ __nvme_msg(struct nvme_global_ctx *ctx, int level, const char *func, const char
424424
#define nvme_msg(ctx, level, format, ...) \
425425
__nvme_msg(ctx, level, __nvme_log_func, format, ##__VA_ARGS__)
426426

427-
#define ctx_from_ctrl(c) ((c)->s && (c)->s->h ? (c)->s->h->ctx : NULL)
428-
#define ctx_from_ns(n) ((n)->s && (n)->s->h ? (n)->s->h->ctx : \
429-
(n)->c && (n)->c->s && (n)->c->s->h ? (n)->c->s->h->ctx : \
430-
NULL)
427+
#define ctx_from_ctrl(c) ((c)->hdl->ctx)
428+
#define ctx_from_ns(n) ((n)->hdl->ctx)
431429

432430
/* mi internal headers */
433431

0 commit comments

Comments
 (0)