[rtems commit] score/rbtree: Remove "unprotected" from API
Sebastian Huber
sebh at rtems.org
Thu Nov 21 11:52:13 UTC 2013
Module: rtems
Branch: master
Commit: 4ea97d2449e783cce95fb62c7a424c94531ac46c
Changeset: http://git.rtems.org/rtems/commit/?id=4ea97d2449e783cce95fb62c7a424c94531ac46c
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue Nov 19 16:21:54 2013 +0100
score/rbtree: Remove "unprotected" from API
---
cpukit/posix/src/keyfreememory.c | 10 +-
cpukit/posix/src/keygetspecific.c | 2 +-
cpukit/posix/src/keyrundestructors.c | 2 +-
cpukit/posix/src/keysetspecific.c | 2 +-
cpukit/sapi/include/rtems/rbtree.h | 60 +++++++----
cpukit/sapi/src/rbheap.c | 8 +-
cpukit/score/include/rtems/score/rbtree.h | 28 +++---
cpukit/score/include/rtems/score/rbtreeimpl.h | 4 +-
cpukit/score/src/rbtree.c | 2 +-
cpukit/score/src/rbtreeextract.c | 12 +-
cpukit/score/src/rbtreefind.c | 2 +-
cpukit/score/src/rbtreeinsert.c | 6 +-
cpukit/score/src/rbtreeiterate.c | 6 +-
cpukit/score/src/rbtreenext.c | 4 +-
cpukit/score/src/scheduleredfenqueue.c | 2 +-
cpukit/score/src/scheduleredfextract.c | 2 +-
cpukit/score/src/scheduleredfyield.c | 4 +-
testsuites/libtests/rbheap01/init.c | 2 +-
testsuites/sptests/sprbtree01/init.c | 128 ++++++++++++------------
19 files changed, 151 insertions(+), 135 deletions(-)
diff --git a/cpukit/posix/src/keyfreememory.c b/cpukit/posix/src/keyfreememory.c
index ff8fc82..71daba4 100644
--- a/cpukit/posix/src/keyfreememory.c
+++ b/cpukit/posix/src/keyfreememory.c
@@ -34,17 +34,17 @@ void _POSIX_Keys_Free_memory(
key_id = the_key->Object.id;
search_node.key = key_id;
search_node.thread_id = 0;
- iter = _RBTree_Find_unprotected( &_POSIX_Keys_Key_value_lookup_tree, &search_node.Key_value_lookup_node );
+ iter = _RBTree_Find( &_POSIX_Keys_Key_value_lookup_tree, &search_node.Key_value_lookup_node );
if ( !iter )
return;
/**
* find the smallest thread_id node in the rbtree.
*/
- next = _RBTree_Next_unprotected( iter, RBT_LEFT );
+ next = _RBTree_Next( iter, RBT_LEFT );
p = _RBTree_Container_of( next, POSIX_Keys_Key_value_pair, Key_value_lookup_node );
while ( next != NULL && p->key == key_id) {
iter = next;
- next = _RBTree_Next_unprotected( iter, RBT_LEFT );
+ next = _RBTree_Next( iter, RBT_LEFT );
p = _RBTree_Container_of( next, POSIX_Keys_Key_value_pair, Key_value_lookup_node );
}
@@ -53,8 +53,8 @@ void _POSIX_Keys_Free_memory(
*/
p = _RBTree_Container_of( iter, POSIX_Keys_Key_value_pair, Key_value_lookup_node );
while ( iter != NULL && p->key == key_id ) {
- next = _RBTree_Next_unprotected( iter, RBT_RIGHT );
- _RBTree_Extract_unprotected( &_POSIX_Keys_Key_value_lookup_tree, iter );
+ next = _RBTree_Next( iter, RBT_RIGHT );
+ _RBTree_Extract( &_POSIX_Keys_Key_value_lookup_tree, iter );
_Chain_Extract_unprotected( &p->Key_values_per_thread_node );
_POSIX_Keys_Key_value_pair_free( p );
diff --git a/cpukit/posix/src/keygetspecific.c b/cpukit/posix/src/keygetspecific.c
index 011917b..b1e9717 100644
--- a/cpukit/posix/src/keygetspecific.c
+++ b/cpukit/posix/src/keygetspecific.c
@@ -51,7 +51,7 @@ void *pthread_getspecific(
case OBJECTS_LOCAL:
search_node.key = key;
search_node.thread_id = _Thread_Executing->Object.id;
- p = _RBTree_Find_unprotected( &_POSIX_Keys_Key_value_lookup_tree,
+ p = _RBTree_Find( &_POSIX_Keys_Key_value_lookup_tree,
&search_node.Key_value_lookup_node );
key_data = NULL;
if ( p ) {
diff --git a/cpukit/posix/src/keyrundestructors.c b/cpukit/posix/src/keyrundestructors.c
index 5f0a699..2545486 100644
--- a/cpukit/posix/src/keyrundestructors.c
+++ b/cpukit/posix/src/keyrundestructors.c
@@ -60,7 +60,7 @@ void _POSIX_Keys_Run_destructors(
* because Chain_Node is the first member of POSIX_Keys_Key_value_pair
* structure.
*/
- _RBTree_Extract_unprotected(
+ _RBTree_Extract(
&_POSIX_Keys_Key_value_lookup_tree,
&iter->Key_value_lookup_node
);
diff --git a/cpukit/posix/src/keysetspecific.c b/cpukit/posix/src/keysetspecific.c
index 8f5ce72..5cfa90e 100644
--- a/cpukit/posix/src/keysetspecific.c
+++ b/cpukit/posix/src/keysetspecific.c
@@ -54,7 +54,7 @@ int pthread_setspecific(
value_pair_ptr->key = key;
value_pair_ptr->thread_id = _Thread_Executing->Object.id;
value_pair_ptr->value = value;
- if ( _RBTree_Insert_unprotected( &_POSIX_Keys_Key_value_lookup_tree,
+ if ( _RBTree_Insert( &_POSIX_Keys_Key_value_lookup_tree,
&(value_pair_ptr->Key_value_lookup_node) ) ) {
_Freechain_Put( (Freechain_Control *)&_POSIX_Keys_Keypool,
(void *) value_pair_ptr );
diff --git a/cpukit/sapi/include/rtems/rbtree.h b/cpukit/sapi/include/rtems/rbtree.h
index 5cbdab4..b787256 100644
--- a/cpukit/sapi/include/rtems/rbtree.h
+++ b/cpukit/sapi/include/rtems/rbtree.h
@@ -27,6 +27,20 @@ extern "C" {
#endif
/**
+ * @defgroup ClassicRBTrees Red-Black Trees
+ *
+ * @ingroup ClassicRTEMS
+ *
+ * @brief A Red-Black Tree container.
+ *
+ * The red-black tree container offers no internal protection against
+ * concurrent access. The user must ensure that at most one thread at once can
+ * access a red-black tree instance.
+ *
+ * @{
+ */
+
+/**
* @typedef rtems_rbtree_node
*
* A node that can be manipulated in the rbtree.
@@ -299,45 +313,45 @@ RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_root(
}
/**
- * @copydoc _RBTree_Find_unprotected()
+ * @copydoc _RBTree_Find()
*/
-RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_find_unprotected(
+RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_find(
const rtems_rbtree_control *the_rbtree,
const rtems_rbtree_node *the_node
)
{
- return _RBTree_Find_unprotected( the_rbtree, the_node );
+ return _RBTree_Find( the_rbtree, the_node );
}
/**
- * @copydoc _RBTree_Predecessor_unprotected()
+ * @copydoc _RBTree_Predecessor()
*/
-RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_predecessor_unprotected(
+RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_predecessor(
const rtems_rbtree_node *node
)
{
- return _RBTree_Predecessor_unprotected( node );
+ return _RBTree_Predecessor( node );
}
/**
- * @copydoc _RBTree_Successor_unprotected()
+ * @copydoc _RBTree_Successor()
*/
-RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_successor_unprotected(
+RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_successor(
const rtems_rbtree_node *node
)
{
- return _RBTree_Successor_unprotected( node );
+ return _RBTree_Successor( node );
}
/**
- * @copydoc _RBTree_Extract_unprotected()
+ * @copydoc _RBTree_Extract()
*/
-RTEMS_INLINE_ROUTINE void rtems_rbtree_extract_unprotected(
+RTEMS_INLINE_ROUTINE void rtems_rbtree_extract(
rtems_rbtree_control *the_rbtree,
rtems_rbtree_node *the_node
)
{
- _RBTree_Extract_unprotected( the_rbtree, the_node );
+ _RBTree_Extract( the_rbtree, the_node );
}
/**
@@ -347,11 +361,11 @@ RTEMS_INLINE_ROUTINE void rtems_rbtree_extract_unprotected(
* a pointer to that node. If @a the_rbtree is empty, then NULL is returned.
*/
-RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_get_min_unprotected(
+RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_get_min(
rtems_rbtree_control *the_rbtree
)
{
- return _RBTree_Get_unprotected( the_rbtree, RBT_LEFT );
+ return _RBTree_Get( the_rbtree, RBT_LEFT );
}
/**
@@ -361,11 +375,11 @@ RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_get_min_unprotected(
* a pointer to that node. If @a the_rbtree is empty, then NULL is returned.
*/
-RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_get_max_unprotected(
+RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_get_max(
rtems_rbtree_control *the_rbtree
)
{
- return _RBTree_Get_unprotected( the_rbtree, RBT_RIGHT );
+ return _RBTree_Get( the_rbtree, RBT_RIGHT );
}
/**
@@ -397,24 +411,24 @@ RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_peek_max(
}
/**
- * @copydoc _RBTree_Find_header_unprotected()
+ * @copydoc _RBTree_Find_header()
*/
-RTEMS_INLINE_ROUTINE rtems_rbtree_control *rtems_rbtree_find_header_unprotected(
+RTEMS_INLINE_ROUTINE rtems_rbtree_control *rtems_rbtree_find_header(
rtems_rbtree_node *the_node
)
{
- return _RBTree_Find_header_unprotected( the_node );
+ return _RBTree_Find_header( the_node );
}
/**
- * @copydoc _RBTree_Insert_unprotected()
+ * @copydoc _RBTree_Insert()
*/
-RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_insert_unprotected(
+RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_insert(
rtems_rbtree_control *the_rbtree,
rtems_rbtree_node *the_node
)
{
- return _RBTree_Insert_unprotected( the_rbtree, the_node );
+ return _RBTree_Insert( the_rbtree, the_node );
}
/**
@@ -427,6 +441,8 @@ RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_unique(
return _RBTree_Is_unique(the_rbtree);
}
+/** @} */
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/sapi/src/rbheap.c b/cpukit/sapi/src/rbheap.c
index 5233778..a33b980 100644
--- a/cpukit/sapi/src/rbheap.c
+++ b/cpukit/sapi/src/rbheap.c
@@ -80,7 +80,7 @@ static void insert_into_tree(
rtems_rbheap_chunk *chunk
)
{
- _RBTree_Insert_unprotected(tree, &chunk->tree_node);
+ _RBTree_Insert(tree, &chunk->tree_node);
}
rtems_status_code rtems_rbheap_initialize(
@@ -198,7 +198,7 @@ static rtems_rbheap_chunk *find(rtems_rbtree_control *chunk_tree, uintptr_t key)
rtems_rbheap_chunk chunk = { .begin = key };
return rtems_rbheap_chunk_of_node(
- _RBTree_Find_unprotected(chunk_tree, &chunk.tree_node)
+ _RBTree_Find(chunk_tree, &chunk.tree_node)
);
}
@@ -208,7 +208,7 @@ static rtems_rbheap_chunk *get_next(
)
{
return rtems_rbheap_chunk_of_node(
- _RBTree_Next_unprotected(&chunk->tree_node, dir)
+ _RBTree_Next(&chunk->tree_node, dir)
);
}
@@ -230,7 +230,7 @@ static void check_and_merge(
a->size += b->size;
rtems_chain_extract_unprotected(&b->chain_node);
add_to_chain(free_chain, b);
- _RBTree_Extract_unprotected(chunk_tree, &b->tree_node);
+ _RBTree_Extract(chunk_tree, &b->tree_node);
}
}
diff --git a/cpukit/score/include/rtems/score/rbtree.h b/cpukit/score/include/rtems/score/rbtree.h
index a3744e5..b9a172c 100644
--- a/cpukit/score/include/rtems/score/rbtree.h
+++ b/cpukit/score/include/rtems/score/rbtree.h
@@ -216,13 +216,13 @@ void _RBTree_Initialize(
* and contains duplicate keys, the set of duplicate keys acts as FIFO.
* @retval NULL No node exists in the tree for the key.
*/
-RBTree_Node *_RBTree_Find_unprotected(
+RBTree_Node *_RBTree_Find(
const RBTree_Control *the_rbtree,
const RBTree_Node *the_node
);
/**
- * @brief Insert @a the_node on the Red-Black Tree @a the_rbtree (unprotected).
+ * @brief Insert @a the_node on the Red-Black Tree @a the_rbtree.
*
* This routine inserts @a the_node on the Red-Black Tree @a the_rbtree.
*
@@ -231,17 +231,17 @@ RBTree_Node *_RBTree_Find_unprotected(
* @retval RBTree_Node* if one with equal value to @a the_node 's key exists
* in an unique @a the_rbtree.
*/
-RBTree_Node *_RBTree_Insert_unprotected(
+RBTree_Node *_RBTree_Insert(
RBTree_Control *the_rbtree,
RBTree_Node *the_node
);
/**
- * @brief Extracts (removes) @a the_node from @a the_rbtree (unprotected).
+ * @brief Extracts (removes) @a the_node from @a the_rbtree.
*
* This routine extracts (removes) @a the_node from @a the_rbtree.
*/
-void _RBTree_Extract_unprotected(
+void _RBTree_Extract(
RBTree_Control *the_rbtree,
RBTree_Node *the_node
);
@@ -255,7 +255,7 @@ void _RBTree_Extract_unprotected(
* @retval NULL The in-order next node does not exist.
* @retval otherwise The next node.
*/
-RBTree_Node *_RBTree_Next_unprotected(
+RBTree_Node *_RBTree_Next(
const RBTree_Node *node,
RBTree_Direction dir
);
@@ -471,7 +471,7 @@ RTEMS_INLINE_ROUTINE bool _RBTree_Is_root(
* This function returns a pointer to the header of the Red Black
* Tree containing @a the_node if it exists, and NULL if not.
*/
-RTEMS_INLINE_ROUTINE RBTree_Control *_RBTree_Find_header_unprotected(
+RTEMS_INLINE_ROUTINE RBTree_Control *_RBTree_Find_header(
RBTree_Node *the_node
)
{
@@ -508,11 +508,11 @@ RTEMS_INLINE_ROUTINE void _RBTree_Initialize_empty(
* @retval NULL The predecessor does not exist. Otherwise it returns
* the predecessor node.
*/
-RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Predecessor_unprotected(
+RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Predecessor(
const RBTree_Node *node
)
{
- return _RBTree_Next_unprotected( node, RBT_LEFT );
+ return _RBTree_Next( node, RBT_LEFT );
}
/**
@@ -522,15 +522,15 @@ RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Predecessor_unprotected(
*
* @retval NULL The successor does not exist. Otherwise the successor node.
*/
-RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Successor_unprotected(
+RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Successor(
const RBTree_Node *node
)
{
- return _RBTree_Next_unprotected( node, RBT_RIGHT );
+ return _RBTree_Next( node, RBT_RIGHT );
}
/**
- * @brief Get the first node (unprotected).
+ * @brief Get the first node.
*
* This function removes the minimum or maximum node from the_rbtree and
* returns a pointer to that node.
@@ -542,13 +542,13 @@ RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Successor_unprotected(
*
* @note This routine may return NULL if the RBTree is empty.
*/
-RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Get_unprotected(
+RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Get(
RBTree_Control *the_rbtree,
RBTree_Direction dir
)
{
RBTree_Node *the_node = the_rbtree->first[dir];
- _RBTree_Extract_unprotected(the_rbtree, the_node);
+ _RBTree_Extract(the_rbtree, the_node);
return the_node;
}
diff --git a/cpukit/score/include/rtems/score/rbtreeimpl.h b/cpukit/score/include/rtems/score/rbtreeimpl.h
index 30d55d2..0a3a883 100644
--- a/cpukit/score/include/rtems/score/rbtreeimpl.h
+++ b/cpukit/score/include/rtems/score/rbtreeimpl.h
@@ -43,7 +43,7 @@ extern "C" {
* @retval true Stop the iteration.
* @retval false Continue the iteration.
*
- * @see _RBTree_Iterate_unprotected().
+ * @see _RBTree_Iterate().
*/
typedef bool (*RBTree_Visitor)(
const RBTree_Node *node,
@@ -59,7 +59,7 @@ typedef bool (*RBTree_Visitor)(
* @param[in] visitor The visitor.
* @param[in] visitor_arg The visitor argument.
*/
-void _RBTree_Iterate_unprotected(
+void _RBTree_Iterate(
const RBTree_Control *rbtree,
RBTree_Direction dir,
RBTree_Visitor visitor,
diff --git a/cpukit/score/src/rbtree.c b/cpukit/score/src/rbtree.c
index 59dfd76..4ec0ad6 100644
--- a/cpukit/score/src/rbtree.c
+++ b/cpukit/score/src/rbtree.c
@@ -43,7 +43,7 @@ void _RBTree_Initialize(
count = number_nodes;
next = starting_address;
while ( count-- ) {
- _RBTree_Insert_unprotected(the_rbtree, next);
+ _RBTree_Insert(the_rbtree, next);
next = (RBTree_Node *)
_Addresses_Add_offset( (void *) next, node_size );
}
diff --git a/cpukit/score/src/rbtreeextract.c b/cpukit/score/src/rbtreeextract.c
index 8dafe3b..730d3f8 100644
--- a/cpukit/score/src/rbtreeextract.c
+++ b/cpukit/score/src/rbtreeextract.c
@@ -21,7 +21,7 @@
* @note It does NOT disable interrupts to ensure the atomicity
* of the extract operation.
*/
-static void _RBTree_Extract_validate_unprotected(
+static void _RBTree_Extract_validate(
RBTree_Node *the_node
)
{
@@ -91,7 +91,7 @@ static void _RBTree_Extract_validate_unprotected(
* @note It does NOT disable interrupts to ensure the atomicity
* of the extract operation.
*/
-void _RBTree_Extract_unprotected(
+void _RBTree_Extract(
RBTree_Control *the_rbtree,
RBTree_Node *the_node
)
@@ -105,7 +105,7 @@ void _RBTree_Extract_unprotected(
/* check if min needs to be updated */
if (the_node == the_rbtree->first[RBT_LEFT]) {
RBTree_Node *next;
- next = _RBTree_Successor_unprotected(the_node);
+ next = _RBTree_Successor(the_node);
the_rbtree->first[RBT_LEFT] = next;
}
@@ -113,7 +113,7 @@ void _RBTree_Extract_unprotected(
* do not use else if here. */
if (the_node == the_rbtree->first[RBT_RIGHT]) {
RBTree_Node *previous;
- previous = _RBTree_Predecessor_unprotected(the_node);
+ previous = _RBTree_Predecessor(the_node);
the_rbtree->first[RBT_RIGHT] = previous;
}
@@ -139,7 +139,7 @@ void _RBTree_Extract_unprotected(
leaf->parent = target->parent;
} else {
/* fix the tree here if the child is a null leaf. */
- _RBTree_Extract_validate_unprotected(target);
+ _RBTree_Extract_validate(target);
}
victim_color = target->color;
dir = target != target->parent->child[0];
@@ -176,7 +176,7 @@ void _RBTree_Extract_unprotected(
leaf->parent = the_node->parent;
} else {
/* fix the tree here if the child is a null leaf. */
- _RBTree_Extract_validate_unprotected(the_node);
+ _RBTree_Extract_validate(the_node);
}
victim_color = the_node->color;
diff --git a/cpukit/score/src/rbtreefind.c b/cpukit/score/src/rbtreefind.c
index 9b2663d..7aa0b35 100644
--- a/cpukit/score/src/rbtreefind.c
+++ b/cpukit/score/src/rbtreefind.c
@@ -20,7 +20,7 @@
#include <rtems/score/rbtreeimpl.h>
#include <rtems/score/isr.h>
-RBTree_Node *_RBTree_Find_unprotected(
+RBTree_Node *_RBTree_Find(
const RBTree_Control *the_rbtree,
const RBTree_Node *the_node
)
diff --git a/cpukit/score/src/rbtreeinsert.c b/cpukit/score/src/rbtreeinsert.c
index a2f6f09..c39249f 100644
--- a/cpukit/score/src/rbtreeinsert.c
+++ b/cpukit/score/src/rbtreeinsert.c
@@ -21,7 +21,7 @@
* @note It does NOT disable interrupts to ensure the atomicity of the
* append operation.
*/
-static void _RBTree_Validate_insert_unprotected(
+static void _RBTree_Validate_insert(
RBTree_Node *the_node
)
{
@@ -73,7 +73,7 @@ static void _RBTree_Validate_insert_unprotected(
* @note It does NOT disable interrupts to ensure the atomicity
* of the extract operation.
*/
-RBTree_Node *_RBTree_Insert_unprotected(
+RBTree_Node *_RBTree_Insert(
RBTree_Control *the_rbtree,
RBTree_Node *the_node
)
@@ -118,7 +118,7 @@ RBTree_Node *_RBTree_Insert_unprotected(
} /* while(iter_node) */
/* verify red-black properties */
- _RBTree_Validate_insert_unprotected(the_node);
+ _RBTree_Validate_insert(the_node);
}
return (RBTree_Node*)0;
}
diff --git a/cpukit/score/src/rbtreeiterate.c b/cpukit/score/src/rbtreeiterate.c
index 880fa2b..629b69f 100644
--- a/cpukit/score/src/rbtreeiterate.c
+++ b/cpukit/score/src/rbtreeiterate.c
@@ -3,7 +3,7 @@
*
* @ingroup ScoreRBTree
*
- * @brief _RBTree_Iterate_unprotected() implementation.
+ * @brief _RBTree_Iterate() implementation.
*/
/*
@@ -26,7 +26,7 @@
#include <rtems/score/rbtreeimpl.h>
-void _RBTree_Iterate_unprotected(
+void _RBTree_Iterate(
const RBTree_Control *rbtree,
RBTree_Direction dir,
RBTree_Visitor visitor,
@@ -40,6 +40,6 @@ void _RBTree_Iterate_unprotected(
while ( !stop && current != NULL ) {
stop = (*visitor)( current, dir, visitor_arg );
- current = _RBTree_Next_unprotected( current, dir );
+ current = _RBTree_Next( current, dir );
}
}
diff --git a/cpukit/score/src/rbtreenext.c b/cpukit/score/src/rbtreenext.c
index f3268d2..5b3d7cb 100644
--- a/cpukit/score/src/rbtreenext.c
+++ b/cpukit/score/src/rbtreenext.c
@@ -3,7 +3,7 @@
*
* @ingroup ScoreRBTree
*
- * @brief _RBTree_Next_unprotected() and _RBTree_Next() implementation.
+ * @brief _RBTree_Next() and _RBTree_Next() implementation.
*/
/*
@@ -27,7 +27,7 @@
#include <rtems/score/rbtreeimpl.h>
#include <rtems/score/isr.h>
-RBTree_Node *_RBTree_Next_unprotected(
+RBTree_Node *_RBTree_Next(
const RBTree_Node *node,
RBTree_Direction dir
)
diff --git a/cpukit/score/src/scheduleredfenqueue.c b/cpukit/score/src/scheduleredfenqueue.c
index 9a9b906..921721f 100644
--- a/cpukit/score/src/scheduleredfenqueue.c
+++ b/cpukit/score/src/scheduleredfenqueue.c
@@ -31,6 +31,6 @@ void _Scheduler_EDF_Enqueue(
(Scheduler_EDF_Per_thread*) the_thread->scheduler_info;
RBTree_Node *node = &(sched_info->Node);
- _RBTree_Insert_unprotected( &_Scheduler_EDF_Ready_queue, node );
+ _RBTree_Insert( &_Scheduler_EDF_Ready_queue, node );
sched_info->queue_state = SCHEDULER_EDF_QUEUE_STATE_YES;
}
diff --git a/cpukit/score/src/scheduleredfextract.c b/cpukit/score/src/scheduleredfextract.c
index b2f91cc..7547caf 100644
--- a/cpukit/score/src/scheduleredfextract.c
+++ b/cpukit/score/src/scheduleredfextract.c
@@ -31,6 +31,6 @@ void _Scheduler_EDF_Extract(
(Scheduler_EDF_Per_thread*) the_thread->scheduler_info;
RBTree_Node *node = &(sched_info->Node);
- _RBTree_Extract_unprotected( &_Scheduler_EDF_Ready_queue, node );
+ _RBTree_Extract( &_Scheduler_EDF_Ready_queue, node );
sched_info->queue_state = SCHEDULER_EDF_QUEUE_STATE_NOT_PRESENTLY;
}
diff --git a/cpukit/score/src/scheduleredfyield.c b/cpukit/score/src/scheduleredfyield.c
index 4a80168..fc5b13a 100644
--- a/cpukit/score/src/scheduleredfyield.c
+++ b/cpukit/score/src/scheduleredfyield.c
@@ -35,8 +35,8 @@ void _Scheduler_EDF_Yield( Thread_Control *thread )
* The RBTree has more than one node, enqueue behind the tasks
* with the same priority in case there are such ones.
*/
- _RBTree_Extract_unprotected( &_Scheduler_EDF_Ready_queue, thread_node );
- _RBTree_Insert_unprotected( &_Scheduler_EDF_Ready_queue, thread_node );
+ _RBTree_Extract( &_Scheduler_EDF_Ready_queue, thread_node );
+ _RBTree_Insert( &_Scheduler_EDF_Ready_queue, thread_node );
_ISR_Flash( level );
diff --git a/testsuites/libtests/rbheap01/init.c b/testsuites/libtests/rbheap01/init.c
index d00eefe..bf4ef6d 100644
--- a/testsuites/libtests/rbheap01/init.c
+++ b/testsuites/libtests/rbheap01/init.c
@@ -187,7 +187,7 @@ static void test_chunk_tree(
.free_end = free_end
};
- _RBTree_Iterate_unprotected(
+ _RBTree_Iterate(
&control->chunk_tree,
RBT_RIGHT,
chunk_visitor,
diff --git a/testsuites/sptests/sprbtree01/init.c b/testsuites/sptests/sprbtree01/init.c
index a0dd9b9..df2a947 100644
--- a/testsuites/sptests/sprbtree01/init.c
+++ b/testsuites/sptests/sprbtree01/init.c
@@ -117,10 +117,10 @@ rtems_task Init(
node1.key = 1;
node2.id = 2;
node2.key = 2;
- rtems_rbtree_insert_unprotected( &rbtree1, &node1.Node );
- rtems_rbtree_insert_unprotected( &rbtree1, &node2.Node );
+ rtems_rbtree_insert( &rbtree1, &node1.Node );
+ rtems_rbtree_insert( &rbtree1, &node2.Node );
- p = rtems_rbtree_insert_unprotected( &rbtree1, NULL );
+ p = rtems_rbtree_insert( &rbtree1, NULL );
if (p != (void *)(-1))
puts( "INIT - FAILED NULL NODE INSERT" );
@@ -135,8 +135,8 @@ rtems_task Init(
if (!rb_assert(rbtree1.root) )
puts( "INIT - FAILED TREE CHECK" );
- for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 1 ; p ;
- p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
+ for ( p = rtems_rbtree_get_min(&rbtree1), id = 1 ; p ;
+ p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
test_node *t = rtems_rbtree_container_of(p,test_node,Node);
if ( id > 2 ) {
puts( "INIT - TOO MANY NODES ON RBTREE" );
@@ -157,14 +157,14 @@ rtems_task Init(
puts("INIT - Verify rtems_rbtree_insert with the same value twice");
node2.key = node1.key;
- rtems_rbtree_insert_unprotected(&rbtree1, &node1.Node);
- p = rtems_rbtree_insert_unprotected(&rbtree1, &node2.Node);
+ rtems_rbtree_insert(&rbtree1, &node1.Node);
+ p = rtems_rbtree_insert(&rbtree1, &node2.Node);
if (p != &node1.Node)
puts( "INIT - FAILED DUPLICATE INSERT" );
- for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 1 ; p ;
- p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
+ for ( p = rtems_rbtree_get_min(&rbtree1), id = 1 ; p ;
+ p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
test_node *t = rtems_rbtree_container_of(p,test_node,Node);
if ( id > 1 ) {
puts( "INIT - TOO MANY NODES ON RBTREE" );
@@ -192,11 +192,11 @@ rtems_task Init(
}
puts( "INIT - Verify rtems_XXX on an empty tree" );
- if(rtems_rbtree_get_min_unprotected(&rbtree1)) {
+ if(rtems_rbtree_get_min(&rbtree1)) {
puts("INIT - get_min on empty returned non-NULL");
rtems_test_exit(0);
}
- if(rtems_rbtree_get_max_unprotected(&rbtree1)) {
+ if(rtems_rbtree_get_max(&rbtree1)) {
puts("INIT - get_max on empty returned non-NULL");
rtems_test_exit(0);
}
@@ -216,8 +216,8 @@ rtems_task Init(
node1.key = 2;
node2.id = 1;
node2.key = 1;
- rtems_rbtree_insert_unprotected( &rbtree1, &node1.Node );
- rtems_rbtree_insert_unprotected( &rbtree1, &node2.Node );
+ rtems_rbtree_insert( &rbtree1, &node1.Node );
+ rtems_rbtree_insert( &rbtree1, &node2.Node );
puts( "INIT - Verify rtems_rbtree_peek_max/min, rtems_rbtree_extract" );
test_node *t1 = rtems_rbtree_container_of(rtems_rbtree_peek_max(&rbtree1),
@@ -229,16 +229,16 @@ rtems_task Init(
rtems_test_exit(0);
}
p = rtems_rbtree_peek_max(&rbtree1);
- rtems_rbtree_extract_unprotected(&rbtree1, p);
+ rtems_rbtree_extract(&rbtree1, p);
t1 = rtems_rbtree_container_of(p,test_node,Node);
if (t1->key != 2) {
puts( "INIT - rtems_rbtree_extract failed");
rtems_test_exit(0);
}
- rtems_rbtree_insert_unprotected(&rbtree1, p);
+ rtems_rbtree_insert(&rbtree1, p);
- for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 1 ; p ;
- p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
+ for ( p = rtems_rbtree_get_min(&rbtree1), id = 1 ; p ;
+ p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
test_node *t = rtems_rbtree_container_of(p,test_node,Node);
if ( id > 2 ) {
puts( "INIT - TOO MANY NODES ON RBTREE" );
@@ -254,7 +254,7 @@ rtems_task Init(
for (i = 0; i < 100; i++) {
node_array[i].id = i;
node_array[i].key = i;
- rtems_rbtree_insert_unprotected( &rbtree1, &node_array[i].Node );
+ rtems_rbtree_insert( &rbtree1, &node_array[i].Node );
if (!rb_assert(rbtree1.root) )
puts( "INIT - FAILED TREE CHECK" );
@@ -262,8 +262,8 @@ rtems_task Init(
puts( "INIT - Removing 100 nodes" );
- for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 0 ; p ;
- p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
+ for ( p = rtems_rbtree_get_min(&rbtree1), id = 0 ; p ;
+ p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
test_node *t = rtems_rbtree_container_of(p,test_node,Node);
if ( id > 99 ) {
puts( "INIT - TOO MANY NODES ON RBTREE" );
@@ -287,7 +287,7 @@ rtems_task Init(
for (i = 0; i < 100; i++) {
node_array[i].id = 99-i;
node_array[i].key = 99-i;
- rtems_rbtree_insert_unprotected( &rbtree1, &node_array[i].Node );
+ rtems_rbtree_insert( &rbtree1, &node_array[i].Node );
if (!rb_assert(rbtree1.root) )
puts( "INIT - FAILED TREE CHECK" );
@@ -295,8 +295,8 @@ rtems_task Init(
puts( "INIT - Removing 100 nodes" );
- for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 0 ; p ;
- p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
+ for ( p = rtems_rbtree_get_min(&rbtree1), id = 0 ; p ;
+ p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
test_node *t = rtems_rbtree_container_of(p,test_node,Node);
if ( id > 99 ) {
puts( "INIT - TOO MANY NODES ON RBTREE" );
@@ -322,7 +322,7 @@ rtems_task Init(
for (i = 0; i < 100; i++) {
node_array[i].id = i;
node_array[i].key = i;
- rtems_rbtree_insert_unprotected( &rbtree1, &node_array[i].Node );
+ rtems_rbtree_insert( &rbtree1, &node_array[i].Node );
if (!rb_assert(rbtree1.root) )
puts( "INIT - FAILED TREE CHECK" );
@@ -332,15 +332,15 @@ rtems_task Init(
for (i = 0; i < 20; i++) {
id = numbers[i];
- rtems_rbtree_extract_unprotected( &rbtree1, &node_array[id].Node );
+ rtems_rbtree_extract( &rbtree1, &node_array[id].Node );
if (!rb_assert(rbtree1.root) )
puts( "INIT - FAILED TREE CHECK" );
}
puts( "INIT - Removing 80 nodes" );
- for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 0, i = 0 ; p ;
- p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
+ for ( p = rtems_rbtree_get_min(&rbtree1), id = 0, i = 0 ; p ;
+ p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
test_node *t = rtems_rbtree_container_of(p, test_node, Node);
while ( id == numbers_sorted[i] ) {
@@ -374,26 +374,26 @@ rtems_task Init(
node_array[i].id = i;
node_array[i].key = i;
}
- rtems_rbtree_insert_unprotected( &rbtree1, &node_array[3].Node );
- rtems_rbtree_insert_unprotected( &rbtree1, &node_array[1].Node );
- rtems_rbtree_insert_unprotected( &rbtree1, &node_array[5].Node );
- rtems_rbtree_insert_unprotected( &rbtree1, &node_array[0].Node );
- rtems_rbtree_insert_unprotected( &rbtree1, &node_array[2].Node );
- rtems_rbtree_insert_unprotected( &rbtree1, &node_array[4].Node );
- rtems_rbtree_insert_unprotected( &rbtree1, &node_array[6].Node );
- rtems_rbtree_extract_unprotected( &rbtree1, &node_array[2].Node );
+ rtems_rbtree_insert( &rbtree1, &node_array[3].Node );
+ rtems_rbtree_insert( &rbtree1, &node_array[1].Node );
+ rtems_rbtree_insert( &rbtree1, &node_array[5].Node );
+ rtems_rbtree_insert( &rbtree1, &node_array[0].Node );
+ rtems_rbtree_insert( &rbtree1, &node_array[2].Node );
+ rtems_rbtree_insert( &rbtree1, &node_array[4].Node );
+ rtems_rbtree_insert( &rbtree1, &node_array[6].Node );
+ rtems_rbtree_extract( &rbtree1, &node_array[2].Node );
/* node_array[1] has now only a left child. */
if ( !node_array[1].Node.child[RBT_LEFT] ||
node_array[1].Node.child[RBT_RIGHT] )
puts( "INIT - LEFT CHILD ONLY NOT FOUND" );
- rtems_rbtree_extract_unprotected( &rbtree1, &node_array[3].Node );
- while( (p = rtems_rbtree_get_max_unprotected(&rbtree1)) );
+ rtems_rbtree_extract( &rbtree1, &node_array[3].Node );
+ while( (p = rtems_rbtree_get_max(&rbtree1)) );
puts( "INIT - Verify rtems_rbtree_get_max with 100 nodes value [99,0]" );
for (i = 0; i < 100; i++) {
node_array[i].id = 99-i;
node_array[i].key = 99-i;
- rtems_rbtree_insert_unprotected( &rbtree1, &node_array[i].Node );
+ rtems_rbtree_insert( &rbtree1, &node_array[i].Node );
if (!rb_assert(rbtree1.root) )
puts( "INIT - FAILED TREE CHECK" );
@@ -401,8 +401,8 @@ rtems_task Init(
puts( "INIT - Removing 100 nodes" );
- for ( p = rtems_rbtree_get_max_unprotected(&rbtree1), id = 0 ; p ;
- p = rtems_rbtree_get_max_unprotected(&rbtree1) , id++ ) {
+ for ( p = rtems_rbtree_get_max(&rbtree1), id = 0 ; p ;
+ p = rtems_rbtree_get_max(&rbtree1) , id++ ) {
test_node *t = rtems_rbtree_container_of(p,test_node,Node);
if ( id > 99 ) {
puts( "INIT - TOO MANY NODES ON RBTREE" );
@@ -426,7 +426,7 @@ rtems_task Init(
for (i = 0; i < 100; i++) {
node_array[i].id = i;
node_array[i].key = i;
- rtems_rbtree_insert_unprotected( &rbtree1, &node_array[i].Node );
+ rtems_rbtree_insert( &rbtree1, &node_array[i].Node );
if (!rb_assert(rbtree1.root) )
puts( "INIT - FAILED TREE CHECK" );
@@ -434,28 +434,28 @@ rtems_task Init(
puts( "INIT - Verify rtems_rbtree_find" );
search_node.key = 30;
- p = rtems_rbtree_find_unprotected(&rbtree1, &search_node.Node);
+ p = rtems_rbtree_find(&rbtree1, &search_node.Node);
if(rtems_rbtree_container_of(p,test_node,Node)->id != 30) {
puts ("INIT - ERROR ON RBTREE ID MISMATCH");
rtems_test_exit(0);
}
puts( "INIT - Verify rtems_rbtree_predecessor/successor");
- p = rtems_rbtree_predecessor_unprotected(p);
+ p = rtems_rbtree_predecessor(p);
if(p && rtems_rbtree_container_of(p,test_node,Node)->id != 29) {
puts ("INIT - ERROR ON RBTREE ID MISMATCH");
rtems_test_exit(0);
}
- p = rtems_rbtree_find_unprotected(&rbtree1, &search_node.Node);
- p = rtems_rbtree_successor_unprotected(p);
+ p = rtems_rbtree_find(&rbtree1, &search_node.Node);
+ p = rtems_rbtree_successor(p);
if(p && rtems_rbtree_container_of(p,test_node,Node)->id != 31) {
puts ("INIT - ERROR ON RBTREE ID MISMATCH");
rtems_test_exit(0);
}
- p = rtems_rbtree_find_unprotected(&rbtree1, &search_node.Node);
+ p = rtems_rbtree_find(&rbtree1, &search_node.Node);
puts( "INIT - Verify rtems_rbtree_find_header" );
- if (rtems_rbtree_find_header_unprotected(p) != &rbtree1) {
+ if (rtems_rbtree_find_header(p) != &rbtree1) {
puts ("INIT - ERROR ON RBTREE HEADER MISMATCH");
rtems_test_exit(0);
}
@@ -473,8 +473,8 @@ rtems_task Init(
puts( "INIT - Removing 100 nodes" );
- for ( p = rtems_rbtree_get_max_unprotected(&rbtree1), id = 99 ; p ;
- p = rtems_rbtree_get_max_unprotected(&rbtree1) , id-- ) {
+ for ( p = rtems_rbtree_get_max(&rbtree1), id = 99 ; p ;
+ p = rtems_rbtree_get_max(&rbtree1) , id-- ) {
test_node *t = rtems_rbtree_container_of(p,test_node,Node);
if ( id < 0 ) {
puts( "INIT - TOO MANY NODES ON RBTREE" );
@@ -494,11 +494,11 @@ rtems_task Init(
rtems_test_exit(0);
}
- if (rtems_rbtree_find_header_unprotected(&node_array[0].Node) != NULL) {
+ if (rtems_rbtree_find_header(&node_array[0].Node) != NULL) {
puts ("INIT - ERROR ON RBTREE HEADER MISMATCH");
rtems_test_exit(0);
}
- if (rtems_rbtree_find_header_unprotected(NULL) != NULL) {
+ if (rtems_rbtree_find_header(NULL) != NULL) {
puts ("INIT - ERROR ON RBTREE HEADER MISMATCH");
rtems_test_exit(0);
}
@@ -507,7 +507,7 @@ rtems_task Init(
for (i = 0; i < 20; i++) {
node_array[i].id = numbers[i];
node_array[i].key = numbers[i];
- rtems_rbtree_insert_unprotected( &rbtree1, &node_array[i].Node );
+ rtems_rbtree_insert( &rbtree1, &node_array[i].Node );
if (!rb_assert(rbtree1.root) )
puts( "INIT - FAILED TREE CHECK" );
@@ -515,8 +515,8 @@ rtems_task Init(
puts( "INIT - Removing 20 nodes" );
- for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 0 ; p ;
- p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
+ for ( p = rtems_rbtree_get_min(&rbtree1), id = 0 ; p ;
+ p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
test_node *t = rtems_rbtree_container_of(p,test_node,Node);
if ( id > 19 ) {
puts( "INIT - TOO MANY NODES ON RBTREE" );
@@ -547,8 +547,8 @@ rtems_task Init(
puts( "INIT - Removing 100 nodes" );
- for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 0 ; p ;
- p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
+ for ( p = rtems_rbtree_get_min(&rbtree1), id = 0 ; p ;
+ p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
test_node *t = rtems_rbtree_container_of(p,test_node,Node);
if ( id > 99 ) {
puts( "INIT - TOO MANY NODES ON RBTREE" );
@@ -582,7 +582,7 @@ rtems_task Init(
for (i = 0; i < 100; i++) {
node_array[i].id = i;
node_array[i].key = i%5;
- rtems_rbtree_insert_unprotected( &rbtree1, &node_array[i].Node );
+ rtems_rbtree_insert( &rbtree1, &node_array[i].Node );
if (!rb_assert(rbtree1.root) )
puts( "INIT - FAILED TREE CHECK" );
@@ -590,7 +590,7 @@ rtems_task Init(
puts( "INIT - Verify rtems_rbtree_find in a duplicate tree" );
search_node.key = 2;
- p = rtems_rbtree_find_unprotected(&rbtree1, &search_node.Node);
+ p = rtems_rbtree_find(&rbtree1, &search_node.Node);
if(rtems_rbtree_container_of(p,test_node,Node)->id != 2) {
puts ("INIT - ERROR ON RBTREE ID MISMATCH");
rtems_test_exit(0);
@@ -598,8 +598,8 @@ rtems_task Init(
puts( "INIT - Removing 100 nodes" );
- for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 0 ; p ;
- p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
+ for ( p = rtems_rbtree_get_min(&rbtree1), id = 0 ; p ;
+ p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
test_node *t = rtems_rbtree_container_of(p,test_node,Node);
if ( id > 99 ) {
puts( "INIT - TOO MANY NODES ON RBTREE" );
@@ -623,7 +623,7 @@ rtems_task Init(
for (i = 0; i < 100; i++) {
node_array[i].id = 99-i;
node_array[i].key = (99-i)%5;
- rtems_rbtree_insert_unprotected( &rbtree1, &node_array[i].Node );
+ rtems_rbtree_insert( &rbtree1, &node_array[i].Node );
if (!rb_assert(rbtree1.root) )
puts( "INIT - FAILED TREE CHECK" );
@@ -631,7 +631,7 @@ rtems_task Init(
puts( "INIT - Verify rtems_rbtree_find in a duplicate tree" );
search_node.key = 2;
- p = rtems_rbtree_find_unprotected(&rbtree1, &search_node.Node);
+ p = rtems_rbtree_find(&rbtree1, &search_node.Node);
if(rtems_rbtree_container_of(p,test_node,Node)->id != 97) {
puts ("INIT - ERROR ON RBTREE ID MISMATCH");
rtems_test_exit(0);
@@ -639,8 +639,8 @@ rtems_task Init(
puts( "INIT - Removing 100 nodes" );
- for ( p = rtems_rbtree_get_min_unprotected(&rbtree1), id = 0 ; p ;
- p = rtems_rbtree_get_min_unprotected(&rbtree1) , id++ ) {
+ for ( p = rtems_rbtree_get_min(&rbtree1), id = 0 ; p ;
+ p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
test_node *t = rtems_rbtree_container_of(p,test_node,Node);
if ( id > 99 ) {
puts( "INIT - TOO MANY NODES ON RBTREE" );
More information about the vc
mailing list