summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarcelo Tosatti <marcelo.tosatti@cyclades.com>2005-09-06 15:16:48 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-07 16:57:21 -0700
commit32605a18152b246df483fadc1c23854addde8755 (patch)
treecb13f4d0d9040120b5ef6a90c8b174a0619756d0 /lib
parent201b6264ff3865090747f58f48e087c3a35e0dbc (diff)
downloadlinux-32605a18152b246df483fadc1c23854addde8755.tar.gz
linux-32605a18152b246df483fadc1c23854addde8755.tar.bz2
linux-32605a18152b246df483fadc1c23854addde8755.zip
[PATCH] radix_tag_get(): differentiate between no present node and tag unset cases
Simple patch to radix_tree_tag_get() to return different values for non present node and tag unset. The function is not used by any in-kernel callers (yet), but this information is definitely useful. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/radix-tree.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 2e9bd54beba4..b972dd29289d 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -418,15 +418,16 @@ EXPORT_SYMBOL(radix_tree_tag_clear);
#ifndef __KERNEL__ /* Only the test harness uses this at present */
/**
- * radix_tree_tag_get - get a tag on a radix tree node
- * @root: radix tree root
- * @index: index key
- * @tag: tag index
+ * radix_tree_tag_get - get a tag on a radix tree node
+ * @root: radix tree root
+ * @index: index key
+ * @tag: tag index
*
- * Return the search tag corresponging to @index in the radix tree.
+ * Return values:
*
- * Returns zero if the tag is unset, or if there is no corresponding item
- * in the tree.
+ * 0: tag not present
+ * 1: tag present, set
+ * -1: tag present, unset
*/
int radix_tree_tag_get(struct radix_tree_root *root,
unsigned long index, int tag)
@@ -460,7 +461,7 @@ int radix_tree_tag_get(struct radix_tree_root *root,
int ret = tag_get(slot, tag, offset);
BUG_ON(ret && saw_unset_tag);
- return ret;
+ return ret ? 1 : -1;
}
slot = slot->slots[offset];
shift -= RADIX_TREE_MAP_SHIFT;