From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=37423 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OnV9i-0006mQ-Eo for qemu-devel@nongnu.org; Mon, 23 Aug 2010 07:25:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OnV9f-0005a6-FK for qemu-devel@nongnu.org; Mon, 23 Aug 2010 07:25:32 -0400 Received: from mail-vw0-f45.google.com ([209.85.212.45]:41507) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnV9f-0005Zy-Bi for qemu-devel@nongnu.org; Mon, 23 Aug 2010 07:25:31 -0400 Received: by vws19 with SMTP id 19so5276348vws.4 for ; Mon, 23 Aug 2010 04:25:30 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4C725AA4.2020905@redhat.com> Date: Mon, 23 Aug 2010 13:25:24 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <20100803161914.15514.59304.stgit@localhost6.localdomain6> <1282308092.3860.0.camel@x201> <4C6EA5C9.8080700@codemonkey.ws> <4C6EC5AA.6050502@codemonkey.ws> In-Reply-To: <4C6EC5AA.6050502@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] qdev: Reset hotplugged devices List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Alex Williamson , glommer@redhat.com, Markus Armbruster , qemu-devel@nongnu.org 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. Paolo