dump: change cpu_get_note_size to return ssize_t

So that it can use the same prototype in both cases.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2012-06-07 08:48:09 +02:00
parent db2077692f
commit 4720bd0506
3 changed files with 10 additions and 5 deletions

View File

@ -552,7 +552,7 @@ int cpu_write_elf64_qemunote(write_core_dump_function f, CPUArchState *env,
int cpu_write_elf32_qemunote(write_core_dump_function f, CPUArchState *env, int cpu_write_elf32_qemunote(write_core_dump_function f, CPUArchState *env,
void *opaque); void *opaque);
int cpu_get_dump_info(ArchDumpInfo *info); int cpu_get_dump_info(ArchDumpInfo *info);
size_t cpu_get_note_size(int class, int machine, int nr_cpus); ssize_t cpu_get_note_size(int class, int machine, int nr_cpus);
#else #else
static inline int cpu_write_elf64_note(write_core_dump_function f, static inline int cpu_write_elf64_note(write_core_dump_function f,
CPUArchState *env, int cpuid, CPUArchState *env, int cpuid,
@ -587,7 +587,7 @@ static inline int cpu_get_dump_info(ArchDumpInfo *info)
return -1; return -1;
} }
static inline int cpu_get_note_size(int class, int machine, int nr_cpus) static inline ssize_t cpu_get_note_size(int class, int machine, int nr_cpus)
{ {
return -1; return -1;
} }

9
dump.c
View File

@ -750,6 +750,13 @@ static int dump_init(DumpState *s, int fd, bool paging, bool has_filter,
goto cleanup; goto cleanup;
} }
s->note_size = cpu_get_note_size(s->dump_info.d_class,
s->dump_info.d_machine, nr_cpus);
if (ret < 0) {
error_set(errp, QERR_UNSUPPORTED);
goto cleanup;
}
/* get memory mapping */ /* get memory mapping */
memory_mapping_list_init(&s->list); memory_mapping_list_init(&s->list);
if (paging) { if (paging) {
@ -784,8 +791,6 @@ static int dump_init(DumpState *s, int fd, bool paging, bool has_filter,
} }
} }
s->note_size = cpu_get_note_size(s->dump_info.d_class,
s->dump_info.d_machine, nr_cpus);
if (s->dump_info.d_class == ELFCLASS64) { if (s->dump_info.d_class == ELFCLASS64) {
if (s->have_section) { if (s->have_section) {
s->memory_offset = sizeof(Elf64_Ehdr) + s->memory_offset = sizeof(Elf64_Ehdr) +

View File

@ -415,7 +415,7 @@ int cpu_get_dump_info(ArchDumpInfo *info)
return 0; return 0;
} }
size_t cpu_get_note_size(int class, int machine, int nr_cpus) ssize_t cpu_get_note_size(int class, int machine, int nr_cpus)
{ {
int name_size = 5; /* "CORE" or "QEMU" */ int name_size = 5; /* "CORE" or "QEMU" */
size_t elf_note_size = 0; size_t elf_note_size = 0;