[PATCH 1/3] Add and use RTEMS_CONTAINER_OF()
Gedare Bloom
gedare at rtems.org
Mon Aug 4 13:59:19 UTC 2014
Thanks, two style comments below.
On Sun, Aug 3, 2014 at 8:45 AM, Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
>
> ---
> cpukit/libblock/src/bdbuf.c | 4 +-
> cpukit/posix/include/rtems/posix/keyimpl.h | 3 ++
> cpukit/posix/src/key.c | 4 +-
> cpukit/posix/src/keyfreememory.c | 8 ++--
> cpukit/posix/src/keygetspecific.c | 4 +-
> cpukit/posix/src/keysetspecific.c | 5 +--
> cpukit/sapi/include/rtems/rbheap.h | 2 +-
> cpukit/sapi/include/rtems/rbtree.h | 10 -----
> cpukit/score/include/rtems/score/basedefs.h | 10 +++++
> cpukit/score/include/rtems/score/mrspimpl.h | 2 +-
> cpukit/score/include/rtems/score/rbtree.h | 14 -------
> .../score/include/rtems/score/scheduleredfimpl.h | 2 +-
> cpukit/score/include/rtems/score/schedulerimpl.h | 2 +-
> cpukit/score/include/rtems/score/threadimpl.h | 18 ++++-----
> cpukit/score/src/resourceiterate.c | 6 +--
> cpukit/score/src/schedulerchangeroot.c | 2 +-
> cpukit/score/src/scheduleredf.c | 4 +-
> cpukit/score/src/threadq.c | 12 +++---
> cpukit/score/src/threadqdequeue.c | 2 +-
> cpukit/score/src/threadqfirst.c | 5 ++-
> testsuites/sptests/sprbtree01/init.c | 44 +++++++++++-----------
> 21 files changed, 72 insertions(+), 91 deletions(-)
>
> diff --git a/cpukit/libblock/src/bdbuf.c b/cpukit/libblock/src/bdbuf.c
> index 31dd289..f215911 100644
> --- a/cpukit/libblock/src/bdbuf.c
> +++ b/cpukit/libblock/src/bdbuf.c
> @@ -3178,8 +3178,8 @@ rtems_bdbuf_read_ahead_task (rtems_task_argument arg)
>
> while ((node = rtems_chain_get_unprotected (chain)) != NULL)
> {
> - rtems_disk_device *dd = (rtems_disk_device *)
> - ((char *) node - offsetof (rtems_disk_device, read_ahead.node));
> + rtems_disk_device *dd =
> + RTEMS_CONTAINER_OF (node, rtems_disk_device, read_ahead.node);
Delete the extra space between OF and (.
> diff --git a/cpukit/score/src/scheduleredf.c b/cpukit/score/src/scheduleredf.c
> index 01b5244..231bc04 100644
> --- a/cpukit/score/src/scheduleredf.c
> +++ b/cpukit/score/src/scheduleredf.c
> @@ -25,9 +25,9 @@ int _Scheduler_EDF_Compare(
> const RBTree_Node* n2
> )
> {
> - Priority_Control value1 = _RBTree_Container_of
> + Priority_Control value1 = RTEMS_CONTAINER_OF
> (n1,Scheduler_EDF_Node,Node)->thread->current_priority;
> - Priority_Control value2 = _RBTree_Container_of
> + Priority_Control value2 = RTEMS_CONTAINER_OF
> (n2,Scheduler_EDF_Node,Node)->thread->current_priority;
>
Fix the whitespace here, by moving the opening parens to after OF?
-Gedare
More information about the devel
mailing list