Changeset 833dd90 in rtems


Ignore:
Timestamp:
Nov 19, 2013, 3:09:39 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
4ea97d24
Parents:
eea7c937
git-author:
Sebastian Huber <sebastian.huber@…> (11/19/13 15:09:39)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/21/13 11:58:46)
Message:

score/rbtree: Delete protected operations

The user of the red-black tree container must now ensure that at most
one thread at once can access an instance.

Files:
2 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • cpukit/sapi/include/rtems/rbtree.h

    reea7c937 r833dd90  
    310310}
    311311
    312 /** @brief Find the node with given key in the tree.
    313  *
    314  * This function returns a pointer to the node having key equal to the key
    315  * of @a the_node if it exists within @a the_rbtree, and NULL if not.
    316  * @a the_node has to be made up before a search.
    317  *
    318  * @note If the tree is not unique and contains duplicate keys, the set
    319  *       of duplicate keys acts as FIFO.
    320  */
    321 RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_find(
    322   const rtems_rbtree_control *the_rbtree,
    323   const rtems_rbtree_node *the_node
    324 )
    325 {
    326   return _RBTree_Find( the_rbtree, the_node );
    327 }
    328 
    329312/**
    330313 * @copydoc _RBTree_Predecessor_unprotected()
     
    338321
    339322/**
    340  * @copydoc _RBTree_Predecessor()
    341  */
    342 RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_predecessor(
    343   const rtems_rbtree_node *node
    344 )
    345 {
    346   return _RBTree_Predecessor( node );
    347 }
    348 
    349 /**
    350323 * @copydoc _RBTree_Successor_unprotected()
    351324 */
     
    355328{
    356329  return _RBTree_Successor_unprotected( node );
    357 }
    358 
    359 /**
    360  * @copydoc _RBTree_Successor()
    361  */
    362 RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_successor(
    363   const rtems_rbtree_node *node
    364 )
    365 {
    366   return _RBTree_Successor( node );
    367330}
    368331
     
    379342
    380343/**
    381  * @brief Extract the specified node from a rbtree.
    382  *
    383  * This routine extracts @a the_node from @a the_rbtree on which it resides.
    384  * It disables interrupts to ensure the atomicity of the extract operation.
    385  */
    386 RTEMS_INLINE_ROUTINE void rtems_rbtree_extract(
    387   rtems_rbtree_control *the_rbtree,
    388   rtems_rbtree_node *the_node
    389 )
    390 {
    391   _RBTree_Extract( the_rbtree, the_node );
    392 }
    393 
    394 /**
    395344 * @brief Obtain the min node on a rbtree.
    396345 *
     
    407356
    408357/**
    409  * @brief Obtain the min node on a rbtree.
    410  *
    411  * This function removes the min node from @a the_rbtree and returns
    412  * a pointer to that node.  If @a the_rbtree is empty, then NULL is returned.
    413  * It disables interrupts to ensure the atomicity of the get operation.
    414  */
    415 RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_get_min(
    416   rtems_rbtree_control *the_rbtree
    417 )
    418 {
    419   return _RBTree_Get( the_rbtree, RBT_LEFT );
    420 }
    421 
    422 /**
    423358 * @brief Obtain the max node on a rbtree.
    424359 *
     
    432367{
    433368  return _RBTree_Get_unprotected( the_rbtree, RBT_RIGHT );
    434 }
    435 
    436 /**
    437  * @brief Obtain the max node on a rbtree.
    438  *
    439  * This function removes the max node from @a the_rbtree and returns
    440  * a pointer to that node.  If @a the_rbtree is empty, then NULL is returned.
    441  * It disables interrupts to ensure the atomicity of the get operation.
    442  */
    443 RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_get_max(
    444   rtems_rbtree_control *the_rbtree
    445 )
    446 {
    447   return _RBTree_Get( the_rbtree, RBT_RIGHT );
    448369}
    449370
     
    487408
    488409/**
    489  * @brief Find the control header of the tree containing a given node.
    490  *
    491  * This routine finds the rtems_rbtree_control structure of the tree
    492  * containing @a the_node.
    493  * It disables interrupts to ensure the atomicity of the find operation.
    494  */
    495 RTEMS_INLINE_ROUTINE rtems_rbtree_control *rtems_rbtree_find_header(
    496   rtems_rbtree_node *the_node
    497 )
    498 {
    499   return _RBTree_Find_header( the_node );
    500 }
    501 
    502 /**
    503410 * @copydoc _RBTree_Insert_unprotected()
    504411 */
     
    511418}
    512419
    513 /**
    514  * @brief Insert a node on a rbtree.
    515  *
    516  * This routine inserts @a the_node on @a the_rbtree.
    517  * It disables interrupts to ensure the atomicity of the insert operation.
    518  *
    519  * @retval 0 Successfully inserted.
    520  * @retval -1 NULL @a the_node.
    521  * @retval RBTree_Node* if one with equal key to the key of @a the_node exists
    522  *         in an unique @a the_rbtree.
    523  */
    524 RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_insert(
    525   rtems_rbtree_control *the_rbtree,
    526   rtems_rbtree_node *the_node
    527 )
    528 {
    529   return _RBTree_Insert( the_rbtree, the_node );
    530 }
    531 
    532420/**
    533421 * @brief Determines whether the tree is unique.
  • cpukit/score/Makefile.am

    reea7c937 r833dd90  
    261261## RBTREE_C_FILES
    262262libscore_a_SOURCES += src/rbtree.c \
    263     src/rbtreeextract.c src/rbtreefind.c src/rbtreefindheader.c \
    264     src/rbtreeget.c src/rbtreeinsert.c src/rbtreeiterate.c src/rbtreenext.c
     263    src/rbtreeextract.c src/rbtreefind.c \
     264    src/rbtreeinsert.c src/rbtreeiterate.c src/rbtreenext.c
    265265
    266266## THREAD_C_FILES
  • cpukit/score/include/rtems/score/rbtree.h

    reea7c937 r833dd90  
    208208
    209209/**
    210  *  @brief Obtain the min or max node of a rbtree.
    211  *
    212  *  This function removes the min or max node from @a the_rbtree and returns
    213  *  a pointer to that node.  If @a the_rbtree is empty, then NULL is returned.
    214  *  @a dir specifies whether to return the min (0) or max (1).
    215  *
    216  *  @retval This method returns a pointer to a node.  If a node was removed,
    217  *          then a pointer to that node is returned.  If @a the_rbtree was
    218  *          empty, then NULL is returned.
    219  *
    220  *  @note It disables interrupts to ensure the atomicity of the get operation.
    221  */
    222 RBTree_Node *_RBTree_Get(
    223   RBTree_Control *the_rbtree,
    224   RBTree_Direction dir
    225 );
    226 
    227 /** @brief Find the node with given key in the tree
    228  *
    229  *  This function returns a pointer to the node in @a the_rbtree
    230  *  having key equal to key of  @a the_node if it exists,
    231  *  and NULL if not. @a the_node has to be made up before a search.
    232  *
    233  *  @note If the tree is not unique and contains duplicate keys, the set
    234  *        of duplicate keys acts as FIFO.
     210 * @brief Tries to find a node for the specified key in the tree.
     211 *
     212 * @param[in] the_rbtree The red-black tree control.
     213 * @param[in] the_node A node specifying the key.
     214 *
     215 * @retval node A node corresponding to the key.  If the tree is not unique
     216 * and contains duplicate keys, the set of duplicate keys acts as FIFO.
     217 * @retval NULL No node exists in the tree for the key.
    235218 */
    236219RBTree_Node *_RBTree_Find_unprotected(
     
    240223
    241224/**
    242  *  @brief Find the node with given key in the tree.
    243  *
    244  *  This function returns a pointer to the node with key equal to a key
    245  *  of @a the_node if it exists in the Red-Black Tree @a the_rbtree,
    246  *  and NULL if not.
    247  *
    248  *  @param[in] the_rbtree pointer to rbtree control
    249  *  @param[in] the_node node with the key to search for
    250  *  @retval This method returns pointer to control header of rbtree. *
    251  *          If there is no control header available (the node is not part
    252  *          of a tree), then NULL is returned. *
    253  *
    254  *  - INTERRUPT LATENCY:
    255  *    + single case
    256  */
    257 RBTree_Node *_RBTree_Find(
    258   const RBTree_Control *the_rbtree,
    259   const RBTree_Node *the_node
    260 );
    261 
    262 /**
    263  *  @brief Find the control structure of the tree containing the given node.
    264  *
    265  *  This function returns a pointer called @a return_header to the
    266  *  control structure of the tree containing @a the_node, if it exists,
    267  *   and @a NULL if not.
    268  *
    269  *  @param[in] the_node is the pointer to the rbtree node.
    270  *
    271  *  -INTERRUPT LATENCY:
    272  *    + single case
    273  */
    274 RBTree_Control *_RBTree_Find_header(
    275   RBTree_Node *the_node
    276 );
    277 
    278 /**
    279225 *  @brief Insert @a the_node on the Red-Black Tree @a the_rbtree (unprotected).
    280226 *
     
    285231 *  @retval RBTree_Node* if one with equal value to @a the_node 's key exists
    286232 *          in an unique @a the_rbtree.
    287  *
    288  *  @note It does NOT disable interrupts to ensure the atomicity
    289  *        of the extract operation.
    290233 */
    291234RBTree_Node *_RBTree_Insert_unprotected(
     
    295238
    296239/**
    297  *  @brief Insert a node on a rbtree.
    298  *
    299  *  This routine inserts @a the_node on the tree @a the_rbtree.
    300  *
    301  *  @retval 0 Successfully inserted.
    302  *  @retval -1 NULL @a the_node.
    303  *  @retval RBTree_Node* if one with equal value to @a the_node 's key exists
    304  *          in an unique @a the_rbtree.
    305  *
    306  *  @note It disables interrupts to ensure the atomicity
    307  *  of the extract operation.
    308  */
    309 RBTree_Node *_RBTree_Insert(
    310   RBTree_Control *the_rbtree,
    311   RBTree_Node *the_node
    312 );
    313 
    314 
    315 /**
    316240 *  @brief Extracts (removes) @a the_node from @a the_rbtree (unprotected).
    317241 *
    318242 *  This routine extracts (removes) @a the_node from @a the_rbtree.
    319  *
    320  *  @note It does NOT disable interrupts to ensure the atomicity
    321  *        of the extract operation.
    322243 */
    323244void _RBTree_Extract_unprotected(
     
    327248
    328249/**
    329  *  @brief Delete a node from the rbtree.
    330  *
    331  *  This routine deletes @a the_node from @a the_rbtree.
    332  *
    333  *  @note It disables interrupts to ensure the atomicity of the
    334  *  append operation.
    335  */
    336 void _RBTree_Extract(
    337   RBTree_Control *the_rbtree,
    338   RBTree_Node    *the_node
    339 );
    340 
    341 /**
    342250 * @brief Returns the in-order next node of a node.
    343251 *
     
    349257 */
    350258RBTree_Node *_RBTree_Next_unprotected(
    351   const RBTree_Node *node,
    352   RBTree_Direction dir
    353 );
    354 
    355 /**
    356  * @copydoc _RBTree_Next_unprotected()
    357  *
    358  * The function disables the interrupts protect the operation.
    359  */
    360 RBTree_Node *_RBTree_Next(
    361259  const RBTree_Node *node,
    362260  RBTree_Direction dir
     
    619517
    620518/**
    621  * @copydoc _RBTree_Predecessor_unprotected()
    622  *
    623  * The function disables the interrupts protect the operation.
    624  */
    625 RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Predecessor(
    626   const RBTree_Node *node
    627 )
    628 {
    629   return _RBTree_Next( node, RBT_LEFT );
    630 }
    631 
    632 /**
    633519 * @brief Returns the successor of a node.
    634520 *
     
    645531
    646532/**
    647  * @copydoc _RBTree_Successor_unprotected()
    648  *
    649  * The function disables the interrupts protect the operation.
    650  */
    651 RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Successor(
    652   const RBTree_Node *node
    653 )
    654 {
    655   return _RBTree_Next( node, RBT_RIGHT );
    656 }
    657 
    658 /**
    659533 * @brief Get the first node (unprotected).
    660534 *
    661535 * This function removes the minimum or maximum node from the_rbtree and
    662  * returns a pointer to that node.  It does NOT disable interrupts to ensure
    663  * the atomicity of the get operation.
     536 * returns a pointer to that node.
    664537 *
    665538 * @param[in] the_rbtree is the rbtree to attempt to get the min node from.
  • cpukit/score/src/rbtreeextract.c

    reea7c937 r833dd90  
    203203  if (the_rbtree->root) the_rbtree->root->color = RBT_BLACK;
    204204}
    205 
    206 
    207 /*
    208  *  _RBTree_Extract
    209  *
    210  *  This kernel routine deletes the given node from a rbtree.
    211  *
    212  *  Input parameters:
    213  *    node - pointer to node in rbtree to be deleted
    214  *
    215  *  Output parameters:  NONE
    216  *
    217  *  INTERRUPT LATENCY:
    218  *    only case
    219  */
    220 
    221 void _RBTree_Extract(
    222   RBTree_Control *the_rbtree,
    223   RBTree_Node *the_node
    224 )
    225 {
    226   ISR_Level level;
    227 
    228   _ISR_Disable( level );
    229     _RBTree_Extract_unprotected( the_rbtree, the_node );
    230   _ISR_Enable( level );
    231 }
  • cpukit/score/src/rbtreefind.c

    reea7c937 r833dd90  
    2020#include <rtems/score/rbtreeimpl.h>
    2121#include <rtems/score/isr.h>
    22 
    23 RBTree_Node *_RBTree_Find(
    24   const RBTree_Control *the_rbtree,
    25   const RBTree_Node *search_node
    26 )
    27 {
    28   ISR_Level          level;
    29   RBTree_Node *return_node;
    30 
    31   return_node = NULL;
    32   _ISR_Disable( level );
    33       return_node = _RBTree_Find_unprotected( the_rbtree, search_node );
    34   _ISR_Enable( level );
    35   return return_node;
    36 }
    3722
    3823RBTree_Node *_RBTree_Find_unprotected(
  • cpukit/score/src/rbtreeinsert.c

    reea7c937 r833dd90  
    123123  return (RBTree_Node*)0;
    124124}
    125 
    126 
    127 /*
    128  *  _RBTree_Insert
    129  *
    130  *  This kernel routine inserts a given node after a specified node
    131  *  a requested rbtree.
    132  *
    133  *  Input parameters:
    134  *    tree - pointer to RBTree Control for tree to insert to
    135  *    node       - pointer to node to be inserted
    136  *
    137  *  Output parameters:  NONE
    138  *
    139  *  INTERRUPT LATENCY:
    140  *    only case
    141  */
    142 
    143 RBTree_Node *_RBTree_Insert(
    144   RBTree_Control *tree,
    145   RBTree_Node *node
    146 )
    147 {
    148   ISR_Level level;
    149   RBTree_Node *return_node;
    150 
    151   _ISR_Disable( level );
    152   return_node = _RBTree_Insert_unprotected( tree, node );
    153   _ISR_Enable( level );
    154   return return_node;
    155 }
  • cpukit/score/src/rbtreenext.c

    reea7c937 r833dd90  
    6161  return next;
    6262}
    63 
    64 RBTree_Node *_RBTree_Next(
    65   const RBTree_Node *node,
    66   RBTree_Direction dir
    67 )
    68 {
    69   RBTree_Node *next;
    70   ISR_Level level;
    71 
    72   _ISR_Disable( level );
    73   next = _RBTree_Next_unprotected( node, dir );
    74   _ISR_Enable( level );
    75 
    76   return next;
    77 }
  • testsuites/sptests/sprbtree01/init.c

    reea7c937 r833dd90  
    118118  node2.id = 2;
    119119  node2.key = 2;
    120   rtems_rbtree_insert( &rbtree1, &node1.Node );
    121   rtems_rbtree_insert( &rbtree1, &node2.Node );
    122 
    123   p = rtems_rbtree_insert( &rbtree1, NULL );
     120  rtems_rbtree_insert_unprotected( &rbtree1, &node1.Node );
     121  rtems_rbtree_insert_unprotected( &rbtree1, &node2.Node );
     122
     123  p = rtems_rbtree_insert_unprotected( &rbtree1, NULL );
    124124  if (p != (void *)(-1))
    125125    puts( "INIT - FAILED NULL NODE INSERT" );
     
    136136    puts( "INIT - FAILED TREE CHECK" );
    137137
    138   for ( p = rtems_rbtree_get_min(&rbtree1), id = 1 ; p ;
    139       p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
     138  for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 1 ; p ;
     139      p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
    140140    test_node *t = rtems_rbtree_container_of(p,test_node,Node);
    141141    if ( id > 2 ) {
     
    158158  puts("INIT - Verify rtems_rbtree_insert with the same value twice");
    159159  node2.key = node1.key;
    160   rtems_rbtree_insert(&rbtree1, &node1.Node);
    161   p = rtems_rbtree_insert(&rbtree1, &node2.Node);
     160  rtems_rbtree_insert_unprotected(&rbtree1, &node1.Node);
     161  p = rtems_rbtree_insert_unprotected(&rbtree1, &node2.Node);
    162162
    163163  if (p != &node1.Node)
    164164    puts( "INIT - FAILED DUPLICATE INSERT" );
    165165
    166   for ( p = rtems_rbtree_get_min(&rbtree1), id = 1 ; p ;
    167       p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
     166  for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 1 ; p ;
     167      p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
    168168    test_node *t = rtems_rbtree_container_of(p,test_node,Node);
    169169    if ( id > 1 ) {
     
    193193
    194194  puts( "INIT - Verify rtems_XXX on an empty tree" );
    195   if(rtems_rbtree_get_min(&rbtree1)) {
     195  if(rtems_rbtree_get_min_unprotected(&rbtree1)) {
    196196    puts("INIT - get_min on empty returned non-NULL");
    197197    rtems_test_exit(0);
    198198  }
    199   if(rtems_rbtree_get_max(&rbtree1)) {
     199  if(rtems_rbtree_get_max_unprotected(&rbtree1)) {
    200200    puts("INIT - get_max on empty returned non-NULL");
    201201    rtems_test_exit(0);
     
    217217  node2.id = 1;
    218218  node2.key = 1;
    219   rtems_rbtree_insert( &rbtree1, &node1.Node );
    220   rtems_rbtree_insert( &rbtree1, &node2.Node );
     219  rtems_rbtree_insert_unprotected( &rbtree1, &node1.Node );
     220  rtems_rbtree_insert_unprotected( &rbtree1, &node2.Node );
    221221
    222222  puts( "INIT - Verify rtems_rbtree_peek_max/min, rtems_rbtree_extract" );
     
    230230  }
    231231  p = rtems_rbtree_peek_max(&rbtree1);
    232   rtems_rbtree_extract(&rbtree1, p);
     232  rtems_rbtree_extract_unprotected(&rbtree1, p);
    233233  t1 = rtems_rbtree_container_of(p,test_node,Node);
    234234  if (t1->key != 2) {
     
    236236    rtems_test_exit(0);
    237237  }
    238   rtems_rbtree_insert(&rbtree1, p);
    239 
    240   for ( p = rtems_rbtree_get_min(&rbtree1), id = 1 ; p ;
    241       p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
     238  rtems_rbtree_insert_unprotected(&rbtree1, p);
     239
     240  for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 1 ; p ;
     241      p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
    242242    test_node *t = rtems_rbtree_container_of(p,test_node,Node);
    243243    if ( id > 2 ) {
     
    255255    node_array[i].id = i;
    256256    node_array[i].key = i;
    257     rtems_rbtree_insert( &rbtree1, &node_array[i].Node );
     257    rtems_rbtree_insert_unprotected( &rbtree1, &node_array[i].Node );
    258258
    259259    if (!rb_assert(rbtree1.root) )
     
    263263  puts( "INIT - Removing 100 nodes" );
    264264
    265   for ( p = rtems_rbtree_get_min(&rbtree1), id = 0 ; p ;
    266       p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
     265  for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 0 ; p ;
     266      p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
    267267    test_node *t = rtems_rbtree_container_of(p,test_node,Node);
    268268    if ( id > 99 ) {
     
    288288    node_array[i].id = 99-i;
    289289    node_array[i].key = 99-i;
    290     rtems_rbtree_insert( &rbtree1, &node_array[i].Node );
     290    rtems_rbtree_insert_unprotected( &rbtree1, &node_array[i].Node );
    291291
    292292    if (!rb_assert(rbtree1.root) )
     
    296296  puts( "INIT - Removing 100 nodes" );
    297297
    298   for ( p = rtems_rbtree_get_min(&rbtree1), id = 0 ; p ;
    299       p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
     298  for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 0 ; p ;
     299      p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
    300300    test_node *t = rtems_rbtree_container_of(p,test_node,Node);
    301301    if ( id > 99 ) {
     
    323323    node_array[i].id = i;
    324324    node_array[i].key = i;
    325     rtems_rbtree_insert( &rbtree1, &node_array[i].Node );
     325    rtems_rbtree_insert_unprotected( &rbtree1, &node_array[i].Node );
    326326
    327327    if (!rb_assert(rbtree1.root) )
     
    333333  for (i = 0; i < 20; i++) {
    334334    id = numbers[i];
    335     rtems_rbtree_extract( &rbtree1, &node_array[id].Node );
     335    rtems_rbtree_extract_unprotected( &rbtree1, &node_array[id].Node );
    336336    if (!rb_assert(rbtree1.root) )
    337337      puts( "INIT - FAILED TREE CHECK" );
     
    340340  puts( "INIT - Removing 80 nodes" );
    341341
    342   for ( p = rtems_rbtree_get_min(&rbtree1), id = 0, i = 0 ; p ;
    343       p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
     342  for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 0, i = 0 ; p ;
     343      p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
    344344    test_node *t = rtems_rbtree_container_of(p, test_node, Node);
    345345
     
    375375    node_array[i].key = i;
    376376  }
    377   rtems_rbtree_insert( &rbtree1, &node_array[3].Node );
    378   rtems_rbtree_insert( &rbtree1, &node_array[1].Node );
    379   rtems_rbtree_insert( &rbtree1, &node_array[5].Node );
    380   rtems_rbtree_insert( &rbtree1, &node_array[0].Node );
    381   rtems_rbtree_insert( &rbtree1, &node_array[2].Node );
    382   rtems_rbtree_insert( &rbtree1, &node_array[4].Node );
    383   rtems_rbtree_insert( &rbtree1, &node_array[6].Node );
    384   rtems_rbtree_extract( &rbtree1, &node_array[2].Node );
     377  rtems_rbtree_insert_unprotected( &rbtree1, &node_array[3].Node );
     378  rtems_rbtree_insert_unprotected( &rbtree1, &node_array[1].Node );
     379  rtems_rbtree_insert_unprotected( &rbtree1, &node_array[5].Node );
     380  rtems_rbtree_insert_unprotected( &rbtree1, &node_array[0].Node );
     381  rtems_rbtree_insert_unprotected( &rbtree1, &node_array[2].Node );
     382  rtems_rbtree_insert_unprotected( &rbtree1, &node_array[4].Node );
     383  rtems_rbtree_insert_unprotected( &rbtree1, &node_array[6].Node );
     384  rtems_rbtree_extract_unprotected( &rbtree1, &node_array[2].Node );
    385385  /* node_array[1] has now only a left child. */
    386386  if ( !node_array[1].Node.child[RBT_LEFT] ||
    387387        node_array[1].Node.child[RBT_RIGHT] )
    388388     puts( "INIT - LEFT CHILD ONLY NOT FOUND" );
    389   rtems_rbtree_extract( &rbtree1, &node_array[3].Node );
    390   while( (p = rtems_rbtree_get_max(&rbtree1)) );
     389  rtems_rbtree_extract_unprotected( &rbtree1, &node_array[3].Node );
     390  while( (p = rtems_rbtree_get_max_unprotected(&rbtree1)) );
    391391
    392392  puts( "INIT - Verify rtems_rbtree_get_max with 100 nodes value [99,0]" );
     
    394394    node_array[i].id = 99-i;
    395395    node_array[i].key = 99-i;
    396     rtems_rbtree_insert( &rbtree1, &node_array[i].Node );
     396    rtems_rbtree_insert_unprotected( &rbtree1, &node_array[i].Node );
    397397
    398398    if (!rb_assert(rbtree1.root) )
     
    402402  puts( "INIT - Removing 100 nodes" );
    403403
    404   for ( p = rtems_rbtree_get_max(&rbtree1), id = 0 ; p ;
    405       p = rtems_rbtree_get_max(&rbtree1) , id++ ) {
     404  for ( p = rtems_rbtree_get_max_unprotected(&rbtree1), id = 0 ; p ;
     405      p = rtems_rbtree_get_max_unprotected(&rbtree1) , id++ ) {
    406406    test_node *t = rtems_rbtree_container_of(p,test_node,Node);
    407407    if ( id > 99 ) {
     
    427427    node_array[i].id = i;
    428428    node_array[i].key = i;
    429     rtems_rbtree_insert( &rbtree1, &node_array[i].Node );
     429    rtems_rbtree_insert_unprotected( &rbtree1, &node_array[i].Node );
    430430
    431431    if (!rb_assert(rbtree1.root) )
     
    435435  puts( "INIT - Verify rtems_rbtree_find" );
    436436  search_node.key = 30;
    437   p = rtems_rbtree_find(&rbtree1, &search_node.Node);
     437  p = rtems_rbtree_find_unprotected(&rbtree1, &search_node.Node);
    438438  if(rtems_rbtree_container_of(p,test_node,Node)->id != 30) {
    439439    puts ("INIT - ERROR ON RBTREE ID MISMATCH");
     
    442442
    443443  puts( "INIT - Verify rtems_rbtree_predecessor/successor");
    444   p = rtems_rbtree_predecessor(p);
     444  p = rtems_rbtree_predecessor_unprotected(p);
    445445  if(p && rtems_rbtree_container_of(p,test_node,Node)->id != 29) {
    446446    puts ("INIT - ERROR ON RBTREE ID MISMATCH");
    447447    rtems_test_exit(0);
    448448  }
    449   p = rtems_rbtree_find(&rbtree1, &search_node.Node);
    450   p = rtems_rbtree_successor(p);
     449  p = rtems_rbtree_find_unprotected(&rbtree1, &search_node.Node);
     450  p = rtems_rbtree_successor_unprotected(p);
    451451  if(p && rtems_rbtree_container_of(p,test_node,Node)->id != 31) {
    452452    puts ("INIT - ERROR ON RBTREE ID MISMATCH");
     
    454454  }
    455455
    456   p = rtems_rbtree_find(&rbtree1, &search_node.Node);
     456  p = rtems_rbtree_find_unprotected(&rbtree1, &search_node.Node);
    457457  puts( "INIT - Verify rtems_rbtree_find_header" );
    458   if (rtems_rbtree_find_header(p) != &rbtree1) {
     458  if (rtems_rbtree_find_header_unprotected(p) != &rbtree1) {
    459459    puts ("INIT - ERROR ON RBTREE HEADER MISMATCH");
    460460    rtems_test_exit(0);
     
    474474  puts( "INIT - Removing 100 nodes" );
    475475
    476   for ( p = rtems_rbtree_get_max(&rbtree1), id = 99 ; p ;
    477       p = rtems_rbtree_get_max(&rbtree1) , id-- ) {
     476  for ( p = rtems_rbtree_get_max_unprotected(&rbtree1), id = 99 ; p ;
     477      p = rtems_rbtree_get_max_unprotected(&rbtree1) , id-- ) {
    478478    test_node *t = rtems_rbtree_container_of(p,test_node,Node);
    479479    if ( id < 0 ) {
     
    495495  }
    496496
    497   if (rtems_rbtree_find_header(&node_array[0].Node) != NULL) {
     497  if (rtems_rbtree_find_header_unprotected(&node_array[0].Node) != NULL) {
    498498    puts ("INIT - ERROR ON RBTREE HEADER MISMATCH");
    499499    rtems_test_exit(0);
    500500  }
    501   if (rtems_rbtree_find_header(NULL) != NULL) {
     501  if (rtems_rbtree_find_header_unprotected(NULL) != NULL) {
    502502    puts ("INIT - ERROR ON RBTREE HEADER MISMATCH");
    503503    rtems_test_exit(0);
     
    508508    node_array[i].id = numbers[i];
    509509    node_array[i].key = numbers[i];
    510     rtems_rbtree_insert( &rbtree1, &node_array[i].Node );
     510    rtems_rbtree_insert_unprotected( &rbtree1, &node_array[i].Node );
    511511
    512512    if (!rb_assert(rbtree1.root) )
     
    516516  puts( "INIT - Removing 20 nodes" );
    517517
    518   for ( p = rtems_rbtree_get_min(&rbtree1), id = 0 ; p ;
    519       p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
     518  for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 0 ; p ;
     519      p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
    520520    test_node *t = rtems_rbtree_container_of(p,test_node,Node);
    521521    if ( id > 19 ) {
     
    548548  puts( "INIT - Removing 100 nodes" );
    549549
    550   for ( p = rtems_rbtree_get_min(&rbtree1), id = 0 ; p ;
    551       p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
     550  for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 0 ; p ;
     551      p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
    552552    test_node *t = rtems_rbtree_container_of(p,test_node,Node);
    553553    if ( id > 99 ) {
     
    583583    node_array[i].id = i;
    584584    node_array[i].key = i%5;
    585     rtems_rbtree_insert( &rbtree1, &node_array[i].Node );
     585    rtems_rbtree_insert_unprotected( &rbtree1, &node_array[i].Node );
    586586
    587587    if (!rb_assert(rbtree1.root) )
     
    591591  puts( "INIT - Verify rtems_rbtree_find in a duplicate tree" );
    592592  search_node.key = 2;
    593   p = rtems_rbtree_find(&rbtree1, &search_node.Node);
     593  p = rtems_rbtree_find_unprotected(&rbtree1, &search_node.Node);
    594594  if(rtems_rbtree_container_of(p,test_node,Node)->id != 2) {
    595595    puts ("INIT - ERROR ON RBTREE ID MISMATCH");
     
    599599  puts( "INIT - Removing 100 nodes" );
    600600
    601   for ( p = rtems_rbtree_get_min(&rbtree1), id = 0 ; p ;
    602       p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
     601  for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 0 ; p ;
     602      p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
    603603    test_node *t = rtems_rbtree_container_of(p,test_node,Node);
    604604    if ( id > 99 ) {
     
    624624    node_array[i].id = 99-i;
    625625    node_array[i].key = (99-i)%5;
    626     rtems_rbtree_insert( &rbtree1, &node_array[i].Node );
     626    rtems_rbtree_insert_unprotected( &rbtree1, &node_array[i].Node );
    627627
    628628    if (!rb_assert(rbtree1.root) )
     
    632632  puts( "INIT - Verify rtems_rbtree_find in a duplicate tree" );
    633633  search_node.key = 2;
    634   p = rtems_rbtree_find(&rbtree1, &search_node.Node);
     634  p = rtems_rbtree_find_unprotected(&rbtree1, &search_node.Node);
    635635  if(rtems_rbtree_container_of(p,test_node,Node)->id != 97) {
    636636    puts ("INIT - ERROR ON RBTREE ID MISMATCH");
     
    640640  puts( "INIT - Removing 100 nodes" );
    641641
    642   for ( p = rtems_rbtree_get_min(&rbtree1), id = 0 ; p ;
    643       p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
     642  for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 0 ; p ;
     643      p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
    644644    test_node *t = rtems_rbtree_container_of(p,test_node,Node);
    645645    if ( id > 99 ) {
Note: See TracChangeset for help on using the changeset viewer.