From: Kenn H. <ke...@us...> - 2003-08-27 23:47:29
|
Update of /cvsroot/linux-vax/kernel-2.5/lib In directory sc8-pr-cvs1:/tmp/cvs-serv5627/lib Modified Files: radix-tree.c Log Message: Merge with 2.5.68 Index: radix-tree.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/lib/radix-tree.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- radix-tree.c 19 Aug 2003 19:30:15 -0000 1.2 +++ radix-tree.c 27 Aug 2003 23:47:23 -0000 1.3 @@ -349,15 +349,18 @@ * @index: index key * * Remove the item at @index from the radix tree rooted at @root. + * + * Returns the address of the deleted item, or NULL if it was not present. */ -int radix_tree_delete(struct radix_tree_root *root, unsigned long index) +void *radix_tree_delete(struct radix_tree_root *root, unsigned long index) { struct radix_tree_path path[RADIX_TREE_MAX_PATH], *pathp = path; unsigned int height, shift; + void *ret = NULL; height = root->height; if (index > radix_tree_maxindex(height)) - return -ENOENT; + goto out; shift = (height-1) * RADIX_TREE_MAP_SHIFT; pathp->node = NULL; @@ -365,7 +368,7 @@ while (height > 0) { if (*pathp->slot == NULL) - return -ENOENT; + goto out; pathp[1].node = *pathp[0].slot; pathp[1].slot = (struct radix_tree_node **) @@ -375,8 +378,9 @@ height--; } - if (*pathp[0].slot == NULL) - return -ENOENT; + ret = *pathp[0].slot; + if (ret == NULL) + goto out; *pathp[0].slot = NULL; while (pathp[0].node && --pathp[0].node->count == 0) { @@ -387,8 +391,8 @@ if (root->rnode == NULL) root->height = 0; /* Empty tree, we can reset the height */ - - return 0; +out: + return ret; } EXPORT_SYMBOL(radix_tree_delete); |