Changeset ce19f1fa in rtems


Ignore:
Timestamp:
Jan 23, 2008, 10:57:43 PM (12 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.9, master
Children:
23a368d
Parents:
8571262
Message:

2008-01-23 Joel Sherrill <joel.sherrill@…>

  • itron/include/rtems/itron/object.h, itron/src/cre_tsk.c, libblock/src/show_bdbuf.c, libmisc/capture/capture-cli.c, libmisc/capture/capture.c, libmisc/monitor/mon-manager.c, libmisc/stackchk/check.c, posix/src/condinit.c, posix/src/keycreate.c, posix/src/mqueuecreatesupp.c, posix/src/mqueuedeletesupp.c, posix/src/mqueuenametoid.c, posix/src/mqueueopen.c, posix/src/mqueueunlink.c, posix/src/mutexinit.c, posix/src/pbarrierinit.c, posix/src/prwlockinit.c, posix/src/pspininit.c, posix/src/pthreadcreate.c, posix/src/pthreadexit.c, posix/src/semaphorecreatesupp.c, posix/src/semaphorenametoid.c, posix/src/timercreate.c, rtems/src/barrierident.c, rtems/src/dpmemident.c, rtems/src/msgqident.c, rtems/src/partident.c, rtems/src/ratemonident.c, rtems/src/regionident.c, rtems/src/semident.c, rtems/src/taskident.c, rtems/src/timerident.c, sapi/src/extensionident.c, score/Makefile.am, score/include/rtems/score/object.h, score/inline/rtems/score/object.inl, score/src/apimutexallocate.c, score/src/objectextendinformation.c, score/src/objectgetnameasstring.c, score/src/objectmp.c, score/src/objectnametoid.c: Convert the Objects_Name type from a simple type to a union of an unsigned 32 bit integer and a pointer. This should help eliminate weird casts between u32 and pointers in various places. The APIs now have to explicitly call _u32 or _string versions of helper routines. This should also simplify things and eliminate the need for ugly casts in some cases.
  • score/src/objectclearname.c, score/src/objectcomparenameraw.c, score/src/objectcomparenamestring.c, score/src/objectcopynameraw.c, score/src/objectcopynamestring.c: Removed.
Location:
cpukit
Files:
5 deleted
42 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r8571262 rce19f1fa  
     12008-01-23      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * itron/include/rtems/itron/object.h, itron/src/cre_tsk.c,
     4        libblock/src/show_bdbuf.c, libmisc/capture/capture-cli.c,
     5        libmisc/capture/capture.c, libmisc/monitor/mon-manager.c,
     6        libmisc/stackchk/check.c, posix/src/condinit.c,
     7        posix/src/keycreate.c, posix/src/mqueuecreatesupp.c,
     8        posix/src/mqueuedeletesupp.c, posix/src/mqueuenametoid.c,
     9        posix/src/mqueueopen.c, posix/src/mqueueunlink.c,
     10        posix/src/mutexinit.c, posix/src/pbarrierinit.c,
     11        posix/src/prwlockinit.c, posix/src/pspininit.c,
     12        posix/src/pthreadcreate.c, posix/src/pthreadexit.c,
     13        posix/src/semaphorecreatesupp.c, posix/src/semaphorenametoid.c,
     14        posix/src/timercreate.c, rtems/src/barrierident.c,
     15        rtems/src/dpmemident.c, rtems/src/msgqident.c, rtems/src/partident.c,
     16        rtems/src/ratemonident.c, rtems/src/regionident.c,
     17        rtems/src/semident.c, rtems/src/taskident.c, rtems/src/timerident.c,
     18        sapi/src/extensionident.c, score/Makefile.am,
     19        score/include/rtems/score/object.h,
     20        score/inline/rtems/score/object.inl, score/src/apimutexallocate.c,
     21        score/src/objectextendinformation.c,
     22        score/src/objectgetnameasstring.c, score/src/objectmp.c,
     23        score/src/objectnametoid.c: Convert the Objects_Name type from a
     24        simple type to a union of an unsigned 32 bit integer and a pointer.
     25        This should help eliminate weird casts between u32 and pointers in
     26        various places. The APIs now have to explicitly call _u32 or _string
     27        versions of helper routines. This should also simplify things and
     28        eliminate the need for ugly casts in some cases.
     29        * score/src/objectclearname.c, score/src/objectcomparenameraw.c,
     30        score/src/objectcomparenamestring.c, score/src/objectcopynameraw.c,
     31        score/src/objectcopynamestring.c: Removed.
     32
    1332008-01-23      Joel Sherrill <joel.sherrill@oarcorp.com>
    234
  • cpukit/itron/include/rtems/itron/object.h

    r8571262 rce19f1fa  
    4242
    4343#define _ITRON_Objects_Open( _the_information, _the_object ) \
    44     _Objects_Open( (_the_information), (_the_object), NULL )
     44    _Objects_Open_u32( (_the_information), (_the_object), 0 )
    4545
    4646/*
  • cpukit/itron/src/cre_tsk.c

    r8571262 rce19f1fa  
    3737  boolean                      status;
    3838  Priority_Control             core_priority;
     39  Objects_Name                 name;
    3940
    4041  /*
     
    8283   */
    8384
     85  name.name_u32 = 0;
    8486  core_priority = _ITRON_Task_Priority_to_Core( pk_ctsk->itskpri );
    8587  status = _Thread_Initialize(
     
    98100    NULL,        /* no budget algorithm callout */
    99101    0,
    100     NULL
     102    name
    101103  );
    102104
  • cpukit/libblock/src/show_bdbuf.c

    r8571262 rce19f1fa  
    567567    thread_id   = the_thread->Object.id;
    568568    thread_name = the_thread->Object.name;
    569     thread_name_nonstring = (uint32_t)thread_name;
     569    thread_name_nonstring = (uint32_t)thread_name.name_u32;
    570570    printf("%20s %3d (0x%08" PRIx32 ") %c%c%c%c\n",
    571571           ((thread_cnt == 1) ? "Threads waiting:" : ""),
  • cpukit/libmisc/capture/capture-cli.c

    r8571262 rce19f1fa  
    660660     *          remove unless the score has been updated.
    661661     */
    662     Objects_Name object_name;
    663662    rtems_name   rname;
    664663   
    665664    rname = rtems_build_name(arg[0], arg[1], arg[2], arg[3]);
    666     object_name = (Objects_Name) rname;
    667     *name = (rtems_name) object_name;
     665    *name = rname;
    668666    *valid_name = 1;
    669667  }
  • cpukit/libmisc/capture/capture.c

    r8571262 rce19f1fa  
    413413   * Check the type of name the object has.
    414414   */
    415   if (_Objects_Get_API (new_task->Object.id) == OBJECTS_CLASSIC_API)
    416     name = (rtems_name) new_task->Object.name;
    417   else
    418     name = rtems_build_name (((char*) new_task->Object.name)[0],
    419                              ((char*) new_task->Object.name)[1],
    420                              ((char*) new_task->Object.name)[2],
    421                              ((char*) new_task->Object.name)[3]);
     415
     416  name = 0; 
     417  if ( _Objects_Get_API (new_task->Object.id) == OBJECTS_CLASSIC_API )
     418    name = new_task->Object.name.name_u32;
     419  else if (new_task->Object.name.name_p)
     420    name = rtems_build_name (new_task->Object.name.name_p[0],
     421                             new_task->Object.name.name_p[1],
     422                             new_task->Object.name.name_p[2],
     423                             new_task->Object.name.name_p[3]);
    422424 
    423425  rtems_capture_dup_name (&task->name, name);
  • cpukit/libmisc/monitor/mon-manager.c

    r8571262 rce19f1fa  
    4646        copy = (rtems_monitor_generic_t *) canonical;
    4747        copy->id = object->id;
    48         if (table->is_string)
    49           _Objects_Copy_name_raw(object->name, &copy->name, sizeof(copy->name));
    50         else
    51           _Objects_Copy_name_raw(&object->name, &copy->name, sizeof(copy->name));
     48        copy->name = object->name.name_u32;
    5249    }
    5350
  • cpukit/libmisc/stackchk/check.c

    r8571262 rce19f1fa  
    218218    running,
    219219    running->Object.id,
    220     (uint32_t) running->Object.name
     220    running->Object.name.name_u32
    221221  );
    222222
  • cpukit/posix/src/condinit.c

    r8571262 rce19f1fa  
    7373  );
    7474
    75   _Objects_Open(
     75  _Objects_Open_u32(
    7676    &_POSIX_Condition_variables_Information,
    7777    &the_cond->Object,
  • cpukit/posix/src/keycreate.c

    r8571262 rce19f1fa  
    9999  the_key->is_active = TRUE;
    100100
    101   _Objects_Open( &_POSIX_Keys_Information, &the_key->Object, 0 );
     101  _Objects_Open_u32( &_POSIX_Keys_Information, &the_key->Object, 0 );
    102102
    103103  *key = the_key->Object.id;
  • cpukit/posix/src/mqueuecreatesupp.c

    r8571262 rce19f1fa  
    143143  }
    144144
    145   _Objects_Open(
     145  _Objects_Open_string(
    146146    &_POSIX_Message_queue_Information,
    147147    &the_mq->Object,
    148     (char *) name
     148    name
    149149  );
    150150
  • cpukit/posix/src/mqueuedeletesupp.c

    r8571262 rce19f1fa  
    5252  if ( !the_mq->linked && !the_mq->open_count ) {
    5353      /* the name memory may have been freed by unlink. */
    54       if ( the_mq->Object.name )
    55         _Workspace_Free( the_mq->Object.name );
     54      Objects_Control *the_object = &the_mq->Object;
    5655
    57       _Objects_Close( &_POSIX_Message_queue_Information, &the_mq->Object );
     56      if ( the_object->name.name_p )
     57        _Workspace_Free( (void *)the_object->name.name_p );
     58
     59      _Objects_Close( &_POSIX_Message_queue_Information, the_object );
    5860
    5961      _CORE_message_queue_Close(
  • cpukit/posix/src/mqueuenametoid.c

    r8571262 rce19f1fa  
    6464    return ENAMETOOLONG;
    6565
    66   status = _Objects_Name_to_id(
    67     &_POSIX_Message_queue_Information, (char *)name, 0, id );
     66  status = _Objects_Name_to_id_string(
     67    &_POSIX_Message_queue_Information, name, 0, id );
    6868
    6969  if ( status == OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL )
  • cpukit/posix/src/mqueueopen.c

    r8571262 rce19f1fa  
    120120    the_mq->open_count += 1;
    121121    the_mq_fd->Queue = the_mq;
    122     _Objects_Open(
     122    _Objects_Open_string(
    123123      &_POSIX_Message_queue_Information_fds,
    124124      &the_mq_fd->Object,
     
    154154
    155155  the_mq_fd->Queue = the_mq;
    156   _Objects_Open(
     156  _Objects_Open_string(
    157157    &_POSIX_Message_queue_Information_fds,
    158158    &the_mq_fd->Object,
  • cpukit/posix/src/mqueueunlink.c

    r8571262 rce19f1fa  
    6868
    6969  the_mq->linked = FALSE;
    70   _Workspace_Free( the_mq->Object.name );
     70  if ( the_mq->Object.name.name_p )
     71    _Workspace_Free( (void *)the_mq->Object.name.name_p );
    7172  _POSIX_Message_queue_Namespace_remove( the_mq );
    7273  _POSIX_Message_queue_Delete( the_mq );
  • cpukit/posix/src/mutexinit.c

    r8571262 rce19f1fa  
    160160  );
    161161
    162   _Objects_Open( &_POSIX_Mutex_Information, &the_mutex->Object, 0 );
     162  _Objects_Open_u32( &_POSIX_Mutex_Information, &the_mutex->Object, 0 );
    163163
    164164  *mutex = the_mutex->Object.id;
  • cpukit/posix/src/pbarrierinit.c

    r8571262 rce19f1fa  
    102102  _CORE_barrier_Initialize( &the_barrier->Barrier, &the_attributes );
    103103
    104   _Objects_Open(
     104  _Objects_Open_u32(
    105105    &_POSIX_Barrier_Information,
    106106    &the_barrier->Object,
  • cpukit/posix/src/prwlockinit.c

    r8571262 rce19f1fa  
    9696  _CORE_RWLock_Initialize( &the_rwlock->RWLock, &the_attributes );
    9797
    98   _Objects_Open(
     98  _Objects_Open_u32(
    9999    &_POSIX_RWLock_Information,
    100100    &the_rwlock->Object,
  • cpukit/posix/src/pspininit.c

    r8571262 rce19f1fa  
    6868  _CORE_spinlock_Initialize( &the_spinlock->Spinlock, &attributes );
    6969
    70   _Objects_Open(
    71     &_POSIX_Spinlock_Information,
    72     &the_spinlock->Object,
    73     0
    74   );
     70  _Objects_Open_u32( &_POSIX_Spinlock_Information, &the_spinlock->Object, 0 );
    7571
    7672  *spinlock = the_spinlock->Object.id;
  • cpukit/posix/src/pthreadcreate.c

    r8571262 rce19f1fa  
    4343  int                                 schedpolicy = SCHED_RR;
    4444  struct sched_param                  schedparam;
     45  Objects_Name                        name;
    4546
    4647  the_attr = (attr) ? attr : &_POSIX_Threads_Default_attributes;
     
    176177   */
    177178
     179  name.name_p = NULL;   /* posix threads don't have a name by default */
    178180  status = _Thread_Initialize(
    179181    &_POSIX_Threads_Information,
     
    187189    budget_callout,
    188190    0,                    /* isr level */
    189     NULL                  /* posix threads don't have a name */
     191    name                  /* posix threads don't have a name */
    190192  );
    191193
  • cpukit/posix/src/pthreadexit.c

    r8571262 rce19f1fa  
    3434  the_information = _Objects_Get_information( _Thread_Executing->Object.id );
    3535
    36   /* This should never happen if _Thread_Get() works right */
    37   assert( the_information );
    38 
     36  /*
     37   * the_information has to be non-NULL.  Otherwise, we couldn't be
     38   * running in a thread of this API and class.
     39   */
     40 
    3941  _Thread_Disable_dispatch();
    4042
  • cpukit/posix/src/semaphorecreatesupp.c

    r8571262 rce19f1fa  
    107107   */
    108108
    109   _Objects_Open(&_POSIX_Semaphore_Information, &the_semaphore->Object, name_p);
     109  _Objects_Open_string(
     110    &_POSIX_Semaphore_Information,
     111    &the_semaphore->Object,
     112    name_p
     113  );
    110114
    111115  *the_sem = the_semaphore;
  • cpukit/posix/src/semaphorenametoid.c

    r8571262 rce19f1fa  
    4949    return EINVAL;
    5050
    51   status = _Objects_Name_to_id(
    52     &_POSIX_Semaphore_Information, (char *)name, 0, (Objects_Id*)id );
     51  status = _Objects_Name_to_id_string(
     52    &_POSIX_Semaphore_Information, name, 0, (Objects_Id*)id );
    5353
    5454  if ( status == OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL )
  • cpukit/posix/src/timercreate.c

    r8571262 rce19f1fa  
    9090
    9191  _Watchdog_Initialize( &ptimer->Timer, NULL, 0, NULL );
    92   _Objects_Open(&_POSIX_Timer_Information, &ptimer->Object, (Objects_Name) 0);
     92  _Objects_Open_u32(&_POSIX_Timer_Information, &ptimer->Object, 0);
    9393
    9494  *timerid  = ptimer->Object.id;
  • cpukit/rtems/src/barrierident.c

    r8571262 rce19f1fa  
    4646  Objects_Name_or_id_lookup_errors  status;
    4747
    48   status = _Objects_Name_to_id(
     48  status = _Objects_Name_to_id_u32(
    4949    &_Barrier_Information,
    50     (Objects_Name) name,
     50    name,
    5151    OBJECTS_SEARCH_LOCAL_NODE,
    5252    id
  • cpukit/rtems/src/dpmemident.c

    r8571262 rce19f1fa  
    4949  Objects_Name_or_id_lookup_errors  status;
    5050
    51   status = _Objects_Name_to_id(
     51  status = _Objects_Name_to_id_u32(
    5252    &_Dual_ported_memory_Information,
    53     (Objects_Name) name,
     53    name,
    5454    OBJECTS_SEARCH_ALL_NODES,
    5555    id
  • cpukit/rtems/src/msgqident.c

    r8571262 rce19f1fa  
    6161  Objects_Name_or_id_lookup_errors  status;
    6262
    63   status = _Objects_Name_to_id(
     63  status = _Objects_Name_to_id_u32(
    6464    &_Message_queue_Information,
    65     (Objects_Name) name,
     65    name,
    6666    node,
    6767    id
  • cpukit/rtems/src/partident.c

    r8571262 rce19f1fa  
    5252  Objects_Name_or_id_lookup_errors  status;
    5353
    54   status = _Objects_Name_to_id(
    55     &_Partition_Information,
    56     (Objects_Name) name,
    57     node,
    58     id
    59   );
     54  status = _Objects_Name_to_id_u32( &_Partition_Information, name, node, id );
    6055
    6156  return _Status_Object_name_errors_to_status[ status ];
  • cpukit/rtems/src/ratemonident.c

    r8571262 rce19f1fa  
    4848  Objects_Name_or_id_lookup_errors  status;
    4949
    50   status = _Objects_Name_to_id(
     50  status = _Objects_Name_to_id_u32(
    5151    &_Rate_monotonic_Information,
    52     (Objects_Name) name,
     52    name,
    5353    OBJECTS_SEARCH_LOCAL_NODE,
    5454    id
  • cpukit/rtems/src/regionident.c

    r8571262 rce19f1fa  
    5151  Objects_Name_or_id_lookup_errors  status;
    5252
    53   status = _Objects_Name_to_id(
     53  status = _Objects_Name_to_id_u32(
    5454    &_Region_Information,
    55     (Objects_Name) name,
     55    name,
    5656    OBJECTS_SEARCH_LOCAL_NODE,
    5757    id
  • cpukit/rtems/src/semident.c

    r8571262 rce19f1fa  
    7676  Objects_Name_or_id_lookup_errors  status;
    7777
    78   status = _Objects_Name_to_id(
    79     &_Semaphore_Information,
    80     (Objects_Name) name,
    81     node,
    82     id
    83   );
     78  status = _Objects_Name_to_id_u32( &_Semaphore_Information, name, node, id );
    8479
    8580  return _Status_Object_name_errors_to_status[ status ];
  • cpukit/rtems/src/taskident.c

    r8571262 rce19f1fa  
    6767   }
    6868
    69   status = _Objects_Name_to_id(
    70     &_RTEMS_tasks_Information,
    71     (Objects_Name) name,
    72     node,
    73     id
    74   );
     69  status = _Objects_Name_to_id_u32( &_RTEMS_tasks_Information, name, node, id );
    7570
    7671  return _Status_Object_name_errors_to_status[ status ];
  • cpukit/rtems/src/timerident.c

    r8571262 rce19f1fa  
    5050  Objects_Name_or_id_lookup_errors  status;
    5151
    52   status = _Objects_Name_to_id(
     52  status = _Objects_Name_to_id_u32(
    5353    &_Timer_Information,
    54     (Objects_Name) name,
     54    name,
    5555    OBJECTS_SEARCH_LOCAL_NODE,
    5656    id
  • cpukit/sapi/src/extensionident.c

    r8571262 rce19f1fa  
    4646  Objects_Name_or_id_lookup_errors  status;
    4747
    48   status = _Objects_Name_to_id(
     48  status = _Objects_Name_to_id_u32(
    4949    &_Extension_Information,
    50     (Objects_Name) name,
     50    name,
    5151    OBJECTS_SEARCH_LOCAL_NODE,
    5252    id
  • cpukit/score/Makefile.am

    r8571262 rce19f1fa  
    114114## OBJECT_C_FILES
    115115libscore_a_SOURCES += src/object.c src/objectallocate.c \
    116     src/objectclearname.c src/objectcomparenameraw.c \
    117     src/objectcomparenamestring.c src/objectcopynameraw.c \
    118     src/objectcopynamestring.c src/objectextendinformation.c \
    119     src/objectfree.c src/objectget.c src/objectgetisr.c src/objectgetnext.c \
    120     src/objectinitializeinformation.c src/objectnametoid.c \
     116    src/objectextendinformation.c src/objectfree.c src/objectget.c \
     117    src/objectgetisr.c src/objectgetnext.c src/objectinitializeinformation.c \
     118    src/objectnametoid.c src/objectnametoidstring.c \
    121119    src/objectshrinkinformation.c src/objectgetnoprotection.c \
    122120    src/objectidtoname.c src/objectgetnameasstring.c
  • cpukit/score/include/rtems/score/object.h

    r8571262 rce19f1fa  
    3434 *  object names.
    3535 */
    36 typedef void * Objects_Name;
     36typedef union {
     37  /** This is a pointer to a string name. */
     38  const char *name_p;
     39  /** This is the actual 32-bit "raw" integer name. */
     40  uint32_t    name_u32;
     41} Objects_Name;
    3742
    3843/**
     
    338343  Objects_Control **local_table;
    339344  /** This points to the table of local object names. */
    340   Objects_Name     *name_table;
     345  /* XXX should be safe to remove this field */
     346  uint32_t        **name_table;
    341347  /** This is the chain of inactive control blocks. */
    342348  Chain_Control     Inactive;
     
    534540
    535541/**
    536  *  This method zeroes out the name.
    537  *
    538  *  @param[in] name points to the name to be zeroed out.
    539  *  @param[in] length is the length of the object name field.
    540  */
    541 void _Objects_Clear_name(
    542   void         *name,
    543   const size_t  length
    544 );
    545 
    546 /**
    547  *  This method copies a string style object name from source to destination.
    548  *
    549  *  @param[in] source is the source name to copy.
    550  *  @param[in] destination is the destination of the copy.
    551  *  @param[in] length is the number of bytes to copy.
    552  */
    553 void _Objects_Copy_name_string(
    554   const void   *source,
    555   void         *destination,
    556   const size_t  length
    557 );
    558 
    559 /**
    560  *  This method copies a raw style object name from source to destination.
    561  *
    562  *  @param[in] source is the source name to copy.
    563  *  @param[in] destination is the destination of the copy.
    564  *  @param[in] length is the number of bytes to copy.
    565  */
    566 void _Objects_Copy_name_raw(
    567   const void   *source,
    568   void         *destination,
    569   const size_t  length
    570 );
    571 
    572 /**
    573  *  This method compares two string style object names.
    574  *
    575  *  @param[in] name_1 is the left hand name to compare.
    576  *  @param[in] name_2 is the right hand name to compare.
    577  *  @param[in] length is the length of the names to compare.
    578  */
    579 boolean _Objects_Compare_name_string(
    580   void       *name_1,
    581   void       *name_2,
    582   uint16_t    length
    583 );
    584 
    585 /**
    586  *  This method compares two raw style object names.
    587  *
    588  *  @param[in] name_1 is the left hand name to compare.
    589  *  @param[in] name_2 is the right hand name to compare.
    590  *  @param[in] length is the length of the names to compare.
    591  */
    592 boolean _Objects_Compare_name_raw(
    593   void       *name_1,
    594   void       *name_2,
    595   uint16_t    length
    596 );
    597 
    598 /**
    599542 *  This function implements the common portion of the object
    600543 *  identification directives.  This directive returns the object
     
    638581 *          the requested object.
    639582 */
    640 Objects_Name_or_id_lookup_errors _Objects_Name_to_id(
     583Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32(
    641584  Objects_Information *information,
    642   Objects_Name         name,
     585  uint32_t             name,
     586  uint32_t             node,
     587  Objects_Id          *id
     588);
     589
     590/**
     591 *  This method converts an object name to an Id.  It performs a look up
     592 *  using the object information block for this object class.
     593 *
     594 *  @param[in] information points to an object class information block.
     595 *  @param[in] name is the name of the object to find.
     596 *  @param[in] node is the set of nodes to search.
     597 *  @param[in] id will contain the Id if the search is successful.
     598 *
     599 *  @return This method returns one of the values from the
     600 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
     601 *          successful or failure.  On success @a id will contain the Id of
     602 *          the requested object.
     603 */
     604Objects_Name_or_id_lookup_errors _Objects_Name_to_id_string(
     605  Objects_Information *information,
     606  const char          *name,
    643607  uint32_t             node,
    644608  Objects_Id          *id
  • cpukit/score/inline/rtems/score/object.inl

    r8571262 rce19f1fa  
    290290  _Objects_Set_local_object( information, index, the_object );
    291291
    292   if ( information->is_string )
    293     /* _Objects_Copy_name_string( name, the_object->name ); */
    294     the_object->name = name;
    295   else
    296     /* _Objects_Copy_name_raw( name, the_object->name, information->name_length ); */
    297     the_object->name = name;
     292  the_object->name = name;
     293}
     294
     295/**
     296 *  This function places the_object control pointer and object name
     297 *  in the Local Pointer and Local Name Tables, respectively.
     298 *
     299 *  @param[in] information points to an Object Information Table
     300 *  @param[in] the_object is a pointer to an object
     301 *  @param[in] name is the name of the object to make accessible
     302 */
     303RTEMS_INLINE_ROUTINE void _Objects_Open_u32(
     304  Objects_Information *information,
     305  Objects_Control     *the_object,
     306  uint32_t             name
     307)
     308{
     309  uint32_t    index;
     310
     311  index = _Objects_Get_index( the_object->id );
     312  _Objects_Set_local_object( information, index, the_object );
     313
     314  /* ASSERT: information->is_string == FALSE */
     315  the_object->name.name_u32 = name;
     316}
     317
     318/**
     319 *  This function places the_object control pointer and object name
     320 *  in the Local Pointer and Local Name Tables, respectively.
     321 *
     322 *  @param[in] information points to an Object Information Table
     323 *  @param[in] the_object is a pointer to an object
     324 *  @param[in] name is the name of the object to make accessible
     325 */
     326RTEMS_INLINE_ROUTINE void _Objects_Open_string(
     327  Objects_Information *information,
     328  Objects_Control     *the_object,
     329  const char          *name
     330)
     331{
     332  uint32_t    index;
     333
     334  index = _Objects_Get_index( the_object->id );
     335  _Objects_Set_local_object( information, index, the_object );
     336
     337  /* information->is_string */
     338  the_object->name.name_p = name;
    298339}
    299340
     
    310351)
    311352{
    312   uint32_t   index;
    313 
    314   index = _Objects_Get_index( the_object->id );
    315   _Objects_Set_local_object( information, index, NULL );
    316   /* _Objects_Clear_name( the_object->name, information->name_length ); */
    317   the_object->name = 0;
     353  _Objects_Set_local_object(
     354    information,
     355    _Objects_Get_index( the_object->id ),
     356    NULL
     357  );
     358
     359  the_object->name.name_u32 = 0;
     360  the_object->name.name_p   = NULL;
    318361}
    319362
     
    329372)
    330373{
    331   /* _Objects_Clear_name( the_object->name, information->name_length ); */
    332   the_object->name = 0;
     374  /*
     375   * Clear out either format.
     376   */
     377  the_object->name.name_p   = NULL;
     378  the_object->name.name_u32 = 0;
    333379}
    334380
  • cpukit/score/src/apimutexallocate.c

    r8571262 rce19f1fa  
    2222{
    2323  API_Mutex_Control *mutex;
     24
    2425  CORE_mutex_Attributes attr =  {
    2526    CORE_MUTEX_NESTING_IS_ERROR,
     
    3334  _CORE_mutex_Initialize( &mutex->Mutex, &attr, CORE_MUTEX_UNLOCKED );
    3435
    35   _Objects_Open( &_API_Mutex_Information, &mutex->Object, (Objects_Name) 1 );
     36  _Objects_Open_u32( &_API_Mutex_Information, &mutex->Object, 1 );
    3637
    3738  *the_mutex = mutex;
  • cpukit/score/src/objectextendinformation.c

    r8571262 rce19f1fa  
    8585    ISR_Level         level;
    8686    void            **object_blocks;
    87     Objects_Name     *name_table;
     87    void            **name_table;
    8888    uint32_t         *inactive_per_block;
    8989    Objects_Control **local_table;
     
    148148    inactive_per_block = (uint32_t   *) _Addresses_Add_offset(
    149149        object_blocks, block_count * sizeof(void*) );
    150     name_table = (Objects_Name *) _Addresses_Add_offset(
     150    name_table = (void *) _Addresses_Add_offset(
    151151        inactive_per_block, block_count * sizeof(uint32_t  ) );
    152152    local_table = (Objects_Control **) _Addresses_Add_offset(
     
    196196    object_blocks[block_count] = NULL;
    197197    inactive_per_block[block_count] = 0;
    198     name_table[block_count] = NULL;
     198    // name_table[block_count] = NULL;
    199199
    200200    for ( index=index_base ;
     
    210210    information->object_blocks = object_blocks;
    211211    information->inactive_per_block = inactive_per_block;
    212     information->name_table = name_table;
     212    information->name_table = (void *)name_table;
    213213    information->local_table = local_table;
    214214    information->maximum = maximum;
     
    254254    (information->allocation_size * information->size)
    255255  );
    256   information->name_table[ block ] = name_area;
     256  // information->name_table[ block ] = name_area;
    257257
    258258  /*
     
    282282      );
    283283
    284     the_object->name = (void *) name_area;
    285 
    286     name_area = _Addresses_Add_offset( name_area, information->name_length );
     284    name_area = (void *)_Addresses_Add_offset( name_area, information->name_length );
    287285
    288286    _Chain_Append( &information->Inactive, &the_object->Node );
  • cpukit/score/src/objectgetnameasstring.c

    r8571262 rce19f1fa  
    3636{
    3737  Objects_Information *information;
    38   char                  *s;
     38  const char            *s;
    3939  char                  *d;
    4040  uint32_t               i;
     
    6666
    6767      if ( information->is_string ) {
    68         s = the_object->name;
     68        s = the_object->name.name_p;
    6969      } else {
    70         uint32_t  u32_name = (uint32_t) the_object->name;
     70        uint32_t  u32_name = (uint32_t) the_object->name.name_u32;
    7171
    7272        lname[ 0 ] = (u32_name >> 24) & 0xff;
  • cpukit/score/src/objectmp.c

    r8571262 rce19f1fa  
    193193    /*
    194194     *  NOTE: The local node was search (if necessary) by
    195      *        _Objects_Name_to_id before this was invoked.
     195     *        _Objects_Name_to_id_XXX before this was invoked.
    196196     */
    197197
     
    240240  /*
    241241   *  NOTE: The local node was search (if necessary) by
    242    *        _Objects_Name_to_id before this was invoked.
     242   *        _Objects_Name_to_id_XXX before this was invoked.
    243243   *
    244244   *        The NODE field of an object id cannot be 0
  • cpukit/score/src/objectnametoid.c

    r8571262 rce19f1fa  
    33 *
    44 *
    5  *  COPYRIGHT (c) 1989-1999.
     5 *  COPYRIGHT (c) 1989-2008.
    66 *  On-Line Applications Research Corporation (OAR).
    77 *
     
    3131/*PAGE
    3232 *
    33  *  _Objects_Name_to_id
     33 *  _Objects_Name_to_id_u32
    3434 *
    3535 *  These kernel routines search the object table(s) for the given
     
    4848 */
    4949
    50 Objects_Name_or_id_lookup_errors _Objects_Name_to_id(
     50Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32(
    5151  Objects_Information *information,
    52   Objects_Name         name,
     52  uint32_t             name,
    5353  uint32_t             node,
    5454  Objects_Id          *id
     
    5959  uint32_t                   index;
    6060  uint32_t                   name_length;
    61   Objects_Name_comparators   compare_them;
     61
     62  /* ASSERT: information->is_string == FALSE */
    6263
    6364  if ( !id )
     
    7980    name_length = information->name_length;
    8081
    81     if ( information->is_string ) compare_them = _Objects_Compare_name_string;
    82     else                          compare_them = _Objects_Compare_name_raw;
    83 
    8482    for ( index = 1; index <= information->maximum; index++ ) {
    8583      the_object = information->local_table[ index ];
    86       if ( !the_object || !the_object->name )
     84      if ( !the_object )
    8785        continue;
    8886
    89       if ( (*compare_them)( name, the_object->name, name_length ) ) {
     87      if ( name == the_object->name.name_u32 ) {
    9088        *id = the_object->id;
    9189        return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL;
Note: See TracChangeset for help on using the changeset viewer.