From 3a9f95ab03988cd1d4755f6da7c9a24b0c9ff121 Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 23 Oct 2016 22:34:20 -0400 Subject: driver: internals: added the static inlined mdso_get_driver_ictx() helper. --- src/internal/mdso_driver_impl.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/internal') diff --git a/src/internal/mdso_driver_impl.h b/src/internal/mdso_driver_impl.h index c6131b8..f43b790 100644 --- a/src/internal/mdso_driver_impl.h +++ b/src/internal/mdso_driver_impl.h @@ -46,4 +46,17 @@ struct mdso_unit_ctx_impl { struct mdso_unit_ctx uctx; }; +static inline struct mdso_driver_ctx_impl * mdso_get_driver_ictx( + const struct mdso_driver_ctx * dctx) +{ + uintptr_t addr; + + if (dctx) { + addr = (uintptr_t)dctx - offsetof(struct mdso_driver_ctx_impl,ctx); + return (struct mdso_driver_ctx_impl *)addr; + } + + return 0; +} + #endif -- cgit v1.2.3