diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/block/qapi.h | 9 | ||||
-rw-r--r-- | include/disas/dis-asm.h (renamed from include/disas/bfd.h) | 5 | ||||
-rw-r--r-- | include/exec/cpu-all.h | 4 | ||||
-rw-r--r-- | include/exec/cpu-common.h | 13 | ||||
-rw-r--r-- | include/exec/log.h | 2 | ||||
-rw-r--r-- | include/exec/memory-internal.h | 3 | ||||
-rw-r--r-- | include/exec/memory.h | 3 | ||||
-rw-r--r-- | include/monitor/monitor.h | 8 | ||||
-rw-r--r-- | include/qemu-common.h | 2 | ||||
-rw-r--r-- | include/qemu/cutils.h | 2 | ||||
-rw-r--r-- | include/qemu/error-report.h | 11 | ||||
-rw-r--r-- | include/qemu/fprintf-fn.h | 14 | ||||
-rw-r--r-- | include/qemu/qemu-print.h | 23 | ||||
-rw-r--r-- | include/qemu/qsp.h | 6 | ||||
-rw-r--r-- | include/qom/cpu.h | 24 | ||||
-rw-r--r-- | include/sysemu/cpus.h | 4 |
16 files changed, 54 insertions, 79 deletions
diff --git a/include/block/qapi.h b/include/block/qapi.h index 83bdb098bd..cd9410dee3 100644 --- a/include/block/qapi.h +++ b/include/block/qapi.h @@ -37,10 +37,7 @@ void bdrv_query_image_info(BlockDriverState *bs, ImageInfo **p_info, Error **errp); -void bdrv_snapshot_dump(fprintf_function func_fprintf, void *f, - QEMUSnapshotInfo *sn); -void bdrv_image_info_specific_dump(fprintf_function func_fprintf, void *f, - ImageInfoSpecific *info_spec); -void bdrv_image_info_dump(fprintf_function func_fprintf, void *f, - ImageInfo *info); +void bdrv_snapshot_dump(QEMUSnapshotInfo *sn); +void bdrv_image_info_specific_dump(ImageInfoSpecific *info_spec); +void bdrv_image_info_dump(ImageInfo *info); #endif diff --git a/include/disas/bfd.h b/include/disas/dis-asm.h index 41b61c85f9..9240ec32c2 100644 --- a/include/disas/bfd.h +++ b/include/disas/dis-asm.h @@ -9,8 +9,6 @@ #ifndef DISAS_BFD_H #define DISAS_BFD_H -#include "qemu/fprintf-fn.h" - typedef void *PTR; typedef uint64_t bfd_vma; typedef int64_t bfd_signed_vma; @@ -243,6 +241,9 @@ typedef struct symbol_cache_entry } udata; } asymbol; +typedef int (*fprintf_function)(FILE *f, const char *fmt, ...) + GCC_FMT_ATTR(2, 3); + enum dis_insn_type { dis_noninsn, /* Not a valid instruction */ dis_nonbranch, /* Not a branch instruction */ diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index b16c9ec513..da07ce311f 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -362,8 +362,8 @@ static inline bool tlb_hit(target_ulong tlb_addr, target_ulong addr) return tlb_hit_page(tlb_addr, addr & TARGET_PAGE_MASK); } -void dump_exec_info(FILE *f, fprintf_function cpu_fprintf); -void dump_opcount_info(FILE *f, fprintf_function cpu_fprintf); +void dump_exec_info(void); +void dump_opcount_info(void); #endif /* !CONFIG_USER_ONLY */ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr, diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index cef8b88a2a..848a4b94ab 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -9,19 +9,6 @@ #include "qemu/bswap.h" #include "qemu/queue.h" -#include "qemu/fprintf-fn.h" - -/** - * CPUListState: - * @cpu_fprintf: Print function. - * @file: File to print to using @cpu_fprint. - * - * State commonly used for iterating over CPU models. - */ -typedef struct CPUListState { - fprintf_function cpu_fprintf; - FILE *file; -} CPUListState; /* The CPU list lock nests outside page_(un)lock or mmap_(un)lock */ void qemu_init_cpu_list(void); diff --git a/include/exec/log.h b/include/exec/log.h index c249307911..de067f173b 100644 --- a/include/exec/log.h +++ b/include/exec/log.h @@ -16,7 +16,7 @@ static inline void log_cpu_state(CPUState *cpu, int flags) { if (qemu_log_enabled()) { - cpu_dump_state(cpu, qemu_logfile, fprintf, flags); + cpu_dump_state(cpu, qemu_logfile, flags); } } diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h index bb08fa4d2f..d1a9dd1ec8 100644 --- a/include/exec/memory-internal.h +++ b/include/exec/memory-internal.h @@ -45,8 +45,7 @@ AddressSpaceDispatch *address_space_dispatch_new(FlatView *fv); void address_space_dispatch_compact(AddressSpaceDispatch *d); void address_space_dispatch_free(AddressSpaceDispatch *d); -void mtree_print_dispatch(fprintf_function mon, void *f, - struct AddressSpaceDispatch *d, +void mtree_print_dispatch(struct AddressSpaceDispatch *d, MemoryRegion *root); struct page_collection; diff --git a/include/exec/memory.h b/include/exec/memory.h index 1625913f84..9144a47f57 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1720,8 +1720,7 @@ void memory_global_dirty_log_start(void); */ void memory_global_dirty_log_stop(void); -void mtree_info(fprintf_function mon_printf, void *f, bool flatview, - bool dispatch_tree, bool owner); +void mtree_info(bool flatview, bool dispatch_tree, bool owner); /** * memory_region_dispatch_read: perform a read directly to the specified diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index c1b40a9cac..86656297f1 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -28,10 +28,9 @@ void monitor_resume(Monitor *mon); int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp); int monitor_fd_param(Monitor *mon, const char *fdname, Error **errp); -void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) +int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0); -void monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3); -int monitor_fprintf(FILE *stream, const char *fmt, ...) GCC_FMT_ATTR(2, 3); +int monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3); void monitor_flush(Monitor *mon); int monitor_set_cpu(int cpu_index); int monitor_get_cpu_index(void); @@ -48,7 +47,4 @@ int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd); void monitor_fdset_dup_fd_remove(int dup_fd); int monitor_fdset_dup_fd_find(int dup_fd); -void monitor_vfprintf(FILE *stream, - const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0); - #endif /* MONITOR_H */ diff --git a/include/qemu-common.h b/include/qemu-common.h index a102245519..f891e05e7e 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -12,8 +12,6 @@ #ifndef QEMU_COMMON_H #define QEMU_COMMON_H -#include "qemu/fprintf-fn.h" - #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR) /* Copyright string for -version arguments, About dialogs, etc */ diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h index d2dad3057c..12301340a4 100644 --- a/include/qemu/cutils.h +++ b/include/qemu/cutils.h @@ -1,8 +1,6 @@ #ifndef QEMU_CUTILS_H #define QEMU_CUTILS_H -#include "qemu/fprintf-fn.h" - /** * pstrcpy: * @buf: buffer to copy string into diff --git a/include/qemu/error-report.h b/include/qemu/error-report.h index 0a8d9cc9ea..00d069b20f 100644 --- a/include/qemu/error-report.h +++ b/include/qemu/error-report.h @@ -30,11 +30,10 @@ void loc_set_none(void); void loc_set_cmdline(char **argv, int idx, int cnt); void loc_set_file(const char *fname, int lno); -void error_vprintf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); -void error_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2); -void error_vprintf_unless_qmp(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); -void error_printf_unless_qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2); -void error_set_progname(const char *argv0); +int error_vprintf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); +int error_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2); +int error_vprintf_unless_qmp(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); +int error_printf_unless_qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2); void error_vreport(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); void warn_vreport(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); @@ -49,6 +48,8 @@ bool error_report_once_cond(bool *printed, const char *fmt, ...) bool warn_report_once_cond(bool *printed, const char *fmt, ...) GCC_FMT_ATTR(2, 3); +void error_init(const char *argv0); + /* * Similar to error_report(), except it prints the message just once. * Return true when it prints, false otherwise. diff --git a/include/qemu/fprintf-fn.h b/include/qemu/fprintf-fn.h deleted file mode 100644 index 9068a960b3..0000000000 --- a/include/qemu/fprintf-fn.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Typedef for fprintf-alike function pointers. - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef QEMU_FPRINTF_FN_H -#define QEMU_FPRINTF_FN_H - -typedef int (*fprintf_function)(FILE *f, const char *fmt, ...) - GCC_FMT_ATTR(2, 3); - -#endif diff --git a/include/qemu/qemu-print.h b/include/qemu/qemu-print.h new file mode 100644 index 0000000000..40b596262f --- /dev/null +++ b/include/qemu/qemu-print.h @@ -0,0 +1,23 @@ +/* + * Print to stream or current monitor + * + * Copyright (C) 2019 Red Hat Inc. + * + * Authors: + * Markus Armbruster <armbru@redhat.com>, + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#ifndef QEMU_PRINT_H +#define QEMU_PRINT_H + +int qemu_vprintf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); +int qemu_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2); + +int qemu_vfprintf(FILE *stream, const char *fmt, va_list ap) + GCC_FMT_ATTR(2, 0); +int qemu_fprintf(FILE *stream, const char *fmt, ...) GCC_FMT_ATTR(2, 3); + +#endif diff --git a/include/qemu/qsp.h b/include/qemu/qsp.h index a94c464f90..bf36aabfa8 100644 --- a/include/qemu/qsp.h +++ b/include/qemu/qsp.h @@ -11,15 +11,13 @@ #ifndef QEMU_QSP_H #define QEMU_QSP_H -#include "qemu/fprintf-fn.h" - enum QSPSortBy { QSP_SORT_BY_TOTAL_WAIT_TIME, QSP_SORT_BY_AVG_WAIT_TIME, }; -void qsp_report(FILE *f, fprintf_function cpu_fprintf, size_t max, - enum QSPSortBy sort_by, bool callsite_coalesce); +void qsp_report(size_t max, enum QSPSortBy sort_by, + bool callsite_coalesce); bool qsp_is_enabled(void); void qsp_enable(void); diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 1d6099e5d4..e9bec3a5bc 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -21,12 +21,11 @@ #define QEMU_CPU_H #include "hw/qdev-core.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" #include "exec/hwaddr.h" #include "exec/memattrs.h" #include "qapi/qapi-types-run-state.h" #include "qemu/bitmap.h" -#include "qemu/fprintf-fn.h" #include "qemu/rcu_queue.h" #include "qemu/queue.h" #include "qemu/thread.h" @@ -181,11 +180,9 @@ typedef struct CPUClass { bool (*virtio_is_big_endian)(CPUState *cpu); int (*memory_rw_debug)(CPUState *cpu, vaddr addr, uint8_t *buf, int len, bool is_write); - void (*dump_state)(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, - int flags); + void (*dump_state)(CPUState *cpu, FILE *, int flags); GuestPanicInformation* (*get_crash_info)(CPUState *cpu); - void (*dump_statistics)(CPUState *cpu, FILE *f, - fprintf_function cpu_fprintf, int flags); + void (*dump_statistics)(CPUState *cpu, int flags); int64_t (*get_arch_id)(CPUState *cpu); bool (*get_paging_enabled)(const CPUState *cpu); void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list, @@ -564,26 +561,21 @@ enum CPUDumpFlags { /** * cpu_dump_state: * @cpu: The CPU whose state is to be dumped. - * @f: File to dump to. - * @cpu_fprintf: Function to dump with. - * @flags: Flags what to dump. + * @f: If non-null, dump to this stream, else to current print sink. * * Dumps CPU state. */ -void cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, - int flags); +void cpu_dump_state(CPUState *cpu, FILE *f, int flags); /** * cpu_dump_statistics: * @cpu: The CPU whose state is to be dumped. - * @f: File to dump to. - * @cpu_fprintf: Function to dump with. * @flags: Flags what to dump. * - * Dumps CPU statistics. + * Dump CPU statistics to the current monitor if we have one, else to + * stdout. */ -void cpu_dump_statistics(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, - int flags); +void cpu_dump_statistics(CPUState *cpu, int flags); #ifndef CONFIG_USER_ONLY /** diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h index 731756d948..32c05f27e7 100644 --- a/include/sysemu/cpus.h +++ b/include/sysemu/cpus.h @@ -18,7 +18,7 @@ extern int icount_align_option; /* drift information for info jit command */ extern int64_t max_delay; extern int64_t max_advance; -void dump_drift_info(FILE *f, fprintf_function cpu_fprintf); +void dump_drift_info(void); /* Unblock cpu */ void qemu_cpu_kick_self(void); @@ -38,7 +38,7 @@ extern int smp_cores; extern int smp_threads; #endif -void list_cpus(FILE *f, fprintf_function cpu_fprintf, const char *optarg); +void list_cpus(const char *optarg); void qemu_tcg_configure(QemuOpts *opts, Error **errp); |