|
From: | Anthony Liguori |
Subject: | [Qemu-devel] Re: [PATCH] qdev: Reset hotplugged devices |
Date: | Mon, 23 Aug 2010 08:27:27 -0500 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100713 Lightning/1.0b1 Thunderbird/3.0.6 |
On 08/23/2010 06:25 AM, Paolo Bonzini wrote:
On 08/20/2010 08:12 PM, Anthony Liguori wrote:+/* Returns false to terminate walk; true to continue */ +typedef int (qdev_walkerfn)(DeviceState *dev, void *opaque); +Since you're introducing qbus_walk_children, I suggest a different interface: qdev_walkerfn should return 0 to walk children, -1 to skip walking children, and anything else to terminate walk. If anything ever returns x > 0, qbus_walk_children returns that x, else qbus_walk_children returns 0. This interface is inspired by a similar one in GCC and it works well.
Good suggestion. Regards, Anthony Liguori
If you don't want to introduce the full complication, removing the "-1 to skip walking children" part would still give the same flexibility WRT to the return values, which is the important part.Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |