From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: Xenomai <xenomai@xenomai.org>
Subject: Re: [Xenomai] reworking rtdm
Date: Mon, 20 Jan 2014 22:03:35 +0100 [thread overview]
Message-ID: <52DD8F27.1050008@xenomai.org> (raw)
In-Reply-To: <52C7DAA8.5090506@web.de>
-----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-----
prev parent reply other threads:[~2014-01-20 21:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-27 8:40 [Xenomai] reworking rtdm Gilles Chanteperdrix
2014-01-03 13:55 ` Jan Kiszka
2014-01-03 17:38 ` Gilles Chanteperdrix
2014-01-03 20:17 ` Jan Kiszka
2014-01-03 21:05 ` Gilles Chanteperdrix
2014-01-04 9:55 ` Jan Kiszka
2014-01-20 21:03 ` Gilles Chanteperdrix [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52DD8F27.1050008@xenomai.org \
--to=gilles.chanteperdrix@xenomai.org \
--cc=jan.kiszka@web.de \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.