Skip to content

Clean up and simplify around fprintf_function

Markus Armbruster qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest17 patches 4 repliesIn review
  2. v117 patches 22 repliesSuperseded

Changes in v2 from the cover letter

* PATCH 08: Commit message pasto [Dave]
* PATCH 09: Commit message typo [Dave]
* PATCH 14: Drop spurious change to x86_cpu_dump_local_apic_state() [Dave]

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/17include: Include fprintf-fn.h only where neededinclude/qemu-common.h include/qemu/cutils.h include/sysemu/cpus.h+1 -40 replies
2/17trace: Simplify how st_print_trace_file_status() printsmonitor.c trace/simple.c trace/simple.h+6 -50 replies
3/17tcg: Simplify how dump_opcount_info() printsaccel/tcg/translate-all.c include/exec/cpu-all.h monitor.c +2 more+10 -90 replies
4/17tcg: Simplify how dump_exec_info() printsaccel/tcg/translate-all.c include/exec/cpu-all.h monitor.c +2 more+47 -450 replies
5/17tcg: Simplify how dump_drift_info() printscpus.c include/sysemu/cpus.h monitor.c+11 -80 replies
6/17qsp: Simplify how qsp_report() printsinclude/block/qapi.h include/qemu/qsp.h monitor.c +1 more+15 -150 replies
7/17block/qapi: Clean up how we print to monitor or stdoutblock/qapi.c hmp.c include/block/qapi.h +2 more+67 -830 replies
8/17memory: Clean up how mtree_info() printsexec.c include/exec/memory-internal.h include/exec/memory.h +2 more+98 -1070 replies
9/17target: Simplify how the TARGET_cpu_list() printbsd-user/main.c cpus.c include/exec/cpu-common.h +37 more+129 -2181 reply
10/17target: Clean up how the dump_mmu() printtarget/m68k/cpu.h target/m68k/helper.c target/m68k/monitor.c +15 more+178 -1830 replies
11/17target/i386: Simplify how x86_cpu_dump_local_apic_state() printstarget/i386/cpu.h target/i386/helper.c target/i386/monitor.c+39 -460 replies
12/17qom/cpu: Simplify how CPUClass::dump_statistics() printsinclude/qom/cpu.h monitor.c qom/cpu.c +2 more+12 -180 replies
13/17qemu-print: New qemu_fprintf(), qemu_vfprintf()include/qemu/qemu-print.h util/qemu-print.c+31 -00 replies
14/17qom/cpu: Simplify how CPUClass:cpu_dump_state() printsaccel/kvm/kvm-all.c bsd-user/main.c cpus.c +60 more+682 -7110 replies
15/17monitor: Clean up how monitor_disas() funnels output to monitordisas.c include/monitor/monitor.h monitor.c+2 -132 replies
16/17disas: Rename include/disas/bfd.h back to include/disas/dis-asm.hdisas.c disas/alpha.c disas/arm-a64.cc +22 more+24 -241 reply
17/17include: Move fprintf_function to disas/include/disas/dis-asm.h include/qemu/fprintf-fn.h+3 -160 replies

Reviews trailers per patch

All 17 patches have a Reviewed-by or Acked-by.

PatchDr. David Alan Gilbert
1/17R-b
2/17R-b
3/17R-b
4/17R-b
5/17R-b
6/17R-b
7/17R-b
8/17R-b
9/17R-b
10/17R-b
11/17R-b
12/17R-b
13/17R-b
14/17R-b
15/17R-b
16/17R-b
17/17R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function

We pass around fprintf_function callbacks together a FILE * argument. Three cases:

* We pass fprintf() and stdout, stderr or qemu_log_file. Okay.

* We pass monitor_fprintf() together with the current monitor cast to FILE *. The type-punning is ugly.

* We pass monitor_printf() cast to fprintf_function together with the current monitor cast to FILE *. Even uglier.

All but two instances can be replaced by using qemu_printf() directly instead of printing through a callback.

One more can be replace by using new qemu_fprintf() directly.

The last one can use qemu_fprintf() to at least avoid the type-punning.

Based-on: <[email protected]>

v2:
* PATCH 08: Commit message pasto [Dave]
* PATCH 09: Commit message typo [Dave]
* PATCH 14: Drop spurious change to x86_cpu_dump_local_apic_state() [Dave]

Markus Armbruster (17):
include: Include fprintf-fn.h only where needed
trace: Simplify how st_print_trace_file_status() prints
tcg: Simplify how dump_opcount_info() prints
tcg: Simplify how dump_exec_info() prints
tcg: Simplify how dump_drift_info() prints
qsp: Simplify how qsp_report() prints
block/qapi: Clean up how we print to monitor or stdout
memory: Clean up how mtree_info() prints
target: Simplify how the TARGET_cpu_list() print
target: Clean up how the dump_mmu() print
target/i386: Simplify how x86_cpu_dump_local_apic_state() prints qom/cpu: Simplify how CPUClass::dump_statistics() prints
qemu-print: New qemu_fprintf(), qemu_vfprintf() qom/cpu: Simplify how CPUClass:cpu_dump_state() prints
monitor: Clean up how monitor_disas() funnels output to monitor
disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
include: Move fprintf_function to disas/

 accel/kvm/kvm-all.c                |   4 +-
 accel/tcg/translate-all.c          |  49 ++--
 block/qapi.c                       | 120 +++++-----
 bsd-user/main.c                    |   4 +-
 cpus.c                             |  21 +-
 disas.c                            |   5 +-
 disas/alpha.c                      |   2 +-
 disas/arm-a64.cc                   |   2 +-
 disas/arm.c                        |   2 +-
 disas/cris.c                       |   2 +-
 disas/hppa.c                       |   2 +-
 disas/i386.c                       |   2 +-
 disas/lm32.c                       |   2 +-
 disas/m68k.c                       |   2 +-
 disas/microblaze.c                 |   2 +-
 disas/mips.c                       |   2 +-
 disas/moxie.c                      |   2 +-
 disas/nanomips.cpp                 |   2 +-
 disas/nios2.c                      |   2 +-
 disas/ppc.c                        |   2 +-
 disas/riscv.c                      |   2 +-
 disas/s390.c                       |   2 +-
 disas/sh4.c                        |   2 +-
 disas/sparc.c                      |   2 +-
 disas/tci.c                        |   2 +-
 disas/xtensa.c                     |   2 +-
 exec.c                             |  42 ++--
 hmp.c                              |  12 +-
 include/block/qapi.h               |   9 +-
 include/disas/{bfd.h => dis-asm.h} |   5 +-
 include/exec/cpu-all.h             |   4 +-
 include/exec/cpu-common.h          |  13 --
 include/exec/log.h                 |   2 +-
 include/exec/memory-internal.h     |   3 +-
 include/exec/memory.h              |   3 +-
 include/monitor/monitor.h          |   1 -
 include/qemu-common.h              |   2 -
 include/qemu/cutils.h              |   2 -
 include/qemu/fprintf-fn.h          |  14 --
 include/qemu/qemu-print.h          |   4 +
 include/qemu/qsp.h                 |   6 +-
 include/qom/cpu.h                  |  24 +-
 include/sysemu/cpus.h              |   4 +-
 linux-user/alpha/cpu_loop.c        |   2 +-
 linux-user/cpu_loop-common.h       |   2 +-
 linux-user/cris/cpu_loop.c         |   2 +-
 linux-user/main.c                  |   2 +-
 linux-user/microblaze/cpu_loop.c   |   4 +-
 linux-user/s390x/cpu_loop.c        |   4 +-
 linux-user/sh4/cpu_loop.c          |   2 +-
 linux-user/sparc/cpu_loop.c        |   2 +-
 memory.c                           | 156 ++++++-------
 monitor.c                          |  30 +--
 qemu-img.c                         |   6 +-
 qemu-io-cmds.c                     |   2 +-
 qom/cpu.c                          |  11 +-
 target/alpha/cpu.c                 |  15 +-
 target/alpha/cpu.h                 |   5 +-
 target/alpha/helper.c              |  24 +-
 target/arm/arm-semi.c              |   2 +-
 target/arm/cpu.c                   |   1 -
 target/arm/cpu.h                   |   5 +-
 target/arm/helper.c                |  15 +-
 target/arm/translate-a64.c         |  82 +++----
 target/arm/translate.c             |  58 ++---
 target/arm/translate.h             |   7 +-
 target/cris/cpu.c                  |  14 +-
 target/cris/cpu.h                  |   5 +-
 target/cris/helper.c               |   2 +-
 target/cris/translate.c            |  36 +--
 target/hppa/cpu.c                  |  14 +-
 target/hppa/cpu.h                  |   4 +-
 target/hppa/helper.c               |  24 +-
 target/i386/cpu.c                  |  29 +--
 target/i386/cpu.h                  |   8 +-
 target/i386/hax-all.c              |   4 +-
 target/i386/helper.c               | 356 ++++++++++++++---------------
 target/i386/monitor.c              |   3 +-
 target/lm32/cpu.c                  |  14 +-
 target/lm32/cpu.h                  |   5 +-
 target/lm32/translate.c            |  36 +--
 target/m68k/cpu.h                  |   8 +-
 target/m68k/helper.c               | 129 +++++------
 target/m68k/monitor.c              |   2 +-
 target/m68k/translate.c            |  86 +++----
 target/microblaze/cpu.h            |   3 +-
 target/microblaze/helper.c         |   2 +-
 target/microblaze/translate.c      |  39 ++--
 target/mips/cpu.h                  |   2 +-
 target/mips/internal.h             |   3 +-
 target/mips/translate.c            |  77 ++++---
 target/mips/translate_init.inc.c   |   5 +-
 target/moxie/cpu.h                 |   3 +-
 target/moxie/helper.c              |   2 +-
 target/moxie/translate.c           |  22 +-
 target/nios2/cpu.h                 |   5 +-
 target/nios2/helper.c              |   2 +-
 target/nios2/mmu.c                 |   7 +-
 target/nios2/monitor.c             |   2 +-
 target/nios2/translate.c           |  24 +-
 target/openrisc/cpu.c              |  15 +-
 target/openrisc/cpu.h              |   5 +-
 target/openrisc/disas.c            |   2 +-
 target/openrisc/translate.c        |  11 +-
 target/ppc/cpu.h                   |  10 +-
 target/ppc/mmu-hash64.c            |   7 +-
 target/ppc/mmu-hash64.h            |   2 +-
 target/ppc/mmu_helper.c            |  70 +++---
 target/ppc/monitor.c               |   2 +-
 target/ppc/translate.c             | 170 +++++++-------
 target/ppc/translate_init.inc.c    |  28 +--
 target/riscv/cpu.c                 |  54 ++---
 target/riscv/cpu.h                 |   2 +-
 target/s390x/cpu.h                 |   2 +-
 target/s390x/cpu_models.c          |  21 +-
 target/s390x/helper.c              |  42 ++--
 target/s390x/internal.h            |   3 +-
 target/sh4/cpu.c                   |  17 +-
 target/sh4/cpu.h                   |   5 +-
 target/sh4/translate.c             |  27 +--
 target/sparc/cpu.c                 | 133 ++++++-----
 target/sparc/cpu.h                 |   7 +-
 target/sparc/ldst_helper.c         |  18 +-
 target/sparc/mmu_helper.c          |  97 ++++----
 target/sparc/monitor.c             |   2 +-
 target/tilegx/cpu.c                |  14 +-
 target/tricore/cpu.h               |   5 +-
 target/tricore/helper.c            |  15 +-
 target/tricore/translate.c         |  26 +--
 target/unicore32/cpu.h             |   3 +-
 target/unicore32/translate.c       |  39 ++--
 target/xtensa/cpu.h                |   7 +-
 target/xtensa/helper.c             |   7 +-
 target/xtensa/mmu_helper.c         |  24 +-
 target/xtensa/monitor.c            |   2 +-
 target/xtensa/translate.c          |  40 ++--
 tcg/tcg.c                          |  50 ++--
 tcg/tcg.h                          |   4 +-
 trace/simple.c                     |   7 +-
 trace/simple.h                     |   2 +-
 util/qemu-print.c                  |  27 +++
 util/qsp.c                         |  21 +-
 vl.c                               |   2 +-
 143 files changed, 1353 insertions(+), 1503 deletions(-)
 rename include/disas/{bfd.h => dis-asm.h} (99%)
 delete mode 100644 include/qemu/fprintf-fn.h
Signature · 1 line
2.17.2