-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 01/04/2014 10:55 AM, Jan Kiszka wrote:
> On 2014-01-03 22:05, Gilles Chanteperdrix wrote:
>>>> Now the question is, do we want to have a macro allowing to fix the
>>>> callbacks signature to compile for both 2.x and forge? Or do you plan to
>>>> stop supporting 2.x for instance for rtnet, when 3.0 is out?
>>>>
>>
>>> I guess RTnet will not be the only affected project.
>>
>> I understand you want to be able to support both API I take it?
>
> Yes, we have to for a certain period. X3-only drivers may just use the
> new API, but those supporting X2 for longer while will require wrappers.
> Those should ideally be placed in some rtdm/compat.h which could then be
> carried by out-of-tree drivers in case the target Xenomai version does
> not provide it.
So, coming back from that discussion, I propose:
#if FORGE
#define RTDM_CONTEXT(name) rtdm_dev_context_t *name
#define RTDM_DEFINE_USER_INFO(name, context) rtdm_user_info_t *name =
rtdm_user_info(context)
#else /* CLASSIC */
#define RTDM_CONTEXT(name) rtdm_dev_context_t *name, rtdm_user_info_t
__user_info __attribute__((unused))
#define RTDM_DEFINE_USER_INFO(name, context) rtdm_user_info_t *name =
__user_info
#endif
So, a callback would be written
ssize_t foo_read(RTDM_CONTEXT(fd), char *__user buf, size_t size)
{
...
}
And if it needs the user_info, it would be:
ssize_t foo_read(RTDM_CONTEXT(fd), char *__user buf, size_t size)
{
RTDM_DEFINE_USER_INFO(user_info, fd);
... user user_info
}
- --
Gilles.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/
iD8DBQFS3Y8nGpcgE6m/fboRAhkwAJ0Wk294Xvky01ZgWSHE6zd1IQ2qhgCeJzWa
3a1ttHg31MfUvvGHILjoAqQ=
=zrcC
-----END PGP SIGNATURE-----
_______________________________________________
Xenomai mailing list
[email protected]
http://www.xenomai.org/mailman/listinfo/xenomai