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