Module: xenomai-head Branch: master Commit: e1ea047421db1c4008b7073af344477494b3eb2b URL: http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=e1ea047421db1c4008b7073af344477494b3eb2b
Author: Philippe Gerum <r...@xenomai.org> Date: Sat Sep 5 23:47:08 2009 +0200 rtdm: introduce device context <-> private area accessors Introduce rtdm_context_to_private() and rtdm_private_to_context() accessors, returning the private area associated with a device context structure, and conversely. --- include/rtdm/rtdm_driver.h | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/include/rtdm/rtdm_driver.h b/include/rtdm/rtdm_driver.h index 7f1f3f8..ea543c1 100644 --- a/include/rtdm/rtdm_driver.h +++ b/include/rtdm/rtdm_driver.h @@ -405,6 +405,34 @@ struct rtdm_dev_context { char dev_private[0]; }; +/** + * Locate the driver private area associated to a device context structure + * + * @param[in] context Context structure associated with opened device instance + * + * @return The address of the private driver area associated to @a + * context. + */ +static inline void * +rtdm_context_to_private(struct rtdm_dev_context *context) +{ + return (void *)context->dev_private; +} + +/** + * Locate a device context structure from its driver private area + * + * @param[in] dev_private Address of a private context area + * + * @return The address of the device context structure defining @a + * dev_private. + */ +static inline struct rtdm_dev_context * +rtdm_private_to_context(void *dev_private) +{ + return container_of(dev_private, struct rtdm_dev_context, dev_private); +} + struct rtdm_dev_reserved { struct list_head entry; atomic_t refcount; _______________________________________________ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git