From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=44253 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQE4L-0004wk-PZ for qemu-devel@nongnu.org; Wed, 08 Dec 2010 02:04:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PQE4K-0006QB-3n for qemu-devel@nongnu.org; Wed, 08 Dec 2010 02:04:05 -0500 Received: from mail.valinux.co.jp ([210.128.90.3]:59715) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PQE4J-0006Pi-OQ for qemu-devel@nongnu.org; Wed, 08 Dec 2010 02:04:04 -0500 Date: Wed, 8 Dec 2010 16:03:58 +0900 From: Isaku Yamahata Subject: Re: [Qemu-devel] [PATCH 06/21] vl: add a tmp pointer so that a handler can delete the entry to which it belongs. Message-ID: <20101208070358.GA3303@valinux.co.jp> References: <1290665220-26478-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> <1290665220-26478-7-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1290665220-26478-7-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yoshiaki Tamura Cc: ohmura.kei@lab.ntt.co.jp, dlaor@redhat.com, ananth@in.ibm.com, kvm@vger.kernel.org, mtosatti@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org, avi@redhat.com, vatsa@linux.vnet.ibm.com, psuriset@linux.vnet.ibm.com, stefanha@linux.vnet.ibm.com QLIST_FOREACH_SAFE? On Thu, Nov 25, 2010 at 03:06:45PM +0900, Yoshiaki Tamura wrote: > By copying the next entry to a tmp pointer, > qemu_del_vm_change_state_handler() can be called in the handler. > > Signed-off-by: Yoshiaki Tamura > --- > vl.c | 5 +++-- > 1 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/vl.c b/vl.c > index 805e11f..6b6aec0 100644 > --- a/vl.c > +++ b/vl.c > @@ -1073,11 +1073,12 @@ void qemu_del_vm_change_state_handler(VMChangeStateEntry *e) > > void vm_state_notify(int running, int reason) > { > - VMChangeStateEntry *e; > + VMChangeStateEntry *e, *ne; > > trace_vm_state_notify(running, reason); > > - for (e = vm_change_state_head.lh_first; e; e = e->entries.le_next) { > + for (e = vm_change_state_head.lh_first; e; e = ne) { > + ne = e->entries.le_next; > e->cb(e->opaque, running, reason); > } > } > -- > 1.7.1.2 > > -- yamahata