From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UliD0-0002Ob-1S for qemu-devel@nongnu.org; Sun, 09 Jun 2013 12:11:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UliCy-0001wj-Sb for qemu-devel@nongnu.org; Sun, 09 Jun 2013 12:11:09 -0400 Received: from cantor2.suse.de ([195.135.220.15]:39894 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UliCy-0001wd-LU for qemu-devel@nongnu.org; Sun, 09 Jun 2013 12:11:08 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 9 Jun 2013 18:10:44 +0200 Message-Id: <1370794247-28267-16-git-send-email-afaerber@suse.de> In-Reply-To: <1370794247-28267-1-git-send-email-afaerber@suse.de> References: <1370794247-28267-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH qom-cpu v4 15/18] dump: Abstract dump_init() further with qemu_for_each_cpu() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qiaonuohan@cn.fujitsu.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= , lcapitulino@redhat.com Allows to drop CPUArchState variable. Signed-off-by: Andreas F=C3=A4rber --- dump.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dump.c b/dump.c index 44a1339..4e6b855 100644 --- a/dump.c +++ b/dump.c @@ -702,10 +702,16 @@ static ram_addr_t get_start_block(DumpState *s) return -1; } =20 +static void count_one_cpu(CPUState *cpu, void *data) +{ + int *nr =3D data; + + *nr =3D *nr + 1; +} + static int dump_init(DumpState *s, int fd, bool paging, bool has_filter, int64_t begin, int64_t length, Error **errp) { - CPUArchState *env; int nr_cpus; Error *err =3D NULL; int ret; @@ -738,9 +744,7 @@ static int dump_init(DumpState *s, int fd, bool pagin= g, bool has_filter, */ cpu_synchronize_all_states(); nr_cpus =3D 0; - for (env =3D first_cpu; env !=3D NULL; env =3D env->next_cpu) { - nr_cpus++; - } + qemu_for_each_cpu(count_one_cpu, &nr_cpus); =20 ret =3D cpu_get_dump_info(&s->dump_info); if (ret < 0) { --=20 1.8.1.4