[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH qom-cpu v4 15/18] dump: Abstract dump_init() further
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH qom-cpu v4 15/18] dump: Abstract dump_init() further with qemu_for_each_cpu() |
Date: |
Sun, 9 Jun 2013 18:10:44 +0200 |
Allows to drop CPUArchState variable.
Signed-off-by: Andreas Färber <address@hidden>
---
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;
}
+static void count_one_cpu(CPUState *cpu, void *data)
+{
+ int *nr = data;
+
+ *nr = *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 = NULL;
int ret;
@@ -738,9 +744,7 @@ static int dump_init(DumpState *s, int fd, bool paging,
bool has_filter,
*/
cpu_synchronize_all_states();
nr_cpus = 0;
- for (env = first_cpu; env != NULL; env = env->next_cpu) {
- nr_cpus++;
- }
+ qemu_for_each_cpu(count_one_cpu, &nr_cpus);
ret = cpu_get_dump_info(&s->dump_info);
if (ret < 0) {
--
1.8.1.4
- Re: [Qemu-devel] [PATCH qom-cpu v4 09/18] cpu: Turn cpu_get_memory_mapping() into a CPUState hook, (continued)
- [Qemu-devel] [PATCH qom-cpu v4 14/18] dump: Abstract dump_init() with cpu_synchronize_all_states(), Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu v4 12/18] cpu: Change default for CPUClass::get_paging_enabled(), Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu v4 13/18] memory_mapping: Cleanup qemu_get_guest_memory_mapping(), Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu v4 15/18] dump: Abstract dump_init() further with qemu_for_each_cpu(),
Andreas Färber <=
- [Qemu-devel] [PATCH qom-cpu v4 16/18] dump: Abstract write_elf{64, 32}_notes() with qemu_for_each_cpu(), Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu v4 17/18] memory_mapping: Use hwaddr type for MemoryMapping virt_addr field, Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu v4 18/18] memory_mapping: Build only once, Andreas Färber, 2013/06/09
- Re: [Qemu-devel] [PATCH qom-cpu v4 00/18] dump: Build cleanups, redone, Andreas Färber, 2013/06/09
- Re: [Qemu-devel] [PATCH qom-cpu v4 00/18] dump: Build cleanups, redone, Andreas Färber, 2013/06/11