summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-10-23 22:34:20 -0400
committermidipix <writeonce@midipix.org>2016-11-11 00:22:48 -0500
commit3a9f95ab03988cd1d4755f6da7c9a24b0c9ff121 (patch)
tree6773c89a1744489e395e19b6458dc9fd300c25a9
parenta9007d5c41b587d26634c633068f9ec0fbe2dc87 (diff)
downloadmdso-3a9f95ab03988cd1d4755f6da7c9a24b0c9ff121.tar.bz2
mdso-3a9f95ab03988cd1d4755f6da7c9a24b0c9ff121.tar.xz
driver: internals: added the static inlined mdso_get_driver_ictx() helper.
-rw-r--r--src/internal/mdso_driver_impl.h13
1 files changed, 13 insertions, 0 deletions
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