[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH] qdev: Reset hotplugged devices

From: Paolo Bonzini
Subject: [Qemu-devel] Re: [PATCH] qdev: Reset hotplugged devices
Date: Mon, 23 Aug 2010 13:25:24 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.0.5

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.

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]