Changeset 9c9c6a9 in rtems


Ignore:
Timestamp:
Nov 21, 2018, 4:30:52 PM (6 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
0da9d80
Parents:
d6e3473
git-author:
Sebastian Huber <sebastian.huber@…> (11/21/18 16:30:52)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/07/18 13:22:01)
Message:

score: Remove Objects_Information::is_string

Use Objects_Information::name_length to store this information.

Update #3621.

Files:
23 edited

Legend:

Unmodified
Added
Removed
  • cpukit/include/rtems/score/objectimpl.h

    rd6e3473 r9c9c6a9  
    133133  /** This is the number of objects in a block. */
    134134  Objects_Maximum   allocation_size;
    135   /** This is the maximum length of names. */
     135  /**
     136   * @brief This is the maximum length of names.
     137   *
     138   * A length of zero indicates that this object has a no string name
     139   * (OBJECTS_NO_STRING_NAME).
     140   */
    136141  uint16_t          name_length;
    137142  /** This field indicates the API of this object class. */
     
    139144  /** This is the class of this object set. */
    140145  uint8_t           the_class;
    141   /** This is true if names are strings. */
    142   bool              is_string;
    143146  /** This is the true if unlimited objects in this class. */
    144147  bool              auto_extend;
     
    226229  uint32_t             maximum,
    227230  uint16_t             size,
    228   bool                 is_string,
    229   uint32_t             maximum_name_length
     231  uint16_t             maximum_name_length
    230232#if defined(RTEMS_MULTIPROCESSING)
    231233  ,
     
    233235#endif
    234236);
     237
     238/**
     239 * @brief Constant for the object information string name length to indicate
     240 * that this object class has no string names.
     241 */
     242#define OBJECTS_NO_STRING_NAME 0
    235243
    236244/**
     
    262270    maximum, \
    263271    size, \
    264     is_string, \
    265272    maximum_name_length, \
    266273    extract \
     
    272279      maximum, \
    273280      size, \
    274       is_string, \
    275281      maximum_name_length, \
    276282      extract \
     
    283289    maximum, \
    284290    size, \
    285     is_string, \
    286291    maximum_name_length, \
    287292    extract \
     
    293298      maximum, \
    294299      size, \
    295       is_string, \
    296300      maximum_name_length \
    297301    )
     
    736740);
    737741
     742RTEMS_INLINE_ROUTINE bool _Objects_Has_string_name(
     743  const Objects_Information *information
     744)
     745{
     746  return information->name_length > 0;
     747}
     748
    738749RTEMS_INLINE_ROUTINE Objects_Maximum _Objects_Extend_size(
    739750  const Objects_Information *information
     
    920931)
    921932{
    922   _Assert( !information->is_string );
     933  _Assert( !_Objects_Has_string_name( information ) );
    923934  the_object->name.name_u32 = name;
    924935
     
    944955)
    945956{
    946   _Assert( information->is_string );
     957  _Assert( _Objects_Has_string_name( information ) );
    947958  the_object->name.name_p = name;
    948959
  • cpukit/posix/src/key.c

    rd6e3473 r9c9c6a9  
    143143    sizeof( POSIX_Keys_Control ),
    144144                                /* size of this object's control block */
    145     false,                      /* true if names for this object are strings */
    146     0,                          /* maximum length of each object's name */
     145    OBJECTS_NO_STRING_NAME,     /* maximum length of each object's name */
    147146    NULL                        /* Proxy extraction support callout */
    148147  );
  • cpukit/posix/src/mqueue.c

    rd6e3473 r9c9c6a9  
    5555    sizeof( POSIX_Message_queue_Control ),
    5656                                /* size of this object's control block */
    57     true,                       /* true if names for this object are strings */
    5857    _POSIX_PATH_MAX,            /* maximum length of each object's name */
    5958    NULL                        /* Proxy extraction support callout */
  • cpukit/posix/src/psxsemaphore.c

    rd6e3473 r9c9c6a9  
    4646    sizeof( POSIX_Semaphore_Control ),
    4747                                /* size of this object's control block */
    48     true,                       /* true if names for this object are strings */
    4948    _POSIX_PATH_MAX,            /* maximum length of each object's name */
    5049    NULL                        /* Proxy extraction support callout */
  • cpukit/posix/src/ptimer.c

    rd6e3473 r9c9c6a9  
    6666    sizeof( POSIX_Timer_Control ),
    6767                                /* size of this object's control block */
    68     false,                      /* true if names for this object are strings */
    69     0,                          /* maximum length of each object's name */
     68    OBJECTS_NO_STRING_NAME,     /* maximum length of an object name */
    7069    NULL                        /* Proxy extraction support callout */
    7170  );
  • cpukit/posix/src/shm.c

    rd6e3473 r9c9c6a9  
    3636    sizeof( POSIX_Shm_Control ),
    3737                                /* size of this object's control block */
    38     true,                       /* true if names for this object are strings */
    3938    _POSIX_PATH_MAX,            /* maximum length of each object's name */
    4039    NULL                        /* Proxy extraction support callout */
  • cpukit/rtems/src/barrier.c

    rd6e3473 r9c9c6a9  
    4040                                   /* maximum objects of this class */
    4141    sizeof( Barrier_Control ),     /* size of this object's control block */
    42     false,                         /* true if the name is a string */
    43     RTEMS_MAXIMUM_NAME_LENGTH,     /* maximum length of an object name */
     42    OBJECTS_NO_STRING_NAME,        /* maximum length of an object name */
    4443    NULL                           /* Proxy extraction support callout */
    4544  );
  • cpukit/rtems/src/dpmem.c

    rd6e3473 r9c9c6a9  
    3838    sizeof( Dual_ported_memory_Control ),
    3939                                  /* size of this object's control block */
    40     false,                        /* true if names of this object are strings */
    41     RTEMS_MAXIMUM_NAME_LENGTH,    /* maximum length of each object's name */
     40    OBJECTS_NO_STRING_NAME,       /* maximum length of an object name */
    4241    NULL                          /* Proxy extraction support callout */
    4342  );
  • cpukit/rtems/src/msg.c

    rd6e3473 r9c9c6a9  
    4040    sizeof( Message_queue_Control ),
    4141                                  /* size of this object's control block */
    42     false,                        /* true if names of this object are strings */
    43     RTEMS_MAXIMUM_NAME_LENGTH,    /* maximum length of each object's name */
     42    OBJECTS_NO_STRING_NAME,       /* maximum length of an object name */
    4443    _Message_queue_MP_Send_extract_proxy
    4544                                  /* Proxy extraction support callout */
  • cpukit/rtems/src/part.c

    rd6e3473 r9c9c6a9  
    3737                                 /* maximum objects of this class */
    3838    sizeof( Partition_Control ), /* size of this object's control block */
    39     false,                       /* true if the name is a string */
    40     RTEMS_MAXIMUM_NAME_LENGTH,   /* maximum length of an object name */
     39    OBJECTS_NO_STRING_NAME,      /* maximum length of an object name */
    4140    _Partition_MP_Send_extract_proxy  /* Proxy extraction support callout */
    4241  );
  • cpukit/rtems/src/ratemon.c

    rd6e3473 r9c9c6a9  
    3737                                     /* maximum objects of this class */
    3838    sizeof( Rate_monotonic_Control ),/* size of this object's control block */
    39     false,                           /* true if the name is a string */
    40     RTEMS_MAXIMUM_NAME_LENGTH,       /* maximum length of an object name */
     39    OBJECTS_NO_STRING_NAME,          /* maximum length of an object name */
    4140    NULL                             /* Proxy extraction support callout */
    4241  );
  • cpukit/rtems/src/region.c

    rd6e3473 r9c9c6a9  
    4848                               /* maximum objects of this class */
    4949    sizeof( Region_Control ),  /* size of this object's control block */
    50     false,                     /* true if the name is a string */
    51     RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of an object name */
     50    OBJECTS_NO_STRING_NAME,    /* maximum length of an object name */
    5251    NULL                       /* Proxy extraction support callout */
    5352  );
  • cpukit/rtems/src/rtemstimer.c

    rd6e3473 r9c9c6a9  
    3939                               /* maximum objects of this class */
    4040    sizeof( Timer_Control ),   /* size of this object's control block */
    41     false,                     /* true if the name is a string */
    42     RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of an object name */
     41    OBJECTS_NO_STRING_NAME,    /* maximum length of an object name */
    4342    NULL                       /* Proxy extraction support callout */
    4443  );
  • cpukit/rtems/src/sem.c

    rd6e3473 r9c9c6a9  
    3434                                 /* maximum objects of this class */
    3535    sizeof( Semaphore_Control ), /* size of this object's control block */
    36     false,                       /* true if the name is a string */
    37     RTEMS_MAXIMUM_NAME_LENGTH,   /* maximum length of an object name */
     36    OBJECTS_NO_STRING_NAME,      /* maximum length of an object name */
    3837    _Semaphore_MP_Send_extract_proxy /* Proxy extraction support callout */
    3938  );
  • cpukit/sapi/src/extension.c

    rd6e3473 r9c9c6a9  
    3636    rtems_configuration_get_maximum_extensions(),
    3737    sizeof( Extension_Control ),
    38     false,                     /* true if the name is a string */
    39     RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of an object name */
     38    OBJECTS_NO_STRING_NAME,    /* maximum length of an object name */
    4039    NULL                       /* Proxy extraction support callout */
    4140  );
  • cpukit/score/src/objectgetnameasstring.c

    rd6e3473 r9c9c6a9  
    115115  _Objects_Name_to_string(
    116116    the_object->name,
    117     information->is_string,
     117    _Objects_Has_string_name( information ),
    118118    name,
    119119    length
  • cpukit/score/src/objectidtoname.c

    rd6e3473 r9c9c6a9  
    4141    return OBJECTS_INVALID_ID;
    4242
    43   if ( information->is_string )
     43  if ( _Objects_Has_string_name( information ) )
    4444    return OBJECTS_INVALID_ID;
    4545
  • cpukit/score/src/objectinitializeinformation.c

    rd6e3473 r9c9c6a9  
    3131  uint32_t             maximum,
    3232  uint16_t             size,
    33   bool                 is_string,
    34   uint32_t             maximum_name_length
     33  uint16_t             maximum_name_length
    3534#if defined(RTEMS_MULTIPROCESSING)
    3635  ,
     
    5049  information->object_blocks      = 0;
    5150  information->inactive           = 0;
    52   information->is_string          = is_string;
    5351
    5452  /*
  • cpukit/score/src/objectnamespaceremove.c

    rd6e3473 r9c9c6a9  
    2828)
    2929{
    30   _Assert( !information->is_string );
     30  _Assert( !_Objects_Has_string_name( information ) );
    3131  the_object->name.name_u32 = 0;
    3232}
     
    3939  char *name;
    4040
    41   _Assert( information->is_string );
     41  _Assert( _Objects_Has_string_name( information ) );
    4242  name = RTEMS_DECONST( char *, the_object->name.name_p );
    4343  the_object->name.name_p = NULL;
  • cpukit/score/src/objectnametoidstring.c

    rd6e3473 r9c9c6a9  
    3434  uint32_t index;
    3535
    36   _Assert( information->is_string );
     36  _Assert( _Objects_Has_string_name( information ) );
    3737  _Assert( _Objects_Allocator_is_owner() );
    3838
  • cpukit/score/src/objectsetname.c

    rd6e3473 r9c9c6a9  
    3030)
    3131{
    32   size_t                 length;
    33   const char            *s;
     32  if ( _Objects_Has_string_name( information ) ) {
     33    size_t  length;
     34    char   *dup;
    3435
    35   s      = name;
    36   length = strnlen( name, information->name_length );
     36    length = strnlen( name, information->name_length );
     37    dup = _Workspace_String_duplicate( name, length );
     38    if ( dup == NULL ) {
     39      return false;
     40    }
    3741
    38   if ( information->is_string ) {
    39     char *d;
     42    the_object->name.name_p = dup;
     43  } else {
     44    char c[ 4 ];
     45    size_t i;
    4046
    41     d = _Workspace_Allocate( length + 1 );
    42     if ( !d )
    43       return false;
     47    memset( c, ' ', sizeof( c ) );
    4448
    45     _Workspace_Free( (void *)the_object->name.name_p );
    46     the_object->name.name_p = NULL;
     49    for ( i = 0; i < 4; ++i ) {
     50      if ( name[ i ] == '\0') {
     51        break;
     52      }
    4753
    48     strncpy( d, name, length );
    49     d[length] = '\0';
    50     the_object->name.name_p = d;
    51   } else {
    52     the_object->name.name_u32 =  _Objects_Build_name(
    53       ((length)     ? s[ 0 ] : ' '),
    54       ((length > 1) ? s[ 1 ] : ' '),
    55       ((length > 2) ? s[ 2 ] : ' '),
    56       ((length > 3) ? s[ 3 ] : ' ')
    57     );
     54      c[ i ] = name[ i ];
     55    }
     56
     57    the_object->name.name_u32 =
     58      _Objects_Build_name( c[ 0 ], c[ 1 ], c[ 2 ], c[ 3 ] );
    5859  }
    5960
  • cpukit/score/src/thread.c

    rd6e3473 r9c9c6a9  
    5959    maximum,
    6060    _Thread_Control_size,
    61     false,
    62     RTEMS_MAXIMUM_NAME_LENGTH,
     61    OBJECTS_NO_STRING_NAME,
    6362    NULL
    6463  );
  • testsuites/psxtests/psxobj01/init.c

    rd6e3473 r9c9c6a9  
    4646    0,           /* maximum */
    4747    4,           /* size */
    48     true,        /* is_string */
    4948    10,          /* maximum_name_length */
    5049    NULL         /* Objects_Thread_queue_Extract_callout extract */
Note: See TracChangeset for help on using the changeset viewer.