From c1a0ca80bdd86381b8dd6e07d61ae3f88aece9ce Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Sat, 22 Mar 2014 03:30:57 +0100 Subject: [PATCH 06/30] dump: const-qualify the buf of WriteCoreDumpFunction RH-Author: Laszlo Ersek Message-id: <1395459071-19118-6-git-send-email-lersek@redhat.com> Patchwork-id: 58217 O-Subject: [RHEL-6.6 qemu-kvm PATCH 05/19] dump: const-qualify the buf of WriteCoreDumpFunction Bugzilla: 1035162 RH-Acked-by: Paolo Bonzini RH-Acked-by: Dr. David Alan Gilbert (git) RH-Acked-by: Luiz Capitulino From: qiaonuohan WriteCoreDumpFunction is a function pointer that points to the function used to write content in "buf" into core file, so "buf" should be const-qualify. Signed-off-by: Qiao Nuohan Reviewed-by: Laszlo Ersek Signed-off-by: Luiz Capitulino (cherry picked from commit b5ba1cc6260917926781fb79fbb05d53bf586d53) Conflicts: include/qom/cpu.h RHEL-6 note: write_core_dump_function vs. WriteCoreDumpFunction due to not having commit c72bf468259935a80ea185f2cbe807c3da9c1bbd Author: Jens Freimann Date: Fri Apr 19 16:45:06 2013 +0200 cpu: Move cpu_write_elfXX_note() functions to CPUState Signed-off-by: Laszlo Ersek --- cpu-all.h | 3 ++- dump.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) Signed-off-by: Miroslav Rezanina --- cpu-all.h | 3 ++- dump.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cpu-all.h b/cpu-all.h index ce48351..e0b17a3 100644 --- a/cpu-all.h +++ b/cpu-all.h @@ -1124,7 +1124,8 @@ static inline bool cpu_paging_enabled(CPUArchState *env) } #endif -typedef int (*write_core_dump_function)(void *buf, size_t size, void *opaque); +typedef int (*write_core_dump_function)(const void *buf, size_t size, + void *opaque); #if defined(CONFIG_HAVE_CORE_DUMP) int cpu_write_elf64_note(write_core_dump_function f, CPUArchState *env, int cpuid, void *opaque); diff --git a/dump.c b/dump.c index e996331..16fc5e6 100644 --- a/dump.c +++ b/dump.c @@ -104,7 +104,7 @@ static void dump_error(DumpState *s, const char *reason) dump_cleanup(s); } -static int fd_write_vmcore(void *buf, size_t size, void *opaque) +static int fd_write_vmcore(const void *buf, size_t size, void *opaque) { DumpState *s = opaque; size_t written_size; -- 1.7.1