Remove some of the fprintf(stderr, "*
PATCH v2 32/47 hw/ppc: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisReplace a large number of the fprintf(stderr, "*\n" calls with error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +Some lines where then manually tweaked to pass checkpatch.
---
V2:
- Split hw patch into individual directories
hw/ppc/e500.c | 20 ++++++++++---------- hw/ppc/mac_newworld.c | 2 +- hw/ppc/mac_oldworld.c | 2 +- hw/ppc/mpc8544_guts.c | 5 +++-- hw/ppc/ppc405_boards.c | 8 ++++---- hw/ppc/ppc440_bamboo.c | 19 ++++++++++--------- hw/ppc/ppc4xx_pci.c | 3 ++- hw/ppc/prep.c | 4 ++-- hw/ppc/virtex_ml507.c | 4 ++-- 9 files changed, 35 insertions(+), 32 deletions(-)
hw/ppc/e500.c +10 -10
@@ -333,13 +333,13 @@ static int ppce500_load_device_tree(MachineState *machine, ret =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-start" , initrd_base);if (ret <0 ) { -fprintf (stderr,"couldn't set /chosen/linux,initrd-start\n" ); +error_report ("couldn't set /chosen/linux,initrd-start" ); } ret =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-end" , (initrd_base + initrd_size));if (ret <0 ) { -fprintf (stderr,"couldn't set /chosen/linux,initrd-end\n" ); +error_report ("couldn't set /chosen/linux,initrd-end" ); } }
@@ -353,7 +353,7 @@ static int ppce500_load_device_tree(MachineState *machine, ret =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , machine->kernel_cmdline);if (ret <0 ) -fprintf (stderr,"couldn't set /chosen/bootargs\n" ); +error_report ("couldn't set /chosen/bootargs" );if (kvm_enabled ()) {/* Read out host's frequencies */
@@ -720,7 +720,7 @@ static DeviceState *ppce500_init_mpic_kvm(PPCE500Params *params,CPU_FOREACH (cs) {if (kvm_openpic_connect_vcpu (dev, cs)) { -fprintf (stderr,"%s: failed to connect vcpu to irqchip\n" , +error_report ("%s: failed to connect vcpu to irqchip" , __func__);abort (); }
@@ -821,7 +821,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) cs =CPU (cpu);if (env->mmu_model !=POWERPC_MMU_BOOKE206 ) { -fprintf (stderr,"MMU model %i not supported by this machine.\n" , +error_report ("MMU model %i not supported by this machine." , env->mmu_model);exit (1 ); }
@@ -967,7 +967,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) cur_base, ram_size - cur_base);if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , machine->kernel_filename);exit (1 ); }
@@ -982,8 +982,8 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) ram_size - initrd_base);if (initrd_size <0 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - machine->initrd_filename); +error_report ("qemu: could not load initial ram disk '%s'" , + machine->initrd_filename);exit (1 ); }
@@ -1024,7 +1024,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) kernel_size =load_uimage (filename, &bios_entry, &loadaddr,NULL ,NULL ,NULL );if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load firmware '%s'\n" , filename); +error_report ("qemu: could not load firmware '%s'" , filename);exit (1 ); } }
@@ -1037,7 +1037,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) initrd_base, initrd_size, kernel_base, kernel_size);if (dt_size <0 ) { -fprintf (stderr,"couldn't load device tree\n" ); +error_report ("couldn't load device tree" );exit (1 ); }assert (dt_size <DTB_MAX_SIZE );
hw/ppc/mac_newworld.c +1 -1
@@ -278,7 +278,7 @@ static void ppc_core99_init(MachineState *machine) } }if (ppc_boot_device =='\0' ) { -fprintf (stderr,"No valid boot device for Mac99 machine\n" ); +error_report ("No valid boot device for Mac99 machine" );exit (1 ); } }
hw/ppc/mac_oldworld.c +1 -1
@@ -221,7 +221,7 @@ static void ppc_heathrow_init(MachineState *machine)#endif }if (ppc_boot_device =='\0' ) { -fprintf (stderr,"No valid boot device for G3 Beige machine\n" ); +error_report ("No valid boot device for G3 Beige machine" );exit (1 ); } }
hw/ppc/mpc8544_guts.c +3 -2
@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "cpu.h" #include "hw/hw.h"
@@ -83,7 +84,7 @@ static uint64_t mpc8544_guts_read(void *opaque, hwaddr addr, value = env->spr[SPR_E500_SVR ];break ;default : -fprintf (stderr,"guts: Unknown register read: %x\n" , (int )addr); +error_report ("guts: Unknown register read: %x" , (int )addr);break ; }
@@ -102,7 +103,7 @@ static void mpc8544_guts_write(void *opaque, hwaddr addr, }break ;default : -fprintf (stderr,"guts: Unknown register write: %x = %x\n" , +error_report ("guts: Unknown register write: %x = %x" , (int )addr, (unsigned )value);break ; }
hw/ppc/ppc405_boards.c +4 -4
@@ -324,7 +324,7 @@ static void ref405ep_init(MachineState *machine) kernel_size =load_image_targphys (kernel_filename, kernel_base, ram_size - kernel_base);if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }
@@ -336,8 +336,8 @@ static void ref405ep_init(MachineState *machine) initrd_size =load_image_targphys (initrd_filename, initrd_base, ram_size - initrd_base);if (initrd_size <0 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - initrd_filename); +error_report ("qemu: could not load initial ram disk '%s'" , + initrd_filename);exit (1 ); } }else {
@@ -607,7 +607,7 @@ static void taihu_405ep_init(MachineState *machine) kernel_size =load_image_targphys (kernel_filename, kernel_base, ram_size - kernel_base);if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }
hw/ppc/ppc440_bamboo.c +10 -9
@@ -12,6 +12,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "net/net.h" #include "hw/hw.h"
@@ -80,22 +81,22 @@ static int bamboo_load_device_tree(hwaddr addr, ret =qemu_fdt_setprop (fdt,"/memory" ,"reg" , mem_reg_property,sizeof (mem_reg_property));if (ret <0 ) -fprintf (stderr,"couldn't set /memory/reg\n" ); +error_report ("couldn't set /memory/reg" ); ret =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-start" , initrd_base);if (ret <0 ) -fprintf (stderr,"couldn't set /chosen/linux,initrd-start\n" ); +error_report ("couldn't set /chosen/linux,initrd-start" ); ret =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-end" , (initrd_base + initrd_size));if (ret <0 ) -fprintf (stderr,"couldn't set /chosen/linux,initrd-end\n" ); +error_report ("couldn't set /chosen/linux,initrd-end" ); ret =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , kernel_cmdline);if (ret <0 ) -fprintf (stderr,"couldn't set /chosen/bootargs\n" ); +error_report ("couldn't set /chosen/bootargs" );/* Copy data from the host device tree into the guest. Since the guest can * directly access the timebase without host involvement, we must expose
@@ -190,7 +191,7 @@ static void bamboo_init(MachineState *machine) env = &cpu->env;if (env->mmu_model !=POWERPC_MMU_BOOKE ) { -fprintf (stderr,"MMU model %i not supported by this machine.\n" , +error_report ("MMU model %i not supported by this machine." , env->mmu_model);exit (1 ); }
@@ -224,7 +225,7 @@ static void bamboo_init(MachineState *machine) NULL); pcibus = (PCIBus *)qdev_get_child_bus (dev,"pci.0" );if (!pcibus) { -fprintf (stderr,"couldn't create PCI controller!\n" ); +error_report ("couldn't create PCI controller!" );exit (1 ); }
@@ -265,7 +266,7 @@ static void bamboo_init(MachineState *machine) }/* XXX try again as binary */ if (success <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }
@@ -277,7 +278,7 @@ static void bamboo_init(MachineState *machine) ram_size - RAMDISK_ADDR);if (initrd_size <0 ) { -fprintf (stderr,"qemu: could not load ram disk '%s' at %x\n" , +error_report ("qemu: could not load ram disk '%s' at %x" , initrd_filename,RAMDISK_ADDR );exit (1 ); }
@@ -287,7 +288,7 @@ static void bamboo_init(MachineState *machine)if (kernel_filename) {if (bamboo_load_device_tree (FDT_ADDR , ram_size,RAMDISK_ADDR , initrd_size, kernel_cmdline) <0 ) { -fprintf (stderr,"couldn't load device tree\n" ); +error_report ("couldn't load device tree" );exit (1 ); } }
hw/ppc/ppc4xx_pci.c +2 -1
@@ -20,6 +20,7 @@* 4xx SoCs, such as the 440EP. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/ppc/ppc.h" #include "hw/ppc/ppc4xx.h"
@@ -254,7 +255,7 @@ static void ppc4xx_pci_set_irq(void *opaque, int irq_num, int level)trace_ppc4xx_pci_set_irq (irq_num);if (irq_num <0 ) { -fprintf (stderr,"%s: PCI irq %d\n" , __func__, irq_num); +error_report ("%s: PCI irq %d" , __func__, irq_num);return ; }qemu_set_irq (pci_irqs[irq_num], level);
hw/ppc/prep.c +2 -2
@@ -576,7 +576,7 @@ static void ppc_prep_init(MachineState *machine) } }if (ppc_boot_device =='\0' ) { -fprintf (stderr,"No valid boot device for Mac99 machine\n" ); +error_report ("No valid boot device for Mac99 machine" );exit (1 ); } }
@@ -597,7 +597,7 @@ static void ppc_prep_init(MachineState *machine)qdev_init_nofail (dev); pci_bus = (PCIBus *)qdev_get_child_bus (dev,"pci.0" );if (pci_bus ==NULL ) { -fprintf (stderr,"Couldn't create PCI host controller.\n" ); +error_report ("Couldn't create PCI host controller." );exit (1 ); } sysctrl->contiguous_map_irq =qdev_get_gpio_in (dev,0 );
hw/ppc/virtex_ml507.c +2 -2
@@ -187,7 +187,7 @@ static int xilinx_load_device_tree(hwaddr addr, r =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , kernel_cmdline);if (r <0 ) -fprintf (stderr,"couldn't set /chosen/bootargs\n" ); +error_report ("couldn't set /chosen/bootargs" );cpu_physical_memory_write (addr, fdt, fdt_size);return fdt_size; }
@@ -219,7 +219,7 @@ static void virtex_init(MachineState *machine) env = &cpu->env;if (env->mmu_model !=POWERPC_MMU_BOOKE ) { -fprintf (stderr,"MMU model %i not supported by this machine.\n" , +error_report ("MMU model %i not supported by this machine." , env->mmu_model);exit (1 ); }
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH v2 32/47] hw/ppc: Replace fprintf(stderr, "*\n" with error_report()
Quoted 38 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +
Quoted 3 lines
Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>
Quoted 339 lines
---
V2:
- Split hw patch into individual directorieshw/ppc/e500.c | 20 ++++++++++---------- hw/ppc/mac_newworld.c | 2 +- hw/ppc/mac_oldworld.c | 2 +- hw/ppc/mpc8544_guts.c | 5 +++-- hw/ppc/ppc405_boards.c | 8 ++++---- hw/ppc/ppc440_bamboo.c | 19 ++++++++++--------- hw/ppc/ppc4xx_pci.c | 3 ++- hw/ppc/prep.c | 4 ++-- hw/ppc/virtex_ml507.c | 4 ++-- 9 files changed, 35 insertions(+), 32 deletions(-)hw/ppc/e500.c +10
-10@@ -333,13 +333,13 @@ static int ppce500_load_device_tree(MachineState *machine, ret =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-start" , initrd_base);if (ret <0 ) { -fprintf (stderr,"couldn't set /chosen/linux,initrd-start\n" ); +error_report ("couldn't set /chosen/linux,initrd-start" ); } ret =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-end" , (initrd_base + initrd_size));if (ret <0 ) { -fprintf (stderr,"couldn't set /chosen/linux,initrd-end\n" ); +error_report ("couldn't set /chosen/linux,initrd-end" ); } }@@ -353,7 +353,7 @@ static int ppce500_load_device_tree(MachineState *machine, ret =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , machine->kernel_cmdline);if (ret <0 ) -fprintf (stderr,"couldn't set /chosen/bootargs\n" ); +error_report ("couldn't set /chosen/bootargs" );if (kvm_enabled ()) {/* Read out host's frequencies */ @@ -720,7 +720,7 @@ static DeviceState *ppce500_init_mpic_kvm(PPCE500Params *params,CPU_FOREACH (cs) {if (kvm_openpic_connect_vcpu (dev, cs)) { -fprintf (stderr,"%s: failed to connect vcpu to irqchip\n" , +error_report ("%s: failed to connect vcpu to irqchip" , __func__);abort (); }@@ -821,7 +821,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) cs =CPU (cpu);if (env->mmu_model !=POWERPC_MMU_BOOKE206 ) { -fprintf (stderr,"MMU model %i not supported by this machine.\n" , +error_report ("MMU model %i not supported by this machine." , env->mmu_model);exit (1 ); }@@ -967,7 +967,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) cur_base, ram_size - cur_base);if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , machine->kernel_filename);exit (1 ); }@@ -982,8 +982,8 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) ram_size - initrd_base);if (initrd_size <0 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - machine->initrd_filename); +error_report ("qemu: could not load initial ram disk '%s'" , + machine->initrd_filename);exit (1 ); }@@ -1024,7 +1024,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) kernel_size =load_uimage (filename, &bios_entry, &loadaddr,NULL ,NULL ,NULL );if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load firmware '%s'\n" , filename); +error_report ("qemu: could not load firmware '%s'" , filename);exit (1 ); } }@@ -1037,7 +1037,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) initrd_base, initrd_size, kernel_base, kernel_size);if (dt_size <0 ) { -fprintf (stderr,"couldn't load device tree\n" ); +error_report ("couldn't load device tree" );exit (1 ); }assert (dt_size <DTB_MAX_SIZE );hw/ppc/mac_newworld.c +1
-1@@ -278,7 +278,7 @@ static void ppc_core99_init(MachineState *machine) } }if (ppc_boot_device =='\0' ) { -fprintf (stderr,"No valid boot device for Mac99 machine\n" ); +error_report ("No valid boot device for Mac99 machine" );exit (1 ); } }hw/ppc/mac_oldworld.c +1
-1@@ -221,7 +221,7 @@ static void ppc_heathrow_init(MachineState *machine)#endif }if (ppc_boot_device =='\0' ) { -fprintf (stderr,"No valid boot device for G3 Beige machine\n" ); +error_report ("No valid boot device for G3 Beige machine" );exit (1 ); } }hw/ppc/mpc8544_guts.c +3
-2@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "cpu.h" #include "hw/hw.h" @@ -83,7 +84,7 @@ static uint64_t mpc8544_guts_read(void *opaque, hwaddr addr, value = env->spr[SPR_E500_SVR ];break ;default : -fprintf (stderr,"guts: Unknown register read: %x\n" , (int )addr); +error_report ("guts: Unknown register read: %x" , (int )addr);break ; }@@ -102,7 +103,7 @@ static void mpc8544_guts_write(void *opaque, hwaddr addr, }break ;default : -fprintf (stderr,"guts: Unknown register write: %x = %x\n" , +error_report ("guts: Unknown register write: %x = %x" , (int )addr, (unsigned )value);break ; }hw/ppc/ppc405_boards.c +4
-4@@ -324,7 +324,7 @@ static void ref405ep_init(MachineState *machine) kernel_size =load_image_targphys (kernel_filename, kernel_base, ram_size - kernel_base);if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }@@ -336,8 +336,8 @@ static void ref405ep_init(MachineState *machine) initrd_size =load_image_targphys (initrd_filename, initrd_base, ram_size - initrd_base);if (initrd_size <0 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - initrd_filename); +error_report ("qemu: could not load initial ram disk '%s'" , + initrd_filename);exit (1 ); } }else {@@ -607,7 +607,7 @@ static void taihu_405ep_init(MachineState *machine) kernel_size =load_image_targphys (kernel_filename, kernel_base, ram_size - kernel_base);if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }hw/ppc/ppc440_bamboo.c +10
-9@@ -12,6 +12,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "net/net.h" #include "hw/hw.h" @@ -80,22 +81,22 @@ static int bamboo_load_device_tree(hwaddr addr, ret =qemu_fdt_setprop (fdt,"/memory" ,"reg" , mem_reg_property,sizeof (mem_reg_property));if (ret <0 ) -fprintf (stderr,"couldn't set /memory/reg\n" ); +error_report ("couldn't set /memory/reg" ); ret =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-start" , initrd_base);if (ret <0 ) -fprintf (stderr,"couldn't set /chosen/linux,initrd-start\n" ); +error_report ("couldn't set /chosen/linux,initrd-start" ); ret =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-end" , (initrd_base + initrd_size));if (ret <0 ) -fprintf (stderr,"couldn't set /chosen/linux,initrd-end\n" ); +error_report ("couldn't set /chosen/linux,initrd-end" ); ret =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , kernel_cmdline);if (ret <0 ) -fprintf (stderr,"couldn't set /chosen/bootargs\n" ); +error_report ("couldn't set /chosen/bootargs" );/* Copy data from the host device tree into the guest. Since the guest can * directly access the timebase without host involvement, we must expose @@ -190,7 +191,7 @@ static void bamboo_init(MachineState *machine) env = &cpu->env;if (env->mmu_model !=POWERPC_MMU_BOOKE ) { -fprintf (stderr,"MMU model %i not supported by this machine.\n" , +error_report ("MMU model %i not supported by this machine." , env->mmu_model);exit (1 ); }@@ -224,7 +225,7 @@ static void bamboo_init(MachineState *machine) NULL); pcibus = (PCIBus *)qdev_get_child_bus (dev,"pci.0" );if (!pcibus) { -fprintf (stderr,"couldn't create PCI controller!\n" ); +error_report ("couldn't create PCI controller!" );exit (1 ); }@@ -265,7 +266,7 @@ static void bamboo_init(MachineState *machine) }/* XXX try again as binary */ if (success <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }@@ -277,7 +278,7 @@ static void bamboo_init(MachineState *machine) ram_size - RAMDISK_ADDR);if (initrd_size <0 ) { -fprintf (stderr,"qemu: could not load ram disk '%s' at %x\n" , +error_report ("qemu: could not load ram disk '%s' at %x" , initrd_filename,RAMDISK_ADDR );exit (1 ); }@@ -287,7 +288,7 @@ static void bamboo_init(MachineState *machine)if (kernel_filename) {if (bamboo_load_device_tree (FDT_ADDR , ram_size,RAMDISK_ADDR , initrd_size, kernel_cmdline) <0 ) { -fprintf (stderr,"couldn't load device tree\n" ); +error_report ("couldn't load device tree" );exit (1 ); } }hw/ppc/ppc4xx_pci.c +2
-1@@ -20,6 +20,7 @@* 4xx SoCs, such as the 440EP. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/ppc/ppc.h" #include "hw/ppc/ppc4xx.h" @@ -254,7 +255,7 @@ static void ppc4xx_pci_set_irq(void *opaque, int irq_num, int level)trace_ppc4xx_pci_set_irq (irq_num);if (irq_num <0 ) { -fprintf (stderr,"%s: PCI irq %d\n" , __func__, irq_num); +error_report ("%s: PCI irq %d" , __func__, irq_num);return ; }qemu_set_irq (pci_irqs[irq_num], level);hw/ppc/prep.c +2
-2@@ -576,7 +576,7 @@ static void ppc_prep_init(MachineState *machine) } }if (ppc_boot_device =='\0' ) { -fprintf (stderr,"No valid boot device for Mac99 machine\n" ); +error_report ("No valid boot device for Mac99 machine" );exit (1 ); } }@@ -597,7 +597,7 @@ static void ppc_prep_init(MachineState *machine)qdev_init_nofail (dev); pci_bus = (PCIBus *)qdev_get_child_bus (dev,"pci.0" );if (pci_bus ==NULL ) { -fprintf (stderr,"Couldn't create PCI host controller.\n" ); +error_report ("Couldn't create PCI host controller." );exit (1 ); } sysctrl->contiguous_map_irq =qdev_get_gpio_in (dev,0 );hw/ppc/virtex_ml507.c +2
-2@@ -187,7 +187,7 @@ static int xilinx_load_device_tree(hwaddr addr, r =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , kernel_cmdline);if (r <0 ) -fprintf (stderr,"couldn't set /chosen/bootargs\n" ); +error_report ("couldn't set /chosen/bootargs" );cpu_physical_memory_write (addr, fdt, fdt_size);return fdt_size; }@@ -219,7 +219,7 @@ static void virtex_init(MachineState *machine) env = &cpu->env;if (env->mmu_model !=POWERPC_MMU_BOOKE ) { -fprintf (stderr,"MMU model %i not supported by this machine.\n" , +error_report ("MMU model %i not supported by this machine." , env->mmu_model);exit (1 ); }
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH v2 32/47] hw/ppc: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 3 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
[...]
Quoted 4 lines
hw/ppc/e500.c +0
-0
[...]
Quoted 21 lines
hw/ppc/e500.c +3
-3@@ -967,7 +967,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) cur_base, ram_size - cur_base);if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , machine->kernel_filename);exit (1 ); }@@ -982,8 +982,8 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) ram_size - initrd_base);if (initrd_size <0 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - machine->initrd_filename); +error_report ("qemu: could not load initial ram disk '%s'" , + machine->initrd_filename);exit (1 ); }
hw/ppc/e500.c void ppce500_init(MachineState *machine, PPCE500Params *params) · line 1030
Quoted 8 lines
hw/ppc/e500.c +1
-1@@ -1024,7 +1024,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) kernel_size =load_uimage (filename, &bios_entry, &loadaddr,NULL ,NULL ,NULL );if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load firmware '%s'\n" , filename); +error_report ("qemu: could not load firmware '%s'" , filename);exit (1 ); } }
Please remove the "qemu:" prefix from the strings here, too.
Thomas
PATCH v2 33/47 hw/s390x: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisReplace a large number of the fprintf(stderr, "*\n" calls with error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +Some lines where then manually tweaked to pass checkpatch.
---
V2:
- Split hw patch into individual directories
hw/s390x/virtio-ccw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/s390x/virtio-ccw.c +1 -1
@@ -468,7 +468,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)* passes us zeroes for those we don't support. */ if (features.features) { -fprintf (stderr,"Guest bug: features[%i]=%x (expected 0)\n" , +error_report ("Guest bug: features[%i]=%x (expected 0)" , features.index, features.features);/* XXX: do a unit check here? */ }
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH v2 33/47] hw/s390x: Replace fprintf(stderr, "*\n" with error_report()
Quoted 53 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>---
V2:
- Split hw patch into individual directorieshw/s390x/virtio-ccw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/s390x/virtio-ccw.c +0
-0
hw/s390x/virtio-ccw.c static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) · line 474
Quoted 8 lines
hw/s390x/virtio-ccw.c +1
-1@@ -468,7 +468,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)* passes us zeroes for those we don't support. */ if (features.features) { -fprintf (stderr,"Guest bug: features[%i]=%x (expected 0)\n" , +error_report ("Guest bug: features[%i]=%x (expected 0)" , features.index, features.features);/* XXX: do a unit check here? */ }
Sounds like this should rather be a qemu_log_mask(LOG_GUEST_ERROR, ...) instead?
Thomas
PATCH v2 34/47 hw/scsi: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisReplace a large number of the fprintf(stderr, "*\n" calls with error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +Some lines where then manually tweaked to pass checkpatch.
---
V2:
- Split hw patch into individual directories
hw/scsi/lsi53c895a.c | 4 ++-- hw/scsi/spapr_vscsi.c | 49 +++++++++++++++++++++-------------------- hw/scsi/virtio-scsi-dataplane.c | 6 ++--- 3 files changed, 30 insertions(+), 29 deletions(-)
hw/scsi/lsi53c895a.c +2 -2
@@ -14,7 +14,7 @@*/ #include "qemu/osdep.h" - +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/pci/pci.h" #include "hw/scsi/scsi.h"
@@ -1501,7 +1501,7 @@ again:This is apparently sufficient to beat the drivers into submission. */ if (!(s->sien0 &LSI_SIST0_UDC )) -fprintf (stderr,"inf. loop with UDC masked\n" ); +error_report ("inf. loop with UDC masked" );lsi_script_scsi_interrupt (s,LSI_SIST0_UDC ,0 );lsi_disconnect (s); }else if (s->istat1 &LSI_ISTAT1_SRUN && !s->waiting) {
hw/scsi/spapr_vscsi.c +25 -24
187 lines not on this page · raw message
hw/scsi/virtio-scsi-dataplane.c +3 -3
@@ -97,7 +97,7 @@ static int virtio_scsi_vring_init(VirtIOSCSI *s, VirtQueue *vq, int n,/* Set up virtqueue notify */ rc =virtio_bus_set_host_notifier (VIRTIO_BUS (qbus), n, true);if (rc !=0 ) { -fprintf (stderr,"virtio-scsi: Failed to set host notifier (%d)\n" , +error_report ("virtio-scsi: Failed to set host notifier (%d)" , rc); s->dataplane_fenced = true;return rc;
@@ -141,8 +141,8 @@ int virtio_scsi_dataplane_start(VirtIODevice *vdev)/* Set up guest notifier (irq) */ rc = k->set_guest_notifiers (qbus->parent, vs->conf.num_queues +2 , true);if (rc !=0 ) { -fprintf (stderr,"virtio-scsi: Failed to set guest notifiers (%d), " -"ensure -enable-kvm is set\n" , rc); +error_report ("virtio-scsi: Failed to set guest notifiers (%d), " +"ensure -enable-kvm is set" , rc); goto fail_guest_notifiers; }
Signature · 1 line
2.11.0
PATCH v2 35/47 hw/sd: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisReplace a large number of the fprintf(stderr, "*\n" calls with error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +Some lines where then manually tweaked to pass checkpatch.
---
V2:
- Split hw patch into individual directories
hw/sd/pl181.c | 5 +++-- hw/sd/sd.c | 14 +++++++------- 2 files changed, 10 insertions(+), 9 deletions(-)
hw/sd/pl181.c +3 -2
@@ -8,6 +8,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "hw/sysbus.h"
@@ -146,7 +147,7 @@ static void pl181_fifo_push(PL181State *s, uint32_t value)int n;if (s->fifo_len ==PL181_FIFO_LEN ) { -fprintf (stderr,"pl181: FIFO overflow\n" ); +error_report ("pl181: FIFO overflow" );return ; } n = (s->fifo_pos + s->fifo_len) & (PL181_FIFO_LEN -1 );
@@ -160,7 +161,7 @@ static uint32_t pl181_fifo_pop(PL181State *s)uint32_t value;if (s->fifo_len ==0 ) { -fprintf (stderr,"pl181: FIFO underflow\n" ); +error_report ("pl181: FIFO underflow" );return 0 ; } value = s->fifo[s->fifo_pos];
hw/sd/sd.c +7 -7
@@ -700,7 +700,7 @@ static void sd_lock_command(SDState *sd) sd->card_status &= ~CARD_IS_LOCKED ; sd->pwd_len =0 ;/* Erasing the entire card here! */ -fprintf (stderr,"SD: Card force-erased by CMD42\n" ); +error_report ("SD: Card force-erased by CMD42" );return ; }
@@ -1282,7 +1282,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,return sd_r1;case 56 :/* CMD56: GEN_CMD */ -fprintf (stderr,"SD: GEN_CMD 0x%08x\n" , req.arg); +error_report ("SD: GEN_CMD 0x%08x" , req.arg);switch (sd->state) {case sd_transfer_state:
@@ -1565,10 +1565,10 @@ send_response:int i;DPRINTF ("Response:" );for (i =0 ; i < rsplen; i++) -fprintf (stderr," %02x" , response[i]); - fprintf(stderr, " state %d\n", sd->state); +error_report (" %02x" , response[i]); + error_report(" state %d", sd->state); }else { -DPRINTF ("No response %d\n" , sd->state); +DPRINTF ("No response %d" , sd->state); }#endif
@@ -1580,14 +1580,14 @@ static void sd_blk_read(SDState *sd, uint64_t addr, uint32_t len)DPRINTF ("sd_blk_read: addr = 0x%08llx, len = %d\n" , (unsigned long long ) addr, len);if (!sd->blk ||blk_pread (sd->blk, addr, sd->data, len) <0 ) { -fprintf (stderr,"sd_blk_read: read error on host side\n" ); +error_report ("sd_blk_read: read error on host side" ); } }static void sd_blk_write (SDState *sd,uint64_t addr,uint32_t len) {if (!sd->blk ||blk_pwrite (sd->blk, addr, sd->data, len,0 ) <0 ) { -fprintf (stderr,"sd_blk_write: write error on host side\n" ); +error_report ("sd_blk_write: write error on host side" ); } }
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH v2 35/47] hw/sd: Replace fprintf(stderr, "*\n" with error_report()
Quoted 102 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>---
V2:
- Split hw patch into individual directorieshw/sd/pl181.c | 5 +++-- hw/sd/sd.c | 14 +++++++------- 2 files changed, 10 insertions(+), 9 deletions(-)hw/sd/pl181.c +3
-2@@ -8,6 +8,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "hw/sysbus.h" @@ -146,7 +147,7 @@ static void pl181_fifo_push(PL181State *s, uint32_t value)int n;if (s->fifo_len ==PL181_FIFO_LEN ) { -fprintf (stderr,"pl181: FIFO overflow\n" ); +error_report ("pl181: FIFO overflow" );return ; } n = (s->fifo_pos + s->fifo_len) & (PL181_FIFO_LEN -1 );@@ -160,7 +161,7 @@ static uint32_t pl181_fifo_pop(PL181State *s)uint32_t value;if (s->fifo_len ==0 ) { -fprintf (stderr,"pl181: FIFO underflow\n" ); +error_report ("pl181: FIFO underflow" );return 0 ; } value = s->fifo[s->fifo_pos];hw/sd/sd.c +2
-2@@ -700,7 +700,7 @@ static void sd_lock_command(SDState *sd) sd->card_status &= ~CARD_IS_LOCKED ; sd->pwd_len =0 ;/* Erasing the entire card here! */ -fprintf (stderr,"SD: Card force-erased by CMD42\n" ); +error_report ("SD: Card force-erased by CMD42" );return ; }@@ -1282,7 +1282,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,return sd_r1;case 56 :/* CMD56: GEN_CMD */ -fprintf (stderr,"SD: GEN_CMD 0x%08x\n" , req.arg); +error_report ("SD: GEN_CMD 0x%08x" , req.arg);switch (sd->state) {case sd_transfer_state:
hw/sd/sd.c send_response: · line 1567
Quoted 3 lines
hw/sd/sd.c +0
-0@@ -1565,10 +1565,10 @@ send_response:int i;DPRINTF ("Response:" );for (i =0 ; i < rsplen; i++)
please while here:
{hw/sd/sd.c send_response: · line 1568
Quoted 2 lines
hw/sd/sd.c +1
-1-fprintf (stderr," %02x" , response[i]); +error_report (" %02x" , response[i]);
}
hw/sd/sd.c send_response: · line 1571
Quoted 5 lines
hw/sd/sd.c +2
-2-fprintf (stderr," state %d\n" , sd->state); +error_report (" state %d" , sd->state); }else { -DPRINTF ("No response %d\n" , sd->state); +DPRINTF ("No response %d" , sd->state);
hmm?
Quoted 21 lines
hw/sd/sd.c +2
-2}#endif @@ -1580,14 +1580,14 @@ static void sd_blk_read(SDState *sd, uint64_t addr, uint32_t len)DPRINTF ("sd_blk_read: addr = 0x%08llx, len = %d\n" , (unsigned long long ) addr, len);if (!sd->blk ||blk_pread (sd->blk, addr, sd->data, len) <0 ) { -fprintf (stderr,"sd_blk_read: read error on host side\n" ); +error_report ("sd_blk_read: read error on host side" ); } }static void sd_blk_write (SDState *sd,uint64_t addr,uint32_t len) {if (!sd->blk ||blk_pwrite (sd->blk, addr, sd->data, len,0 ) <0 ) { -fprintf (stderr,"sd_blk_write: write error on host side\n" ); +error_report ("sd_blk_write: write error on host side" ); } }
PATCH v2 36/47 hw/sh4: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisReplace a large number of the fprintf(stderr, "*\n" calls with error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +Some lines where then manually tweaked to pass checkpatch.
---
V2:
- Split hw patch into individual directories
hw/sh4/r2d.c | 9 ++++---- hw/sh4/sh7750.c | 64 +++++++++++++++++++++++++++++---------------------------- 2 files changed, 38 insertions(+), 35 deletions(-)
hw/sh4/r2d.c +5 -4
@@ -24,6 +24,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h"
@@ -319,8 +320,8 @@ static void r2d_init(MachineState *machine)SDRAM_BASE +LINUX_LOAD_OFFSET , INITRD_LOAD_OFFSET - LINUX_LOAD_OFFSET);if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); -exit (1 ); +error_report ("qemu: could not load kernel '%s'" , kernel_filename); +exit (1 ); }/* initialization which should be done by firmware */
@@ -339,8 +340,8 @@ static void r2d_init(MachineState *machine) SDRAM_SIZE - INITRD_LOAD_OFFSET);if (initrd_size <0 ) { -fprintf (stderr,"qemu: could not load initrd '%s'\n" , initrd_filename); -exit (1 ); +error_report ("qemu: could not load initrd '%s'" , initrd_filename); +exit (1 ); }/* initialization which should be done by firmware */
hw/sh4/sh7750.c +33 -31
108 lines not on this page · raw message
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH v2 36/47] hw/sh4: Replace fprintf(stderr, "*\n" with error_report()
Quoted 75 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>Cc Magnus Damm <[email protected]>Cc Aurelien Jarno <[email protected]>---
V2:
- Split hw patch into individual directorieshw/sh4/r2d.c | 9 ++++---- hw/sh4/sh7750.c | 64 +++++++++++++++++++++++++++++---------------------------- 2 files changed, 38 insertions(+), 35 deletions(-)hw/sh4/r2d.c +3
-2@@ -24,6 +24,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" @@ -319,8 +320,8 @@ static void r2d_init(MachineState *machine)SDRAM_BASE +LINUX_LOAD_OFFSET , INITRD_LOAD_OFFSET - LINUX_LOAD_OFFSET);if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); -exit (1 ); +error_report ("qemu: could not load kernel '%s'" , kernel_filename); +exit (1 ); }/* initialization which should be done by firmware */
hw/sh4/r2d.c static void r2d_init(MachineState *machine) · line 345
Quoted 8 lines
hw/sh4/r2d.c +2
-2@@ -339,8 +340,8 @@ static void r2d_init(MachineState *machine) SDRAM_SIZE - INITRD_LOAD_OFFSET);if (initrd_size <0 ) { -fprintf (stderr,"qemu: could not load initrd '%s'\n" , initrd_filename); -exit (1 ); +error_report ("qemu: could not load initrd '%s'" , initrd_filename); +exit (1 ); }
Please remove the "qemu:" prefix here as well.
Thomas
PATCH v2 37/47 hw/sparc*: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisReplace a large number of the fprintf(stderr, "*\n" calls with error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +Some lines where then manually tweaked to pass checkpatch.
---
V2:
- Split hw patch into individual directories
hw/sparc/leon3.c | 9 +++++---- hw/sparc/sun4m.c | 8 ++++---- hw/sparc64/niagara.c | 2 +- hw/sparc64/sun4u.c | 9 +++++---- 4 files changed, 15 insertions(+), 13 deletions(-)
hw/sparc/leon3.c +5 -4
@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h"
@@ -172,7 +173,7 @@ static void leon3_generic_hw_init(MachineState *machine) }if (bios_size > prom_size) { -fprintf (stderr,"qemu: could not load prom '%s': file too big\n" , +error_report ("qemu: could not load prom '%s': file too big" , filename);exit (1 ); }
@@ -180,11 +181,11 @@ static void leon3_generic_hw_init(MachineState *machine)if (bios_size >0 ) { ret =load_image_targphys (filename,0x00000000 , bios_size);if (ret <0 || ret > prom_size) { -fprintf (stderr,"qemu: could not load prom '%s'\n" , filename); +error_report ("qemu: could not load prom '%s'" , filename);exit (1 ); } }else if (kernel_filename ==NULL && !qtest_enabled ()) { -fprintf (stderr,"Can't read bios image %s\n" , filename); +error_report ("Can't read bios image %s" , filename);exit (1 ); }g_free (filename);
@@ -197,7 +198,7 @@ static void leon3_generic_hw_init(MachineState *machine) kernel_size =load_elf (kernel_filename,NULL ,NULL , &entry,NULL ,NULL ,1 /* big endian */ ,EM_SPARC ,0 ,0 );if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }
hw/sparc/sun4m.c +4 -4
@@ -261,7 +261,7 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,KERNEL_LOAD_ADDR , RAM_size - KERNEL_LOAD_ADDR);if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }
@@ -273,8 +273,8 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,INITRD_LOAD_ADDR , RAM_size - INITRD_LOAD_ADDR);if (initrd_size <0 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - initrd_filename); +error_report ("qemu: could not load initial ram disk '%s'" , + initrd_filename);exit (1 ); } }
@@ -688,7 +688,7 @@ static void prom_init(hwaddr addr, const char *bios_name) ret =-1 ; }if (ret <0 || ret >PROM_SIZE_MAX ) { -fprintf (stderr,"qemu: could not load prom '%s'\n" , bios_name); +error_report ("qemu: could not load prom '%s'" , bios_name);exit (1 ); } }
hw/sparc64/niagara.c +1 -1
@@ -153,7 +153,7 @@ static void niagara_init(MachineState *machine) dinfo->is_default =1 ;rom_add_file_fixed (blk_bs (blk)->filename,NIAGARA_VDISK_BASE ,-1 ); }else { -fprintf (stderr,"qemu: could not load ram disk '%s'\n" , +error_report ("qemu: could not load ram disk '%s'" ,blk_bs (blk)->filename);exit (1 ); }
hw/sparc64/sun4u.c +5 -4
@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h"
@@ -165,7 +166,7 @@ static uint64_t sun4u_load_kernel(const char *kernel_filename, RAM_size - KERNEL_LOAD_ADDR); }if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }
@@ -178,8 +179,8 @@ static uint64_t sun4u_load_kernel(const char *kernel_filename, *initrd_addr, RAM_size - *initrd_addr);if ((int )*initrd_size <0 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - initrd_filename); +error_report ("qemu: could not load initial ram disk '%s'" , + initrd_filename);exit (1 ); } }
@@ -322,7 +323,7 @@ static void prom_init(hwaddr addr, const char *bios_name) ret =-1 ; }if (ret <0 || ret >PROM_SIZE_MAX ) { -fprintf (stderr,"qemu: could not load prom '%s'\n" , bios_name); +error_report ("qemu: could not load prom '%s'" , bios_name);exit (1 ); } }
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH v2 37/47] hw/sparc*: Replace fprintf(stderr, "*\n" with error_report()
Quoted 38 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +
Quoted 3 lines
Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>
Quoted 145 lines
Cc Fabien Chouteau <[email protected]>Cc Mark Cave-Ayland <[email protected]>Cc Artyom Tarasenko <[email protected]>---
V2:
- Split hw patch into individual directorieshw/sparc/leon3.c | 9 +++++---- hw/sparc/sun4m.c | 8 ++++---- hw/sparc64/niagara.c | 2 +- hw/sparc64/sun4u.c | 9 +++++---- 4 files changed, 15 insertions(+), 13 deletions(-)hw/sparc/leon3.c +5
-4@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" @@ -172,7 +173,7 @@ static void leon3_generic_hw_init(MachineState *machine) }if (bios_size > prom_size) { -fprintf (stderr,"qemu: could not load prom '%s': file too big\n" , +error_report ("qemu: could not load prom '%s': file too big" , filename);exit (1 ); }@@ -180,11 +181,11 @@ static void leon3_generic_hw_init(MachineState *machine)if (bios_size >0 ) { ret =load_image_targphys (filename,0x00000000 , bios_size);if (ret <0 || ret > prom_size) { -fprintf (stderr,"qemu: could not load prom '%s'\n" , filename); +error_report ("qemu: could not load prom '%s'" , filename);exit (1 ); } }else if (kernel_filename ==NULL && !qtest_enabled ()) { -fprintf (stderr,"Can't read bios image %s\n" , filename); +error_report ("Can't read bios image %s" , filename);exit (1 ); }g_free (filename);@@ -197,7 +198,7 @@ static void leon3_generic_hw_init(MachineState *machine) kernel_size =load_elf (kernel_filename,NULL ,NULL , &entry,NULL ,NULL ,1 /* big endian */ ,EM_SPARC ,0 ,0 );if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }hw/sparc/sun4m.c +4
-4@@ -261,7 +261,7 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,KERNEL_LOAD_ADDR , RAM_size - KERNEL_LOAD_ADDR);if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }@@ -273,8 +273,8 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,INITRD_LOAD_ADDR , RAM_size - INITRD_LOAD_ADDR);if (initrd_size <0 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - initrd_filename); +error_report ("qemu: could not load initial ram disk '%s'" , + initrd_filename);exit (1 ); } }@@ -688,7 +688,7 @@ static void prom_init(hwaddr addr, const char *bios_name) ret =-1 ; }if (ret <0 || ret >PROM_SIZE_MAX ) { -fprintf (stderr,"qemu: could not load prom '%s'\n" , bios_name); +error_report ("qemu: could not load prom '%s'" , bios_name);exit (1 ); } }hw/sparc64/niagara.c +1
-1@@ -153,7 +153,7 @@ static void niagara_init(MachineState *machine) dinfo->is_default =1 ;rom_add_file_fixed (blk_bs (blk)->filename,NIAGARA_VDISK_BASE ,-1 ); }else { -fprintf (stderr,"qemu: could not load ram disk '%s'\n" , +error_report ("qemu: could not load ram disk '%s'" ,blk_bs (blk)->filename);exit (1 ); }hw/sparc64/sun4u.c +5
-4@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" @@ -165,7 +166,7 @@ static uint64_t sun4u_load_kernel(const char *kernel_filename, RAM_size - KERNEL_LOAD_ADDR); }if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }@@ -178,8 +179,8 @@ static uint64_t sun4u_load_kernel(const char *kernel_filename, *initrd_addr, RAM_size - *initrd_addr);if ((int )*initrd_size <0 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - initrd_filename); +error_report ("qemu: could not load initial ram disk '%s'" , + initrd_filename);exit (1 ); } }@@ -322,7 +323,7 @@ static void prom_init(hwaddr addr, const char *bios_name) ret =-1 ; }if (ret <0 || ret >PROM_SIZE_MAX ) { -fprintf (stderr,"qemu: could not load prom '%s'\n" , bios_name); +error_report ("qemu: could not load prom '%s'" , bios_name);exit (1 ); } }
PATCH v2 38/47 hw/ssi: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisReplace a large number of the fprintf(stderr, "*\n" calls with error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +Some lines where then manually tweaked to pass checkpatch.
---
V2:
- Split hw patch into individual directories
hw/ssi/omap_spi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
hw/ssi/omap_spi.c +3 -2
@@ -20,6 +20,7 @@* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/arm/omap.h"
@@ -295,9 +296,9 @@ static void omap_mcspi_write(void *opaque, hwaddr addr,if ((value ^ s->ch[ch].config) & (3 <<14 ))/* DMAR | DMAW */ omap_mcspi_dmarequest_update (s->ch + ch);if (((value >>12 ) &3 ) ==3 )/* TRM */ -fprintf (stderr,"%s: invalid TRM value (3)\n" , __func__); +error_report ("%s: invalid TRM value (3)" , __func__);if (((value >>7 ) &0x1f ) <3 )/* WL */ -fprintf (stderr,"%s: invalid WL value (%" PRIx64")\n" , +error_report ("%s: invalid WL value (%" PRIx64")" , __func__, (value >>7 ) &0x1f ); s->ch[ch].config = value &0x7fffff ;break ;
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH v2 38/47] hw/ssi: Replace fprintf(stderr, "*\n" with error_report()
Quoted 38 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +
Quoted 3 lines
Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>
Quoted 32 lines
---
V2:
- Split hw patch into individual directorieshw/ssi/omap_spi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)hw/ssi/omap_spi.c +3
-2@@ -20,6 +20,7 @@* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/arm/omap.h" @@ -295,9 +296,9 @@ static void omap_mcspi_write(void *opaque, hwaddr addr,if ((value ^ s->ch[ch].config) & (3 <<14 ))/* DMAR | DMAW */ omap_mcspi_dmarequest_update (s->ch + ch);if (((value >>12 ) &3 ) ==3 )/* TRM */ -fprintf (stderr,"%s: invalid TRM value (3)\n" , __func__); +error_report ("%s: invalid TRM value (3)" , __func__);if (((value >>7 ) &0x1f ) <3 )/* WL */ -fprintf (stderr,"%s: invalid WL value (%" PRIx64")\n" , +error_report ("%s: invalid WL value (%" PRIx64")" , __func__, (value >>7 ) &0x1f ); s->ch[ch].config = value &0x7fffff ;break ;
PATCH v2 39/47 hw/timer: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisReplace a large number of the fprintf(stderr, "*\n" calls with error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +Some lines where then manually tweaked to pass checkpatch.
---
V2:
- Split hw patch into individual directories
hw/timer/omap_gptimer.c | 11 ++++++----- hw/timer/twl92230.c | 2 +- hw/timer/xilinx_timer.c | 8 ++++---- 3 files changed, 11 insertions(+), 10 deletions(-)
hw/timer/omap_gptimer.c +6 -5
@@ -18,6 +18,7 @@* with this program; if not, see <http://www.gnu.org/licenses/>. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "qemu/timer.h" #include "hw/arm/omap.h"
@@ -356,7 +357,7 @@ static void omap_gp_timer_write(void *opaque, hwaddr addr,case 0x10 :/* TIOCP_CFG */ s->config = value &0x33d ;if (((value >>3 ) &3 ) ==3 )/* IDLEMODE */ -fprintf (stderr,"%s: illegal IDLEMODE value in TIOCP_CFG\n" , +error_report ("%s: illegal IDLEMODE value in TIOCP_CFG" , __func__);if (value &2 )/* SOFTRESET */ omap_gp_timer_reset (s);
@@ -394,11 +395,11 @@ static void omap_gp_timer_write(void *opaque, hwaddr addr, s->ar = (value >>1 ) &1 ; s->st = (value >>0 ) &1 ;if (s->inout && s->trigger != gpt_trigger_none) -fprintf (stderr,"%s: GP timer pin must be an output " -"for this trigger mode\n" , __func__); +error_report ("%s: GP timer pin must be an output " +"for this trigger mode" , __func__);if (!s->inout && s->capture != gpt_capture_none) -fprintf (stderr,"%s: GP timer pin must be an input " -"for this capture mode\n" , __func__); +error_report ("%s: GP timer pin must be an input " +"for this capture mode" , __func__);if (s->trigger == gpt_trigger_none)omap_gp_timer_out (s, s->scpwm);/* TODO: make sure this doesn't overflow 32-bits */
hw/timer/twl92230.c +1 -1
@@ -614,7 +614,7 @@ static void menelaus_write(void *opaque, uint8_t addr, uint8_t value)break ; rtc_badness:default : -fprintf (stderr,"%s: bad RTC_UPDATE value %02x\n" , +error_report ("%s: bad RTC_UPDATE value %02x" , __func__, value); s->status |=1 <<10 ;/* RTCERR */ menelaus_update (s);
hw/timer/xilinx_timer.c +4 -4
@@ -127,7 +127,7 @@ timer_read(void *opaque, hwaddr addr, unsigned int size)break ; } -D (fprintf (stderr,"%s timer=%d %x=%x\n" , __func__, timer, addr *4 , r)); +D (error_report ("%s timer=%d %x=%x" , __func__, timer, addr *4 , r));return r; }
@@ -135,7 +135,7 @@ static void timer_enable(struct xlx_timer *xt) {uint64_t count; -D (fprintf (stderr,"%s timer=%d down=%d\n" , __func__, +D (error_report ("%s timer=%d down=%d" , __func__, xt->nr, xt->regs[R_TCSR ] &TCSR_UDT ));ptimer_stop (xt->ptimer);
@@ -160,7 +160,7 @@ timer_write(void *opaque, hwaddr addr, addr >>=2 ; timer =timer_from_addr (addr); xt = &t->timers[timer]; -D (fprintf (stderr,"%s addr=%x val=%x (timer=%d off=%d)\n" , +D (error_report ("%s addr=%x val=%x (timer=%d off=%d)" , __func__, addr *4 , value, timer, addr &3 ));/* Further decoding to address a specific timers reg. */ addr &=3 ;
@@ -197,7 +197,7 @@ static void timer_hit(void *opaque) {struct xlx_timer *xt = opaque;struct timerblock *t = xt->parent; -D (fprintf (stderr,"%s %d\n" , __func__, xt->nr)); +D (error_report ("%s %d" , __func__, xt->nr)); xt->regs[R_TCSR ] |=TCSR_TINT ;if (xt->regs[R_TCSR ] &TCSR_ARHT )
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH v2 39/47] hw/timer: Replace fprintf(stderr, "*\n" with error_report()
Quoted 38 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +
Quoted 3 lines
Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>
Quoted 100 lines
---
V2:
- Split hw patch into individual directorieshw/timer/omap_gptimer.c | 11 ++++++----- hw/timer/twl92230.c | 2 +- hw/timer/xilinx_timer.c | 8 ++++---- 3 files changed, 11 insertions(+), 10 deletions(-)hw/timer/omap_gptimer.c +6
-5@@ -18,6 +18,7 @@* with this program; if not, see <http://www.gnu.org/licenses/>. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "qemu/timer.h" #include "hw/arm/omap.h" @@ -356,7 +357,7 @@ static void omap_gp_timer_write(void *opaque, hwaddr addr,case 0x10 :/* TIOCP_CFG */ s->config = value &0x33d ;if (((value >>3 ) &3 ) ==3 )/* IDLEMODE */ -fprintf (stderr,"%s: illegal IDLEMODE value in TIOCP_CFG\n" , +error_report ("%s: illegal IDLEMODE value in TIOCP_CFG" , __func__);if (value &2 )/* SOFTRESET */ omap_gp_timer_reset (s);@@ -394,11 +395,11 @@ static void omap_gp_timer_write(void *opaque, hwaddr addr, s->ar = (value >>1 ) &1 ; s->st = (value >>0 ) &1 ;if (s->inout && s->trigger != gpt_trigger_none) -fprintf (stderr,"%s: GP timer pin must be an output " -"for this trigger mode\n" , __func__); +error_report ("%s: GP timer pin must be an output " +"for this trigger mode" , __func__);if (!s->inout && s->capture != gpt_capture_none) -fprintf (stderr,"%s: GP timer pin must be an input " -"for this capture mode\n" , __func__); +error_report ("%s: GP timer pin must be an input " +"for this capture mode" , __func__);if (s->trigger == gpt_trigger_none)omap_gp_timer_out (s, s->scpwm);/* TODO: make sure this doesn't overflow 32-bits */ hw/timer/twl92230.c +1
-1@@ -614,7 +614,7 @@ static void menelaus_write(void *opaque, uint8_t addr, uint8_t value)break ; rtc_badness:default : -fprintf (stderr,"%s: bad RTC_UPDATE value %02x\n" , +error_report ("%s: bad RTC_UPDATE value %02x" , __func__, value); s->status |=1 <<10 ;/* RTCERR */ menelaus_update (s);hw/timer/xilinx_timer.c +4
-4@@ -127,7 +127,7 @@ timer_read(void *opaque, hwaddr addr, unsigned int size)break ; } -D (fprintf (stderr,"%s timer=%d %x=%x\n" , __func__, timer, addr *4 , r)); +D (error_report ("%s timer=%d %x=%x" , __func__, timer, addr *4 , r));return r; }@@ -135,7 +135,7 @@ static void timer_enable(struct xlx_timer *xt) {uint64_t count; -D (fprintf (stderr,"%s timer=%d down=%d\n" , __func__, +D (error_report ("%s timer=%d down=%d" , __func__, xt->nr, xt->regs[R_TCSR ] &TCSR_UDT ));ptimer_stop (xt->ptimer);@@ -160,7 +160,7 @@ timer_write(void *opaque, hwaddr addr, addr >>=2 ; timer =timer_from_addr (addr); xt = &t->timers[timer]; -D (fprintf (stderr,"%s addr=%x val=%x (timer=%d off=%d)\n" , +D (error_report ("%s addr=%x val=%x (timer=%d off=%d)" , __func__, addr *4 , value, timer, addr &3 ));/* Further decoding to address a specific timers reg. */ addr &=3 ;@@ -197,7 +197,7 @@ static void timer_hit(void *opaque) {struct xlx_timer *xt = opaque;struct timerblock *t = xt->parent; -D (fprintf (stderr,"%s %d\n" , __func__, xt->nr)); +D (error_report ("%s %d" , __func__, xt->nr)); xt->regs[R_TCSR ] |=TCSR_TINT ;if (xt->regs[R_TCSR ] &TCSR_ARHT )
PATCH v2 40/47 hw/usb: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisReplace a large number of the fprintf(stderr, "*\n" calls with error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +Some lines where then manually tweaked to pass checkpatch.
---
V2:
- Split hw patch into individual directories
hw/usb/core.c | 15 ++++++++------- hw/usb/desc.c | 4 ++-- hw/usb/dev-audio.c | 29 +++++++++++++++-------------- hw/usb/dev-bluetooth.c | 4 ++-- hw/usb/dev-mtp.c | 9 +++++---- hw/usb/dev-network.c | 20 ++++++++++---------- hw/usb/hcd-ehci.c | 32 ++++++++++++++++---------------- hw/usb/hcd-musb.c | 4 ++-- hw/usb/hcd-xhci.c | 3 ++- hw/usb/host-legacy.c | 2 +- 10 files changed, 63 insertions(+), 59 deletions(-)
hw/usb/core.c +8 -7
@@ -24,6 +24,7 @@* THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "hw/usb.h" #include "qemu/iov.h"
@@ -599,7 +600,7 @@ void usb_packet_copy(USBPacket *p, void *ptr, size_t bytes)iov_from_buf (iov->iov, iov->niov, p->actual_length, ptr, bytes);break ;default : -fprintf (stderr,"%s: invalid pid: %x\n" , __func__, p->pid); +error_report ("%s: invalid pid: %x" , __func__, p->pid);abort (); } p->actual_length += bytes;
@@ -681,7 +682,7 @@ void usb_ep_dump(USBDevice *dev) };int ifnum, ep, first; -fprintf (stderr,"Device \"%s\", config %d\n" , +error_report ("Device \"%s\", config %d" , dev->product_desc, dev->configuration);for (ifnum =0 ; ifnum <16 ; ifnum++) { first =1 ;
@@ -690,10 +691,10 @@ void usb_ep_dump(USBDevice *dev) dev->ep_in[ep].ifnum == ifnum) {if (first) { first =0 ; -fprintf (stderr," Interface %d, alternative %d\n" , +error_report (" Interface %d, alternative %d" , ifnum, dev->altsetting[ifnum]); } -fprintf (stderr," Endpoint %d, IN, %s, %d max\n" , ep, +error_report (" Endpoint %d, IN, %s, %d max" , ep, tname[dev->ep_in[ep].type], dev->ep_in[ep].max_packet_size); }
@@ -701,16 +702,16 @@ void usb_ep_dump(USBDevice *dev) dev->ep_out[ep].ifnum == ifnum) {if (first) { first =0 ; -fprintf (stderr," Interface %d, alternative %d\n" , +error_report (" Interface %d, alternative %d" , ifnum, dev->altsetting[ifnum]); } -fprintf (stderr," Endpoint %d, OUT, %s, %d max\n" , ep, +error_report (" Endpoint %d, OUT, %s, %d max" , ep, tname[dev->ep_out[ep].type], dev->ep_out[ep].max_packet_size); } } } -fprintf (stderr,"--\n" ); +error_report ("--" ); }struct USBEndpoint *usb_ep_get (USBDevice *dev,int pid,int ep)
hw/usb/desc.c +2 -2
@@ -1,5 +1,5 @@#include "qemu/osdep.h" - +#include "qemu/error-report.h" #include "hw/usb.h" #include "hw/usb/desc.h" #include "trace.h"
@@ -688,7 +688,7 @@ int usb_desc_get_descriptor(USBDevice *dev, USBPacket *p,break ;default : -fprintf (stderr,"%s: %d unknown type %d (len %zd)\n" , __func__, +error_report ("%s: %d unknown type %d (len %zd)" , __func__, dev->addr, type, len);break ; }
hw/usb/dev-audio.c +15 -14
@@ -30,6 +30,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "hw/usb.h" #include "hw/usb/desc.h"
@@ -398,7 +399,7 @@ static int usb_audio_set_output_altset(USBAudioState *s, int altset) }if (s->debug) { -fprintf (stderr,"usb-audio: set interface %d\n" , altset); +error_report ("usb-audio: set interface %d" , altset); } s->out.altset = altset;return 0 ;
@@ -478,7 +479,7 @@ static int usb_audio_set_control(USBAudioState *s, uint8_t attrib,uint16_t vol = data[0 ] + (data[1 ] <<8 );if (s->debug) { -fprintf (stderr,"usb-audio: vol %04x\n" , (uint16_t )vol); +error_report ("usb-audio: vol %04x" , (uint16_t )vol); } vol -=0x8000 ;
@@ -496,7 +497,7 @@ static int usb_audio_set_control(USBAudioState *s, uint8_t attrib,if (set_vol) {if (s->debug) { -fprintf (stderr,"usb-audio: mute %d, lvol %3d, rvol %3d\n" , +error_report ("usb-audio: mute %d, lvol %3d, rvol %3d" , s->out.mute, s->out.vol[0 ], s->out.vol[1 ]); } AUD_set_volume_out(s->out.voice, s->out.mute,
@@ -514,8 +515,8 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p,int ret =0 ;if (s->debug) { -fprintf (stderr,"usb-audio: control transaction: " -"request 0x%04x value 0x%04x index 0x%04x length 0x%04x\n" , +error_report ("usb-audio: control transaction: " +"request 0x%04x value 0x%04x index 0x%04x length 0x%04x" , request, value, index, length); }
@@ -533,7 +534,7 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, length, data);if (ret <0 ) {if (s->debug) { -fprintf (stderr,"usb-audio: fail: get control\n" ); +error_report ("usb-audio: fail: get control" ); } goto fail; }
@@ -548,7 +549,7 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, length, data);if (ret <0 ) {if (s->debug) { -fprintf (stderr,"usb-audio: fail: set control\n" ); +error_report ("usb-audio: fail: set control" ); } goto fail; }
@@ -557,8 +558,8 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p,default : fail:if (s->debug) { -fprintf (stderr,"usb-audio: failed control transaction: " -"request 0x%04x value 0x%04x index 0x%04x length 0x%04x\n" , +error_report ("usb-audio: failed control transaction: " +"request 0x%04x value 0x%04x index 0x%04x length 0x%04x" , request, value, index, length); } p->status =USB_RET_STALL ;
@@ -581,7 +582,7 @@ static void usb_audio_handle_reset(USBDevice *dev)USBAudioState *s =USB_AUDIO (dev);if (s->debug) { -fprintf (stderr,"usb-audio: reset\n" ); +error_report ("usb-audio: reset" ); }usb_audio_set_output_altset (s,ALTSET_OFF ); }
@@ -595,7 +596,7 @@ static void usb_audio_handle_dataout(USBAudioState *s, USBPacket *p)streambuf_put (&s->out.buf, p);if (p->actual_length < p->iov.size && s->debug >1 ) { -fprintf (stderr,"usb-audio: output overrun (%zd bytes)\n" , +error_report ("usb-audio: output overrun (%zd bytes)" , p->iov.size - p->actual_length); } }
@@ -611,8 +612,8 @@ static void usb_audio_handle_data(USBDevice *dev, USBPacket *p) p->status =USB_RET_STALL ;if (s->debug) { -fprintf (stderr,"usb-audio: failed data transaction: " -"pid 0x%x ep 0x%x len 0x%zx\n" , +error_report ("usb-audio: failed data transaction: " +"pid 0x%x ep 0x%x len 0x%zx" , p->pid, p->ep->nr, p->iov.size); } }
@@ -622,7 +623,7 @@ static void usb_audio_unrealize(USBDevice *dev, Error **errp)USBAudioState *s =USB_AUDIO (dev);if (s->debug) { -fprintf (stderr,"usb-audio: destroy\n" ); +error_report ("usb-audio: destroy" ); }usb_audio_set_output_altset (s,ALTSET_OFF );
hw/usb/dev-bluetooth.c +2 -2
@@ -274,13 +274,13 @@ static void usb_bt_fifo_enqueue(struct usb_hci_in_fifo_s *fifo,if (off <=DFIFO_LEN_MASK ) {if (off + len >DFIFO_LEN_MASK +1 && (fifo->dsize = off + len) > (DFIFO_LEN_MASK +1 ) *2 ) { -fprintf (stderr,"%s: can't alloc %i bytes\n" , __func__, len); +error_report ("%s: can't alloc %i bytes" , __func__, len);exit (-1 ); } buf = fifo->data + off; }else {if (fifo->dlen > fifo->dsize) { -fprintf (stderr,"%s: can't alloc %i bytes\n" , __func__, len); +error_report ("%s: can't alloc %i bytes" , __func__, len);exit (-1 ); } buf = fifo->data + off - fifo->dsize;
hw/usb/dev-mtp.c +5 -4
@@ -10,6 +10,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include <wchar.h> #include <dirent.h>
@@ -546,7 +547,7 @@ static void inotify_watchfn(void *arg)break ;default : -fprintf (stderr,"usb-mtp: failed to parse inotify event\n" ); +error_report ("usb-mtp: failed to parse inotify event" );continue ; }
@@ -617,7 +618,7 @@ static void usb_mtp_object_readdir(MTPState *s, MTPObject *o)#ifdef CONFIG_INOTIFY1 int watchfd =usb_mtp_add_watch (s->inotifyfd, o->path);if (watchfd ==-1 ) { -fprintf (stderr,"usb-mtp: failed to add watch for %s\n" , o->path); +error_report ("usb-mtp: failed to add watch for %s" , o->path); }else {trace_usb_mtp_inotify_event (s->dev.addr, o->path,0 ,"Watch Added" );
@@ -1144,7 +1145,7 @@ static void usb_mtp_command(MTPState *s, MTPControl *c)usb_mtp_object_alloc (s, s->next_handle++,NULL , s->root);#ifdef CONFIG_INOTIFY1 if (usb_mtp_inotify_init (s)) { -fprintf (stderr,"usb-mtp: file monitoring init failed\n" ); +error_report ("usb-mtp: file monitoring init failed" ); }#endif break ;
@@ -1348,7 +1349,7 @@ static void usb_mtp_handle_control(USBDevice *dev, USBPacket *p,static void usb_mtp_cancel_packet (USBDevice *dev,USBPacket *p) {/* we don't use async packets, so this should never be called */ -fprintf (stderr,"%s\n" , __func__); +error_report ("%s" , __func__); }static void usb_mtp_handle_data (USBDevice *dev,USBPacket *p)
hw/usb/dev-network.c +10 -10
@@ -815,7 +815,7 @@ static int ndis_query(USBNetState *s, uint32_t oid,return sizeof (le32);default : -fprintf (stderr,"usbnet: unknown OID 0x%08x\n" , oid); +error_report ("usbnet: unknown OID 0x%08x" , oid);return 0 ; }return -1 ;
@@ -1084,9 +1084,9 @@ static void usb_net_handle_control(USBDevice *dev, USBPacket *p,for (i =0 ; i < length; i++) {if (!(i &15 ))fprintf (stderr,"\n%04x:" , i); -fprintf (stderr," %02x" , data[i]); +error_report (" %02x" , data[i]); } - fprintf(stderr, "\n\n"); + fprintf(stderr, "\n"); }#endif ret =rndis_parse (s, data, length);
@@ -1111,17 +1111,17 @@ static void usb_net_handle_control(USBDevice *dev, USBPacket *p,for (i =0 ; i < p->actual_length; i++) {if (!(i &15 ))fprintf (stderr,"\n%04x:" , i); -fprintf (stderr," %02x" , data[i]); +error_report (" %02x" , data[i]); } - fprintf(stderr, "\n\n"); + fprintf(stderr, "\n"); }#endif break ;default : fail: -fprintf (stderr,"usbnet: failed control transaction: " -"request 0x%x value 0x%x index 0x%x length 0x%x\n" , +error_report ("usbnet: failed control transaction: " +"request 0x%x value 0x%x index 0x%x length 0x%x" , request, value, index, length); p->status =USB_RET_STALL ;break ;
@@ -1190,7 +1190,7 @@ static void usb_net_handle_dataout(USBNetState *s, USBPacket *p)uint32_t len;#ifdef TRAFFIC_DEBUG -fprintf (stderr,"usbnet: data out len %zu\n" , p->iov.size); +error_report ("usbnet: data out len %zu" , p->iov.size);iov_hexdump (p->iov.iov, p->iov.niov, stderr,"usbnet" , p->iov.size);#endif
@@ -1260,8 +1260,8 @@ static void usb_net_handle_data(USBDevice *dev, USBPacket *p) }if (p->status ==USB_RET_STALL ) { -fprintf (stderr,"usbnet: failed data transaction: " -"pid 0x%x ep 0x%x len 0x%zx\n" , +error_report ("usbnet: failed data transaction: " +"pid 0x%x ep 0x%x len 0x%zx" , p->pid, p->ep->nr, p->iov.size); } }
hw/usb/hcd-ehci.c +16 -16
@@ -419,7 +419,7 @@ static int ehci_get_pid(EHCIqtd *qtd)case 2 :return USB_TOKEN_SETUP ;default : -fprintf (stderr,"bad token\n" ); +error_report ("bad token" );return 0 ; } }
@@ -1033,7 +1033,7 @@ static void ehci_opreg_write(void *ptr, hwaddr addr,/* not supporting dynamic frame list size at the moment */ if ((val &USBCMD_FLS ) && !(s->usbcmd &USBCMD_FLS )) { -fprintf (stderr,"attempt to set frame list size -- value %d\n" , +error_report ("attempt to set frame list size -- value %d" , (int )val &USBCMD_FLS ); val &= ~USBCMD_FLS ; }
@@ -1190,7 +1190,7 @@ static int ehci_init_transfer(EHCIPacket *p)while (bytes >0 ) {if (cpage >4 ) { -fprintf (stderr,"cpage out of range (%d)\n" , cpage); +error_report ("cpage out of range (%d)" , cpage);qemu_sglist_destroy (&p->sgl);return -1 ; }
@@ -1296,7 +1296,7 @@ static void ehci_execute_complete(EHCIQueue *q)break ;default :/* should not be triggerable */ -fprintf (stderr,"USB invalid response %d\n" , p->packet.status); +error_report ("USB invalid response %d" , p->packet.status);g_assert_not_reached ();break ; }
@@ -1345,7 +1345,7 @@ static int ehci_execute(EHCIPacket *p, const char *action) p->async == EHCI_ASYNC_INITIALIZED);if (!(p->qtd.token &QTD_TOKEN_ACTIVE )) { -fprintf (stderr,"Attempting to execute inactive qtd\n" ); +error_report ("Attempting to execute inactive qtd" );return -1 ; }
@@ -1383,7 +1383,7 @@ static int ehci_execute(EHCIPacket *p, const char *action) p->packet.actual_length);if (p->packet.actual_length >BUFF_SIZE ) { -fprintf (stderr,"ret from usb_handle_packet > BUFF_SIZE\n" ); +error_report ("ret from usb_handle_packet > BUFF_SIZE" );return -1 ; }
@@ -1461,7 +1461,7 @@ static int ehci_process_itd(EHCIState *ehci,case USB_RET_SUCCESS :break ;default : -fprintf (stderr,"Unexpected iso usb result: %d\n" , +error_report ("Unexpected iso usb result: %d" , ehci->ipacket.status);/* Fall through */ case USB_RET_IOERROR :
@@ -1564,7 +1564,7 @@ static int ehci_state_fetchentry(EHCIState *ehci, int async)/* section 4.8, only QH in async schedule */ if (async && (NLPTR_TYPE_GET (entry) !=NLPTR_TYPE_QH )) { -fprintf (stderr,"non queue head request in async schedule\n" ); +error_report ("non queue head request in async schedule" );return -1 ; }
@@ -1586,8 +1586,8 @@ static int ehci_state_fetchentry(EHCIState *ehci, int async)default :/* TODO: handle FSTN type */ -fprintf (stderr,"FETCHENTRY: entry at %X is of type %d " -"which is not supported yet\n" , entry,NLPTR_TYPE_GET (entry)); +error_report ("FETCHENTRY: entry at %X is of type %d " +"which is not supported yet" , entry,NLPTR_TYPE_GET (entry));return -1 ; }
@@ -2086,7 +2086,7 @@ static void ehci_advance_state(EHCIState *ehci, int async)break ;default : -fprintf (stderr,"Bad state!\n" ); +error_report ("Bad state!" ); again =-1 ;g_assert_not_reached ();break ;
@@ -2094,7 +2094,7 @@ static void ehci_advance_state(EHCIState *ehci, int async)if (again <0 || itd_count >16 ) {/* TODO: notify guest (raise HSE irq?) */ -fprintf (stderr,"processing error - resetting ehci HC\n" ); +error_report ("processing error - resetting ehci HC" );ehci_reset (ehci); again =0 ; }
@@ -2151,8 +2151,8 @@ static void ehci_advance_async_state(EHCIState *ehci)default :/* this should only be due to a developer mistake */ -fprintf (stderr,"ehci: Bad asynchronous state %d. " -"Resetting to active\n" , ehci->astate); +error_report ("ehci: Bad asynchronous state %d. " +"Resetting to active" , ehci->astate);g_assert_not_reached (); } }
@@ -2201,8 +2201,8 @@ static void ehci_advance_periodic_state(EHCIState *ehci)default :/* this should only be due to a developer mistake */ -fprintf (stderr,"ehci: Bad periodic state %d. " -"Resetting to active\n" , ehci->pstate); +error_report ("ehci: Bad periodic state %d. " +"Resetting to active" , ehci->pstate);g_assert_not_reached (); } }
hw/usb/hcd-musb.c +2 -2
@@ -253,8 +253,8 @@/* #define MUSB_DEBUG */ #ifdef MUSB_DEBUG -#define TRACE (fmt, ...) fprintf(stderr, "%s@%d: " fmt "\n", __func__, \ - __LINE__, ##__VA_ARGS__) +#define TRACE (fmt, ...) error_report("%s@%d: " fmt "", __func__, \ + __LINE__, ##__VA_ARGS__)#else #define TRACE (...)#endif
hw/usb/hcd-xhci.c +2 -1
@@ -19,6 +19,7 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "qemu/timer.h" #include "qemu/queue.h"
@@ -39,7 +40,7 @@#else #define DPRINTF (...) do {} while (0)#endif -#define FIXME (_msg) do { fprintf(stderr, "FIXME %s:%d %s\n", \ +#define FIXME (_msg) do { error_report("FIXME %s:%d %s", \ __func__, __LINE__, _msg); abort(); } while (0)#define TRB_LINK_LIMIT 32
hw/usb/host-legacy.c +1 -1
@@ -86,7 +86,7 @@ static int parse_filter(const char *spec, struct USBAutoFilter *f) }if (i <DEV ) { -fprintf (stderr,"husb: invalid auto filter spec %s\n" , spec); +error_report ("husb: invalid auto filter spec %s" , spec);return -1 ; }
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH v2 40/47] hw/usb: Replace fprintf(stderr, "*\n" with error_report()
Quoted 318 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>Cc Gerd Hoffmann <[email protected]>---
V2:
- Split hw patch into individual directorieshw/usb/core.c | 15 ++++++++------- hw/usb/desc.c | 4 ++-- hw/usb/dev-audio.c | 29 +++++++++++++++-------------- hw/usb/dev-bluetooth.c | 4 ++-- hw/usb/dev-mtp.c | 9 +++++---- hw/usb/dev-network.c | 20 ++++++++++---------- hw/usb/hcd-ehci.c | 32 ++++++++++++++++---------------- hw/usb/hcd-musb.c | 4 ++-- hw/usb/hcd-xhci.c | 3 ++- hw/usb/host-legacy.c | 2 +- 10 files changed, 63 insertions(+), 59 deletions(-)hw/usb/core.c +8
-7@@ -24,6 +24,7 @@* THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "hw/usb.h" #include "qemu/iov.h" @@ -599,7 +600,7 @@ void usb_packet_copy(USBPacket *p, void *ptr, size_t bytes)iov_from_buf (iov->iov, iov->niov, p->actual_length, ptr, bytes);break ;default : -fprintf (stderr,"%s: invalid pid: %x\n" , __func__, p->pid); +error_report ("%s: invalid pid: %x" , __func__, p->pid);abort (); } p->actual_length += bytes;@@ -681,7 +682,7 @@ void usb_ep_dump(USBDevice *dev) };int ifnum, ep, first; -fprintf (stderr,"Device \"%s\", config %d\n" , +error_report ("Device \"%s\", config %d" , dev->product_desc, dev->configuration);for (ifnum =0 ; ifnum <16 ; ifnum++) { first =1 ;@@ -690,10 +691,10 @@ void usb_ep_dump(USBDevice *dev) dev->ep_in[ep].ifnum == ifnum) {if (first) { first =0 ; -fprintf (stderr," Interface %d, alternative %d\n" , +error_report (" Interface %d, alternative %d" , ifnum, dev->altsetting[ifnum]); } -fprintf (stderr," Endpoint %d, IN, %s, %d max\n" , ep, +error_report (" Endpoint %d, IN, %s, %d max" , ep, tname[dev->ep_in[ep].type], dev->ep_in[ep].max_packet_size); }@@ -701,16 +702,16 @@ void usb_ep_dump(USBDevice *dev) dev->ep_out[ep].ifnum == ifnum) {if (first) { first =0 ; -fprintf (stderr," Interface %d, alternative %d\n" , +error_report (" Interface %d, alternative %d" , ifnum, dev->altsetting[ifnum]); } -fprintf (stderr," Endpoint %d, OUT, %s, %d max\n" , ep, +error_report (" Endpoint %d, OUT, %s, %d max" , ep, tname[dev->ep_out[ep].type], dev->ep_out[ep].max_packet_size); } } } -fprintf (stderr,"--\n" ); +error_report ("--" ); }struct USBEndpoint *usb_ep_get (USBDevice *dev,int pid,int ep)hw/usb/desc.c +2
-2@@ -1,5 +1,5 @@#include "qemu/osdep.h" - +#include "qemu/error-report.h" #include "hw/usb.h" #include "hw/usb/desc.h" #include "trace.h" @@ -688,7 +688,7 @@ int usb_desc_get_descriptor(USBDevice *dev, USBPacket *p,break ;default : -fprintf (stderr,"%s: %d unknown type %d (len %zd)\n" , __func__, +error_report ("%s: %d unknown type %d (len %zd)" , __func__, dev->addr, type, len);break ; }hw/usb/dev-audio.c +15
-14@@ -30,6 +30,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "hw/usb.h" #include "hw/usb/desc.h" @@ -398,7 +399,7 @@ static int usb_audio_set_output_altset(USBAudioState *s, int altset) }if (s->debug) { -fprintf (stderr,"usb-audio: set interface %d\n" , altset); +error_report ("usb-audio: set interface %d" , altset); } s->out.altset = altset;return 0 ;@@ -478,7 +479,7 @@ static int usb_audio_set_control(USBAudioState *s, uint8_t attrib,uint16_t vol = data[0 ] + (data[1 ] <<8 );if (s->debug) { -fprintf (stderr,"usb-audio: vol %04x\n" , (uint16_t )vol); +error_report ("usb-audio: vol %04x" , (uint16_t )vol); } vol -=0x8000 ;@@ -496,7 +497,7 @@ static int usb_audio_set_control(USBAudioState *s, uint8_t attrib,if (set_vol) {if (s->debug) { -fprintf (stderr,"usb-audio: mute %d, lvol %3d, rvol %3d\n" , +error_report ("usb-audio: mute %d, lvol %3d, rvol %3d" , s->out.mute, s->out.vol[0 ], s->out.vol[1 ]); } AUD_set_volume_out(s->out.voice, s->out.mute,@@ -514,8 +515,8 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p,int ret =0 ;if (s->debug) { -fprintf (stderr,"usb-audio: control transaction: " -"request 0x%04x value 0x%04x index 0x%04x length 0x%04x\n" , +error_report ("usb-audio: control transaction: " +"request 0x%04x value 0x%04x index 0x%04x length 0x%04x" , request, value, index, length); }@@ -533,7 +534,7 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, length, data);if (ret <0 ) {if (s->debug) { -fprintf (stderr,"usb-audio: fail: get control\n" ); +error_report ("usb-audio: fail: get control" ); } goto fail; }@@ -548,7 +549,7 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, length, data);if (ret <0 ) {if (s->debug) { -fprintf (stderr,"usb-audio: fail: set control\n" ); +error_report ("usb-audio: fail: set control" ); } goto fail; }@@ -557,8 +558,8 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p,default : fail:if (s->debug) { -fprintf (stderr,"usb-audio: failed control transaction: " -"request 0x%04x value 0x%04x index 0x%04x length 0x%04x\n" , +error_report ("usb-audio: failed control transaction: " +"request 0x%04x value 0x%04x index 0x%04x length 0x%04x" , request, value, index, length); } p->status =USB_RET_STALL ;@@ -581,7 +582,7 @@ static void usb_audio_handle_reset(USBDevice *dev)USBAudioState *s =USB_AUDIO (dev);if (s->debug) { -fprintf (stderr,"usb-audio: reset\n" ); +error_report ("usb-audio: reset" ); }usb_audio_set_output_altset (s,ALTSET_OFF ); }@@ -595,7 +596,7 @@ static void usb_audio_handle_dataout(USBAudioState *s, USBPacket *p)streambuf_put (&s->out.buf, p);if (p->actual_length < p->iov.size && s->debug >1 ) { -fprintf (stderr,"usb-audio: output overrun (%zd bytes)\n" , +error_report ("usb-audio: output overrun (%zd bytes)" , p->iov.size - p->actual_length); } }@@ -611,8 +612,8 @@ static void usb_audio_handle_data(USBDevice *dev, USBPacket *p) p->status =USB_RET_STALL ;if (s->debug) { -fprintf (stderr,"usb-audio: failed data transaction: " -"pid 0x%x ep 0x%x len 0x%zx\n" , +error_report ("usb-audio: failed data transaction: " +"pid 0x%x ep 0x%x len 0x%zx" , p->pid, p->ep->nr, p->iov.size); } }@@ -622,7 +623,7 @@ static void usb_audio_unrealize(USBDevice *dev, Error **errp)USBAudioState *s =USB_AUDIO (dev);if (s->debug) { -fprintf (stderr,"usb-audio: destroy\n" ); +error_report ("usb-audio: destroy" ); }usb_audio_set_output_altset (s,ALTSET_OFF );hw/usb/dev-bluetooth.c +2
-2@@ -274,13 +274,13 @@ static void usb_bt_fifo_enqueue(struct usb_hci_in_fifo_s *fifo,if (off <=DFIFO_LEN_MASK ) {if (off + len >DFIFO_LEN_MASK +1 && (fifo->dsize = off + len) > (DFIFO_LEN_MASK +1 ) *2 ) { -fprintf (stderr,"%s: can't alloc %i bytes\n" , __func__, len); +error_report ("%s: can't alloc %i bytes" , __func__, len);exit (-1 ); } buf = fifo->data + off; }else {if (fifo->dlen > fifo->dsize) { -fprintf (stderr,"%s: can't alloc %i bytes\n" , __func__, len); +error_report ("%s: can't alloc %i bytes" , __func__, len);exit (-1 ); } buf = fifo->data + off - fifo->dsize;hw/usb/dev-mtp.c +4
-3@@ -10,6 +10,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include <wchar.h> #include <dirent.h> @@ -546,7 +547,7 @@ static void inotify_watchfn(void *arg)break ;default : -fprintf (stderr,"usb-mtp: failed to parse inotify event\n" ); +error_report ("usb-mtp: failed to parse inotify event" );continue ; }@@ -617,7 +618,7 @@ static void usb_mtp_object_readdir(MTPState *s, MTPObject *o)#ifdef CONFIG_INOTIFY1 int watchfd =usb_mtp_add_watch (s->inotifyfd, o->path);if (watchfd ==-1 ) { -fprintf (stderr,"usb-mtp: failed to add watch for %s\n" , o->path); +error_report ("usb-mtp: failed to add watch for %s" , o->path); }else {trace_usb_mtp_inotify_event (s->dev.addr, o->path,0 ,"Watch Added" );@@ -1144,7 +1145,7 @@ static void usb_mtp_command(MTPState *s, MTPControl *c)usb_mtp_object_alloc (s, s->next_handle++,NULL , s->root);#ifdef CONFIG_INOTIFY1 if (usb_mtp_inotify_init (s)) { -fprintf (stderr,"usb-mtp: file monitoring init failed\n" ); +error_report ("usb-mtp: file monitoring init failed" ); }#endif break ;
hw/usb/dev-mtp.c static void usb_mtp_handle_control(USBDevice *dev, USBPacket *p, · line 1352
Quoted 5 lines
hw/usb/dev-mtp.c +1
-1@@ -1348,7 +1349,7 @@ static void usb_mtp_handle_control(USBDevice *dev, USBPacket *p,static void usb_mtp_cancel_packet (USBDevice *dev,USBPacket *p) {/* we don't use async packets, so this should never be called */ -fprintf (stderr,"%s\n" , __func__); +error_report ("%s" , __func__);
what about using tracepoint instead? this report is probably confusing instead of being useful for the user imho.
Quoted 17 lines
hw/usb/dev-mtp.c +0
-0}static void usb_mtp_handle_data (USBDevice *dev,USBPacket *p)hw/usb/dev-network.c +1
-1@@ -815,7 +815,7 @@ static int ndis_query(USBNetState *s, uint32_t oid,return sizeof (le32);default : -fprintf (stderr,"usbnet: unknown OID 0x%08x\n" , oid); +error_report ("usbnet: unknown OID 0x%08x" , oid);return 0 ; }return -1 ;
hw/usb/dev-network.c static void usb_net_handle_control(USBDevice *dev, USBPacket *p, · line 1089
Quoted 8 lines
hw/usb/dev-network.c +2
-2@@ -1084,9 +1084,9 @@ static void usb_net_handle_control(USBDevice *dev, USBPacket *p,for (i =0 ; i < length; i++) {if (!(i &15 ))fprintf (stderr,"\n%04x:" , i); -fprintf (stderr," %02x" , data[i]); +error_report (" %02x" , data[i]); } -fprintf (stderr,"\n\n" ); +fprintf (stderr,"\n" );
eh?
hw/usb/dev-network.c static void usb_net_handle_control(USBDevice *dev, USBPacket *p, · line 1116
Quoted 12 lines
hw/usb/dev-network.c +2
-2}#endif ret =rndis_parse (s, data, length);@@ -1111,17 +1111,17 @@ static void usb_net_handle_control(USBDevice *dev, USBPacket *p,for (i =0 ; i < p->actual_length; i++) {if (!(i &15 ))fprintf (stderr,"\n%04x:" , i); -fprintf (stderr," %02x" , data[i]); +error_report (" %02x" , data[i]); } -fprintf (stderr,"\n\n" ); +fprintf (stderr,"\n" );
eh?
Quoted 210 lines
hw/usb/dev-network.c +5
-5}#endif break ;default : fail: -fprintf (stderr,"usbnet: failed control transaction: " -"request 0x%x value 0x%x index 0x%x length 0x%x\n" , +error_report ("usbnet: failed control transaction: " +"request 0x%x value 0x%x index 0x%x length 0x%x" , request, value, index, length); p->status =USB_RET_STALL ;break ;@@ -1190,7 +1190,7 @@ static void usb_net_handle_dataout(USBNetState *s, USBPacket *p)uint32_t len;#ifdef TRAFFIC_DEBUG -fprintf (stderr,"usbnet: data out len %zu\n" , p->iov.size); +error_report ("usbnet: data out len %zu" , p->iov.size);iov_hexdump (p->iov.iov, p->iov.niov, stderr,"usbnet" , p->iov.size);#endif @@ -1260,8 +1260,8 @@ static void usb_net_handle_data(USBDevice *dev, USBPacket *p) }if (p->status ==USB_RET_STALL ) { -fprintf (stderr,"usbnet: failed data transaction: " -"pid 0x%x ep 0x%x len 0x%zx\n" , +error_report ("usbnet: failed data transaction: " +"pid 0x%x ep 0x%x len 0x%zx" , p->pid, p->ep->nr, p->iov.size); } }hw/usb/hcd-ehci.c +16
-16@@ -419,7 +419,7 @@ static int ehci_get_pid(EHCIqtd *qtd)case 2 :return USB_TOKEN_SETUP ;default : -fprintf (stderr,"bad token\n" ); +error_report ("bad token" );return 0 ; } }@@ -1033,7 +1033,7 @@ static void ehci_opreg_write(void *ptr, hwaddr addr,/* not supporting dynamic frame list size at the moment */ if ((val &USBCMD_FLS ) && !(s->usbcmd &USBCMD_FLS )) { -fprintf (stderr,"attempt to set frame list size -- value %d\n" , +error_report ("attempt to set frame list size -- value %d" , (int )val &USBCMD_FLS ); val &= ~USBCMD_FLS ; }@@ -1190,7 +1190,7 @@ static int ehci_init_transfer(EHCIPacket *p)while (bytes >0 ) {if (cpage >4 ) { -fprintf (stderr,"cpage out of range (%d)\n" , cpage); +error_report ("cpage out of range (%d)" , cpage);qemu_sglist_destroy (&p->sgl);return -1 ; }@@ -1296,7 +1296,7 @@ static void ehci_execute_complete(EHCIQueue *q)break ;default :/* should not be triggerable */ -fprintf (stderr,"USB invalid response %d\n" , p->packet.status); +error_report ("USB invalid response %d" , p->packet.status);g_assert_not_reached ();break ; }@@ -1345,7 +1345,7 @@ static int ehci_execute(EHCIPacket *p, const char *action) p->async == EHCI_ASYNC_INITIALIZED);if (!(p->qtd.token &QTD_TOKEN_ACTIVE )) { -fprintf (stderr,"Attempting to execute inactive qtd\n" ); +error_report ("Attempting to execute inactive qtd" );return -1 ; }@@ -1383,7 +1383,7 @@ static int ehci_execute(EHCIPacket *p, const char *action) p->packet.actual_length);if (p->packet.actual_length >BUFF_SIZE ) { -fprintf (stderr,"ret from usb_handle_packet > BUFF_SIZE\n" ); +error_report ("ret from usb_handle_packet > BUFF_SIZE" );return -1 ; }@@ -1461,7 +1461,7 @@ static int ehci_process_itd(EHCIState *ehci,case USB_RET_SUCCESS :break ;default : -fprintf (stderr,"Unexpected iso usb result: %d\n" , +error_report ("Unexpected iso usb result: %d" , ehci->ipacket.status);/* Fall through */ case USB_RET_IOERROR :@@ -1564,7 +1564,7 @@ static int ehci_state_fetchentry(EHCIState *ehci, int async)/* section 4.8, only QH in async schedule */ if (async && (NLPTR_TYPE_GET (entry) !=NLPTR_TYPE_QH )) { -fprintf (stderr,"non queue head request in async schedule\n" ); +error_report ("non queue head request in async schedule" );return -1 ; }@@ -1586,8 +1586,8 @@ static int ehci_state_fetchentry(EHCIState *ehci, int async)default :/* TODO: handle FSTN type */ -fprintf (stderr,"FETCHENTRY: entry at %X is of type %d " -"which is not supported yet\n" , entry,NLPTR_TYPE_GET (entry)); +error_report ("FETCHENTRY: entry at %X is of type %d " +"which is not supported yet" , entry,NLPTR_TYPE_GET (entry));return -1 ; }@@ -2086,7 +2086,7 @@ static void ehci_advance_state(EHCIState *ehci, int async)break ;default : -fprintf (stderr,"Bad state!\n" ); +error_report ("Bad state!" ); again =-1 ;g_assert_not_reached ();break ;@@ -2094,7 +2094,7 @@ static void ehci_advance_state(EHCIState *ehci, int async)if (again <0 || itd_count >16 ) {/* TODO: notify guest (raise HSE irq?) */ -fprintf (stderr,"processing error - resetting ehci HC\n" ); +error_report ("processing error - resetting ehci HC" );ehci_reset (ehci); again =0 ; }@@ -2151,8 +2151,8 @@ static void ehci_advance_async_state(EHCIState *ehci)default :/* this should only be due to a developer mistake */ -fprintf (stderr,"ehci: Bad asynchronous state %d. " -"Resetting to active\n" , ehci->astate); +error_report ("ehci: Bad asynchronous state %d. " +"Resetting to active" , ehci->astate);g_assert_not_reached (); } }@@ -2201,8 +2201,8 @@ static void ehci_advance_periodic_state(EHCIState *ehci)default :/* this should only be due to a developer mistake */ -fprintf (stderr,"ehci: Bad periodic state %d. " -"Resetting to active\n" , ehci->pstate); +error_report ("ehci: Bad periodic state %d. " +"Resetting to active" , ehci->pstate);g_assert_not_reached (); } }hw/usb/hcd-musb.c +2
-2@@ -253,8 +253,8 @@/* #define MUSB_DEBUG */ #ifdef MUSB_DEBUG -#define TRACE (fmt, ...) fprintf(stderr, "%s@%d: " fmt "\n", __func__, \ - __LINE__, ##__VA_ARGS__) +#define TRACE (fmt, ...) error_report("%s@%d: " fmt "", __func__, \ + __LINE__, ##__VA_ARGS__)#else #define TRACE (...)#endif hw/usb/hcd-xhci.c +2
-1@@ -19,6 +19,7 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "qemu/timer.h" #include "qemu/queue.h" @@ -39,7 +40,7 @@#else #define DPRINTF (...) do {} while (0)#endif -#define FIXME (_msg) do { fprintf(stderr, "FIXME %s:%d %s\n", \ +#define FIXME (_msg) do { error_report("FIXME %s:%d %s", \ __func__, __LINE__, _msg); abort(); } while (0)#define TRB_LINK_LIMIT 32hw/usb/host-legacy.c +1
-1@@ -86,7 +86,7 @@ static int parse_filter(const char *spec, struct USBAutoFilter *f) }if (i <DEV ) { -fprintf (stderr,"husb: invalid auto filter spec %s\n" , spec); +error_report ("husb: invalid auto filter spec %s" , spec);return -1 ; }
Re: [Qemu-devel] [PATCH v2 40/47] hw/usb: Replace fprintf(stderr, "*\n" with error_report()
Quoted 4 lines · Philippe Mathieu-Daudé
Quoted 3 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
[...]
Quoted 10 lines
Quoted 10 lines
hw/usb/desc.c +1
-1@@ -1,5 +1,5 @@ #include "qemu/osdep.h" - +#include "qemu/error-report.h" #include "hw/usb.h" #include "hw/usb/desc.h"
Quoted 8 lines
Quoted 8 lines
hw/usb/desc.c +0
-0#include "trace.h"@@ -688,7 +688,7 @@ int usb_desc_get_descriptor(USBDevice *dev, USBPacket *p, break;default:
- fprintf(stderr, "%s: %d unknown type %d (len %zd)\n",__func__, +error_report("%s: %d unknown type %d (len %zd)", __func__, dev->addr, type, len);
Bad indentation.
Quoted 29 lines
Quoted 29 lines
break;
}hw/usb/dev-audio.c +3
-2@@ -30,6 +30,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "hw/usb.h" #include "hw/usb/desc.h"@@ -398,7 +399,7 @@ static int usb_audio_set_output_altset(USBAudioState *s, int altset) } if (s->debug) { - fprintf(stderr, "usb-audio: set interface %d\n", altset); + error_report("usb-audio: set interface %d", altset); } s->out.altset = altset; return 0;@@ -478,7 +479,7 @@ static int usb_audio_set_control(USBAudioState *s,uint8_t attrib, uint16_t vol = data[0] + (data[1] << 8); if (s->debug) { - fprintf(stderr, "usb-audio: vol %04x\n", (uint16_t)vol); + error_report("usb-audio: vol %04x", (uint16_t)vol); }
Quoted 8 lines
hw/usb/dev-audio.c static int usb_audio_set_control(USBAudioState *s, · line 501
Quoted 8 lines
hw/usb/dev-audio.c +1
-1vol -= 0x8000;@@ -496,7 +497,7 @@ static int usb_audio_set_control(USBAudioState *s, uint8_t attrib, if (set_vol) { if (s->debug) { - fprintf(stderr, "usb-audio: mute %d, lvol %3d, rvol %3d\n", + error_report("usb-audio: mute %d, lvol %3d, rvol %3d", s->out.mute, s->out.vol[0], s->out.vol[1]);
Bad indentation.
Quoted 5 lines
Quoted 5 lines
hw/usb/dev-audio.c +0
-0} AUD_set_volume_out(s->out.voice, s->out.mute,@@ -514,8 +515,8 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, int ret = 0;
Quoted 8 lines
hw/usb/dev-audio.c static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, · line 520
Quoted 8 lines
hw/usb/dev-audio.c +2
-2if (s->debug) { - fprintf(stderr, "usb-audio: control transaction: " - "request 0x%04x value 0x%04x index 0x%04x length 0x%04x\n", + error_report("usb-audio: control transaction: " + "request 0x%04x value 0x%04x index 0x%04x length 0x%04x", request, value, index, length);
Bad indentation.
Quoted 25 lines
Quoted 25 lines
}
@@ -533,7 +534,7 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p,
length, data);
if (ret < 0) {
if (s->debug) {
-fprintf(stderr, "usb-audio: fail: get control\n"); +error_report("usb-audio: fail: get control"); }
goto fail;
}hw/usb/dev-audio.c +1
-1@@ -548,7 +549,7 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, length, data); if (ret < 0) { if (s->debug) { - fprintf(stderr, "usb-audio: fail: set control\n"); + error_report("usb-audio: fail: set control"); } goto fail;}
hw/usb/dev-audio.c +0
-0@@ -557,8 +558,8 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p,default:
fail:
Quoted 8 lines
Quoted 8 lines
if (
s->debug) {
- fprintf(stderr, "usb-audio: failed control transaction: " - "request 0x%04x value 0x%04x index 0x%04x length 0x%04x\n",
+ error_report("usb-audio: failed control transaction: " + "request 0x%04x value 0x%04x index 0x%04x length 0x%04x",
request, value, index, length);
Bad indentation.
Quoted 9 lines
Quoted 9 lines
}
p->status=USB_RET_STALL;hw/usb/dev-audio.c +1
-1@@ -581,7 +582,7 @@ static void usb_audio_handle_reset(USBDevice *dev) USBAudioState *s = USB_AUDIO(dev); if (s->debug) { - fprintf(stderr, "usb-audio: reset\n"); + error_report("usb-audio: reset"); } usb_audio_set_output_altset(s, ALTSET_OFF);
Quoted 8 lines
hw/usb/dev-audio.c static void usb_audio_handle_dataout(USBAudioState · line 600
Quoted 8 lines
hw/usb/dev-audio.c +1
-1}@@ -595,7 +596,7 @@ static void usb_audio_handle_dataout(USBAudioState *s, USBPacket *p) streambuf_put(&s->out.buf, p); if (p->actual_length < p->iov.size && s->debug > 1) { - fprintf(stderr, "usb-audio: output overrun (%zd bytes)\n", + error_report("usb-audio: output overrun (%zd bytes)", p->iov.size - p->actual_length);
Bad indentation.
Quoted 11 lines
hw/usb/dev-audio.c static void usb_audio_handle_data(USBDevice *dev, · line 617
Quoted 11 lines
hw/usb/dev-audio.c +2
-2} }@@ -611,8 +612,8 @@ static void usb_audio_handle_data(USBDevice *dev, USBPacket *p) p->status = USB_RET_STALL; if (s->debug) { - fprintf(stderr, "usb-audio: failed data transaction: " - "pid 0x%x ep 0x%x len 0x%zx\n", + error_report("usb-audio: failed data transaction: " + "pid 0x%x ep 0x%x len 0x%zx", p->pid, p->ep->nr, p->iov.size);
Bad indentation.
Quoted 2 lines
Quoted 2 lines
hw/usb/dev-audio.c +0
-0} }
[...]
Quoted 10 lines
hw/usb/dev-audio.c static void usb_mtp_handle_control(USBDevice · line 1353
Quoted 7 lines
hw/usb/dev-audio.c +1
-1@@ -1348,7 +1349,7 @@ static void usb_mtp_handle_control(USBDevice *dev, USBPacket *p, static void usb_mtp_cancel_packet(USBDevice *dev, USBPacket *p) { /* we don't use async packets, so this should never be called */ - fprintf(stderr, "%s\n", __func__); + error_report("%s", __func__);what about using tracepoint instead? this report is probably confusing instead of being useful for the user imho.
A comment like "should never be called" rather sounds like we should be using g_assert_not_reached() here instead.
Thomas
PATCH v2 41/47 hw/watchdog: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisReplace a large number of the fprintf(stderr, "*\n" calls with error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +Some lines where then manually tweaked to pass checkpatch.
---
V2:
- Split hw patch into individual directories
hw/watchdog/watchdog.c | 9 +++++---- hw/watchdog/wdt_i6300esb.c | 8 +++++--- 2 files changed, 10 insertions(+), 7 deletions(-)
hw/watchdog/watchdog.c +5 -4
@@ -20,6 +20,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu/option.h" #include "qemu/config-file.h" #include "qemu/queue.h"
@@ -51,7 +52,7 @@ int select_watchdog(const char *p)/* -watchdog ? lists available devices and exits cleanly. */ if (is_help_option (p)) { QLIST_FOREACH(model, &watchdog_list, entry) { -fprintf (stderr,"\t%s\t%s\n" , +error_report ("\t%s\t%s" , model->wdt_name, model->wdt_description); }return 2 ;
@@ -67,9 +68,9 @@ int select_watchdog(const char *p) } } -fprintf (stderr,"Unknown -watchdog device. Supported devices are:\n" ); +error_report ("Unknown -watchdog device. Supported devices are:" ); QLIST_FOREACH(model, &watchdog_list, entry) { -fprintf (stderr,"\t%s\t%s\n" , +error_report ("\t%s\t%s" , model->wdt_name, model->wdt_description); }return 1 ;
@@ -133,7 +134,7 @@ void watchdog_perform_action(void)case WDT_DEBUG :qapi_event_send_watchdog (WATCHDOG_EXPIRATION_ACTION_DEBUG , &error_abort); -fprintf (stderr,"watchdog: timer fired\n" ); +error_report ("watchdog: timer fired" );break ;case WDT_NONE :
hw/watchdog/wdt_i6300esb.c +5 -3
@@ -20,7 +20,7 @@*/ #include "qemu/osdep.h" - +#include "qemu/error-report.h" #include "qemu-common.h" #include "qemu/timer.h" #include "sysemu/watchdog.h"
@@ -186,10 +186,12 @@ static void i6300esb_timer_expired(void *vp)/* What to do at the end of stage 1? */ switch (d->int_type) {case INT_TYPE_IRQ : -fprintf (stderr,"i6300esb_timer_expired: I would send APIC 1 INT 10 here if I knew how (XXX)\n" ); +error_report ("i6300esb_timer_expired: I would send APIC 1 INT 10" +"here if I knew how (XXX)" );break ;case INT_TYPE_SMI : -fprintf (stderr,"i6300esb_timer_expired: I would send SMI here if I knew how (XXX)\n" ); +error_report ("i6300esb_timer_expired: I would send SMI here if I" +"knew how (XXX)" );break ; }
Signature · 1 line
2.11.0
PATCH v2 42/47 hw/xen*: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisReplace a large number of the fprintf(stderr, "*\n" calls with error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +Some lines where then manually tweaked to pass checkpatch.
---
V2:
- Split hw patch into individual directories
hw/xen/xen-common.c | 11 ++++++----- hw/xen/xen_pt.c | 4 ++-- hw/xenpv/xen_domainbuild.c | 24 ++++++++++++------------ hw/xenpv/xen_machine_pv.c | 9 +++++---- 4 files changed, 25 insertions(+), 23 deletions(-)
hw/xen/xen-common.c +6 -5
@@ -9,6 +9,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/xen/xen_backend.h" #include "qmp-commands.h" #include "chardev/char.h"
@@ -47,19 +48,19 @@ static int store_dev_info(int domid, Chardev *cs, const char *string)/* We now have everything we need to set the xenstore entry. */ xs =xs_open (0 );if (xs ==NULL ) { -fprintf (stderr,"Could not contact XenStore\n" ); +error_report ("Could not contact XenStore" ); goto out; } path =xs_get_domain_path (xs, domid);if (path ==NULL ) { -fprintf (stderr,"xs_get_domain_path() error\n" ); +error_report ("xs_get_domain_path() error" ); goto out; } newpath =realloc (path, (strlen (path) +strlen (string) +strlen ("/tty" ) +1 ));if (newpath ==NULL ) { -fprintf (stderr,"realloc error\n" ); +error_report ("realloc error" ); goto out; } path = newpath;
@@ -96,13 +97,13 @@ static void xenstore_record_dm_state(struct xs_handle *xs, const char *state)char path[50 ];if (xs ==NULL ) { -fprintf (stderr,"xenstore connection not initialized\n" ); +error_report ("xenstore connection not initialized" );exit (1 ); }snprintf (path,sizeof (path),"device-model/%u/state" , xen_domid);if (!xs_write (xs,XBT_NULL , path, state,strlen (state))) { -fprintf (stderr,"error recording dm state\n" ); +error_report ("error recording dm state" );exit (1 ); } }
hw/xen/xen_pt.c +2 -2
@@ -73,7 +73,7 @@ void xen_pt_log(const PCIDevice *d, const char *f, ...)va_start (ap, f);if (d) { -fprintf (stderr,"[%02x:%02x.%d] " ,pci_bus_num (d->bus), +error_report ("[%02x:%02x.%d] " ,pci_bus_num (d->bus),PCI_SLOT (d->devfn),PCI_FUNC (d->devfn)); }vfprintf (stderr, f, ap);
@@ -87,7 +87,7 @@ static int xen_pt_pci_config_access_check(PCIDevice *d, uint32_t addr, int len)/* check offset range */ if (addr >0xFF ) {XEN_PT_ERR (d,"Failed to access register with offset exceeding 0xFF. " -"(addr: 0x%02x, len: %d)\n" , addr, len); +"(addr: 0x%02x, len: %d)" , addr, len);return -1 ; }
hw/xenpv/xen_domainbuild.c +12 -12
@@ -25,22 +25,22 @@ static int xenstore_domain_mkdir(char *path)int i;if (!xs_mkdir (xenstore,0 , path)) { -fprintf (stderr,"%s: xs_mkdir %s: failed\n" , __func__, path); -return -1 ; +error_report ("%s: xs_mkdir %s: failed" , __func__, path); +return -1 ; }if (!xs_set_permissions (xenstore,0 , path, perms_ro,2 )) { -fprintf (stderr,"%s: xs_set_permissions failed\n" , __func__); -return -1 ; +error_report ("%s: xs_set_permissions failed" , __func__); +return -1 ; }for (i =0 ; writable[i]; i++) {snprintf (subpath,sizeof (subpath),"%s/%s" , path, writable[i]);if (!xs_mkdir (xenstore,0 , subpath)) { -fprintf (stderr,"%s: xs_mkdir %s: failed\n" , __func__, subpath); +error_report ("%s: xs_mkdir %s: failed" , __func__, subpath);return -1 ; }if (!xs_set_permissions (xenstore,0 , subpath, perms_rw,2 )) { -fprintf (stderr,"%s: xs_set_permissions failed\n" , __func__); +error_report ("%s: xs_set_permissions failed" , __func__);return -1 ; } }
@@ -235,7 +235,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk,memcpy (uuid, &qemu_uuid,sizeof (uuid)); rc =xen_domain_create (xen_xc, ssidref, uuid, flags, &xen_domid);if (rc <0 ) { -fprintf (stderr,"xen: xc_domain_create() failed\n" ); +error_report ("xen: xc_domain_create() failed" ); goto err; }qemu_log ("xen: created domain %d\n" , xen_domid);
@@ -248,21 +248,21 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, rc =xc_domain_max_vcpus (xen_xc, xen_domid, smp_cpus);if (rc <0 ) { -fprintf (stderr,"xen: xc_domain_max_vcpus() failed\n" ); +error_report ("xen: xc_domain_max_vcpus() failed" ); goto err; }#if 0 rc =xc_domain_setcpuweight (xen_xc, xen_domid,256 );if (rc <0 ) { -fprintf (stderr,"xen: xc_domain_setcpuweight() failed\n" ); +error_report ("xen: xc_domain_setcpuweight() failed" ); goto err; }#endif rc =xc_domain_setmaxmem (xen_xc, xen_domid, ram_size >>10 );if (rc <0 ) { -fprintf (stderr,"xen: xc_domain_setmaxmem() failed\n" ); +error_report ("xen: xc_domain_setmaxmem() failed" ); goto err; }
@@ -275,7 +275,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, xenstore_port, &xenstore_mfn, console_port, &console_mfn);if (rc <0 ) { -fprintf (stderr,"xen: xc_linux_build() failed\n" ); +error_report ("xen: xc_linux_build() failed" ); goto err; }
@@ -285,7 +285,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk,qemu_log ("xen: unpausing domain %d\n" , xen_domid); rc =xc_domain_unpause (xen_xc, xen_domid);if (rc <0 ) { -fprintf (stderr,"xen: xc_domain_unpause() failed\n" ); +error_report ("xen: xc_domain_unpause() failed" ); goto err; }
hw/xenpv/xen_machine_pv.c +5 -4
@@ -23,6 +23,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/boards.h" #include "hw/xen/xen_backend.h"
@@ -36,7 +37,7 @@ static void xen_init_pv(MachineState *machine)/* Initialize backend core & drivers */ if (xen_be_init () !=0 ) { -fprintf (stderr,"%s: xen backend core setup failed\n" , __func__); +error_report ("%s: xen backend core setup failed" , __func__);exit (1 ); }
@@ -51,18 +52,18 @@ static void xen_init_pv(MachineState *machine)const char *initrd_filename = machine->initrd_filename;if (xen_domain_build_pv (kernel_filename, initrd_filename, kernel_cmdline) <0 ) { -fprintf (stderr,"xen pv domain creation failed\n" ); +error_report ("xen pv domain creation failed" );exit (1 ); } break; }#endif case XEN_EMULATE : -fprintf (stderr,"xen emulation not implemented (yet)\n" ); +error_report ("xen emulation not implemented (yet)" );exit (1 );break ;default : -fprintf (stderr,"unhandled xen_mode %d\n" , xen_mode); +error_report ("unhandled xen_mode %d" , xen_mode);exit (1 );break ; }
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH v2 42/47] hw/xen*: Replace fprintf(stderr, "*\n" with error_report()
Quoted 62 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.hw/xen/xen-common.c +6
-5@@ -9,6 +9,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/xen/xen_backend.h" #include "qmp-commands.h" #include "chardev/char.h" @@ -47,19 +48,19 @@ static int store_dev_info(int domid, Chardev *cs, const char *string)/* We now have everything we need to set the xenstore entry. */ xs =xs_open (0 );if (xs ==NULL ) { -fprintf (stderr,"Could not contact XenStore\n" ); +error_report ("Could not contact XenStore" ); goto out; } path =xs_get_domain_path (xs, domid);if (path ==NULL ) { -fprintf (stderr,"xs_get_domain_path() error\n" ); +error_report ("xs_get_domain_path() error" ); goto out; } newpath =realloc (path, (strlen (path) +strlen (string) +strlen ("/tty" ) +1 ));if (newpath ==NULL ) { -fprintf (stderr,"realloc error\n" ); +error_report ("realloc error" ); goto out; } path = newpath;@@ -96,13 +97,13 @@ static void xenstore_record_dm_state(struct xs_handle *xs, const char *state)char path[50 ];if (xs ==NULL ) { -fprintf (stderr,"xenstore connection not initialized\n" ); +error_report ("xenstore connection not initialized" );exit (1 ); }snprintf (path,sizeof (path),"device-model/%u/state" , xen_domid);if (!xs_write (xs,XBT_NULL , path, state,strlen (state))) { -fprintf (stderr,"error recording dm state\n" ); +error_report ("error recording dm state" );exit (1 ); } }hw/xen/xen_pt.c +0
-0
hw/xen/xen_pt.c void xen_pt_log(const PCIDevice *d, const char *f, ...) · line 76
Quoted 5 lines
hw/xen/xen_pt.c +1
-1@@ -73,7 +73,7 @@ void xen_pt_log(const PCIDevice *d, const char *f, ...)va_start (ap, f);if (d) { - fprintf(stderr, "[%02x:%02x.%d] ", pci_bus_num(d->bus), + error_report("[%02x:%02x.%d] ", pci_bus_num(d->bus),
This is only part of a line of a comment, this is going to be more complecated that just calling error_repport, right?
hw/xen/xen_pt.c void xen_pt_log(const PCIDevice *d, const char *f, ...) · line 79
Quoted 3 lines
hw/xen/xen_pt.c +0
-0PCI_SLOT(d->devfn), PCI_FUNC(d->devfn)); }vfprintf (stderr, f, ap);
The second part of the line is printed here.
hw/xen/xen_pt.c static int xen_pt_pci_config_access_check(PCIDevice *d, uint32_t addr, int len) · line 90
Quoted 6 lines
hw/xen/xen_pt.c +1
-1@@ -87,7 +87,7 @@ static int xen_pt_pci_config_access_check(PCIDevice *d, uint32_t addr, int len)/* check offset range */ if (addr >0xFF ) {XEN_PT_ERR (d,"Failed to access register with offset exceeding 0xFF. " -"(addr: 0x%02x, len: %d)\n" , addr, len); +"(addr: 0x%02x, len: %d)" , addr, len);
If xen_pt_log is changed, there would be many more of the XEN_PT_ERR call to change. (as well as XEN_PT_LOG and XEN_PT_WARN.)
Quoted 121 lines
hw/xen/xen_pt.c +0
-0return -1 ; }hw/xenpv/xen_domainbuild.c +12
-12@@ -25,22 +25,22 @@ static int xenstore_domain_mkdir(char *path)int i;if (!xs_mkdir (xenstore,0 , path)) { -fprintf (stderr,"%s: xs_mkdir %s: failed\n" , __func__, path); -return -1 ; +error_report ("%s: xs_mkdir %s: failed" , __func__, path); +return -1 ; }if (!xs_set_permissions (xenstore,0 , path, perms_ro,2 )) { -fprintf (stderr,"%s: xs_set_permissions failed\n" , __func__); -return -1 ; +error_report ("%s: xs_set_permissions failed" , __func__); +return -1 ; }for (i =0 ; writable[i]; i++) {snprintf (subpath,sizeof (subpath),"%s/%s" , path, writable[i]);if (!xs_mkdir (xenstore,0 , subpath)) { -fprintf (stderr,"%s: xs_mkdir %s: failed\n" , __func__, subpath); +error_report ("%s: xs_mkdir %s: failed" , __func__, subpath);return -1 ; }if (!xs_set_permissions (xenstore,0 , subpath, perms_rw,2 )) { -fprintf (stderr,"%s: xs_set_permissions failed\n" , __func__); +error_report ("%s: xs_set_permissions failed" , __func__);return -1 ; } }@@ -235,7 +235,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk,memcpy (uuid, &qemu_uuid,sizeof (uuid)); rc =xen_domain_create (xen_xc, ssidref, uuid, flags, &xen_domid);if (rc <0 ) { -fprintf (stderr,"xen: xc_domain_create() failed\n" ); +error_report ("xen: xc_domain_create() failed" ); goto err; }qemu_log ("xen: created domain %d\n" , xen_domid);@@ -248,21 +248,21 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, rc =xc_domain_max_vcpus (xen_xc, xen_domid, smp_cpus);if (rc <0 ) { -fprintf (stderr,"xen: xc_domain_max_vcpus() failed\n" ); +error_report ("xen: xc_domain_max_vcpus() failed" ); goto err; }#if 0 rc =xc_domain_setcpuweight (xen_xc, xen_domid,256 );if (rc <0 ) { -fprintf (stderr,"xen: xc_domain_setcpuweight() failed\n" ); +error_report ("xen: xc_domain_setcpuweight() failed" ); goto err; }#endif rc =xc_domain_setmaxmem (xen_xc, xen_domid, ram_size >>10 );if (rc <0 ) { -fprintf (stderr,"xen: xc_domain_setmaxmem() failed\n" ); +error_report ("xen: xc_domain_setmaxmem() failed" ); goto err; }@@ -275,7 +275,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, xenstore_port, &xenstore_mfn, console_port, &console_mfn);if (rc <0 ) { -fprintf (stderr,"xen: xc_linux_build() failed\n" ); +error_report ("xen: xc_linux_build() failed" ); goto err; }@@ -285,7 +285,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk,qemu_log ("xen: unpausing domain %d\n" , xen_domid); rc =xc_domain_unpause (xen_xc, xen_domid);if (rc <0 ) { -fprintf (stderr,"xen: xc_domain_unpause() failed\n" ); +error_report ("xen: xc_domain_unpause() failed" ); goto err; }hw/xenpv/xen_machine_pv.c +3
-2@@ -23,6 +23,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/boards.h" #include "hw/xen/xen_backend.h" @@ -36,7 +37,7 @@ static void xen_init_pv(MachineState *machine)/* Initialize backend core & drivers */ if (xen_be_init () !=0 ) { -fprintf (stderr,"%s: xen backend core setup failed\n" , __func__); +error_report ("%s: xen backend core setup failed" , __func__);exit (1 ); }@@ -51,18 +52,18 @@ static void xen_init_pv(MachineState *machine)const char *initrd_filename = machine->initrd_filename;if (xen_domain_build_pv (kernel_filename, initrd_filename, kernel_cmdline) <0 ) { -fprintf (stderr,"xen pv domain creation failed\n" ); +error_report ("xen pv domain creation failed" );exit (1 ); } break; }#endif case XEN_EMULATE :
hw/xenpv/xen_machine_pv.c static void xen_init_pv(MachineState *machine) · line 69
Quoted 10 lines
hw/xenpv/xen_machine_pv.c +2
-2-fprintf (stderr,"xen emulation not implemented (yet)\n" ); +error_report ("xen emulation not implemented (yet)" );exit (1 );break ;default : -fprintf (stderr,"unhandled xen_mode %d\n" , xen_mode); +error_report ("unhandled xen_mode %d" , xen_mode);exit (1 );break ; }
The rest of the patch looks good.
Thanks,
Signature · 1 line
Anthony PERARD
PATCH v2 43/47 util: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisReplace a large number of the fprintf(stderr, "*\n" calls with error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +---
util/aio-posix.c | 5 +++-- util/coroutine-sigaltstack.c | 2 +- util/error.c | 2 +- util/main-loop.c | 2 +- util/mmap-alloc.c | 3 ++- util/module.c | 6 +++--- util/osdep.c | 4 ++-- util/oslib-posix.c | 3 ++- util/oslib-win32.c | 3 ++- util/qemu-coroutine.c | 5 +++-- util/qemu-progress.c | 3 ++- util/qemu-thread-posix.c | 5 +++-- util/qemu-thread-win32.c | 5 +++-- util/qemu-timer-common.c | 3 ++- util/qht.c | 2 +- 15 files changed, 31 insertions(+), 22 deletions(-)
util/aio-posix.c +3 -2
@@ -15,6 +15,7 @@#include "qemu/osdep.h" #include "qemu-common.h" +#include "qemu/error-report.h" #include "block/block.h" #include "qemu/rcu_queue.h" #include "qemu/sockets.h"
@@ -696,8 +697,8 @@ void aio_context_setup(AioContext *ctx) {/* TODO remove this in final patch submission */ if (getenv ("QEMU_AIO_POLL_MAX_NS" )) { -fprintf (stderr,"The QEMU_AIO_POLL_MAX_NS environment variable has " -"been replaced with -object iothread,poll-max-ns=NUM\n" ); +error_report ("The QEMU_AIO_POLL_MAX_NS environment variable has " +"been replaced with -object iothread,poll-max-ns=NUM" );exit (1 ); }
util/coroutine-sigaltstack.c +1 -1
@@ -80,7 +80,7 @@ static void __attribute__((constructor)) coroutine_init(void) ret =pthread_key_create (&thread_state_key, qemu_coroutine_thread_cleanup);if (ret !=0 ) { -fprintf (stderr,"unable to create leader key: %s\n" ,strerror (errno)); +error_report ("unable to create leader key: %s" ,strerror (errno));abort (); } }
util/error.c +1 -1
@@ -32,7 +32,7 @@ Error *error_fatal;static void error_handle_fatal (Error **errp,Error *err) {if (errp == &error_abort) { -fprintf (stderr,"Unexpected error in %s() at %s:%d:\n" , +error_report ("Unexpected error in %s() at %s:%d:" , err->func, err->src, err->line);error_report_err (err);abort ();
util/main-loop.c +1 -1
@@ -95,7 +95,7 @@ static int qemu_signal_init(void)sigdelset (&set,SIG_IPI ); sigfd =qemu_signalfd (&set);if (sigfd ==-1 ) { -fprintf (stderr,"failed to create signalfd\n" ); +error_report ("failed to create signalfd" );return -errno; }
util/mmap-alloc.c +2 -1
@@ -11,6 +11,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu/mmap-alloc.h" #include "qemu/host-utils.h"
@@ -51,7 +52,7 @@ size_t qemu_mempath_getpagesize(const char *mem_path) }while (ret !=0 && errno ==EINTR );if (ret !=0 ) { -fprintf (stderr,"Couldn't statfs() memory path: %s\n" , +error_report ("Couldn't statfs() memory path: %s" ,strerror (errno));exit (1 ); }
util/module.c +3 -3
@@ -124,13 +124,13 @@ static int module_load_file(const char *fname) g_module =g_module_open (fname,G_MODULE_BIND_LAZY |G_MODULE_BIND_LOCAL );if (!g_module) { -fprintf (stderr,"Failed to open module: %s\n" , +error_report ("Failed to open module: %s" ,g_module_error ()); ret = -EINVAL ; goto out; }if (!g_module_symbol (g_module,DSO_STAMP_FUN_STR , (gpointer *)&sym)) { -fprintf (stderr,"Failed to initialize module: %s\n" , +error_report ("Failed to initialize module: %s" , fname);/* Print some info if this is a QEMU module (but from different build), * this will make debugging user problems easier. */
@@ -169,7 +169,7 @@ void module_load_one(const char *prefix, const char *lib_name)static GHashTable *loaded_modules;if (!g_module_supported ()) { -fprintf (stderr,"Module is not supported by system.\n" ); +error_report ("Module is not supported by system." );return ; }
util/osdep.c +2 -2
@@ -425,7 +425,7 @@ void fips_set_state(bool requested)#endif /* __linux__ */ #ifdef _FIPS_DEBUG -fprintf (stderr,"FIPS mode %s (requested %s)\n" , +error_report ("FIPS mode %s (requested %s)" , (fips_enabled ?"enabled" :"disabled" ), (requested ?"enabled" :"disabled" ));#endif
@@ -452,7 +452,7 @@ int socket_init(void) ret =WSAStartup (MAKEWORD (2 ,2 ), &Data);if (ret !=0 ) { err =WSAGetLastError (); -fprintf (stderr,"WSAStartup: %d\n" , err); +error_report ("WSAStartup: %d" , err);return -1 ; }atexit (socket_cleanup);
util/oslib-posix.c +2 -1
@@ -34,6 +34,7 @@#include "sysemu/sysemu.h" #include "trace.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "qemu/sockets.h" #include <libgen.h> #include <sys/signal.h>
@@ -87,7 +88,7 @@ int qemu_daemon(int nochdir, int noclose)void *qemu_oom_check (void *ptr) {if (ptr ==NULL ) { -fprintf (stderr,"Failed to allocate memory: %s\n" ,strerror (errno)); +error_report ("Failed to allocate memory: %s" ,strerror (errno));abort (); }return ptr;
util/oslib-win32.c +2 -1
@@ -30,6 +30,7 @@* see the license comment there. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include <windows.h> #include "qapi/error.h" #include "sysemu/sysemu.h"
@@ -44,7 +45,7 @@void *qemu_oom_check (void *ptr) {if (ptr ==NULL ) { -fprintf (stderr,"Failed to allocate memory: %lu\n" ,GetLastError ()); +error_report ("Failed to allocate memory: %lu" ,GetLastError ());abort (); }return ptr;
util/qemu-coroutine.c +3 -2
@@ -13,6 +13,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "trace.h" #include "qemu-common.h" #include "qemu/thread.h"
@@ -110,7 +111,7 @@ void qemu_aio_coroutine_enter(AioContext *ctx, Coroutine *co)trace_qemu_aio_coroutine_enter (ctx, self, co, co->entry_arg);if (co->caller) { -fprintf (stderr,"Co-routine re-entered recursively\n" ); +error_report ("Co-routine re-entered recursively" );abort (); }
@@ -164,7 +165,7 @@ void coroutine_fn qemu_coroutine_yield(void)trace_qemu_coroutine_yield (self, to);if (!to) { -fprintf (stderr,"Co-routine is yielding to no one\n" ); +error_report ("Co-routine is yielding to no one" );abort (); }
util/qemu-progress.c +2 -1
@@ -23,6 +23,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" struct progress_state {
@@ -68,7 +69,7 @@ static void sigusr_print(int signal)static void progress_dummy_print (void ) {if (print_pending) { -fprintf (stderr," (%3.2f/100%%)\n" , state.current); +error_report (" (%3.2f/100%%)" , state.current); print_pending =0 ; } }
util/qemu-thread-posix.c +3 -2
@@ -11,6 +11,7 @@* */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu/thread.h" #include "qemu/atomic.h" #include "qemu/notify.h"
@@ -25,14 +26,14 @@ void qemu_thread_naming(bool enable)#ifndef CONFIG_THREAD_SETNAME_BYTHREAD /* This is a debugging option, not fatal */ if (enable) { -fprintf (stderr,"qemu: thread naming not supported on this host\n" ); +error_report ("qemu: thread naming not supported on this host" ); }#endif }static void error_exit (int err,const char *msg) { -fprintf (stderr,"qemu: %s: %s\n" , msg,strerror (err)); +error_report ("qemu: %s: %s" , msg,strerror (err));abort (); }
util/qemu-thread-win32.c +3 -2
@@ -16,6 +16,7 @@#endif #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "qemu/thread.h" #include "qemu/notify.h"
@@ -29,7 +30,7 @@ void qemu_thread_naming(bool enable)/* But note we don't actually name them on Windows yet */ name_threads = enable; -fprintf (stderr,"qemu: thread naming not supported on this host\n" ); +error_report ("qemu: thread naming not supported on this host" ); }static void error_exit (int err,const char *msg)
@@ -38,7 +39,7 @@ static void error_exit(int err, const char *msg)FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_ALLOCATE_BUFFER ,NULL , err,0 , (LPTSTR )&pstr,2 ,NULL ); -fprintf (stderr,"qemu: %s: %s\n" , msg, pstr); +error_report ("qemu: %s: %s" , msg, pstr);LocalFree (pstr);abort (); }
util/qemu-timer-common.c +2 -1
@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu/timer.h" /***********************************************************/
@@ -37,7 +38,7 @@ static void __attribute__((constructor)) init_get_clock(void)int ret; ret =QueryPerformanceFrequency (&freq);if (ret ==0 ) { -fprintf (stderr,"Could not calibrate ticks\n" ); +error_report ("Could not calibrate ticks" );exit (1 ); } clock_freq = freq.QuadPart;
util/qht.c +1 -1
@@ -154,7 +154,7 @@ static void qht_bucket_debug__locked(struct qht_bucket *b)continue ; }if (seen_empty) { -fprintf (stderr,"%s: b: %p, pos: %i, hash: 0x%x, p: %p\n" , +error_report ("%s: b: %p, pos: %i, hash: 0x%x, p: %p" , __func__, b, i, b->hashes[i], b->pointers[i]); corrupt = true; }
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH v2 43/47] util: Replace fprintf(stderr, "*\n" with error_report()
Quoted 38 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +
Quoted 1 line
Signed-off-by Alistair Francis <[email protected]>
Quoted 345 lines
Cc Kevin Wolf <[email protected]>Cc Markus Armbruster <[email protected]>Cc Paolo Bonzini <[email protected]>Cc Stefan Weil <[email protected]>---
util/aio-posix.c | 5 +++-- util/coroutine-sigaltstack.c | 2 +- util/error.c | 2 +- util/main-loop.c | 2 +- util/mmap-alloc.c | 3 ++- util/module.c | 6 +++--- util/osdep.c | 4 ++-- util/oslib-posix.c | 3 ++- util/oslib-win32.c | 3 ++- util/qemu-coroutine.c | 5 +++-- util/qemu-progress.c | 3 ++- util/qemu-thread-posix.c | 5 +++-- util/qemu-thread-win32.c | 5 +++-- util/qemu-timer-common.c | 3 ++- util/qht.c | 2 +- 15 files changed, 31 insertions(+), 22 deletions(-)util/aio-posix.c +3
-2@@ -15,6 +15,7 @@#include "qemu/osdep.h" #include "qemu-common.h" +#include "qemu/error-report.h" #include "block/block.h" #include "qemu/rcu_queue.h" #include "qemu/sockets.h" @@ -696,8 +697,8 @@ void aio_context_setup(AioContext *ctx) {/* TODO remove this in final patch submission */ if (getenv ("QEMU_AIO_POLL_MAX_NS" )) { -fprintf (stderr,"The QEMU_AIO_POLL_MAX_NS environment variable has " -"been replaced with -object iothread,poll-max-ns=NUM\n" ); +error_report ("The QEMU_AIO_POLL_MAX_NS environment variable has " +"been replaced with -object iothread,poll-max-ns=NUM" );exit (1 ); }util/coroutine-sigaltstack.c +1
-1@@ -80,7 +80,7 @@ static void __attribute__((constructor)) coroutine_init(void) ret =pthread_key_create (&thread_state_key, qemu_coroutine_thread_cleanup);if (ret !=0 ) { -fprintf (stderr,"unable to create leader key: %s\n" ,strerror (errno)); +error_report ("unable to create leader key: %s" ,strerror (errno));abort (); } }util/error.c +1
-1@@ -32,7 +32,7 @@ Error *error_fatal;static void error_handle_fatal (Error **errp,Error *err) {if (errp == &error_abort) { -fprintf (stderr,"Unexpected error in %s() at %s:%d:\n" , +error_report ("Unexpected error in %s() at %s:%d:" , err->func, err->src, err->line);error_report_err (err);abort ();util/main-loop.c +1
-1@@ -95,7 +95,7 @@ static int qemu_signal_init(void)sigdelset (&set,SIG_IPI ); sigfd =qemu_signalfd (&set);if (sigfd ==-1 ) { -fprintf (stderr,"failed to create signalfd\n" ); +error_report ("failed to create signalfd" );return -errno; }util/mmap-alloc.c +2
-1@@ -11,6 +11,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu/mmap-alloc.h" #include "qemu/host-utils.h" @@ -51,7 +52,7 @@ size_t qemu_mempath_getpagesize(const char *mem_path) }while (ret !=0 && errno ==EINTR );if (ret !=0 ) { -fprintf (stderr,"Couldn't statfs() memory path: %s\n" , +error_report ("Couldn't statfs() memory path: %s" ,strerror (errno));exit (1 ); }util/module.c +3
-3@@ -124,13 +124,13 @@ static int module_load_file(const char *fname) g_module =g_module_open (fname,G_MODULE_BIND_LAZY |G_MODULE_BIND_LOCAL );if (!g_module) { -fprintf (stderr,"Failed to open module: %s\n" , +error_report ("Failed to open module: %s" ,g_module_error ()); ret = -EINVAL ; goto out; }if (!g_module_symbol (g_module,DSO_STAMP_FUN_STR , (gpointer *)&sym)) { -fprintf (stderr,"Failed to initialize module: %s\n" , +error_report ("Failed to initialize module: %s" , fname);/* Print some info if this is a QEMU module (but from different build), * this will make debugging user problems easier. */ @@ -169,7 +169,7 @@ void module_load_one(const char *prefix, const char *lib_name)static GHashTable *loaded_modules;if (!g_module_supported ()) { -fprintf (stderr,"Module is not supported by system.\n" ); +error_report ("Module is not supported by system." );return ; }util/osdep.c +2
-2@@ -425,7 +425,7 @@ void fips_set_state(bool requested)#endif /* __linux__ */ #ifdef _FIPS_DEBUG -fprintf (stderr,"FIPS mode %s (requested %s)\n" , +error_report ("FIPS mode %s (requested %s)" , (fips_enabled ?"enabled" :"disabled" ), (requested ?"enabled" :"disabled" ));#endif @@ -452,7 +452,7 @@ int socket_init(void) ret =WSAStartup (MAKEWORD (2 ,2 ), &Data);if (ret !=0 ) { err =WSAGetLastError (); -fprintf (stderr,"WSAStartup: %d\n" , err); +error_report ("WSAStartup: %d" , err);return -1 ; }atexit (socket_cleanup);util/oslib-posix.c +2
-1@@ -34,6 +34,7 @@#include "sysemu/sysemu.h" #include "trace.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "qemu/sockets.h" #include <libgen.h> #include <sys/signal.h> @@ -87,7 +88,7 @@ int qemu_daemon(int nochdir, int noclose)void *qemu_oom_check (void *ptr) {if (ptr ==NULL ) { -fprintf (stderr,"Failed to allocate memory: %s\n" ,strerror (errno)); +error_report ("Failed to allocate memory: %s" ,strerror (errno));abort (); }return ptr;util/oslib-win32.c +2
-1@@ -30,6 +30,7 @@* see the license comment there. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include <windows.h> #include "qapi/error.h" #include "sysemu/sysemu.h" @@ -44,7 +45,7 @@void *qemu_oom_check (void *ptr) {if (ptr ==NULL ) { -fprintf (stderr,"Failed to allocate memory: %lu\n" ,GetLastError ()); +error_report ("Failed to allocate memory: %lu" ,GetLastError ());abort (); }return ptr;util/qemu-coroutine.c +3
-2@@ -13,6 +13,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "trace.h" #include "qemu-common.h" #include "qemu/thread.h" @@ -110,7 +111,7 @@ void qemu_aio_coroutine_enter(AioContext *ctx, Coroutine *co)trace_qemu_aio_coroutine_enter (ctx, self, co, co->entry_arg);if (co->caller) { -fprintf (stderr,"Co-routine re-entered recursively\n" ); +error_report ("Co-routine re-entered recursively" );abort (); }@@ -164,7 +165,7 @@ void coroutine_fn qemu_coroutine_yield(void)trace_qemu_coroutine_yield (self, to);if (!to) { -fprintf (stderr,"Co-routine is yielding to no one\n" ); +error_report ("Co-routine is yielding to no one" );abort (); }util/qemu-progress.c +2
-1@@ -23,6 +23,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" struct progress_state {@@ -68,7 +69,7 @@ static void sigusr_print(int signal)static void progress_dummy_print (void ) {if (print_pending) { -fprintf (stderr," (%3.2f/100%%)\n" , state.current); +error_report (" (%3.2f/100%%)" , state.current); print_pending =0 ; } }util/qemu-thread-posix.c +3
-2@@ -11,6 +11,7 @@* */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu/thread.h" #include "qemu/atomic.h" #include "qemu/notify.h" @@ -25,14 +26,14 @@ void qemu_thread_naming(bool enable)#ifndef CONFIG_THREAD_SETNAME_BYTHREAD /* This is a debugging option, not fatal */ if (enable) { -fprintf (stderr,"qemu: thread naming not supported on this host\n" ); +error_report ("qemu: thread naming not supported on this host" ); }#endif }static void error_exit (int err,const char *msg) { -fprintf (stderr,"qemu: %s: %s\n" , msg,strerror (err)); +error_report ("qemu: %s: %s" , msg,strerror (err));abort (); }util/qemu-thread-win32.c +3
-2@@ -16,6 +16,7 @@#endif #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "qemu/thread.h" #include "qemu/notify.h" @@ -29,7 +30,7 @@ void qemu_thread_naming(bool enable)/* But note we don't actually name them on Windows yet */ name_threads = enable; -fprintf (stderr,"qemu: thread naming not supported on this host\n" ); +error_report ("qemu: thread naming not supported on this host" ); }static void error_exit (int err,const char *msg)@@ -38,7 +39,7 @@ static void error_exit(int err, const char *msg)FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_ALLOCATE_BUFFER ,NULL , err,0 , (LPTSTR )&pstr,2 ,NULL ); -fprintf (stderr,"qemu: %s: %s\n" , msg, pstr); +error_report ("qemu: %s: %s" , msg, pstr);LocalFree (pstr);abort (); }util/qemu-timer-common.c +2
-1@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu/timer.h" /***********************************************************/ @@ -37,7 +38,7 @@ static void __attribute__((constructor)) init_get_clock(void)int ret; ret =QueryPerformanceFrequency (&freq);if (ret ==0 ) { -fprintf (stderr,"Could not calibrate ticks\n" ); +error_report ("Could not calibrate ticks" );exit (1 ); } clock_freq = freq.QuadPart;util/qht.c +1
-1@@ -154,7 +154,7 @@ static void qht_bucket_debug__locked(struct qht_bucket *b)continue ; }if (seen_empty) { -fprintf (stderr,"%s: b: %p, pos: %i, hash: 0x%x, p: %p\n" , +error_report ("%s: b: %p, pos: %i, hash: 0x%x, p: %p" , __func__, b, i, b->hashes[i], b->pointers[i]); corrupt = true; }
PATCH v2 44/47 ui: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisReplace a large number of the fprintf(stderr, "*\n" calls with error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +---
ui/cocoa.m | 6 +++--- ui/console.c | 2 +- ui/curses.c | 2 +- ui/cursor.c | 10 +++++----- ui/gtk.c | 10 +++++----- ui/input-linux.c | 3 ++- ui/keymaps.c | 4 ++-- ui/sdl.c | 14 +++++++------- ui/sdl2.c | 8 ++++---- ui/sdl_zoom.c | 3 ++- ui/shader.c | 9 +++++---- ui/spice-display.c | 10 +++++----- ui/vnc-enc-tight.c | 4 ++-- ui/vnc-enc-zlib.c | 4 ++-- ui/vnc-enc-zrle.c | 4 ++-- ui/vnc.c | 2 +- 16 files changed, 49 insertions(+), 46 deletions(-)
ui/cocoa.m +3 -3
@@ -235,7 +235,7 @@ const int mac_to_qkeycode_map[] = { static int cocoa_keycode_to_qemu(int keycode) { if (ARRAY_SIZE(mac_to_qkeycode_map) <= keycode) { - fprintf(stderr, "(cocoa) warning unknown keycode 0x%x\n", keycode); + error_report("(cocoa) warning unknown keycode 0x%x", keycode); return 0; } return mac_to_qkeycode_map[keycode];
@@ -908,7 +908,7 @@ QemuCocoaView *cocoaView; // create a view and add it to the window cocoaView = [[QemuCocoaView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 640.0, 480.0)]; if(!cocoaView) { - fprintf(stderr, "(cocoa) can't create a view\n"); + error_report("(cocoa) can't create a view"); exit(1); }
@@ -917,7 +917,7 @@ QemuCocoaView *cocoaView; styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskClosable backing:NSBackingStoreBuffered defer:NO]; if(!normalWindow) { - fprintf(stderr, "(cocoa) can't create window\n"); + error_report("(cocoa) can't create window"); exit(1); } [normalWindow setAcceptsMouseMovedEvents:YES];
ui/console.c +1 -1
@@ -1417,7 +1417,7 @@ void register_displaychangelistener(DisplayChangeListener *dcl)/* display has opengl support */ assert (dcl->con);if (dcl->con->gl) { -fprintf (stderr,"can't register two opengl displays (%s, %s)\n" , +error_report ("can't register two opengl displays (%s, %s)" , dcl->ops->dpy_name, dcl->con->gl->ops->dpy_name);exit (1 ); }
ui/curses.c +1 -1
@@ -423,7 +423,7 @@ void curses_display_init(DisplayState *ds, int full_screen) {#ifndef _WIN32if (!isatty (1 )) { -fprintf (stderr,"We need a terminal output\n" ); +error_report ("We need a terminal output" );exit (1 ); }#endif
ui/cursor.c +5 -5
@@ -18,12 +18,12 @@ static QEMUCursor *cursor_parse_xpm(const char *xpm[])/* parse header line: width, height, #colors, #chars */ if (sscanf (xpm[line],"%u %u %u %u" , &width, &height, &colors, &chars) !=4 ) { -fprintf (stderr,"%s: header parse error: \"%s\"\n" , - __func__, xpm[line]); +error_report ("%s: header parse error: \"%s\"" , + __func__, xpm[line]);return NULL ; }if (chars !=1 ) { -fprintf (stderr,"%s: chars != 1 not supported\n" , __func__); +error_report ("%s: chars != 1 not supported" , __func__);return NULL ; } line++;
@@ -40,7 +40,7 @@ static QEMUCursor *cursor_parse_xpm(const char *xpm[])continue ; } } -fprintf (stderr,"%s: color parse error: \"%s\"\n" , +error_report ("%s: color parse error: \"%s\"" , __func__, xpm[line]);return NULL ; }
@@ -75,7 +75,7 @@ void cursor_print_ascii_art(QEMUCursor *c, const char *prefix)fprintf (stderr,"o" );/* other */ } } -fprintf (stderr,"|\n" ); +error_report ("|" ); } }
ui/gtk.c +5 -5
@@ -1254,7 +1254,7 @@ static gboolean gd_win_grab(void *opaque) {VirtualConsole *vc = opaque; -fprintf (stderr,"%s: %s\n" , __func__, vc->label); +error_report ("%s: %s" , __func__, vc->label);if (vc->s->ptr_owner) {gd_ungrab_pointer (vc->s); }else {
@@ -2210,12 +2210,12 @@ static void gd_set_keycode_type(GtkDisplayState *s) keycodes =XGetAtomName (x11_display, desc->names->keycodes); }if (keycodes ==NULL ) { -fprintf (stderr,"could not lookup keycode name\n" ); +error_report ("could not lookup keycode name" ); }else if (strstart (keycodes,"evdev" ,NULL )) { s->has_evdev = true; }else if (!strstart (keycodes,"xfree86" ,NULL )) { -fprintf (stderr,"unknown keycodes `%s', please report to " -"[email protected]\n" , keycodes); +error_report ("unknown keycodes `%s', please report to " +"[email protected]" , keycodes); }if (desc) {
@@ -2239,7 +2239,7 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)GdkDisplay *window_display;if (!gtkinit) { -fprintf (stderr,"gtk initialization failed\n" ); +error_report ("gtk initialization failed" );exit (1 ); }
ui/input-linux.c +2 -1
@@ -5,6 +5,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "qemu/config-file.h"
@@ -241,7 +242,7 @@ static void input_linux_event(void *opaque) rc =read (il->fd, &p[il->read_offset], read_size);if (rc != read_size) {if (rc <0 && errno !=EAGAIN ) { -fprintf (stderr,"%s: read: %s\n" , __func__,strerror (errno)); +error_report ("%s: read: %s" , __func__,strerror (errno));qemu_set_fd_handler (il->fd,NULL ,NULL ,NULL );close (il->fd); }else if (rc >0 ) {
ui/keymaps.c +2 -2
@@ -105,7 +105,7 @@ static kbd_layout_t *parse_keyboard_layout(const name2keysym_t *table, f = filename ?fopen (filename,"r" ) :NULL ;g_free (filename);if (!f) { -fprintf (stderr,"Could not read keymap file: '%s'\n" , language); +error_report ("Could not read keymap file: '%s'" , language);return NULL ; }
@@ -150,7 +150,7 @@ static kbd_layout_t *parse_keyboard_layout(const name2keysym_t *table,if (strstr (rest,"numlock" )) {add_to_key_range (&k->keypad_range, keycode);add_to_key_range (&k->numlock_range, keysym); -/* fprintf(stderr, "keypad keysym %04x keycode %d\n", +/* error_report("keypad keysym %04x keycode %d", keysym, keycode); */ }
ui/sdl.c +7 -7
@@ -91,7 +91,7 @@ static void sdl_update(DisplayChangeListener *dcl,SDL_BlitSurface (guest_screen, &rec, real_screen, &rec); }else {if (sdl_zoom_blit (guest_screen, real_screen,SMOOTHING_ON , &rec) <0 ) { -fprintf (stderr,"Zoom blit failed\n" ); +error_report ("Zoom blit failed" );exit (1 ); } }
@@ -120,7 +120,7 @@ static void do_sdl_resize(int width, int height, int bpp) tmp_screen =SDL_SetVideoMode (width, height, bpp, flags);if (!real_screen) {if (!tmp_screen) { -fprintf (stderr,"Could not open SDL display (%dx%dx%d): %s\n" , +error_report ("Could not open SDL display (%dx%dx%d): %s" , width, height, bpp,SDL_GetError ());exit (1 ); }
@@ -130,7 +130,7 @@ static void do_sdl_resize(int width, int height, int bpp)* resolution failed. */ if (!tmp_screen) { -fprintf (stderr,"Failed to set SDL display (%dx%dx%d): %s\n" , +error_report ("Failed to set SDL display (%dx%dx%d): %s" , width, height, bpp,SDL_GetError ());return ; }
@@ -241,12 +241,12 @@ static int check_for_evdev(void) XkbKeycodesNameMask, desc) == Success)) { keycodes =XGetAtomName (info.info.x11.display, desc->names->keycodes);if (keycodes ==NULL ) { -fprintf (stderr,"could not lookup keycode name\n" ); +error_report ("could not lookup keycode name" ); }else if (strstart (keycodes,"evdev" ,NULL )) { has_evdev =1 ; }else if (!strstart (keycodes,"xfree86" ,NULL )) { -fprintf (stderr,"unknown keycodes `%s', please report to " -"[email protected]\n" , keycodes); +error_report ("unknown keycodes `%s', please report to " +"[email protected]" , keycodes); } }
@@ -988,7 +988,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) flags =SDL_INIT_VIDEO |SDL_INIT_NOPARACHUTE ;if (SDL_Init (flags)) { -fprintf (stderr,"Could not initialize SDL(%s) - exiting\n" , +error_report ("Could not initialize SDL(%s) - exiting" ,SDL_GetError ());exit (1 ); }
ui/sdl2.c +4 -4
@@ -400,7 +400,7 @@ static void handle_keydown(SDL_Event *ev) 160); height = (surface_height (scon->surface) * width) /surface_width (scon->surface); -fprintf (stderr,"%s: scale to %dx%d\n" , +error_report ("%s: scale to %dx%d" , __func__, width, height);sdl_scale (scon, width, height);sdl2_redraw (scon);
@@ -686,13 +686,13 @@ static void sdl_mouse_define(DisplayChangeListener *dcl, 0xff0000, 0x00ff00, 0xff, 0xff000000);if (!guest_sprite_surface) { -fprintf (stderr,"Failed to make rgb surface from %p\n" , c); +error_report ("Failed to make rgb surface from %p" , c);return ; } guest_sprite =SDL_CreateColorCursor (guest_sprite_surface, c->hot_x, c->hot_y);if (!guest_sprite) { -fprintf (stderr,"Failed to make color cursor from %p\n" , c); +error_report ("Failed to make color cursor from %p" , c);return ; } if (guest_cursor &&
@@ -783,7 +783,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) flags =SDL_INIT_VIDEO |SDL_INIT_NOPARACHUTE ;if (SDL_Init (flags)) { -fprintf (stderr,"Could not initialize SDL(%s) - exiting\n" , +error_report ("Could not initialize SDL(%s) - exiting" ,SDL_GetError ());exit (1 ); }
ui/sdl_zoom.c +2 -1
@@ -12,6 +12,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "sdl_zoom.h" static void sdl_zoom_rgb16(SDL_Surface *src, SDL_Surface *dst, int smooth,
@@ -81,7 +82,7 @@ int sdl_zoom_blit(SDL_Surface *src_sfc, SDL_Surface *dst_sfc, int smooth,else if (src_sfc->format->BitsPerPixel ==16 )sdl_zoom_rgb16 (src_sfc, dst_sfc, smooth, &zoom);else { -fprintf (stderr,"pixel format not supported\n" ); +error_report ("pixel format not supported" );return -1 ; }
ui/shader.c +5 -4
@@ -25,6 +25,7 @@* THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "ui/shader.h"
@@ -85,9 +86,9 @@ GLuint qemu_gl_create_compile_shader(GLenum type, const GLchar *src)glGetShaderiv (shader,GL_INFO_LOG_LENGTH , &length); errmsg =g_malloc (length);glGetShaderInfoLog (shader, length, &length, errmsg); -fprintf (stderr,"%s: compile %s error\n%s\n" , __func__, - (type ==GL_VERTEX_SHADER ) ?"vertex" :"fragment" , - errmsg); +error_report ("%s: compile %s error: %s" , __func__, + (type ==GL_VERTEX_SHADER ) ?"vertex" :"fragment" , + errmsg);g_free (errmsg);return 0 ; }
@@ -110,7 +111,7 @@ GLuint qemu_gl_create_link_program(GLuint vert, GLuint frag)glGetProgramiv (program,GL_INFO_LOG_LENGTH , &length); errmsg =g_malloc (length);glGetProgramInfoLog (program, length, &length, errmsg); -fprintf (stderr,"%s: link program: %s\n" , __func__, errmsg); +error_report ("%s: link program: %s" , __func__, errmsg);g_free (errmsg);return 0 ; }
ui/spice-display.c +5 -5
@@ -630,13 +630,13 @@ static int interface_req_cursor_notification(QXLInstance *sin)static void interface_notify_update (QXLInstance *sin,uint32_t update_id) { -fprintf (stderr,"%s: abort()\n" , __func__); +error_report ("%s: abort()" , __func__);abort (); }static int interface_flush_resources (QXLInstance *sin) { -fprintf (stderr,"%s: abort()\n" , __func__); +error_report ("%s: abort()" , __func__);abort ();return 0 ; }
@@ -646,7 +646,7 @@ static void interface_update_area_complete(QXLInstance *sin, QXLRect *dirty, uint32_t num_updated_rects) {/* should never be called, used in qxl native mode only */ - fprintf(stderr, "%s: abort()\n", __func__); +error_report ("%s: abort()" , __func__);abort (); }
@@ -671,7 +671,7 @@ static void interface_async_complete(QXLInstance *sin, uint64_t cookie_token)#endif default :/* should never be called, used in qxl native mode only */ -fprintf (stderr,"%s: abort()\n" , __func__); +error_report ("%s: abort()" , __func__);abort (); }g_free (cookie);
@@ -955,7 +955,7 @@ static void qemu_spice_gl_scanout_texture(DisplayChangeListener *dcl,assert (tex_id); fd =egl_get_fd_for_texture (tex_id, &stride, &fourcc);if (fd <0 ) { -fprintf (stderr,"%s: failed to get fd for texture\n" , __func__); +error_report ("%s: failed to get fd for texture" , __func__);return ; } dprint(1, "%s: %dx%d (stride %d, fourcc 0x%x)\n", __func__,
ui/vnc-enc-tight.c +2 -2
@@ -800,7 +800,7 @@ static int tight_init_stream(VncState *vs, int stream_id, MAX_MEM_LEVEL, strategy);if (err !=Z_OK ) { -fprintf (stderr,"VNC: error initializing zlib\n" ); +error_report ("VNC: error initializing zlib" );return -1 ; }
@@ -865,7 +865,7 @@ static int tight_compress_data(VncState *vs, int stream_id, size_t bytes,/* start encoding */ if (deflate (zstream,Z_SYNC_FLUSH ) !=Z_OK ) { -fprintf (stderr,"VNC: error during tight compression\n" ); +error_report ("VNC: error during tight compression" );return -1 ; }
ui/vnc-enc-zlib.c +2 -2
@@ -80,7 +80,7 @@ static int vnc_zlib_stop(VncState *vs) MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY);if (err !=Z_OK ) { -fprintf (stderr,"VNC: error initializing zlib\n" ); +error_report ("VNC: error initializing zlib" );return -1 ; }
@@ -109,7 +109,7 @@ static int vnc_zlib_stop(VncState *vs)// start encoding if (deflate (zstream,Z_SYNC_FLUSH ) !=Z_OK ) { -fprintf (stderr,"VNC: error during zlib compression\n" ); +error_report ("VNC: error during zlib compression" );return -1 ; }
ui/vnc-enc-zrle.c +2 -2
@@ -85,7 +85,7 @@ static int zrle_compress_data(VncState *vs, int level) MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY);if (err !=Z_OK ) { -fprintf (stderr,"VNC: error initializing zlib\n" ); +error_report ("VNC: error initializing zlib" );return -1 ; }
@@ -104,7 +104,7 @@ static int zrle_compress_data(VncState *vs, int level)/* start encoding */ if (deflate (zstream,Z_SYNC_FLUSH ) !=Z_OK ) { -fprintf (stderr,"VNC: error during zrle compression\n" ); +error_report ("VNC: error during zrle compression" );return -1 ; }
ui/vnc.c +1 -1
@@ -71,7 +71,7 @@ static void vnc_set_share_mode(VncState *vs, VncShareMode mode) [VNC_SHARE_MODE_EXCLUSIVE] = "exclusive", [VNC_SHARE_MODE_DISCONNECTED ] ="disconnected" , }; -fprintf (stderr,"%s/%p: %s -> %s\n" , __func__, +error_report ("%s/%p: %s -> %s" , __func__, vs->ioc, mn[vs->share_mode], mn[mode]);#endif
Signature · 1 line
2.11.0
PATCH v2 45/47 tcg: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisReplace a large number of the fprintf(stderr, "*\n" calls with error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +---
cpus.c | 8 ++++---- exec.c | 14 +++++++------- tcg/optimize.c | 8 ++++---- tcg/tcg.c | 2 +- tcg/tcg.h | 3 ++- tcg/tci.c | 2 +- tcg/tci/tcg-target.inc.c | 4 ++-- vl.c | 2 +- 8 files changed, 22 insertions(+), 21 deletions(-)
cpus.c +4 -4
@@ -258,7 +258,7 @@ int64_t cpu_get_icount_raw(void)if (cpu && cpu->running) {if (!cpu->can_do_io) { -fprintf (stderr,"Bad icount read\n" ); +error_report ("Bad icount read" );exit (1 ); }/* Take into account what has run */
@@ -1113,7 +1113,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg) r =kvm_init_vcpu (cpu);if (r <0 ) { -fprintf (stderr,"kvm_init_vcpu failed: %s\n" ,strerror (-r)); +error_report ("kvm_init_vcpu failed: %s" ,strerror (-r));exit (1 ); }
@@ -1143,7 +1143,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg)static void *qemu_dummy_cpu_thread_fn (void *arg) {#ifdef _WIN32 -fprintf (stderr,"qtest is not supported under Windows\n" ); +error_report ("qtest is not supported under Windows" );exit (1 );#else CPUState *cpu = arg;
@@ -1525,7 +1525,7 @@ static void qemu_cpu_kick_thread(CPUState *cpu)#else /* _WIN32 */ if (!qemu_cpu_is_self (cpu)) {if (!QueueUserAPC (dummy_apc_func, cpu->hThread,0 )) { -fprintf (stderr,"%s: QueueUserAPC failed with error %lu\n" , +error_report ("%s: QueueUserAPC failed with error %lu" , __func__,GetLastError ());exit (1 ); }
exec.c +7 -7
@@ -1045,7 +1045,7 @@ static RAMBlock *qemu_get_ram_block(ram_addr_t addr) } } -fprintf (stderr,"Bad ram offset %" PRIx64"\n" , (uint64_t )addr); +error_report ("Bad ram offset %" PRIx64"" , (uint64_t )addr);abort (); found:
@@ -1658,7 +1658,7 @@ static ram_addr_t find_ram_offset(ram_addr_t size) }if (offset ==RAM_ADDR_MAX ) { -fprintf (stderr,"Failed to find gap of requested size: %" PRIu64"\n" , +error_report ("Failed to find gap of requested size: %" PRIu64"" , (uint64_t )size);abort (); }
@@ -1688,8 +1688,8 @@ static void qemu_ram_setup_dump(void *addr, ram_addr_t size) ret =qemu_madvise (addr, size,QEMU_MADV_DONTDUMP );if (ret) {perror ("qemu_madvise" ); -fprintf (stderr,"madvise doesn't support MADV_DONTDUMP, " -"but dump_guest_core=off specified\n" ); +error_report ("madvise doesn't support MADV_DONTDUMP, " +"but dump_guest_core=off specified" ); } } }
@@ -1725,7 +1725,7 @@ void qemu_ram_set_idstr(RAMBlock *new_block, const char *name, DeviceState *dev)RAMBLOCK_FOREACH (block) {if (block != new_block && !strcmp (block->idstr, new_block->idstr)) { -fprintf (stderr,"RAMBlock \"%s\" already registered, abort!\n" , +error_report ("RAMBlock \"%s\" already registered, abort!" , new_block->idstr);abort (); }
@@ -2153,8 +2153,8 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length) flags, -1, 0); }if (area != vaddr) { -fprintf (stderr,"Could not remap addr: " -RAM_ADDR_FMT "@" RAM_ADDR_FMT "\n" , +error_report ("Could not remap addr: " +RAM_ADDR_FMT "@" RAM_ADDR_FMT "" , length, addr);exit (1 ); }
tcg/optimize.c +4 -4
@@ -96,8 +96,8 @@ static TCGOpcode op_to_mov(TCGOpcode op)case 64 :return INDEX_op_mov_i64;default : -fprintf (stderr,"op_to_mov: unexpected return value of " -"function op_bits.\n" ); +error_report ("op_to_mov: unexpected return value of " +"function op_bits." );tcg_abort (); } }
@@ -110,8 +110,8 @@ static TCGOpcode op_to_movi(TCGOpcode op)case 64 :return INDEX_op_movi_i64;default : -fprintf (stderr,"op_to_movi: unexpected return value of " -"function op_bits.\n" ); +error_report ("op_to_movi: unexpected return value of " +"function op_bits." );tcg_abort (); } }
tcg/tcg.c +1 -1
@@ -673,7 +673,7 @@ static void tcg_temp_free_internal(int idx)#if defined(CONFIG_DEBUG_TCG ) s->temps_in_use--;if (s->temps_in_use <0 ) { -fprintf (stderr,"More temporaries freed than allocated!\n" ); +error_report ("More temporaries freed than allocated!" ); }#endif
tcg/tcg.h +2 -1
@@ -29,6 +29,7 @@#include "cpu.h" #include "exec/tb-context.h" #include "qemu/bitops.h" +#include "qemu/error-report.h" #include "tcg-mo.h" #include "tcg-target.h"
@@ -897,7 +898,7 @@ typedef struct TCGTargetOpDef {#define tcg_abort () \ do {\ - fprintf(stderr, "%s:%d: tcg fatal error\n", __FILE__, __LINE__);\ + error_report("%s:%d: tcg fatal error", __FILE__, __LINE__);\ abort();\ } while (0)
tcg/tci.c +1 -1
@@ -35,7 +35,7 @@/* Marker for missing code. */ #define TODO () \ do { \ - fprintf(stderr, "TODO %s:%u: %s()\n", \ + error_report("TODO %s:%u: %s()", \ __FILE__, __LINE__, __func__); \ tcg_abort(); \ } while (0)
tcg/tci/tcg-target.inc.c +2 -2
@@ -29,7 +29,7 @@/* Marker for missing code. */ #define TODO () \ do { \ - fprintf(stderr, "TODO %s:%u: %s()\n", \ + error_report("TODO %s:%u: %s()", \ __FILE__, __LINE__, __func__); \ tcg_abort(); \ } while (0)
@@ -403,7 +403,7 @@ static const char *target_parse_constraint(TCGArgConstraint *ct,void tci_disas (uint8_t opc) {const TCGOpDef *def = &tcg_op_defs[opc]; -fprintf (stderr,"TCG %s %u, %u, %u\n" , +error_report ("TCG %s %u, %u, %u" , def->name, def->nb_oargs, def->nb_iargs, def->nb_cargs); }#endif
vl.c +1 -1
@@ -2232,7 +2232,7 @@ static DisplayType select_display(const char *p) display_opengl =1 ; display =DT_EGL ;#else -fprintf (stderr,"egl support is disabled\n" ); +error_report ("egl support is disabled" );exit (1 );#endif }else if (strstart (p,"curses" , &opts)) {
Signature · 1 line
2.11.0
PATCH v2 46/47 target: Use qemu_log() instead of fprintf(stderr, ...)
In reply to Alistair Francis---
target/cris/translate.c | 2 +- target/ppc/translate.c | 22 +++++++++++----------- target/sh4/translate.c | 4 ++-- target/unicore32/translate.c | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-)
target/cris/translate.c +1 -1
@@ -138,7 +138,7 @@ typedef struct DisasContext {static void gen_BUG (DisasContext *dc,const char *file,int line) { -fprintf (stderr,"BUG: pc=%x %s %d\n" , dc->pc, file, line); +qemu_log ("BUG: pc=%x %s %d\n" , dc->pc, file, line);if (qemu_log_separate ()) {qemu_log ("BUG: pc=%x %s %d\n" , dc->pc, file, line); }
target/ppc/translate.c +11 -11
@@ -3943,11 +3943,11 @@ static inline void gen_op_mfspr(DisasContext *ctx)* allowing userland application to read the PVR */ if (sprn !=SPR_PVR ) { -fprintf (stderr,"Trying to read privileged spr %d (0x%03x) at " - TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 ); +qemu_log ("Trying to read privileged spr %d (0x%03x) at " + TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 );if (qemu_log_separate ()) {qemu_log ("Trying to read privileged spr %d (0x%03x) at " - TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 ); + TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 ); } }gen_priv_exception (ctx,POWERPC_EXCP_PRIV_REG );
@@ -3960,8 +3960,8 @@ static inline void gen_op_mfspr(DisasContext *ctx)return ; }/* Not defined */ -fprintf (stderr,"Trying to read invalid spr %d (0x%03x) at " - TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 ); +qemu_log ("Trying to read invalid spr %d (0x%03x) at " + TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 );if (qemu_log_separate ()) {qemu_log ("Trying to read invalid spr %d (0x%03x) at " TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 );
@@ -4106,8 +4106,8 @@ static void gen_mtspr(DisasContext *ctx) (*write_cb)(ctx, sprn,rS (ctx->opcode)); }else {/* Privilege exception */ -fprintf (stderr,"Trying to write privileged spr %d (0x%03x) at " - TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 ); +qemu_log ("Trying to write privileged spr %d (0x%03x) at " + TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 );if (qemu_log_separate ()) {qemu_log ("Trying to write privileged spr %d (0x%03x) at " TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 );
@@ -4127,8 +4127,8 @@ static void gen_mtspr(DisasContext *ctx)qemu_log ("Trying to write invalid spr %d (0x%03x) at " TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 ); } -fprintf (stderr,"Trying to write invalid spr %d (0x%03x) at " - TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 ); +qemu_log ("Trying to write invalid spr %d (0x%03x) at " + TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 );/* The behaviour depends on MSR:PR and SPR# bit 0x10,
@@ -7370,8 +7370,8 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)break ; }if (tcg_check_temp_count ()) { -fprintf (stderr,"Opcode %02x %02x %02x %02x (%08x) leaked " -"temporaries\n" ,opc1 (ctx.opcode),opc2 (ctx.opcode), +qemu_log ("Opcode %02x %02x %02x %02x (%08x) leaked " +"temporaries\n" ,opc1 (ctx.opcode),opc2 (ctx.opcode),opc3 (ctx.opcode),opc4 (ctx.opcode), ctx.opcode);exit (1 ); }
target/sh4/translate.c +2 -2
@@ -438,7 +438,7 @@ static void _decode_opc(DisasContext * ctx) }#if 0 -fprintf (stderr,"Translating opcode 0x%04x\n" , ctx->opcode); +qemu_log ("Translating opcode 0x%04x\n" , ctx->opcode);#endif switch (ctx->opcode) {
@@ -1799,7 +1799,7 @@ static void _decode_opc(DisasContext * ctx)break ; }#if 0 -fprintf (stderr,"unknown instruction 0x%04x at pc 0x%08x\n" , +qemu_log_mask (LOG_UNIMP ,"unknown instruction 0x%04x at pc 0x%08x\n" , ctx->opcode, ctx->pc);fflush (stderr);#endif
target/unicore32/translate.c +1 -1
@@ -1940,7 +1940,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)disas_uc32_insn (env, dc);if (num_temps) { -fprintf (stderr,"Internal resource leak before %08x\n" , dc->pc); +qemu_log ("Internal resource leak before %08x\n" , dc->pc); num_temps =0 ; }
Signature · 1 line
2.11.0
PATCH v2 47/47 target: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisReplace a large number of the fprintf(stderr, "*\n" calls with error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +Some lines where then manually tweaked to pass checkpatch.
---
target/arm/arm-powerctl.c | 5 +++-- target/arm/arm-semi.c | 3 ++- target/arm/helper.c | 4 ++-- target/arm/kvm.c | 16 ++++++------- target/arm/kvm32.c | 2 +- target/arm/kvm64.c | 2 +- target/arm/translate-a64.c | 4 ++-- target/arm/translate.c | 2 +- target/cris/helper.c | 2 +- target/i386/hax-all.c | 52 +++++++++++++++++++++---------------------- target/i386/hax-darwin.c | 26 +++++++++++----------- target/i386/hax-mem.c | 4 ++-- target/i386/hax-windows.c | 42 +++++++++++++++++------------------ target/i386/kvm.c | 38 +++++++++++++++---------------- target/i386/misc_helper.c | 12 +++++----- target/lm32/op_helper.c | 4 ++-- target/mips/mips-semi.c | 3 ++- target/mips/translate.c | 2 +- target/ppc/excp_helper.c | 4 ++-- target/ppc/kvm.c | 34 ++++++++++++++-------------- target/ppc/mmu-hash64.c | 2 +- target/ppc/mmu_helper.c | 2 +- target/ppc/translate_init.c | 53 ++++++++++++++++++++++---------------------- target/s390x/kvm.c | 20 ++++++++--------- target/s390x/misc_helper.c | 2 +- target/unicore32/translate.c | 2 +- 26 files changed, 173 insertions(+), 169 deletions(-)
target/arm/arm-powerctl.c +3 -2
@@ -9,6 +9,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "cpu.h" #include "cpu-qom.h" #include "internals.h"
@@ -24,7 +25,7 @@ #define DPRINTF(fmt, args...) \ do { \ if (DEBUG_ARM_POWERCTL) { \ - fprintf(stderr, "[ARM]%s: " fmt , __func__, ##args); \ + error_report("[ARM]%s: " fmt , __func__, ##args); \ } \ } while (0)
@@ -32,7 +33,7 @@ CPUState *arm_get_cpu_by_id(uint64_t id) {CPUState *cpu; -DPRINTF ("cpu %" PRId64"\n" , id); +DPRINTF ("cpu %" PRId64"" , id);CPU_FOREACH (cpu) {ARMCPU *armcpu =ARM_CPU (cpu);
target/arm/arm-semi.c +2 -1
@@ -19,6 +19,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "cpu.h" #include "exec/semihost.h"
@@ -649,7 +650,7 @@ target_ulong do_arm_semihosting(CPUARMState *env) }/* fall through -- invalid for A32/T32 */ default : -fprintf (stderr,"qemu: Unsupported SemiHosting SWI 0x%02x\n" , nr); +error_report ("qemu: Unsupported SemiHosting SWI 0x%02x" , nr);cpu_dump_state (cs, stderr, fprintf,0 );abort (); }
target/arm/helper.c +2 -2
@@ -5460,9 +5460,9 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r,ARMCPRegInfo *oldreg; oldreg =g_hash_table_lookup (cpu->cp_regs, key);if (oldreg && !(oldreg->type &ARM_CP_OVERRIDE )) { -fprintf (stderr,"Register redefined: cp=%d %d bit " +error_report ("Register redefined: cp=%d %d bit " "crn=%d crm=%d opc1=%d opc2=%d, " -"was %s, now %s\n" , r2->cp,32 +32 * is64, +"was %s, now %s" , r2->cp,32 +32 * is64, r2->crn, r2->crm, r2->opc1, r2->opc2, oldreg->name, r2->name);g_assert_not_reached ();
target/arm/kvm.c +8 -8
@@ -139,7 +139,7 @@ static void kvm_arm_host_cpu_class_init(ObjectClass *oc, void *data)* TCG CPUs. */ if (!kvm_arm_get_host_cpu_features (ahcc)) { -fprintf (stderr,"Failed to retrieve host CPU features!\n" ); +error_report ("Failed to retrieve host CPU features!" );abort (); } }
@@ -256,7 +256,7 @@ static void kvm_arm_set_device_addr(KVMDevice *kd) }if (ret <0 ) { -fprintf (stderr,"Failed to set device address: %s\n" , +error_report ("Failed to set device address: %s" ,strerror (-ret));abort (); }
@@ -352,7 +352,7 @@ int kvm_arm_init_cpreg_list(ARMCPU *cpu)case KVM_REG_SIZE_U64 :break ;default : -fprintf (stderr,"Can't handle size of register in kernel list\n" ); +error_report ("Can't handle size of register in kernel list" ); ret = -EINVAL ; goto out; }
@@ -383,7 +383,7 @@ int kvm_arm_init_cpreg_list(ARMCPU *cpu)/* Shouldn't happen unless kernel is inconsistent about * what registers exist. */ -fprintf (stderr,"Initial read of kernel register state failed\n" ); +error_report ("Initial read of kernel register state failed" ); ret = -EINVAL ; goto out; }
@@ -478,11 +478,11 @@ void kvm_arm_reset_vcpu(ARMCPU *cpu)*/ ret =kvm_arm_vcpu_init (CPU (cpu));if (ret <0 ) { -fprintf (stderr,"kvm_arm_vcpu_init failed: %s\n" ,strerror (-ret)); +error_report ("kvm_arm_vcpu_init failed: %s" ,strerror (-ret));abort (); }if (!write_kvmstate_to_list (cpu)) { -fprintf (stderr,"write_kvmstate_to_list failed\n" ); +error_report ("write_kvmstate_to_list failed" );abort (); } }
@@ -499,7 +499,7 @@ int kvm_arm_sync_mpstate_to_kvm(ARMCPU *cpu) };int ret =kvm_vcpu_ioctl (CPU (cpu),KVM_SET_MP_STATE , &mp_state);if (ret) { -fprintf (stderr,"%s: failed to set MP_STATE %d/%s\n" , +error_report ("%s: failed to set MP_STATE %d/%s" , __func__, ret,strerror (-ret));return -1 ; }
@@ -517,7 +517,7 @@ int kvm_arm_sync_mpstate_to_qemu(ARMCPU *cpu)struct kvm_mp_state mp_state;int ret =kvm_vcpu_ioctl (CPU (cpu),KVM_GET_MP_STATE , &mp_state);if (ret) { -fprintf (stderr,"%s: failed to get MP_STATE %d/%s\n" , +error_report ("%s: failed to get MP_STATE %d/%s" , __func__, ret,strerror (-ret));abort (); }
target/arm/kvm32.c +1 -1
@@ -191,7 +191,7 @@ int kvm_arch_init_vcpu(CPUState *cs)ARMCPU *cpu =ARM_CPU (cs);if (cpu->kvm_target ==QEMU_KVM_ARM_TARGET_NONE ) { -fprintf (stderr,"KVM is not supported for this guest CPU type\n" ); +error_report ("KVM is not supported for this guest CPU type" );return -EINVAL ; }
target/arm/kvm64.c +1 -1
@@ -502,7 +502,7 @@ int kvm_arch_init_vcpu(CPUState *cs)if (cpu->kvm_target ==QEMU_KVM_ARM_TARGET_NONE || !object_dynamic_cast (OBJECT (cpu),TYPE_AARCH64_CPU )) { -fprintf (stderr,"KVM is not supported for this guest CPU type\n" ); +error_report ("KVM is not supported for this guest CPU type" );return -EINVAL ; }
target/arm/translate-a64.c +2 -2
@@ -505,8 +505,8 @@ static inline void assert_fp_access_checked(DisasContext *s) {#ifdef CONFIG_DEBUG_TCG if (unlikely (!s->fp_access_checked || s->fp_excp_el)) { -fprintf (stderr,"target-arm: FP access check missing for " -"instruction 0x%08x\n" , s->insn); +error_report ("target-arm: FP access check missing for " +"instruction 0x%08x" , s->insn);abort (); }#endif
target/arm/translate.c +1 -1
@@ -857,7 +857,7 @@ void arm_test_cc(DisasCompare *cmp, int cc) goto no_invert;default : -fprintf (stderr,"Bad condition code 0x%x\n" , cc); +error_report ("Bad condition code 0x%x" , cc);abort (); }
target/cris/helper.c +1 -1
@@ -282,7 +282,7 @@ hwaddr cris_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)if (!miss) { phy = res.phy; } -D (fprintf (stderr,"%s %x -> %x\n" , __func__, addr, phy)); +D (error_report ("%s %x -> %x" , __func__, addr, phy)); return phy; }#endif
target/i386/hax-all.c +26 -26
193 lines not on this page · raw message
target/i386/hax-darwin.c +13 -13
@@ -24,7 +24,7 @@ hax_fd hax_mod_open(void) {int fd =open ("/dev/HAX" ,O_RDWR );if (fd ==-1 ) { -fprintf (stderr,"Failed to open the hax module\n" ); +error_report ("Failed to open the hax module" ); }fcntl (fd,F_SETFD ,FD_CLOEXEC );
@@ -38,7 +38,7 @@ int hax_populate_ram(uint64_t va, uint32_t size)struct hax_alloc_ram_info info;if (!hax_global.vm || !hax_global.vm->fd) { -fprintf (stderr,"Allocate memory before vm create?\n" ); +error_report ("Allocate memory before vm create?" );return -EINVAL ; }
@@ -46,7 +46,7 @@ int hax_populate_ram(uint64_t va, uint32_t size) info.va = va; ret =ioctl (hax_global.vm->fd,HAX_VM_IOCTL_ALLOC_RAM , &info);if (ret <0 ) { -fprintf (stderr,"Failed to allocate %x memory\n" , size); +error_report ("Failed to allocate %x memory" , size);return ret; }return 0 ;
@@ -75,7 +75,7 @@ int hax_capability(struct hax_state *hax, struct hax_capabilityinfo *cap) ret =ioctl (hax->fd,HAX_IOCTL_CAPABILITY , cap);if (ret ==-1 ) { -fprintf (stderr,"Failed to get HAX capability\n" ); +error_report ("Failed to get HAX capability" );return -errno; }
@@ -88,7 +88,7 @@ int hax_mod_version(struct hax_state *hax, struct hax_module_version *version) ret =ioctl (hax->fd,HAX_IOCTL_VERSION , version);if (ret ==-1 ) { -fprintf (stderr,"Failed to get HAX version\n" ); +error_report ("Failed to get HAX version" );return -errno; }
@@ -100,7 +100,7 @@ static char *hax_vm_devfs_string(int vm_id)char *name;if (vm_id >MAX_VM_ID ) { -fprintf (stderr,"Too big VM id\n" ); +error_report ("Too big VM id" );return NULL ; }
@@ -119,7 +119,7 @@ static char *hax_vcpu_devfs_string(int vm_id, int vcpu_id)char *name;if (vm_id >MAX_VM_ID || vcpu_id >MAX_VCPU_ID ) { -fprintf (stderr,"Too big vm id %x or vcpu id %x\n" , vm_id, vcpu_id); +error_report ("Too big vm id %x or vcpu id %x" , vm_id, vcpu_id);return NULL ; }
@@ -181,7 +181,7 @@ int hax_notify_qemu_version(hax_fd vm_fd, struct hax_qemu_version *qversion) ret =ioctl (vm_fd,HAX_VM_IOCTL_NOTIFY_QEMU_VERSION , qversion);if (ret <0 ) { -fprintf (stderr,"Failed to notify qemu API version\n" ); +error_report ("Failed to notify qemu API version" );return ret; }return 0 ;
@@ -196,7 +196,7 @@ int hax_host_create_vcpu(hax_fd vm_fd, int vcpuid) ret =ioctl (vm_fd,HAX_VM_IOCTL_VCPU_CREATE , &vcpuid);if (ret <0 ) { -fprintf (stderr,"Failed to create vcpu %x\n" , vcpuid); +error_report ("Failed to create vcpu %x" , vcpuid); }return ret;
@@ -209,14 +209,14 @@ hax_fd hax_host_open_vcpu(int vmid, int vcpuid) devfs_path =hax_vcpu_devfs_string (vmid, vcpuid);if (!devfs_path) { -fprintf (stderr,"Failed to get the devfs\n" ); +error_report ("Failed to get the devfs" );return -EINVAL ; } fd =open (devfs_path,O_RDWR );g_free (devfs_path);if (fd <0 ) { -fprintf (stderr,"Failed to open the vcpu devfs\n" ); +error_report ("Failed to open the vcpu devfs" ); }fcntl (fd,F_SETFD ,FD_CLOEXEC );return fd;
@@ -229,12 +229,12 @@ int hax_host_setup_vcpu_channel(struct hax_vcpu_state *vcpu) ret =ioctl (vcpu->fd,HAX_VCPU_IOCTL_SETUP_TUNNEL , &info);if (ret) { -fprintf (stderr,"Failed to setup the hax tunnel\n" ); +error_report ("Failed to setup the hax tunnel" );return ret; }if (!valid_hax_tunnel_size (info.size)) { -fprintf (stderr,"Invalid hax tunnel size %x\n" , info.size); +error_report ("Invalid hax tunnel size %x" , info.size); ret = -EINVAL ;return ret; }
target/i386/hax-mem.c +2 -2
@@ -247,8 +247,8 @@ static void hax_transaction_commit(MemoryListener *listener) }if (hax_set_ram (entry->start_pa, entry->size, entry->host_va, entry->flags)) { -fprintf (stderr,"%s: Failed mapping @0x%016" PRIx64"+0x%" - PRIx32" flags %02x\n" , __func__, entry->start_pa, +error_report ("%s: Failed mapping @0x%016" PRIx64"+0x%" + PRIx32" flags %02x" , __func__, entry->start_pa, entry->size, entry->flags); }QTAILQ_REMOVE (&mappings, entry, entry);
target/i386/hax-windows.c +21 -21
156 lines not on this page · raw message
target/i386/kvm.c +19 -19
@@ -219,7 +219,7 @@ static struct kvm_cpuid2 *try_get_cpuid(KVMState *s, int max)g_free (cpuid);return NULL ; }else { -fprintf (stderr,"KVM_GET_SUPPORTED_CPUID failed: %s\n" , +error_report ("KVM_GET_SUPPORTED_CPUID failed: %s" ,strerror (-r));exit (1 ); }
@@ -470,7 +470,7 @@ static void kvm_mce_inject(X86CPU *cpu, hwaddr paddr, int code)static void hardware_memory_error (void ) { -fprintf (stderr,"Hardware memory error!\n" ); +error_report ("Hardware memory error!" );exit (1 ); }
@@ -497,8 +497,8 @@ void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void *addr)return ; } -fprintf (stderr,"Hardware memory error for memory used by " -"QEMU itself instead of guest system!\n" ); +error_report ("Hardware memory error for memory used by " +"QEMU itself instead of guest system!" ); }if (code ==BUS_MCEERR_AR ) {
@@ -666,7 +666,7 @@ static int hyperv_handle_properties(CPUState *cs)if (!has_msr_hv_synic ||kvm_vcpu_enable_cap (cs,KVM_CAP_HYPERV_SYNIC ,0 )) { -fprintf (stderr,"Hyper-V SynIC is not supported by kernel\n" ); +error_report ("Hyper-V SynIC is not supported by kernel" );return -ENOSYS ; }
@@ -678,7 +678,7 @@ static int hyperv_handle_properties(CPUState *cs) }if (cpu->hyperv_stimer) {if (!has_msr_hv_stimer) { -fprintf (stderr,"Hyper-V timers aren't supported by kernel\n" ); +error_report ("Hyper-V timers aren't supported by kernel" );return -ENOSYS ; } env->features[FEAT_HYPERV_EAX ] |=HV_SYNTIMERS_AVAILABLE ;
@@ -811,7 +811,7 @@ int kvm_arch_init_vcpu(CPUState *cs)for (i =0 ; i <= limit; i++) {if (cpuid_i ==KVM_MAX_CPUID_ENTRIES ) { -fprintf (stderr,"unsupported level value: 0x%x\n" , limit); +error_report ("unsupported level value: 0x%x" , limit);abort (); } c = &cpuid_data.entries[cpuid_i++];
@@ -829,8 +829,8 @@ int kvm_arch_init_vcpu(CPUState *cs)for (j =1 ; j < times; ++j) {if (cpuid_i ==KVM_MAX_CPUID_ENTRIES ) { -fprintf (stderr,"cpuid_data is full, no space for " -"cpuid(eax:2):eax & 0xf = 0x%x\n" , times); +error_report ("cpuid_data is full, no space for " +"cpuid(eax:2):eax & 0xf = 0x%x" , times);abort (); } c = &cpuid_data.entries[cpuid_i++];
@@ -862,8 +862,8 @@ int kvm_arch_init_vcpu(CPUState *cs)continue ; }if (cpuid_i ==KVM_MAX_CPUID_ENTRIES ) { -fprintf (stderr,"cpuid_data is full, no space for " -"cpuid(eax:0x%x,ecx:0x%x)\n" , i, j); +error_report ("cpuid_data is full, no space for " +"cpuid(eax:0x%x,ecx:0x%x)" , i, j);abort (); } c = &cpuid_data.entries[cpuid_i++];
@@ -899,7 +899,7 @@ int kvm_arch_init_vcpu(CPUState *cs)for (i =0x80000000 ; i <= limit; i++) {if (cpuid_i ==KVM_MAX_CPUID_ENTRIES ) { -fprintf (stderr,"unsupported xlevel value: 0x%x\n" , limit); +error_report ("unsupported xlevel value: 0x%x" , limit);abort (); } c = &cpuid_data.entries[cpuid_i++];
@@ -915,7 +915,7 @@ int kvm_arch_init_vcpu(CPUState *cs)for (i =0xC0000000 ; i <= limit; i++) {if (cpuid_i ==KVM_MAX_CPUID_ENTRIES ) { -fprintf (stderr,"unsupported xlevel2 value: 0x%x\n" , limit); +error_report ("unsupported xlevel2 value: 0x%x" , limit);abort (); } c = &cpuid_data.entries[cpuid_i++];
@@ -1245,7 +1245,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)/* Tell fw_cfg to notify the BIOS to reserve the range. */ ret =e820_add_entry (identity_base,0x4000 ,E820_RESERVED );if (ret <0 ) { -fprintf (stderr,"e820_add_entry() table is full\n" ); +error_report ("e820_add_entry() table is full" );return ret; }qemu_register_reset (kvm_unpoison_all,NULL );
@@ -2733,7 +2733,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run)DPRINTF ("injected NMI\n" ); ret =kvm_vcpu_ioctl (cpu,KVM_NMI );if (ret <0 ) { -fprintf (stderr,"KVM: injection failed, NMI lost (%s)\n" , +error_report ("KVM: injection failed, NMI lost (%s)" ,strerror (-ret)); } }
@@ -2744,7 +2744,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run)DPRINTF ("injected SMI\n" ); ret =kvm_vcpu_ioctl (cpu,KVM_SMI );if (ret <0 ) { -fprintf (stderr,"KVM: injection failed, SMI lost (%s)\n" , +error_report ("KVM: injection failed, SMI lost (%s)" ,strerror (-ret)); } }
@@ -3141,7 +3141,7 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)break ;case KVM_EXIT_FAIL_ENTRY : code = run->fail_entry.hardware_entry_failure_reason; -fprintf (stderr,"KVM: entry failed, hardware error 0x%" PRIx64"\n" , +error_report ("KVM: entry failed, hardware error 0x%" PRIx64"" , code);if (host_supports_vmx () && code ==VMX_INVALID_GUEST_STATE ) { fprintf(stderr,
@@ -3157,7 +3157,7 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run) ret =-1 ;break ;case KVM_EXIT_EXCEPTION : -fprintf (stderr,"KVM: exception %d exit (error code 0x%x)\n" , +error_report ("KVM: exception %d exit (error code 0x%x)" , run->ex.exception, run->ex.error_code); ret =-1 ;break ;
@@ -3175,7 +3175,7 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run) ret =0 ;break ;default : -fprintf (stderr,"KVM: unknown exit reason %d\n" , run->exit_reason); +error_report ("KVM: unknown exit reason %d" , run->exit_reason); ret =-1 ;break ; }
target/i386/misc_helper.c +6 -6
@@ -28,7 +28,7 @@void helper_outb (CPUX86State *env,uint32_t port,uint32_t data) {#ifdef CONFIG_USER_ONLY -fprintf (stderr,"outb: port=0x%04x, data=%02x\n" , port, data); +error_report ("outb: port=0x%04x, data=%02x" , port, data);#else address_space_stb (&address_space_io, port, data,cpu_get_mem_attrs (env),NULL );
@@ -38,7 +38,7 @@ void helper_outb(CPUX86State *env, uint32_t port, uint32_t data)target_ulong helper_inb (CPUX86State *env,uint32_t port) {#ifdef CONFIG_USER_ONLY -fprintf (stderr,"inb: port=0x%04x\n" , port); +error_report ("inb: port=0x%04x" , port);return 0 ;#else return address_space_ldub(&address_space_io, port,
@@ -49,7 +49,7 @@ target_ulong helper_inb(CPUX86State *env, uint32_t port)void helper_outw (CPUX86State *env,uint32_t port,uint32_t data) {#ifdef CONFIG_USER_ONLY -fprintf (stderr,"outw: port=0x%04x, data=%04x\n" , port, data); +error_report ("outw: port=0x%04x, data=%04x" , port, data);#else address_space_stw (&address_space_io, port, data,cpu_get_mem_attrs (env),NULL );
@@ -59,7 +59,7 @@ void helper_outw(CPUX86State *env, uint32_t port, uint32_t data)target_ulong helper_inw (CPUX86State *env,uint32_t port) {#ifdef CONFIG_USER_ONLY -fprintf (stderr,"inw: port=0x%04x\n" , port); +error_report ("inw: port=0x%04x" , port);return 0 ;#else return address_space_lduw(&address_space_io, port,
@@ -70,7 +70,7 @@ target_ulong helper_inw(CPUX86State *env, uint32_t port)void helper_outl (CPUX86State *env,uint32_t port,uint32_t data) {#ifdef CONFIG_USER_ONLY -fprintf (stderr,"outw: port=0x%04x, data=%08x\n" , port, data); +error_report ("outw: port=0x%04x, data=%08x" , port, data);#else address_space_stl (&address_space_io, port, data,cpu_get_mem_attrs (env),NULL );
@@ -80,7 +80,7 @@ void helper_outl(CPUX86State *env, uint32_t port, uint32_t data)target_ulong helper_inl (CPUX86State *env,uint32_t port) {#ifdef CONFIG_USER_ONLY -fprintf (stderr,"inl: port=0x%04x\n" , port); +error_report ("inl: port=0x%04x" , port);return 0 ;#else return address_space_ldl(&address_space_io, port,
target/lm32/op_helper.c +2 -2
@@ -40,9 +40,9 @@ void HELPER(ill)(CPULM32State *env) {#ifndef CONFIG_USER_ONLY CPUState *cs =CPU (lm32_env_get_cpu (env)); -fprintf (stderr,"VM paused due to illegal instruction. " +error_report ("VM paused due to illegal instruction. " "Connect a debugger or switch to the monitor console " -"to find out more.\n" ); +"to find out more." );vm_stop (RUN_STATE_PAUSED ); cs->halted =1 ;raise_exception (env,EXCP_HALTED );
target/mips/mips-semi.c +2 -1
@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "cpu.h" #include "qemu/log.h" #include "exec/helper-proto.h"
@@ -366,7 +367,7 @@ void helper_do_semihosting(CPUMIPSState *env)break ;#endif default : -fprintf (stderr,"Unknown UHI operation %d\n" , op); +error_report ("Unknown UHI operation %d" , op);abort (); } uhi_done:
target/mips/translate.c +1 -1
@@ -10886,7 +10886,7 @@ static void gen_branch(DisasContext *ctx, int insn_bytes)tcg_gen_lookup_and_goto_ptr (cpu_PC);break ;default : -fprintf (stderr,"unknown branch 0x%x\n" , proc_hflags); +error_report ("unknown branch 0x%x" , proc_hflags);abort (); } }
target/ppc/excp_helper.c +2 -2
@@ -200,8 +200,8 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)/* Machine check exception is not enabled. * Enter checkstop state. */ -fprintf (stderr,"Machine check while not allowed. " -"Entering checkstop state\n" ); +error_report ("Machine check while not allowed. " +"Entering checkstop state" );if (qemu_log_separate ()) {qemu_log ("Machine check while not allowed. " "Entering checkstop state\n" );
target/ppc/kvm.c +17 -17
@@ -159,8 +159,8 @@ int kvm_arch_init(MachineState *ms, KVMState *s) cap_ppc_pvr_compat = false;if (!cap_interrupt_level) { -fprintf (stderr,"KVM: Couldn't find level irq capability. Expect the " -"VM to stall at times!\n" ); +error_report ("KVM: Couldn't find level irq capability. Expect the " +"VM to stall at times!" ); }kvm_ppc_register_host_cpu_type ();
@@ -188,7 +188,7 @@ static int kvm_arch_sync_sregs(PowerPCCPU *cpu)return 0 ; }else {if (!cap_segstate) { -fprintf (stderr,"kvm error: missing PVR setting capability\n" ); +error_report ("kvm error: missing PVR setting capability" );return -ENOSYS ; } }
@@ -237,7 +237,7 @@ static int kvm_booke206_tlb_init(PowerPCCPU *cpu) ret =kvm_vcpu_enable_cap (cs,KVM_CAP_SW_TLB ,0 , (uintptr_t )&cfg);if (ret <0 ) { -fprintf (stderr,"%s: couldn't enable KVM_CAP_SW_TLB: %s\n" , +error_report ("%s: couldn't enable KVM_CAP_SW_TLB: %s" , __func__,strerror (-ret));return ret; }
@@ -552,7 +552,7 @@ static void kvmppc_hw_debug_points_init(CPUPPCState *cenv) }if ((max_hw_breakpoint + max_hw_watchpoint) >MAX_HW_BKPTS ) { -fprintf (stderr,"Error initializing h/w breakpoints\n" ); +error_report ("Error initializing h/w breakpoints" );return ; } }
@@ -623,7 +623,7 @@ static void kvm_sw_tlb_put(PowerPCCPU *cpu) ret =kvm_vcpu_ioctl (cs,KVM_DIRTY_TLB , &dirty_tlb);if (ret) { -fprintf (stderr,"%s: KVM_DIRTY_TLB: %s\n" , +error_report ("%s: KVM_DIRTY_TLB: %s" , __func__,strerror (-ret)); }
@@ -1480,7 +1480,7 @@ static int kvmppc_handle_halt(PowerPCCPU *cpu)static int kvmppc_handle_dcr_read (CPUPPCState *env,uint32_t dcrn,uint32_t *data) {if (ppc_dcr_read (env->dcr_env, dcrn, data) <0 ) -fprintf (stderr,"Read to unhandled DCR (0x%x)\n" , dcrn); +error_report ("Read to unhandled DCR (0x%x)" , dcrn);return 0 ; }
@@ -1488,7 +1488,7 @@ static int kvmppc_handle_dcr_read(CPUPPCState *env, uint32_t dcrn, uint32_t *datstatic int kvmppc_handle_dcr_write (CPUPPCState *env,uint32_t dcrn,uint32_t data) {if (ppc_dcr_write (env->dcr_env, dcrn, data) <0 ) -fprintf (stderr,"Write to unhandled DCR (0x%x)\n" , dcrn); +error_report ("Write to unhandled DCR (0x%x)" , dcrn);return 0 ; }
@@ -1799,7 +1799,7 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)break ;default : -fprintf (stderr,"KVM: unknown exit reason %d\n" , run->exit_reason); +error_report ("KVM: unknown exit reason %d" , run->exit_reason); ret =-1 ;break ; }
@@ -1863,7 +1863,7 @@ int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu) ret =kvm_vcpu_enable_cap (cs,KVM_CAP_PPC_BOOKE_WATCHDOG ,0 );if (ret <0 ) { -fprintf (stderr,"%s: couldn't enable KVM_CAP_PPC_BOOKE_WATCHDOG: %s\n" , +error_report ("%s: couldn't enable KVM_CAP_PPC_BOOKE_WATCHDOG: %s" , __func__,strerror (-ret));return ret; }
@@ -2198,7 +2198,7 @@ off_t kvmppc_alloc_rma(void **rma) fd =kvm_vm_ioctl (kvm_state,KVM_ALLOCATE_RMA , &ret);if (fd <0 ) { -fprintf (stderr,"KVM: Error on KVM_ALLOCATE_RMA: %s\n" , +error_report ("KVM: Error on KVM_ALLOCATE_RMA: %s" ,strerror (errno));return -1 ; }
@@ -2207,7 +2207,7 @@ off_t kvmppc_alloc_rma(void **rma) *rma =mmap (NULL , size,PROT_READ |PROT_WRITE ,MAP_SHARED , fd,0 );if (*rma ==MAP_FAILED ) { -fprintf (stderr,"KVM: Error mapping RMA: %s\n" ,strerror (errno)); +error_report ("KVM: Error mapping RMA: %s" ,strerror (errno));return -1 ; };
@@ -2309,7 +2309,7 @@ void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift, } fd =kvm_vm_ioctl (kvm_state,KVM_CREATE_SPAPR_TCE , &args);if (fd <0 ) { -fprintf (stderr,"KVM: Failed to create TCE table for liobn 0x%x\n" , +error_report ("KVM: Failed to create TCE table for liobn 0x%x" , liobn);return NULL ; }
@@ -2322,7 +2322,7 @@ void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift, table =mmap (NULL , len,PROT_READ |PROT_WRITE ,MAP_SHARED , fd,0 );if (table ==MAP_FAILED ) { -fprintf (stderr,"KVM: Failed to map TCE table for liobn 0x%x\n" , +error_report ("KVM: Failed to map TCE table for liobn 0x%x" , liobn);close (fd);return NULL ;
@@ -2590,7 +2590,7 @@ int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize, int64_t max_ns) do { rc = read(fd, buf, bufsize); if (rc < 0) { - fprintf(stderr, "Error reading data from KVM HTAB fd: %s\n", + error_report("Error reading data from KVM HTAB fd: %s", strerror(errno)); return rc; } else if (rc) {
@@ -2635,13 +2635,13 @@ int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index, rc =write (fd, buf, chunksize);if (rc <0 ) { -fprintf (stderr,"Error writing KVM hash table: %s\n" , +error_report ("Error writing KVM hash table: %s" ,strerror (errno));return rc; }if (rc != chunksize) {/* We should never get a short write on a single chunk */ -fprintf (stderr,"Short write, restoring KVM hash table\n" ); +error_report ("Short write, restoring KVM hash table" );return -1 ; }return 0 ;
target/ppc/mmu-hash64.c +1 -1
@@ -377,7 +377,7 @@ static int ppc_hash64_amr_prot(PowerPCCPU *cpu, ppc_hash_pte64_t pte) key =HPTE64_R_KEY (pte.pte1); amrbits = (env->spr[SPR_AMR ] >>2 *(31 - key)) &0x3 ; -/* fprintf(stderr, "AMR protection: key=%d AMR=0x%" PRIx64 "\n", key, */ +/* error_report("AMR protection: key=%d AMR=0x%" PRIx64 "", key, */ /* env->spr[SPR_AMR]); */ /*
target/ppc/mmu_helper.c +1 -1
@@ -2600,7 +2600,7 @@ void helper_booke206_tlbwe(CPUPPCState *env)if (((env->spr[SPR_BOOKE_MAS0 ] &MAS0_ATSEL ) ==MAS0_ATSEL_LRAT ) && !msr_gs) {/* XXX we don't support direct LRAT setting yet */ -fprintf (stderr,"cpu: don't support LRAT setting yet\n" ); +error_report ("cpu: don't support LRAT setting yet" );return ; }
target/ppc/translate_init.c +27 -26
114 lines not on this page · raw message
target/s390x/kvm.c +10 -10
@@ -967,13 +967,13 @@ static void inject_vcpu_irq_legacy(CPUState *cs, struct kvm_s390_irq *irq) r =s390_kvm_irq_to_interrupt (irq, &kvmint);if (r <0 ) { -fprintf (stderr,"%s called with bogus interrupt\n" , __func__); +error_report ("%s called with bogus interrupt" , __func__);exit (1 ); } r =kvm_vcpu_ioctl (cs,KVM_S390_INTERRUPT , &kvmint);if (r <0 ) { -fprintf (stderr,"KVM failed to inject interrupt\n" ); +error_report ("KVM failed to inject interrupt" );exit (1 ); } }
@@ -1002,13 +1002,13 @@ static void __kvm_s390_floating_interrupt(struct kvm_s390_irq *irq) r =s390_kvm_irq_to_interrupt (irq, &kvmint);if (r <0 ) { -fprintf (stderr,"%s called with bogus interrupt\n" , __func__); +error_report ("%s called with bogus interrupt" , __func__);exit (1 ); } r =kvm_vm_ioctl (kvm_state,KVM_S390_INTERRUPT , &kvmint);if (r <0 ) { -fprintf (stderr,"KVM failed to inject interrupt\n" ); +error_report ("KVM failed to inject interrupt" );exit (1 ); } }
@@ -1116,14 +1116,14 @@ static int handle_b2(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1)break ;case PRIV_B2_TSCH :/* We should only get tsch via KVM_EXIT_S390_TSCH. */ -fprintf (stderr,"Spurious tsch intercept\n" ); +error_report ("Spurious tsch intercept" );break ;case PRIV_B2_CHSC :ioinst_handle_chsc (cpu, run->s390_sieic.ipb);break ;case PRIV_B2_TPI :/* This should have been handled by kvm already. */ -fprintf (stderr,"Spurious tpi intercept\n" ); +error_report ("Spurious tpi intercept" );break ;case PRIV_B2_SCHM : ioinst_handle_schm(cpu, env->regs[1], env->regs[2],
@@ -2050,15 +2050,15 @@ static int handle_intercept(S390CPU *cpu) }break ;case ICPT_SOFT_INTERCEPT : -fprintf (stderr,"KVM unimplemented icpt SOFT\n" ); +error_report ("KVM unimplemented icpt SOFT" );exit (1 );break ;case ICPT_IO : -fprintf (stderr,"KVM unimplemented icpt IO\n" ); +error_report ("KVM unimplemented icpt IO" );exit (1 );break ;default : -fprintf (stderr,"Unknown intercept code: %d\n" , icpt_code); +error_report ("Unknown intercept code: %d" , icpt_code);exit (1 );break ; }
@@ -2215,7 +2215,7 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run) ret =kvm_arch_handle_debug_exit (cpu);break ;default : -fprintf (stderr,"Unknown KVM exit: %d\n" , run->exit_reason); +error_report ("Unknown KVM exit: %d" , run->exit_reason);break ; }qemu_mutex_unlock_iothread ();
target/s390x/misc_helper.c +1 -1
@@ -354,7 +354,7 @@ uint32_t HELPER(sigp)(CPUS390XState *env, uint64_t order_code, uint32_t r1,#endif default :/* unknown sigp */ -fprintf (stderr,"XXX unknown sigp: 0x%" PRIx64"\n" , order_code); +error_report ("XXX unknown sigp: 0x%" PRIx64"" , order_code); cc =SIGP_CC_NOT_OPERATIONAL ; }
target/unicore32/translate.c +1 -1
@@ -515,7 +515,7 @@ static void gen_test_cc(int cc, TCGLabel *label)tcg_gen_brcondi_i32 (TCG_COND_LT , tmp,0 , label);break ;default : -fprintf (stderr,"Bad condition code 0x%x\n" , cc); +error_report ("Bad condition code 0x%x" , cc);abort (); }dead_tmp (tmp);
Signature · 1 line
2.11.0
Re: [Qemu-arm] [PATCH v2 47/47] target: Replace fprintf(stderr, "*\n" with error_report()
Quoted 90 lines · On Fri, 29 Sep 2017 17:17:26 -0700 Alistair Francis…
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.target/s390x/kvm.c +10
-10@@ -967,13 +967,13 @@ static void inject_vcpu_irq_legacy(CPUState *cs, struct kvm_s390_irq *irq) r =s390_kvm_irq_to_interrupt (irq, &kvmint);if (r <0 ) { -fprintf (stderr,"%s called with bogus interrupt\n" , __func__); +error_report ("%s called with bogus interrupt" , __func__);exit (1 ); } r =kvm_vcpu_ioctl (cs,KVM_S390_INTERRUPT , &kvmint);if (r <0 ) { -fprintf (stderr,"KVM failed to inject interrupt\n" ); +error_report ("KVM failed to inject interrupt" );exit (1 ); } }@@ -1002,13 +1002,13 @@ static void __kvm_s390_floating_interrupt(struct kvm_s390_irq *irq) r =s390_kvm_irq_to_interrupt (irq, &kvmint);if (r <0 ) { -fprintf (stderr,"%s called with bogus interrupt\n" , __func__); +error_report ("%s called with bogus interrupt" , __func__);exit (1 ); } r =kvm_vm_ioctl (kvm_state,KVM_S390_INTERRUPT , &kvmint);if (r <0 ) { -fprintf (stderr,"KVM failed to inject interrupt\n" ); +error_report ("KVM failed to inject interrupt" );exit (1 ); } }@@ -1116,14 +1116,14 @@ static int handle_b2(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1)break ;case PRIV_B2_TSCH :/* We should only get tsch via KVM_EXIT_S390_TSCH. */ -fprintf (stderr,"Spurious tsch intercept\n" ); +error_report ("Spurious tsch intercept" );break ;case PRIV_B2_CHSC :ioinst_handle_chsc (cpu, run->s390_sieic.ipb);break ;case PRIV_B2_TPI :/* This should have been handled by kvm already. */ -fprintf (stderr,"Spurious tpi intercept\n" ); +error_report ("Spurious tpi intercept" );break ;case PRIV_B2_SCHM : ioinst_handle_schm(cpu, env->regs[1], env->regs[2],@@ -2050,15 +2050,15 @@ static int handle_intercept(S390CPU *cpu) }break ;case ICPT_SOFT_INTERCEPT : -fprintf (stderr,"KVM unimplemented icpt SOFT\n" ); +error_report ("KVM unimplemented icpt SOFT" );exit (1 );break ;case ICPT_IO : -fprintf (stderr,"KVM unimplemented icpt IO\n" ); +error_report ("KVM unimplemented icpt IO" );exit (1 );break ;default : -fprintf (stderr,"Unknown intercept code: %d\n" , icpt_code); +error_report ("Unknown intercept code: %d" , icpt_code);exit (1 );break ; }@@ -2215,7 +2215,7 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run) ret =kvm_arch_handle_debug_exit (cpu);break ;default : -fprintf (stderr,"Unknown KVM exit: %d\n" , run->exit_reason); +error_report ("Unknown KVM exit: %d" , run->exit_reason);break ; }qemu_mutex_unlock_iothread ();target/s390x/misc_helper.c +0
-0
target/s390x/misc_helper.c uint32_t HELPER(sigp)(CPUS390XState *env, uint64_t order_code, uint32_t r1, · line 360
Quoted 8 lines
target/s390x/misc_helper.c +1
-1@@ -354,7 +354,7 @@ uint32_t HELPER(sigp)(CPUS390XState *env, uint64_t order_code, uint32_t r1,#endif default :/* unknown sigp */ -fprintf (stderr,"XXX unknown sigp: 0x%" PRIx64"\n" , order_code); +error_report ("XXX unknown sigp: 0x%" PRIx64"" , order_code); cc =SIGP_CC_NOT_OPERATIONAL ; }
There might be some clashes with David's patches (haven't checked), but that depends on what goes in first anyway. So, for the s390x parts:
A message that is not in the archive (sent off-list or not yet received): ade26715c9bde1fe921959823de08da582fce58f.1506730372.git.alistair.francis@xilinx.com
Anthony PERARD
Acked-byRe: [Qemu-devel] [PATCH v2 15/47] hw/i386: Replace fprintf(stderr, "*\n" with error_report()
Quoted 3 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
[...]
Quoted 69 lines
hw/i386/xen/xen-hvm.c +16
-14@@ -246,9 +246,10 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, MemoryRegion *mr,if (runstate_check (RUN_STATE_INMIGRATE )) {/* RAM already populated in Xen */ -fprintf (stderr,"%s: do not alloc " RAM_ADDR_FMT -" bytes of ram at " RAM_ADDR_FMT " when runstate is INMIGRATE\n" , - __func__, size, ram_addr); +error_report ("%s: do not alloc " RAM_ADDR_FMT +" bytes of ram at " RAM_ADDR_FMT " when runstate is " +" INMIGRATE" , + __func__, size, ram_addr);return ; }@@ -444,8 +445,9 @@ static int xen_remove_from_physmap(XenIOState *state, rc =xen_xc_domain_add_to_physmap (xen_xc, xen_domid, XENMAPSPACE_gmfn, idx, gpfn);if (rc) { -fprintf (stderr,"add_to_physmap MFN %" PRI_xen_pfn" to PFN %" - PRI_xen_pfn" failed: %d (errno: %d)\n" , idx, gpfn, rc, errno); +error_report ("add_to_physmap MFN %" PRI_xen_pfn" to PFN %" + PRI_xen_pfn" failed: %d (errno: %d)" , idx, + gpfn, rc, errno);return -rc; } }@@ -1090,11 +1092,11 @@ static void cpu_handle_ioreq(void *opaque) req->data = copy.data;if (req->state !=STATE_IOREQ_INPROCESS ) { -fprintf (stderr,"Badness in I/O request ... not in service?!: " -"%x, ptr: %x, port: %" PRIx64", " -"data: %" PRIx64", count: %u, size: %u, type: %u\n" , - req->state, req->data_is_ptr, req->addr, - req->data, req->count, req->size, req->type); +error_report ("Badness in I/O request ... not in service?!: " +"%x, ptr: %x, port: %" PRIx64", " +"data: %" PRIx64", count: %u, size: %u, type: %u" , + req->state, req->data_is_ptr, req->addr, + req->data, req->count, req->size, req->type);destroy_hvm_domain (false);return ; }@@ -1397,16 +1399,16 @@ void destroy_hvm_domain(bool reboot) xc_handle =xc_interface_open (0 ,0 ,0 );if (xc_handle ==NULL ) { -fprintf (stderr,"Cannot acquire xenctrl handle\n" ); +error_report ("Cannot acquire xenctrl handle" ); }else { sts =xc_domain_shutdown (xc_handle, xen_domid, reboot ? SHUTDOWN_reboot : SHUTDOWN_poweroff);if (sts !=0 ) { -fprintf (stderr,"xc_domain_shutdown failed to issue %s, " -"sts %d, %s\n" , reboot ?"reboot" :"poweroff" , +error_report ("xc_domain_shutdown failed to issue %s, " +"sts %d, %s" , reboot ?"reboot" :"poweroff" , sts,strerror (errno)); }else { -fprintf (stderr,"Issued domain %d %s\n" , xen_domid, +error_report ("Issued domain %d %s" , xen_domid, reboot ?"reboot" :"poweroff" ); }xc_interface_close (xc_handle);
hw/i386/xen/xen-hvm.c void xen_shutdown_fatal_error(const char *fmt, ...) · line 1428
Quoted 2 lines
hw/i386/xen/xen-hvm.c +0
-0@@ -1425,7 +1427,7 @@ void xen_shutdown_fatal_error(const char *fmt, ...)va_start (ap, fmt);vfprintf (stderr, fmt, ap);
Here, we may want to replace vfprintf by error_vreport as well? Or is it more complicated and needs its own patch to fix all call to xen_shutdown_fatal_error?
Quoted 56 lines
hw/i386/xen/xen-hvm.c +1
-1va_end (ap); -fprintf (stderr,"Will destroy the domain.\n" ); +error_report ("Will destroy the domain." );/* destroy the domain */ qemu_system_shutdown_request (SHUTDOWN_CAUSE_HOST_ERROR ); }hw/i386/xen/xen-mapcache.c +6
-6@@ -377,7 +377,7 @@ ram_addr_t xen_ram_addr_from_mapcache(void *ptr) } }if (!found) { -fprintf (stderr,"%s, could not find %p\n" , __func__, ptr); +error_report ("%s, could not find %p" , __func__, ptr); QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) {DPRINTF (" " TARGET_FMT_plx" -> %p is present\n" , reventry->paddr_index, reventry->vaddr_req);@@ -477,9 +477,9 @@ void xen_invalidate_map_cache(void)if (!reventry->dma) {continue ; } -fprintf (stderr,"Locked DMA mapping while invalidating mapcache!" -" " TARGET_FMT_plx" -> %p is present\n" , - reventry->paddr_index, reventry->vaddr_req); +error_report ("Locked DMA mapping while invalidating mapcache!" +" " TARGET_FMT_plx" -> %p is present" , + reventry->paddr_index, reventry->vaddr_req); }for (i =0 ; i < mapcache->nr_buckets; i++) {@@ -545,8 +545,8 @@ static uint8_t *xen_replace_cache_entry_unlocked(hwaddr old_phys_addr, address_index = new_phys_addr >>MCACHE_BUCKET_SHIFT ; address_offset = new_phys_addr & (MCACHE_BUCKET_SIZE -1 ); -fprintf (stderr,"Replacing a dummy mapcache entry for " TARGET_FMT_plx \ -" with " TARGET_FMT_plx"\n" , old_phys_addr, new_phys_addr); +error_report ("Replacing a dummy mapcache entry for " TARGET_FMT_plx \ +" with " TARGET_FMT_plx"" , old_phys_addr, new_phys_addr);xen_remap_bucket (entry, entry->vaddr_base, cache_size, address_index, false);hw/i386/xen/xen_apic.c +1
-0@@ -10,6 +10,7 @@* later. See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/i386/apic_internal.h" #include "hw/pci/msi.h" #include "hw/xen/xen.h"
hw/i386/xen/xen_apic.c static void xen_apic_mem_write(void *opaque, hwaddr addr, · line 31
Quoted 8 lines
hw/i386/xen/xen_apic.c +1
-1@@ -24,7 +25,7 @@ static void xen_apic_mem_write(void *opaque, hwaddr addr, uint64_t data, unsigned size) {if (size !=sizeof (uint32_t )) { -fprintf (stderr,"Xen: APIC write data size = %d, invalid\n" , size); +error_report ("Xen: APIC write data size = %d, invalid" , size);return ; }
Despite my comment, for the Xen part:
Signature · 1 line
Anthony PERARD