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

Hanna Czenczek <[email protected]> Tue, 4 Aug 2026 13:04:55 +0200
Newsgroups gmane.comp.emulators.qemu,gmane.comp.emulators.qemu.block
Message-ID <[email protected]>
On 03.08.26 23:13, Connor Kite wrote:
> On Mon, Aug 3, 2026 at 5:36 AM Hanna Czenczek <[email protected]> wrote:
>>
>> 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
> I have updated the comment to describe the usage of GTraverseFunc as
> below:
>
> /**
> * iova_tree_foreach:
> *
> * @tree: the iova tree to traverse
> * @func: the function called at every node. A true return value ends traversal.
> *              Arguments:
> *                  gpointer key: key of current node
> *                  gpointer value: value of current node
> *                  gpointer data: data passed in at g_tree_foreach call
> *              Return: gboolean
> * @data: an argument passed to func
> *
> * Wrapper to call g_tree_foreach on the underlying g_tree. g_tree_foreach will
> * traverse through every node of the tree, barring an early return. At each
> * node, g_tree_foreach calls func with pointers to the node key, node value,
> * and a pointer to data passed in by the caller.
> *
> * Return: None
> */

Awesome, thanks!

Hanna