[PATCH 7/8] rtems: Remove Message_queue_Control::attribute_set

Joel Sherrill joel at rtems.org
Fri Sep 25 15:42:04 UTC 2020


On Thu, Sep 24, 2020 at 7:13 AM Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

> Add Message_queue_Control::is_global if RTEMS_MULTIPROCESSING is defined.
> This
> reduces the Message_queue_Control size in standard RTEMS configurations.
>
> Update #4007.
> ---
>  cpukit/include/rtems/rtems/messagedata.h |  6 ++++--
>  cpukit/libmisc/monitor/mon-queue.c       | 16 +++++++++++++++-
>  cpukit/rtems/src/msgqcreate.c            | 12 ++++++------
>  cpukit/rtems/src/msgqdelete.c            |  2 +-
>  4 files changed, 26 insertions(+), 10 deletions(-)
>
> diff --git a/cpukit/include/rtems/rtems/messagedata.h
> b/cpukit/include/rtems/rtems/messagedata.h
> index fa1f681473..8c72fba078 100644
> --- a/cpukit/include/rtems/rtems/messagedata.h
> +++ b/cpukit/include/rtems/rtems/messagedata.h
> @@ -40,8 +40,10 @@ typedef struct {
>    Objects_Control             Object;
>    /** This field is the instance of the SuperCore Message Queue. */
>    CORE_message_queue_Control  message_queue;
> -  /** This field is the attribute set as defined by the API. */
> -  rtems_attribute             attribute_set;
> +#if defined(RTEMS_MULTIPROCESSING)
> +  /** This field is true if the message queue is offered globally */
> +  bool                        is_global;
> +#endif
>  }   Message_queue_Control;
>
>  /**
> diff --git a/cpukit/libmisc/monitor/mon-queue.c
> b/cpukit/libmisc/monitor/mon-queue.c
> index 9430797c6c..aadfcd3989 100644
> --- a/cpukit/libmisc/monitor/mon-queue.c
> +++ b/cpukit/libmisc/monitor/mon-queue.c
> @@ -16,7 +16,21 @@ rtems_monitor_queue_canonical(
>  {
>      const Message_queue_Control *rtems_queue = (const
> Message_queue_Control *) queue_void;
>
> -    canonical_queue->attributes = rtems_queue->attribute_set;
> +    canonical_queue->attributes = 0;
> +
> +    if (
> +      rtems_queue->message_queue.operations
> +        == &_Thread_queue_Operations_priority
> +    ) {
>

Why the odd formatting on this? I would think it should be:
   if ( rtems_queue->message_queue.operations ==
          &_Thread_queue_Operations_priority ) {




> +      canonical_queue->attributes |= RTEMS_PRIORITY;
> +    }
> +
> +#if defined(RTEMS_MULTIPROCESSING)
> +    if ( rtems_queue->is_global ) {
> +      canonical_queue->attributes |= RTEMS_GLOBAL;
> +    }
> +#endif
> +
>      canonical_queue->maximum_message_size =
> rtems_queue->message_queue.maximum_message_size;
>      canonical_queue->maximum_pending_messages =
> rtems_queue->message_queue.maximum_pending_messages;
>      canonical_queue->number_of_pending_messages =
> rtems_queue->message_queue.number_of_pending_messages;
> diff --git a/cpukit/rtems/src/msgqcreate.c b/cpukit/rtems/src/msgqcreate.c
> index 79b198199e..20787f00a6 100644
> --- a/cpukit/rtems/src/msgqcreate.c
> +++ b/cpukit/rtems/src/msgqcreate.c
> @@ -53,11 +53,11 @@ rtems_status_code rtems_message_queue_create(
>      return RTEMS_INVALID_ADDRESS;
>
>  #if defined(RTEMS_MULTIPROCESSING)
> -  if ( !_System_state_Is_multiprocessing ) {
> -    attribute_set = _Attributes_Clear( attribute_set, RTEMS_GLOBAL );
> +  if ( _System_state_Is_multiprocessing ) {
> +    is_global = _Attributes_Is_global( attribute_set );
> +  } else {
> +    is_global = false;
>    }
> -
> -  is_global = _Attributes_Is_global( attribute_set );
>  #endif
>
>    if ( count == 0 )
> @@ -99,9 +99,9 @@ rtems_status_code rtems_message_queue_create(
>      _Objects_Allocator_unlock();
>      return RTEMS_TOO_MANY;
>    }
> -#endif
>
> -  the_message_queue->attribute_set = attribute_set;
> +  the_message_queue->is_global = is_global;
> +#endif
>
>    if (_Attributes_Is_priority( attribute_set ) )
>      discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY;
> diff --git a/cpukit/rtems/src/msgqdelete.c b/cpukit/rtems/src/msgqdelete.c
> index 791f96e676..e1d57addc9 100644
> --- a/cpukit/rtems/src/msgqdelete.c
> +++ b/cpukit/rtems/src/msgqdelete.c
> @@ -60,7 +60,7 @@ rtems_status_code rtems_message_queue_delete(
>    );
>
>  #if defined(RTEMS_MULTIPROCESSING)
> -  if ( _Attributes_Is_global( the_message_queue->attribute_set ) ) {
> +  if ( the_message_queue->is_global ) {
>      _Objects_MP_Close(
>        &_Message_queue_Information,
>        the_message_queue->Object.id
> --
> 2.26.2
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200925/0a98cbe1/attachment.html>


More information about the devel mailing list