Messages in this thread Patch in this message | | | Date | Fri, 17 Dec 2004 15:37:57 -0300 | From | Werner Almesberger <> | Subject | [PATCH 1/3] prio_tree: roll call to prio_tree_first into prio_tree_next |
| |
Allow prio_tree_next to be used as the only function for tree traversal, similar to how vma_prio_tree_next works.
This patch isn't needed for the generalization, but since it affects the API, it's better to include it first.
- Werner
---------------------------------- cut here -----------------------------------
Signed-off-by: Werner Almesberger <werner@almesberger.net>
--- linux-2.6.10-rc3-bk10/include/linux/prio_tree.h.orig Fri Dec 17 01:05:14 2004 +++ linux-2.6.10-rc3-bk10/include/linux/prio_tree.h Fri Dec 17 00:38:47 2004 @@ -29,6 +29,7 @@ static inline void prio_tree_iter_init(s iter->root = root; iter->r_index = r_index; iter->h_index = h_index; + iter->cur = NULL; } #define INIT_PRIO_TREE_ROOT(ptr) \ --- linux-2.6.10-rc3-bk10/mm/prio_tree.c.orig Fri Dec 17 01:05:29 2004 +++ linux-2.6.10-rc3-bk10/mm/prio_tree.c Fri Dec 17 00:39:02 2004 @@ -457,6 +457,9 @@ static struct prio_tree_node *prio_tree_ { unsigned long r_index, h_index; + if (iter->cur == NULL) + return prio_tree_first(iter); + repeat: while (prio_tree_left(iter, &r_index, &h_index)) if (overlap(iter, r_index, h_index)) @@ -620,7 +623,7 @@ struct vm_area_struct *vma_prio_tree_nex /* * First call is with NULL vma */ - ptr = prio_tree_first(iter); + ptr = prio_tree_next(iter); if (ptr) { next = prio_tree_entry(ptr, struct vm_area_struct, shared.prio_tree_node); -- _________________________________________________________________________ / Werner Almesberger, Buenos Aires, Argentina werner@almesberger.net / /_http://www.almesberger.net/____________________________________________/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |