summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-01-23 15:55:42 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-02-02 11:09:30 +0100
commit72a3af3e4294200b59764bcd2c17f76609526e6a (patch)
treeb464f37ab2f663e721d3fad9fc43fefcddad97f8 /cpukit
parentImprove comments on console select patch. (diff)
downloadrtems-72a3af3e4294200b59764bcd2c17f76609526e6a.tar.bz2
Extended API to support iteration of const chains.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/sapi/inline/rtems/chain.inl100
-rw-r--r--cpukit/score/inline/rtems/score/chain.inl42
2 files changed, 132 insertions, 10 deletions
diff --git a/cpukit/sapi/inline/rtems/chain.inl b/cpukit/sapi/inline/rtems/chain.inl
index 2816e81b41..d8db855477 100644
--- a/cpukit/sapi/inline/rtems/chain.inl
+++ b/cpukit/sapi/inline/rtems/chain.inl
@@ -135,10 +135,25 @@ RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_head(
return _Chain_Head( the_chain );
}
+/** @brief Return pointer to immutable Chain Head
+ *
+ * This function returns a pointer to the head node on the chain.
+ *
+ * @param[in] the_chain is the chain to be operated upon.
+ *
+ * @return This method returns the permanent head node of the chain.
+ */
+RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_head(
+ const rtems_chain_control *the_chain
+)
+{
+ return _Chain_Immutable_head( the_chain );
+}
+
/**
* @brief Return pointer to Chain Tail
*
- * This function returns a pointer to the last node on the chain.
+ * This function returns a pointer to the tail node on the chain.
*
* @param[in] the_chain is the chain to be operated upon.
*
@@ -151,6 +166,21 @@ RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_tail(
return _Chain_Tail( the_chain );
}
+/** @brief Return pointer to immutable Chain Tail
+ *
+ * This function returns a pointer to the tail node on the chain.
+ *
+ * @param[in] the_chain is the chain to be operated upon.
+ *
+ * @return This method returns the permanent tail node of the chain.
+ */
+RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_tail(
+ const rtems_chain_control *the_chain
+)
+{
+ return _Chain_Immutable_tail( the_chain );
+}
+
/**
* @brief Return pointer to Chain's First node after the permanent head.
*
@@ -168,6 +198,22 @@ RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_first(
return _Chain_First( the_chain );
}
+/** @brief Return pointer to immutable Chain's First node
+ *
+ * This function returns a pointer to the first node on the chain after the
+ * head.
+ *
+ * @param[in] the_chain is the chain to be operated upon.
+ *
+ * @return This method returns the first node of the chain.
+ */
+RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_first(
+ const rtems_chain_control *the_chain
+)
+{
+ return _Chain_Immutable_first( the_chain );
+}
+
/**
* @brief Return pointer to Chain's Last node before the permanent tail.
*
@@ -185,6 +231,22 @@ RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_last(
return _Chain_Last( the_chain );
}
+/** @brief Return pointer to immutable Chain's Last node
+ *
+ * This function returns a pointer to the last node on the chain just before
+ * the tail.
+ *
+ * @param[in] the_chain is the chain to be operated upon.
+ *
+ * @return This method returns the last node of the chain.
+ */
+RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_last(
+ const rtems_chain_control *the_chain
+)
+{
+ return _Chain_Immutable_last( the_chain );
+}
+
/**
* @brief Return pointer the next node from this node
*
@@ -201,6 +263,21 @@ RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_next(
return _Chain_Next( the_node );
}
+/** @brief Return pointer the immutable next node from this node
+ *
+ * This function returns a pointer to the next node after this node.
+ *
+ * @param[in] the_node is the node to be operated upon.
+ *
+ * @return This method returns the next node on the chain.
+ */
+RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_next(
+ const rtems_chain_node *the_node
+)
+{
+ return _Chain_Immutable_next( the_node );
+}
+
/**
* @brief Return pointer the previous node from this node
*
@@ -217,6 +294,21 @@ RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_previous(
return _Chain_Previous( the_node );
}
+/** @brief Return pointer the immutable previous node from this node
+ *
+ * This function returns a pointer to the previous node on this chain.
+ *
+ * @param[in] the_node is the node to be operated upon.
+ *
+ * @return This method returns the previous node on the chain.
+ */
+RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_previous(
+ const rtems_chain_node *the_node
+)
+{
+ return _Chain_Immutable_previous( the_node );
+}
+
/**
* @brief Are Two Nodes Equal
*
@@ -249,7 +341,7 @@ RTEMS_INLINE_ROUTINE bool rtems_chain_are_nodes_equal(
* false otherwise.
*/
RTEMS_INLINE_ROUTINE bool rtems_chain_is_empty(
- rtems_chain_control *the_chain
+ const rtems_chain_control *the_chain
)
{
return _Chain_Is_empty( the_chain );
@@ -323,7 +415,7 @@ RTEMS_INLINE_ROUTINE bool rtems_chain_has_only_one_node(
* @a the_chain and false otherwise.
*/
RTEMS_INLINE_ROUTINE bool rtems_chain_is_head(
- rtems_chain_control *the_chain,
+ const rtems_chain_control *the_chain,
const rtems_chain_node *the_node
)
{
@@ -340,7 +432,7 @@ RTEMS_INLINE_ROUTINE bool rtems_chain_is_head(
* @param[in] the_node is the node to check for being the Chain Tail.
*/
RTEMS_INLINE_ROUTINE bool rtems_chain_is_tail(
- rtems_chain_control *the_chain,
+ const rtems_chain_control *the_chain,
const rtems_chain_node *the_node
)
{
diff --git a/cpukit/score/inline/rtems/score/chain.inl b/cpukit/score/inline/rtems/score/chain.inl
index 15dad9098b..a465a3462b 100644
--- a/cpukit/score/inline/rtems/score/chain.inl
+++ b/cpukit/score/inline/rtems/score/chain.inl
@@ -142,7 +142,7 @@ RTEMS_INLINE_ROUTINE const Chain_Node *_Chain_Immutable_head(
/** @brief Return pointer to Chain Tail
*
- * This function returns a pointer to the last node on the chain.
+ * This function returns a pointer to the tail node on the chain.
*
* @param[in] the_chain is the chain to be operated upon.
*
@@ -157,7 +157,7 @@ RTEMS_INLINE_ROUTINE Chain_Node *_Chain_Tail(
/** @brief Return pointer to immutable Chain Tail
*
- * This function returns a pointer to the last node on the chain.
+ * This function returns a pointer to the tail node on the chain.
*
* @param[in] the_chain is the chain to be operated upon.
*
@@ -249,6 +249,21 @@ RTEMS_INLINE_ROUTINE Chain_Node *_Chain_Next(
return the_node->next;
}
+/** @brief Return pointer the immutable next node from this node
+ *
+ * This function returns a pointer to the next node after this node.
+ *
+ * @param[in] the_node is the node to be operated upon.
+ *
+ * @return This method returns the next node on the chain.
+ */
+RTEMS_INLINE_ROUTINE const Chain_Node *_Chain_Immutable_next(
+ const Chain_Node *the_node
+)
+{
+ return the_node->next;
+}
+
/** @brief Return pointer the previous node from this node
*
* This function returns a pointer to the previous node on this chain.
@@ -264,6 +279,21 @@ RTEMS_INLINE_ROUTINE Chain_Node *_Chain_Previous(
return the_node->previous;
}
+/** @brief Return pointer the immutable previous node from this node
+ *
+ * This function returns a pointer to the previous node on this chain.
+ *
+ * @param[in] the_node is the node to be operated upon.
+ *
+ * @return This method returns the previous node on the chain.
+ */
+RTEMS_INLINE_ROUTINE const Chain_Node *_Chain_Immutable_previous(
+ const Chain_Node *the_node
+)
+{
+ return the_node->previous;
+}
+
/** @brief Is the Chain Empty
*
* This function returns true if there a no nodes on @a the_chain and
@@ -347,11 +377,11 @@ RTEMS_INLINE_ROUTINE bool _Chain_Has_only_one_node(
* @a the_chain and false otherwise.
*/
RTEMS_INLINE_ROUTINE bool _Chain_Is_head(
- Chain_Control *the_chain,
+ const Chain_Control *the_chain,
const Chain_Node *the_node
)
{
- return (the_node == _Chain_Head(the_chain));
+ return (the_node == _Chain_Immutable_head( the_chain ));
}
/** @brief Is this Node the Chail Tail
@@ -363,11 +393,11 @@ RTEMS_INLINE_ROUTINE bool _Chain_Is_head(
* @param[in] the_node is the node to check for being the Chain Tail.
*/
RTEMS_INLINE_ROUTINE bool _Chain_Is_tail(
- Chain_Control *the_chain,
+ const Chain_Control *the_chain,
const Chain_Node *the_node
)
{
- return (the_node == _Chain_Tail(the_chain));
+ return (the_node == _Chain_Immutable_tail( the_chain ));
}
/** @brief Initialize this Chain as Empty