diff options
author | midipix <writeonce@midipix.org> | 2016-10-24 18:58:58 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-11-10 23:35:51 -0500 |
commit | bc24681ca896900e9b61a2aa6d26b467f038815b (patch) | |
tree | fcef64320cc6da8b864a53f3ddb961502651c362 | |
parent | c9c5f77d90d27819aa63a49264cdb37364c663a5 (diff) | |
download | perk-bc24681ca896900e9b61a2aa6d26b467f038815b.tar.bz2 perk-bc24681ca896900e9b61a2aa6d26b467f038815b.tar.xz |
driver: internals: added the static inlined pe_get_driver_ictx() helper.
-rw-r--r-- | src/internal/perk_driver_impl.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/internal/perk_driver_impl.h b/src/internal/perk_driver_impl.h index 5063fa1..bbd5f44 100644 --- a/src/internal/perk_driver_impl.h +++ b/src/internal/perk_driver_impl.h @@ -44,4 +44,18 @@ struct pe_unit_ctx_impl { struct pe_unit_ctx uctx; }; + +static inline struct pe_driver_ctx_impl * pe_get_driver_ictx( + const struct pe_driver_ctx * dctx) +{ + uintptr_t addr; + + if (dctx) { + addr = (uintptr_t)dctx - offsetof(struct pe_driver_ctx_impl,ctx); + return (struct pe_driver_ctx_impl *)addr; + } + + return 0; +} + #endif |