Re: [PATCH RFC 06/15] util/iova-tree: g_tree_foreach wrapper

Hanna Czenczek <[email protected]>
Newsgroups gmane.comp.emulators.qemu.block,gmane.comp.emulators.qemu
Message-ID <[email protected]>
On 24.07.26 00:30, Connor Kite wrote:
> Add a wrapper to iova-tree to call g_tree_foreach.  Provies a means to
> execute some function on each node of the iova-tree.
>
> Signed-off-by: Connor Kite <[email protected]>
> ---
>   include/qemu/iova-tree.h | 13 +++++++++++++
>   util/iova-tree.c         |  5 +++++
>   2 files changed, 18 insertions(+)
>
> diff --git a/include/qemu/iova-tree.h b/include/qemu/iova-tree.h
> index 14e82a22d5..4d77f4dc57 100644
> --- a/include/qemu/iova-tree.h
> +++ b/include/qemu/iova-tree.h
> @@ -161,4 +161,17 @@ int iova_tree_alloc_map(IOVATree *tree, DMAMap *map, hwaddr iova_begin,
>    */
>   void iova_tree_destroy(IOVATree *tree);
>   
> +/**
> + * iova_tree_foreach:
> + *
> + * @tree: the iova tree to traverse
> + * @func: the function called at every node. A true return value ends traversal

Can you document roughly what the function looks like? Because the type 
(`GTraverseFunc`) is not defined in qemu. I know it has a boolean as a 
return type, and that one argument of it is going to be `gpointer data`, 
but surely it will also take a tree element.

Hanna

> + * @data: an argument passed to func
> + *
> + * Wrapper to call g_tree_foreach on underlying g_tree
> + *
> + * Return: None
> + */
> +void iova_tree_foreach(IOVATree *tree, GTraverseFunc func, gpointer data);
> +
>   #endif
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.