From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vq5HA-0008L6-KJ for qemu-devel@nongnu.org; Mon, 09 Dec 2013 13:09:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vq5H4-0005Oz-Aw for qemu-devel@nongnu.org; Mon, 09 Dec 2013 13:09:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:62266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vq5Cv-0004H3-HT for qemu-devel@nongnu.org; Mon, 09 Dec 2013 13:05:25 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rB9I5OL1021052 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 9 Dec 2013 13:05:25 -0500 Message-ID: <52A60662.7040303@redhat.com> Date: Mon, 09 Dec 2013 19:05:22 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1386348867-25038-1-git-send-email-pbonzini@redhat.com> <1386348867-25038-4-git-send-email-pbonzini@redhat.com> <52A59256.6030105@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/4] qdev: allow both pre- and post-order vists in qdev walking functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bandan Das Cc: qemu-devel@nongnu.org, mst@redhat.com Il 09/12/2013 18:56, Bandan Das ha scritto: >> > This is a generic walk function. >> > For reset you want post-order, but in other cases pre-order may make >> > more sense, for example realize. > Sorry, not sure if I get it. What I meant was will this work ? > > int qbus_walk_children(BusState *bus, qdev_walkerfn *devfn, > - qbus_walkerfn *busfn, void *opaque) > + qbus_walkerfn *busfn, bool ispostorder, void *opaque) Yes, but it is a bit less flexible. If we want to remove the flexibility, I'd rather have two separate functions for pre- and post-order, not a new "bool" parameter. > Or there's a case where we would like to traverse pre for parent and post > for children's buses (or something similar).. Probably not, but there may be a case where you want both pre and post (i.e. before and after). For example a "display tree" functionality where the post-order callbacks simply decrement the current indentation. Paolo