Error API: Flag errors in *errp even if errors are being ignored
Subsystems (13)
RFC 15/15 Use 'Error *err[static 1]' instead of 'Error **errp' to catch NULL errp arguments
In reply to Eduardo HabkostThis is being included in the RFC just to help validating the series, and ensure we don't use NULL errp anywhere.
I don't propose we actually change all code to use the 'Error *errp[static 1]' syntax because it confuses Cocinelle.
I am considering including a assert(errp) line in the ERR_IS_SET() macro, so we can catch NULL errp at runtime in case somebody forgets about it.
Generated by the following Coccinelle patch:
@@
typedef Error;
type T;
identifier FN !~ "os_mem_prealloc|qemu_fork";
identifier errp;
@@
T FN(...,
- Error **errp
+ Error *errp[STATIC_1]
);
@@
typedef Error;
type T;
identifier FN !~ "os_mem_prealloc|qemu_fork";
identifier errp;
@@
T FN(...,
- Error **errp
+ Error *errp[STATIC_1]
) { ... }Followed by the following sed command:
$ sed -i -e 's/\[STATIC_1\]/[static 1]/g' $(g grep -w -l STATIC_1)
--- include/qapi/visitor.h | 47 ++++++----- block/nbd-client.h | 2 +- block/qcow2.h | 8 +- block/vhdx.h | 2 +- crypto/blockpriv.h | 4 +- crypto/hmac.h | 10 +-- crypto/tlscredspriv.h | 4 +- hw/9pfs/9p.h | 4 +- hw/block/dataplane/virtio-blk.h | 2 +- hw/s390x/s390-virtio.h | 2 +- hw/timer/m48t59-internal.h | 2 +- hw/usb/hcd-ehci.h | 4 +- hw/vfio/pci.h | 4 +- hw/xen/xen-host-pci-device.h | 2 +- hw/xen/xen_pt.h | 4 +- include/block/aio.h | 4 +- include/block/block.h | 69 +++++++++------- include/block/block_backup.h | 2 +- include/block/block_int.h | 19 +++-- include/block/blockjob.h | 11 +-- include/block/blockjob_int.h | 3 +- include/block/dirty-bitmap.h | 8 +- include/block/nbd.h | 13 +-- include/block/qapi.h | 7 +- include/block/snapshot.h | 12 +-- include/chardev/char-fd.h | 2 +- include/chardev/char-fe.h | 4 +- include/chardev/char-win.h | 3 +- include/chardev/char.h | 9 ++- include/crypto/afsplit.h | 4 +- include/crypto/block.h | 10 +-- include/crypto/cipher.h | 8 +- include/crypto/hash.h | 12 +-- include/crypto/init.h | 2 +- include/crypto/ivgen.h | 2 +- include/crypto/pbkdf.h | 4 +- include/crypto/random.h | 4 +- include/crypto/secret.h | 6 +- include/crypto/tlssession.h | 6 +- include/exec/memory.h | 12 +-- include/exec/ram_addr.h | 12 +-- include/hw/acpi/acpi.h | 4 +- include/hw/acpi/cpu.h | 7 +- include/hw/acpi/cpu_hotplug.h | 3 +- include/hw/acpi/ich9.h | 9 ++- include/hw/acpi/memory_hotplug.h | 6 +- include/hw/acpi/pcihp.h | 4 +- include/hw/block/block.h | 4 +- include/hw/boards.h | 2 +- include/hw/char/serial.h | 2 +- include/hw/hotplug.h | 8 +- include/hw/i386/pc.h | 2 +- include/hw/isa/isa.h | 2 +- include/hw/loader.h | 3 +- include/hw/mem/pc-dimm.h | 10 ++- include/hw/nmi.h | 2 +- include/hw/pci/msi.h | 2 +- include/hw/pci/msix.h | 4 +- include/hw/pci/pci.h | 2 +- include/hw/pci/pcie.h | 5 +- include/hw/pci/pcie_aer.h | 2 +- include/hw/pci/shpc.h | 5 +- include/hw/ppc/pnv_xscom.h | 2 +- include/hw/ppc/xics.h | 7 +- include/hw/qdev-core.h | 8 +- include/hw/qdev-properties.h | 10 ++- include/hw/s390x/css.h | 4 +- include/hw/scsi/scsi.h | 3 +- include/hw/smbios/smbios.h | 2 +- include/hw/usb.h | 8 +- include/hw/vfio/vfio-common.h | 5 +- include/hw/virtio/vhost-scsi-common.h | 2 +- include/hw/virtio/virtio-bus.h | 2 +- include/hw/virtio/virtio-scsi.h | 6 +- include/hw/xen/xen.h | 2 +- include/io/channel-command.h | 2 +- include/io/channel-file.h | 2 +- include/io/channel-socket.h | 14 ++-- include/io/channel-tls.h | 4 +- include/io/channel-util.h | 2 +- include/io/channel.h | 20 ++--- include/io/dns-resolver.h | 2 +- include/io/task.h | 2 +- include/migration/blocker.h | 2 +- include/migration/failover.h | 2 +- include/migration/migration.h | 4 +- include/migration/snapshot.h | 4 +- include/migration/vmstate.h | 2 +- include/monitor/monitor.h | 6 +- include/monitor/qdev.h | 4 +- include/net/net.h | 6 +- include/qapi/error.h | 2 +- include/qapi/qmp/json-parser.h | 3 +- include/qapi/qmp/qdict.h | 2 +- include/qapi/qmp/qjson.h | 5 +- include/qapi/qobject-input-visitor.h | 2 +- include/qapi/util.h | 2 +- include/qemu/base64.h | 2 +- include/qemu/config-file.h | 4 +- include/qemu/log.h | 4 +- include/qemu/main-loop.h | 2 +- include/qemu/option.h | 30 +++---- include/qemu/sockets.h | 33 ++++---- include/qemu/throttle.h | 2 +- include/qom/cpu.h | 4 +- include/qom/object.h | 89 ++++++++++---------- include/qom/object_interfaces.h | 12 +-- include/qom/qom-qobject.h | 4 +- include/sysemu/arch_init.h | 8 +- include/sysemu/block-backend.h | 19 +++-- include/sysemu/cpus.h | 4 +- include/sysemu/cryptodev.h | 8 +- include/sysemu/device_tree.h | 6 +- include/sysemu/hostmem.h | 2 +- include/sysemu/memory_mapping.h | 2 +- include/sysemu/numa.h | 5 +- include/sysemu/qtest.h | 3 +- include/sysemu/sysemu.h | 10 +-- include/sysemu/tpm_backend.h | 2 +- include/ui/console.h | 14 ++-- include/ui/input.h | 2 +- include/ui/qemu-spice.h | 2 +- migration/block.h | 2 +- migration/exec.h | 5 +- migration/fd.h | 4 +- migration/rdma.h | 5 +- migration/savevm.h | 2 +- migration/socket.h | 9 ++- migration/tls.h | 4 +- nbd/nbd-internal.h | 6 +- net/clients.h | 20 ++--- net/tap_int.h | 5 +- qga/guest-agent-core.h | 4 +- qga/vss-win32.h | 2 +- replication.h | 8 +- target/i386/cpu.h | 2 +- target/ppc/cpu.h | 5 +- target/s390x/cpu.h | 7 +- target/s390x/cpu_models.h | 9 ++- qapi/qapi-visit-core.c | 58 ++++++++------ arch_init.c | 2 +- backends/cryptodev-builtin.c | 15 ++-- backends/cryptodev.c | 18 ++--- backends/hostmem-file.c | 11 +-- backends/hostmem-ram.c | 2 +- backends/hostmem.c | 39 +++++---- backends/rng-egd.c | 7 +- backends/rng-random.c | 6 +- backends/rng.c | 7 +- backends/tpm.c | 7 +- balloon.c | 6 +- block.c | 103 +++++++++++++----------- block/backup.c | 7 +- block/blkdebug.c | 17 ++-- block/blkreplay.c | 2 +- block/blkverify.c | 4 +- block/block-backend.c | 22 ++--- block/bochs.c | 4 +- block/cloop.c | 4 +- block/commit.c | 5 +- block/crypto.c | 20 ++--- block/curl.c | 4 +- block/dirty-bitmap.c | 9 ++- block/dmg.c | 6 +- block/file-posix.c | 42 +++++----- block/file-win32.c | 18 +++-- block/gluster.c | 15 ++-- block/io.c | 2 +- block/iscsi.c | 26 +++--- block/mirror.c | 12 +-- block/nbd-client.c | 2 +- block/nbd.c | 18 +++-- block/nfs.c | 25 +++--- block/null.c | 4 +- block/parallels.c | 5 +- block/qapi.c | 13 +-- block/qcow.c | 9 ++- block/qcow2-cluster.c | 2 +- block/qcow2-refcount.c | 8 +- block/qcow2-snapshot.c | 4 +- block/qcow2.c | 29 ++++--- block/qed.c | 21 +++-- block/quorum.c | 9 ++- block/raw-format.c | 14 ++-- block/rbd.c | 23 +++--- block/replication.c | 26 +++--- block/sheepdog.c | 33 ++++---- block/snapshot.c | 12 +-- block/ssh.c | 31 ++++--- block/stream.c | 6 +- block/vdi.c | 7 +- block/vhdx-log.c | 2 +- block/vhdx.c | 11 +-- block/vmdk.c | 33 ++++---- block/vpc.c | 11 +-- block/vvfat.c | 12 +-- block/vxhs.c | 6 +- block/write-threshold.c | 2 +- blockdev-nbd.c | 11 +-- blockdev.c | 129 +++++++++++++++-------------- blockjob.c | 18 +++-- bootdevice.c | 12 +-- chardev/baum.c | 2 +- chardev/char-console.c | 2 +- chardev/char-fd.c | 2 +- chardev/char-fe.c | 4 +- chardev/char-file.c | 4 +- chardev/char-mux.c | 4 +- chardev/char-null.c | 2 +- chardev/char-parallel.c | 8 +- chardev/char-pipe.c | 8 +- chardev/char-pty.c | 2 +- chardev/char-ringbuf.c | 8 +- chardev/char-serial.c | 6 +- chardev/char-socket.c | 10 +-- chardev/char-stdio.c | 4 +- chardev/char-udp.c | 4 +- chardev/char-win-stdio.c | 2 +- chardev/char-win.c | 3 +- chardev/char.c | 19 ++--- chardev/msmouse.c | 2 +- chardev/spice.c | 8 +- chardev/wctablet.c | 2 +- cpus.c | 12 +-- crypto/afsplit.c | 6 +- crypto/block-luks.c | 22 ++--- crypto/block-qcow.c | 10 +-- crypto/block.c | 14 ++-- crypto/cipher-builtin.c | 24 +++--- crypto/cipher-gcrypt.c | 8 +- crypto/cipher-nettle.c | 8 +- crypto/cipher.c | 2 +- crypto/hash-gcrypt.c | 2 +- crypto/hash-glib.c | 2 +- crypto/hash-nettle.c | 2 +- crypto/hash.c | 10 +-- crypto/hmac-gcrypt.c | 4 +- crypto/hmac-glib.c | 8 +- crypto/hmac-nettle.c | 4 +- crypto/hmac.c | 6 +- crypto/init.c | 2 +- crypto/ivgen-essiv.c | 4 +- crypto/ivgen-plain.c | 4 +- crypto/ivgen-plain64.c | 4 +- crypto/ivgen.c | 4 +- crypto/pbkdf-gcrypt.c | 2 +- crypto/pbkdf-nettle.c | 2 +- crypto/pbkdf-stub.c | 2 +- crypto/pbkdf.c | 4 +- crypto/random-gcrypt.c | 4 +- crypto/random-gnutls.c | 4 +- crypto/random-platform.c | 4 +- crypto/secret.c | 38 ++++----- crypto/tlscreds.c | 20 ++--- crypto/tlscredsanon.c | 12 +-- crypto/tlscredsx509.c | 38 ++++----- crypto/tlssession.c | 18 ++--- device_tree.c | 8 +- dump.c | 52 ++++++------ exec.c | 20 ++--- fsdev/qemu-fsdev-throttle.c | 3 +- gdbstub.c | 2 +- hw/9pfs/9p.c | 4 +- hw/9pfs/virtio-9p-device.c | 7 +- hw/acpi/acpi-stub.c | 2 +- hw/acpi/core.c | 6 +- hw/acpi/cpu.c | 7 +- hw/acpi/cpu_hotplug.c | 5 +- hw/acpi/ich9.c | 37 +++++---- hw/acpi/memory_hotplug.c | 8 +- hw/acpi/pcihp.c | 4 +- hw/acpi/piix4.c | 14 ++-- hw/acpi/vmgenid.c | 7 +- hw/arm/allwinner-a10.c | 2 +- hw/arm/armv7m.c | 4 +- hw/arm/aspeed.c | 4 +- hw/arm/aspeed_soc.c | 2 +- hw/arm/bcm2835_peripherals.c | 3 +- hw/arm/bcm2836.c | 2 +- hw/arm/digic.c | 2 +- hw/arm/fsl-imx25.c | 2 +- hw/arm/fsl-imx31.c | 2 +- hw/arm/fsl-imx6.c | 2 +- hw/arm/integratorcp.c | 2 +- hw/arm/musicpal.c | 4 +- hw/arm/pxa2xx.c | 2 +- hw/arm/pxa2xx_gpio.c | 2 +- hw/arm/spitz.c | 4 +- hw/arm/stm32f205_soc.c | 2 +- hw/arm/strongarm.c | 2 +- hw/arm/tosa.c | 2 +- hw/arm/vexpress.c | 5 +- hw/arm/virt.c | 21 ++--- hw/arm/xlnx-zynqmp.c | 4 +- hw/arm/z2.c | 2 +- hw/audio/ac97.c | 2 +- hw/audio/adlib.c | 2 +- hw/audio/cs4231a.c | 2 +- hw/audio/es1370.c | 2 +- hw/audio/gus.c | 2 +- hw/audio/intel-hda.c | 6 +- hw/audio/marvell_88w8618.c | 2 +- hw/audio/milkymist-ac97.c | 2 +- hw/audio/pcspk.c | 2 +- hw/audio/pl041.c | 2 +- hw/audio/sb16.c | 2 +- hw/block/block.c | 4 +- hw/block/dataplane/virtio-blk.c | 2 +- hw/block/fdc.c | 10 +-- hw/block/m25p80.c | 2 +- hw/block/nand.c | 2 +- hw/block/pflash_cfi01.c | 2 +- hw/block/pflash_cfi02.c | 2 +- hw/block/virtio-blk.c | 7 +- hw/bt/hci-csr.c | 2 +- hw/char/bcm2835_aux.c | 2 +- hw/char/cadence_uart.c | 2 +- hw/char/debugcon.c | 4 +- hw/char/digic-uart.c | 2 +- hw/char/escc.c | 2 +- hw/char/etraxfs_ser.c | 2 +- hw/char/exynos4210_uart.c | 2 +- hw/char/imx_serial.c | 2 +- hw/char/ipoctal232.c | 2 +- hw/char/lm32_juart.c | 2 +- hw/char/lm32_uart.c | 2 +- hw/char/mcf_uart.c | 2 +- hw/char/milkymist-uart.c | 2 +- hw/char/parallel.c | 2 +- hw/char/pl011.c | 2 +- hw/char/serial-isa.c | 2 +- hw/char/serial-pci.c | 4 +- hw/char/serial.c | 2 +- hw/char/spapr_vty.c | 2 +- hw/char/stm32f2xx_usart.c | 2 +- hw/char/terminal3270.c | 2 +- hw/char/virtio-console.c | 4 +- hw/char/virtio-serial-bus.c | 16 ++-- hw/char/xilinx_uartlite.c | 2 +- hw/core/bus.c | 11 +-- hw/core/generic-loader.c | 4 +- hw/core/hotplug.c | 8 +- hw/core/loader.c | 3 +- hw/core/machine.c | 87 +++++++++++--------- hw/core/nmi.c | 2 +- hw/core/or-irq.c | 2 +- hw/core/platform-bus.c | 2 +- hw/core/qdev-properties-system.c | 24 +++--- hw/core/qdev-properties.c | 63 ++++++++------- hw/core/qdev.c | 23 +++--- hw/cpu/a15mpcore.c | 2 +- hw/cpu/a9mpcore.c | 2 +- hw/cpu/arm11mpcore.c | 2 +- hw/cpu/core.c | 8 +- hw/cpu/realview_mpcore.c | 2 +- hw/display/ads7846.c | 2 +- hw/display/bcm2835_fb.c | 2 +- hw/display/cg3.c | 2 +- hw/display/cirrus_vga.c | 4 +- hw/display/exynos4210_fimd.c | 2 +- hw/display/jazz_led.c | 2 +- hw/display/milkymist-tmu2.c | 2 +- hw/display/milkymist-vgafb.c | 2 +- hw/display/pl110.c | 2 +- hw/display/qxl.c | 6 +- hw/display/sm501.c | 4 +- hw/display/ssd0323.c | 2 +- hw/display/tcx.c | 2 +- hw/display/vga-isa.c | 2 +- hw/display/vga-pci.c | 9 ++- hw/display/virtio-gpu-pci.c | 3 +- hw/display/virtio-gpu.c | 8 +- hw/display/virtio-vga.c | 3 +- hw/display/vmware_vga.c | 2 +- hw/display/xlnx_dp.c | 4 +- hw/dma/bcm2835_dma.c | 2 +- hw/dma/i82374.c | 2 +- hw/dma/i8257.c | 2 +- hw/dma/pl330.c | 2 +- hw/dma/pxa2xx_dma.c | 2 +- hw/dma/rc4030.c | 4 +- hw/dma/sparc32_dma.c | 2 +- hw/dma/xilinx_axidma.c | 2 +- hw/gpio/bcm2835_gpio.c | 2 +- hw/gpio/gpio_key.c | 2 +- hw/gpio/imx_gpio.c | 2 +- hw/gpio/omap_gpio.c | 4 +- hw/i2c/aspeed_i2c.c | 2 +- hw/i2c/imx_i2c.c | 2 +- hw/i2c/omap_i2c.c | 2 +- hw/i2c/smbus_ich9.c | 2 +- hw/i386/amd_iommu.c | 2 +- hw/i386/intel_iommu.c | 4 +- hw/i386/kvm/apic.c | 4 +- hw/i386/kvm/clock.c | 2 +- hw/i386/kvm/i8254.c | 2 +- hw/i386/kvm/i8259.c | 2 +- hw/i386/kvm/ioapic.c | 2 +- hw/i386/kvm/pci-assign.c | 21 ++--- hw/i386/kvmvapic.c | 2 +- hw/i386/pc.c | 73 +++++++++-------- hw/i386/x86-iommu.c | 2 +- hw/i386/xen/xen-hvm.c | 4 +- hw/i386/xen/xen_apic.c | 2 +- hw/i386/xen/xen_platform.c | 2 +- hw/i386/xen/xen_pvdevice.c | 2 +- hw/ide/ahci.c | 2 +- hw/ide/cmd646.c | 2 +- hw/ide/core.c | 2 +- hw/ide/ich.c | 2 +- hw/ide/isa.c | 2 +- hw/ide/macio.c | 2 +- hw/ide/microdrive.c | 2 +- hw/ide/mmio.c | 2 +- hw/ide/piix.c | 2 +- hw/ide/qdev.c | 8 +- hw/ide/via.c | 2 +- hw/input/adb.c | 6 +- hw/input/pckbd.c | 2 +- hw/input/virtio-input-hid.c | 5 +- hw/input/virtio-input-host.c | 5 +- hw/input/virtio-input.c | 8 +- hw/input/vmmouse.c | 2 +- hw/intc/apic.c | 4 +- hw/intc/apic_common.c | 8 +- hw/intc/arm_gic.c | 2 +- hw/intc/arm_gic_common.c | 2 +- hw/intc/arm_gic_kvm.c | 2 +- hw/intc/arm_gicv2m.c | 2 +- hw/intc/arm_gicv3.c | 2 +- hw/intc/arm_gicv3_common.c | 2 +- hw/intc/arm_gicv3_its_kvm.c | 2 +- hw/intc/arm_gicv3_kvm.c | 2 +- hw/intc/armv7m_nvic.c | 2 +- hw/intc/aspeed_vic.c | 2 +- hw/intc/exynos4210_gic.c | 3 +- hw/intc/grlib_irqmp.c | 2 +- hw/intc/i8259.c | 2 +- hw/intc/i8259_common.c | 2 +- hw/intc/ioapic.c | 2 +- hw/intc/ioapic_common.c | 2 +- hw/intc/mips_gic.c | 2 +- hw/intc/nios2_iic.c | 2 +- hw/intc/omap_intc.c | 4 +- hw/intc/openpic.c | 2 +- hw/intc/openpic_kvm.c | 2 +- hw/intc/realview_gic.c | 2 +- hw/intc/s390_flic.c | 2 +- hw/intc/s390_flic_kvm.c | 2 +- hw/intc/xics.c | 8 +- hw/intc/xics_kvm.c | 8 +- hw/intc/xics_pnv.c | 2 +- hw/intc/xics_spapr.c | 5 +- hw/ipack/ipack.c | 4 +- hw/ipack/tpci200.c | 2 +- hw/ipmi/ipmi.c | 2 +- hw/ipmi/ipmi_bmc_extern.c | 2 +- hw/ipmi/ipmi_bmc_sim.c | 2 +- hw/ipmi/isa_ipmi_bt.c | 4 +- hw/ipmi/isa_ipmi_kcs.c | 4 +- hw/isa/i82378.c | 2 +- hw/isa/isa-bus.c | 2 +- hw/isa/lpc_ich9.c | 4 +- hw/isa/pc87312.c | 2 +- hw/isa/piix4.c | 2 +- hw/isa/vt82c686.c | 8 +- hw/mem/nvdimm.c | 6 +- hw/mem/pc-dimm.c | 18 +++-- hw/mips/cps.c | 2 +- hw/mips/gt64xxx_pci.c | 2 +- hw/misc/applesmc.c | 2 +- hw/misc/arm11scu.c | 2 +- hw/misc/arm_sysctl.c | 2 +- hw/misc/aspeed_scu.c | 2 +- hw/misc/aspeed_sdmc.c | 2 +- hw/misc/bcm2835_mbox.c | 2 +- hw/misc/bcm2835_property.c | 2 +- hw/misc/debugexit.c | 2 +- hw/misc/eccmemctl.c | 2 +- hw/misc/edu.c | 4 +- hw/misc/hyperv_testdev.c | 2 +- hw/misc/imx6_src.c | 2 +- hw/misc/ivshmem.c | 31 +++---- hw/misc/macio/cuda.c | 2 +- hw/misc/macio/macio.c | 8 +- hw/misc/max111x.c | 4 +- hw/misc/mips_cmgcr.c | 2 +- hw/misc/mips_cpc.c | 2 +- hw/misc/mips_itu.c | 2 +- hw/misc/pc-testdev.c | 2 +- hw/misc/pci-testdev.c | 2 +- hw/misc/pvpanic.c | 2 +- hw/misc/sga.c | 2 +- hw/misc/tmp105.c | 4 +- hw/misc/unimp.c | 2 +- hw/misc/vmport.c | 2 +- hw/net/allwinner_emac.c | 2 +- hw/net/cadence_gem.c | 2 +- hw/net/dp8393x.c | 2 +- hw/net/e1000.c | 2 +- hw/net/e1000e.c | 2 +- hw/net/eepro100.c | 2 +- hw/net/fsl_etsec/etsec.c | 2 +- hw/net/ftgmac100.c | 2 +- hw/net/imx_fec.c | 2 +- hw/net/mcf_fec.c | 2 +- hw/net/ne2000-isa.c | 6 +- hw/net/ne2000.c | 2 +- hw/net/pcnet-pci.c | 2 +- hw/net/rocker/qmp-norocker.c | 9 ++- hw/net/rocker/rocker.c | 5 +- hw/net/rocker/rocker_of_dpa.c | 2 +- hw/net/rtl8139.c | 2 +- hw/net/spapr_llan.c | 2 +- hw/net/virtio-net.c | 7 +- hw/net/vmxnet3.c | 4 +- hw/net/xilinx_axienet.c | 2 +- hw/net/xilinx_ethlite.c | 2 +- hw/nvram/fw_cfg.c | 6 +- hw/nvram/mac_nvram.c | 4 +- hw/nvram/spapr_nvram.c | 2 +- hw/pci-bridge/dec.c | 4 +- hw/pci-bridge/gen_pcie_root_port.c | 2 +- hw/pci-bridge/ioh3420.c | 2 +- hw/pci-bridge/pci_bridge_dev.c | 4 +- hw/pci-bridge/pci_expander_bridge.c | 10 ++- hw/pci-bridge/pcie_root_port.c | 2 +- hw/pci-host/apb.c | 4 +- hw/pci-host/bonito.c | 2 +- hw/pci-host/gpex.c | 2 +- hw/pci-host/grackle.c | 2 +- hw/pci-host/piix.c | 15 ++-- hw/pci-host/ppce500.c | 2 +- hw/pci-host/prep.c | 4 +- hw/pci-host/q35.c | 14 ++-- hw/pci-host/uninorth.c | 9 ++- hw/pci-host/versatile.c | 4 +- hw/pci-host/xilinx-pcie.c | 2 +- hw/pci/msi.c | 2 +- hw/pci/msix.c | 4 +- hw/pci/pci-stub.c | 2 +- hw/pci/pci.c | 24 +++--- hw/pci/pcie.c | 8 +- hw/pci/pcie_aer.c | 2 +- hw/pci/shpc.c | 8 +- hw/ppc/e500.c | 3 +- hw/ppc/mac_newworld.c | 2 +- hw/ppc/mac_oldworld.c | 2 +- hw/ppc/pnv.c | 10 +-- hw/ppc/pnv_core.c | 7 +- hw/ppc/pnv_lpc.c | 2 +- hw/ppc/pnv_occ.c | 2 +- hw/ppc/pnv_psi.c | 2 +- hw/ppc/pnv_xscom.c | 2 +- hw/ppc/prep.c | 2 +- hw/ppc/prep_systemio.c | 2 +- hw/ppc/rs6000_mc.c | 2 +- hw/ppc/spapr.c | 61 ++++++++------ hw/ppc/spapr_cpu_core.c | 9 ++- hw/ppc/spapr_drc.c | 15 ++-- hw/ppc/spapr_hcall.c | 2 +- hw/ppc/spapr_iommu.c | 2 +- hw/ppc/spapr_pci.c | 12 +-- hw/ppc/spapr_rng.c | 2 +- hw/ppc/spapr_rtc.c | 5 +- hw/ppc/spapr_vio.c | 2 +- hw/s390x/3270-ccw.c | 2 +- hw/s390x/ccw-device.c | 2 +- hw/s390x/css-bridge.c | 2 +- hw/s390x/css.c | 10 +-- hw/s390x/event-facility.c | 6 +- hw/s390x/ipl.c | 4 +- hw/s390x/s390-ccw.c | 7 +- hw/s390x/s390-pci-bus.c | 12 +-- hw/s390x/s390-skeys.c | 9 ++- hw/s390x/s390-virtio-ccw.c | 25 +++--- hw/s390x/s390-virtio.c | 2 +- hw/s390x/sclp.c | 2 +- hw/s390x/virtio-ccw.c | 41 ++++++---- hw/scsi/esp-pci.c | 4 +- hw/scsi/esp.c | 2 +- hw/scsi/lsi53c895a.c | 4 +- hw/scsi/megasas.c | 2 +- hw/scsi/mptsas.c | 2 +- hw/scsi/scsi-bus.c | 9 ++- hw/scsi/scsi-disk.c | 13 +-- hw/scsi/scsi-generic.c | 2 +- hw/scsi/spapr_vscsi.c | 2 +- hw/scsi/vhost-scsi-common.c | 2 +- hw/scsi/vhost-scsi.c | 4 +- hw/scsi/virtio-scsi-dataplane.c | 2 +- hw/scsi/virtio-scsi.c | 16 ++-- hw/scsi/vmw_pvscsi.c | 8 +- hw/sd/pl181.c | 2 +- hw/sd/sd.c | 4 +- hw/sd/sdhci.c | 4 +- hw/sd/ssi-sd.c | 2 +- hw/sh4/sh_pci.c | 2 +- hw/smbios/smbios-stub.c | 2 +- hw/smbios/smbios.c | 2 +- hw/sparc/sun4m.c | 4 +- hw/sparc64/sun4u.c | 6 +- hw/ssi/aspeed_smc.c | 2 +- hw/ssi/imx_spi.c | 2 +- hw/ssi/ssi.c | 2 +- hw/ssi/xilinx_spips.c | 4 +- hw/timer/a9gtimer.c | 2 +- hw/timer/altera_timer.c | 2 +- hw/timer/arm_mptimer.c | 2 +- hw/timer/arm_timer.c | 2 +- hw/timer/aspeed_timer.c | 2 +- hw/timer/hpet.c | 2 +- hw/timer/i8254.c | 2 +- hw/timer/i8254_common.c | 2 +- hw/timer/imx_epit.c | 2 +- hw/timer/imx_gpt.c | 2 +- hw/timer/lm32_timer.c | 2 +- hw/timer/m48t59-isa.c | 2 +- hw/timer/m48t59.c | 4 +- hw/timer/mc146818rtc.c | 7 +- hw/timer/milkymist-sysctl.c | 2 +- hw/timer/pxa2xx_timer.c | 2 +- hw/timer/xilinx_timer.c | 2 +- hw/tpm/tpm_tis.c | 2 +- hw/usb/bus.c | 24 +++--- hw/usb/dev-audio.c | 4 +- hw/usb/dev-bluetooth.c | 4 +- hw/usb/dev-hid.c | 10 +-- hw/usb/dev-hub.c | 4 +- hw/usb/dev-mtp.c | 2 +- hw/usb/dev-network.c | 4 +- hw/usb/dev-serial.c | 2 +- hw/usb/dev-smartcard-reader.c | 4 +- hw/usb/dev-storage.c | 12 +-- hw/usb/dev-uas.c | 4 +- hw/usb/dev-wacom.c | 4 +- hw/usb/hcd-ehci-pci.c | 2 +- hw/usb/hcd-ehci-sysbus.c | 2 +- hw/usb/hcd-ehci.c | 6 +- hw/usb/hcd-ohci.c | 6 +- hw/usb/hcd-uhci.c | 4 +- hw/usb/hcd-xhci.c | 2 +- hw/usb/host-libusb.c | 4 +- hw/usb/redirect.c | 4 +- hw/vfio/amd-xgbe.c | 2 +- hw/vfio/calxeda-xgmac.c | 2 +- hw/vfio/ccw.c | 12 +-- hw/vfio/common.c | 7 +- hw/vfio/pci-quirks.c | 6 +- hw/vfio/pci.c | 22 ++--- hw/vfio/platform.c | 9 ++- hw/virtio/vhost-vsock.c | 8 +- hw/virtio/virtio-balloon.c | 14 ++-- hw/virtio/virtio-bus.c | 2 +- hw/virtio/virtio-crypto-pci.c | 3 +- hw/virtio/virtio-crypto.c | 10 ++- hw/virtio/virtio-mmio.c | 2 +- hw/virtio/virtio-pci.c | 38 +++++---- hw/virtio/virtio-rng.c | 8 +- hw/virtio/virtio.c | 4 +- hw/watchdog/wdt_aspeed.c | 2 +- hw/watchdog/wdt_diag288.c | 4 +- hw/watchdog/wdt_i6300esb.c | 2 +- hw/watchdog/wdt_ib700.c | 2 +- hw/xen/xen-host-pci-device.c | 12 +-- hw/xen/xen_pt.c | 2 +- hw/xen/xen_pt_config_init.c | 4 +- hw/xen/xen_pt_graphics.c | 2 +- io/channel-buffer.c | 10 +-- io/channel-command.c | 14 ++-- io/channel-file.c | 12 +-- io/channel-socket.c | 30 +++---- io/channel-tls.c | 14 ++-- io/channel-util.c | 2 +- io/channel-websock.c | 26 +++--- io/channel.c | 20 ++--- io/dns-resolver.c | 6 +- io/task.c | 2 +- iothread.c | 8 +- memory.c | 21 ++--- memory_mapping.c | 2 +- migration/colo-failover.c | 4 +- migration/colo.c | 18 ++--- migration/exec.c | 5 +- migration/fd.c | 5 +- migration/migration.c | 37 ++++----- migration/rdma.c | 27 ++++--- migration/savevm.c | 14 ++-- migration/socket.c | 16 ++-- migration/tls.c | 6 +- monitor.c | 43 +++++----- nbd/client.c | 25 +++--- nbd/common.c | 2 +- nbd/server.c | 2 +- net/colo-compare.c | 19 +++-- net/dump.c | 15 ++-- net/filter-buffer.c | 9 ++- net/filter-mirror.c | 16 ++-- net/filter-rewriter.c | 2 +- net/filter.c | 18 +++-- net/hub.c | 2 +- net/l2tpv3.c | 2 +- net/net.c | 21 ++--- net/netmap.c | 5 +- net/slirp.c | 2 +- net/socket.c | 2 +- net/tap-bsd.c | 10 ++- net/tap-linux.c | 5 +- net/tap-solaris.c | 7 +- net/tap-stub.c | 5 +- net/tap-win32.c | 2 +- net/tap.c | 15 ++-- net/vde.c | 2 +- net/vhost-user.c | 7 +- numa.c | 13 +-- qapi/opts-visitor.c | 26 +++--- qapi/qapi-clone-visitor.c | 20 ++--- qapi/qapi-dealloc-visitor.c | 22 ++--- qapi/qapi-util.c | 2 +- qapi/qmp-dispatch.c | 5 +- qapi/qobject-input-visitor.c | 48 ++++++----- qapi/qobject-output-visitor.c | 20 ++--- qapi/string-input-visitor.c | 19 ++--- qapi/string-output-visitor.c | 14 ++-- qdev-monitor.c | 23 +++--- qemu-img.c | 4 +- qemu-nbd.c | 3 +- qga/commands-posix.c | 138 +++++++++++++++++--------------- qga/commands-win32.c | 83 ++++++++++--------- qga/commands.c | 16 ++-- qga/main.c | 2 +- qga/vss-win32.c | 2 +- qmp.c | 76 +++++++++--------- qobject/json-parser.c | 3 +- qobject/qdict.c | 4 +- qobject/qjson.c | 5 +- qom/cpu.c | 10 +-- qom/object.c | 135 ++++++++++++++++--------------- qom/object_interfaces.c | 13 +-- qom/qom-qobject.c | 4 +- qtest.c | 3 +- replication.c | 8 +- stubs/arch-query-cpu-def.c | 2 +- stubs/arch-query-cpu-model-baseline.c | 2 +- stubs/arch-query-cpu-model-comparison.c | 2 +- stubs/arch-query-cpu-model-expansion.c | 2 +- stubs/migr-blocker.c | 2 +- stubs/monitor.c | 2 +- stubs/uuid.c | 2 +- stubs/vmgenid.c | 2 +- stubs/vmstate.c | 2 +- stubs/xen-hvm.c | 4 +- target/alpha/cpu.c | 2 +- target/arm/cpu.c | 2 +- target/arm/cpu64.c | 5 +- target/arm/helper.c | 2 +- target/arm/monitor.c | 2 +- target/cris/cpu.c | 2 +- target/hppa/cpu.c | 2 +- target/i386/arch_memory_mapping.c | 2 +- target/i386/cpu.c | 66 ++++++++------- target/lm32/cpu.c | 2 +- target/m68k/cpu.c | 2 +- target/microblaze/cpu.c | 2 +- target/mips/cpu.c | 2 +- target/moxie/cpu.c | 2 +- target/nios2/cpu.c | 2 +- target/openrisc/cpu.c | 2 +- target/ppc/compat.c | 5 +- target/ppc/translate_init.c | 12 +-- target/s390x/cpu.c | 6 +- target/s390x/cpu_models.c | 32 ++++---- target/s390x/helper.c | 5 +- target/s390x/kvm.c | 5 +- target/sh4/cpu.c | 2 +- target/sparc/cpu.c | 6 +- target/tilegx/cpu.c | 2 +- target/tricore/cpu.c | 2 +- target/unicore32/cpu.c | 2 +- target/xtensa/cpu.c | 2 +- tests/check-qom-proplist.c | 12 +-- tests/test-crypto-block.c | 6 +- tests/test-crypto-tlscredsx509.c | 2 +- tests/test-crypto-tlssession.c | 2 +- tests/test-io-channel-tls.c | 2 +- tests/test-logging.c | 3 +- tests/test-qapi-util.c | 10 +-- tests/test-qdev-global-props.c | 4 +- tests/test-qemu-opts.c | 2 +- tests/test-qmp-commands.c | 17 ++-- tests/test-qmp-event.c | 3 +- tests/test-visitor-serialization.c | 25 +++--- tpm.c | 8 +- trace/qmp.c | 8 +- ui/console.c | 12 +-- ui/gtk.c | 2 +- ui/input-legacy.c | 2 +- ui/input-linux.c | 14 ++-- ui/input.c | 6 +- ui/spice-core.c | 4 +- ui/vnc-auth-sasl.c | 2 +- ui/vnc.c | 30 +++---- util/aio-posix.c | 3 +- util/aio-win32.c | 3 +- util/async.c | 2 +- util/base64.c | 2 +- util/error.c | 2 +- util/keyval.c | 9 ++- util/log.c | 4 +- util/main-loop.c | 2 +- util/qemu-config.c | 15 ++-- util/qemu-option.c | 42 +++++----- util/qemu-sockets.c | 76 ++++++++++-------- util/throttle.c | 2 +- vl.c | 44 +++++----- 815 files changed, 3406 insertions(+), 2952 deletions(-)
include/qapi/visitor.h +26 -21
@@ -296,7 +296,7 @@ void visit_free(Visitor *v);* used for QAPI unions, and maps to JSON objects? */ void visit_start_struct (Visitor *v,const char *name,void **obj, -size_t size,Error **errp); +size_t size,Error *errp[static 1 ]);/* * Prepare for completing an object visit.
@@ -309,7 +309,7 @@ void visit_start_struct(Visitor *v, const char *name, void **obj,* last chance to report errors. May be skipped on a cleanup path, * where there is no need to check for further errors. */ -void visit_check_struct (Visitor *v,Error **errp); +void visit_check_struct (Visitor *v,Error *errp[static 1 ]);/* * Complete an object visit started earlier.
@@ -353,7 +353,7 @@ void visit_end_struct(Visitor *v, void **obj);* examples above. */ void visit_start_list (Visitor *v,const char *name,GenericList **list, -size_t size,Error **errp); +size_t size,Error *errp[static 1 ]);/* * Iterate over a GenericList during a non-virtual list visit.
@@ -382,7 +382,7 @@ GenericList *visit_next_list(Visitor *v, GenericList *tail, size_t size);* last chance to report errors. May be skipped on a cleanup path, * where there is no need to check for further errors. */ -void visit_check_list (Visitor *v,Error **errp); +void visit_check_list (Visitor *v,Error *errp[static 1 ]);/* * Complete a list visit started earlier.
@@ -418,7 +418,7 @@ void visit_end_list(Visitor *v, void **list);*/ void visit_start_alternate (Visitor *v,const char *name,GenericAlternate **obj,size_t size, -bool promote_int,Error **errp); +bool promote_int,Error *errp[static 1 ]);/* * Finish visiting an alternate type.
@@ -471,7 +471,7 @@ bool visit_optional(Visitor *v, const char *name, bool *present);* that visit_type_str() must have no unwelcome side effects. */ void visit_type_enum (Visitor *v,const char *name,int *obj, -const char *const strings[],Error **errp); +const char *const strings[],Error *errp[static 1 ]);/* * Check if visitor is an input visitor.
@@ -489,28 +489,29 @@ bool visit_is_input(Visitor *v);* @obj must be non-NULL. Input visitors set *@obj to the value; * other visitors will leave *@obj unchanged. */ -void visit_type_int (Visitor *v,const char *name,int64_t *obj,Error **errp); +void visit_type_int (Visitor *v,const char *name,int64_t *obj, +Error *errp[static 1 ]);/* * Visit a uint8_t value. * Like visit_type_int(), except clamps the value to uint8_t range. */ void visit_type_uint8 (Visitor *v,const char *name,uint8_t *obj, -Error **errp); +Error *errp[static 1 ]);/* * Visit a uint16_t value. * Like visit_type_int(), except clamps the value to uint16_t range. */ void visit_type_uint16 (Visitor *v,const char *name,uint16_t *obj, -Error **errp); +Error *errp[static 1 ]);/* * Visit a uint32_t value. * Like visit_type_int(), except clamps the value to uint32_t range. */ void visit_type_uint32 (Visitor *v,const char *name,uint32_t *obj, -Error **errp); +Error *errp[static 1 ]);/* * Visit a uint64_t value.
@@ -518,34 +519,35 @@ void visit_type_uint32(Visitor *v, const char *name, uint32_t *obj,* that is, ensures it is unsigned. */ void visit_type_uint64 (Visitor *v,const char *name,uint64_t *obj, -Error **errp); +Error *errp[static 1 ]);/* * Visit an int8_t value. * Like visit_type_int(), except clamps the value to int8_t range. */ -void visit_type_int8 (Visitor *v,const char *name,int8_t *obj,Error **errp); +void visit_type_int8 (Visitor *v,const char *name,int8_t *obj, +Error *errp[static 1 ]);/* * Visit an int16_t value. * Like visit_type_int(), except clamps the value to int16_t range. */ void visit_type_int16 (Visitor *v,const char *name,int16_t *obj, -Error **errp); +Error *errp[static 1 ]);/* * Visit an int32_t value. * Like visit_type_int(), except clamps the value to int32_t range. */ void visit_type_int32 (Visitor *v,const char *name,int32_t *obj, -Error **errp); +Error *errp[static 1 ]);/* * Visit an int64_t value. * Identical to visit_type_int(). */ void visit_type_int64 (Visitor *v,const char *name,int64_t *obj, -Error **errp); +Error *errp[static 1 ]);/* * Visit a uint64_t value.
@@ -554,7 +556,7 @@ void visit_type_int64(Visitor *v, const char *name, int64_t *obj,* values. */ void visit_type_size (Visitor *v,const char *name,uint64_t *obj, -Error **errp); +Error *errp[static 1 ]);/* * Visit a boolean value.
@@ -565,7 +567,8 @@ void visit_type_size(Visitor *v, const char *name, uint64_t *obj,* @obj must be non-NULL. Input visitors set *@obj to the value; * other visitors will leave *@obj unchanged. */ -void visit_type_bool (Visitor *v,const char *name,bool *obj,Error **errp); +void visit_type_bool (Visitor *v,const char *name,bool *obj, +Error *errp[static 1 ]);/* * Visit a string value.
@@ -583,7 +586,8 @@ void visit_type_bool(Visitor *v, const char *name, bool *obj, Error **errp);* * FIXME: Callers that try to output NULL *obj should not be allowed. */ -void visit_type_str (Visitor *v,const char *name,char **obj,Error **errp); +void visit_type_str (Visitor *v,const char *name,char **obj, +Error *errp[static 1 ]);/* * Visit a number (i.e. double) value.
@@ -596,7 +600,7 @@ void visit_type_str(Visitor *v, const char *name, char **obj, Error **errp);* document if infinity or NaN are not permitted. */ void visit_type_number (Visitor *v,const char *name,double *obj, -Error **errp); +Error *errp[static 1 ]);/* * Visit an arbitrary value.
@@ -612,7 +616,8 @@ void visit_type_number(Visitor *v, const char *name, double *obj,* E.g. the visitor returned by qobject_input_visitor_new_keyval() * can't create numbers or booleans, only strings. */ -void visit_type_any (Visitor *v,const char *name,QObject **obj,Error **errp); +void visit_type_any (Visitor *v,const char *name,QObject **obj, +Error *errp[static 1 ]);/* * Visit a JSON null value.
@@ -624,6 +629,6 @@ void visit_type_any(Visitor *v, const char *name, QObject **obj, Error **errp);* needed; rather, this is a witness that an explicit null value is * expected rather than any other type. */ -void visit_type_null (Visitor *v,const char *name,Error **errp); +void visit_type_null (Visitor *v,const char *name,Error *errp[static 1 ]);#endif
block/nbd-client.h +1 -1
@@ -39,7 +39,7 @@ int nbd_client_init(BlockDriverState *bs,const char *export_name, QCryptoTLSCreds *tlscreds, const char *hostname, - Error **errp); + Error *errp[static 1]);void nbd_client_close (BlockDriverState *bs);int nbd_client_co_pdiscard (BlockDriverState *bs,int64_t offset,int count);
block/qcow2.h +4 -4
@@ -530,7 +530,7 @@ int qcow2_pre_write_overlap_check(BlockDriverState *bs, int ign, int64_t offset,int qcow2_change_refcount_order (BlockDriverState *bs,int refcount_order,BlockDriverAmendStatusCB *status_cb, -void *cb_opaque,Error **errp); +void *cb_opaque,Error *errp[static 1 ]);/* qcow2-cluster.c functions */ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size,
@@ -539,7 +539,7 @@ int qcow2_write_l1_entry(BlockDriverState *bs, int l1_index);int qcow2_decompress_cluster (BlockDriverState *bs,uint64_t cluster_offset);int qcow2_encrypt_sectors (BDRVQcow2State *s,int64_t sector_num,uint8_t *out_buf,const uint8_t *in_buf, -int nb_sectors,bool enc,Error **errp); +int nb_sectors,bool enc,Error *errp[static 1 ]);int qcow2_get_cluster_offset (BlockDriverState *bs,uint64_t offset,unsigned int *bytes,uint64_t *cluster_offset);
@@ -567,12 +567,12 @@ int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id);int qcow2_snapshot_delete (BlockDriverState *bs,const char *snapshot_id,const char *name, -Error **errp); +Error *errp[static 1 ]);int qcow2_snapshot_list (BlockDriverState *bs,QEMUSnapshotInfo **psn_tab);int qcow2_snapshot_load_tmp (BlockDriverState *bs,const char *snapshot_id,const char *name, -Error **errp); +Error *errp[static 1 ]);void qcow2_free_snapshots (BlockDriverState *bs);int qcow2_read_snapshots (BlockDriverState *bs);
block/vhdx.h +1 -1
@@ -413,7 +413,7 @@ uint32_t vhdx_checksum_calc(uint32_t crc, uint8_t *buf, size_t size,bool vhdx_checksum_is_valid (uint8_t *buf,size_t size,int crc_offset);int vhdx_parse_log (BlockDriverState *bs,BDRVVHDXState *s,bool *flushed, -Error **errp); +Error *errp[static 1 ]);int vhdx_log_write_and_flush (BlockDriverState *bs,BDRVVHDXState *s,void *data,uint32_t length,uint64_t offset);
crypto/blockpriv.h +2 -2
@@ -82,7 +82,7 @@ int qcrypto_block_decrypt_helper(QCryptoCipher *cipher,uint64_t startsector, uint8_t *buf, size_t len, - Error **errp); + Error *errp[static 1]); int qcrypto_block_encrypt_helper(QCryptoCipher *cipher, size_t niv,
@@ -91,6 +91,6 @@ int qcrypto_block_encrypt_helper(QCryptoCipher *cipher,uint64_t startsector, uint8_t *buf, size_t len, - Error **errp); + Error *errp[static 1]);#endif /* QCRYPTO_BLOCKPRIV_H */
crypto/hmac.h +5 -5
@@ -53,7 +53,7 @@ bool qcrypto_hmac_supports(QCryptoHashAlgorithm alg);*/ QCryptoHmac *qcrypto_hmac_new (QCryptoHashAlgorithm alg,const uint8_t *key,size_t nkey, -Error **errp); +Error *errp[static 1 ]);/** * qcrypto_hmac_free:
@@ -88,7 +88,7 @@ int qcrypto_hmac_bytesv(QCryptoHmac *hmac,size_t niov, uint8_t **result, size_t *resultlen, - Error **errp); + Error *errp[static 1]);/** * qcrypto_hmac_bytes:
@@ -114,7 +114,7 @@ int qcrypto_hmac_bytes(QCryptoHmac *hmac,size_t len, uint8_t **result, size_t *resultlen, - Error **errp); + Error *errp[static 1]);/** * qcrypto_hmac_digestv:
@@ -138,7 +138,7 @@ int qcrypto_hmac_digestv(QCryptoHmac *hmac,const struct iovec *iov, size_t niov, char **digest, - Error **errp); + Error *errp[static 1]);/** * qcrypto_hmac_digest:
@@ -161,6 +161,6 @@ int qcrypto_hmac_digest(QCryptoHmac *hmac,const char *buf, size_t len, char **digest, - Error **errp); + Error *errp[static 1]);#endif
crypto/tlscredspriv.h +2 -2
@@ -29,12 +29,12 @@ int qcrypto_tls_creds_get_path(QCryptoTLSCreds *creds,const char *filename, bool required, char **cred, - Error **errp); + Error *errp[static 1]);int qcrypto_tls_creds_get_dh_params_file (QCryptoTLSCreds *creds,const char *filename,gnutls_dh_params_t *dh_params, -Error **errp); +Error *errp[static 1 ]);#endif
hw/9pfs/9p.h +2 -2
@@ -340,8 +340,8 @@ void v9fs_path_sprintf(V9fsPath *path, const char *fmt, ...);void v9fs_path_copy (V9fsPath *lhs,V9fsPath *rhs);int v9fs_name_to_path (V9fsState *s,V9fsPath *dirpath,const char *name,V9fsPath *path); -int v9fs_device_realize_common (V9fsState *s,Error **errp); -void v9fs_device_unrealize_common (V9fsState *s,Error **errp); +int v9fs_device_realize_common (V9fsState *s,Error *errp[static 1 ]); +void v9fs_device_unrealize_common (V9fsState *s,Error *errp[static 1 ]);ssize_t pdu_marshal (V9fsPDU *pdu,size_t offset,const char *fmt, ...);ssize_t pdu_unmarshal (V9fsPDU *pdu,size_t offset,const char *fmt, ...);
hw/block/dataplane/virtio-blk.h +1 -1
@@ -21,7 +21,7 @@ typedef struct VirtIOBlockDataPlane VirtIOBlockDataPlane;void virtio_blk_data_plane_create (VirtIODevice *vdev,VirtIOBlkConf *conf,VirtIOBlockDataPlane **dataplane, -Error **errp); +Error *errp[static 1 ]);void virtio_blk_data_plane_destroy (VirtIOBlockDataPlane *s);void virtio_blk_data_plane_notify (VirtIOBlockDataPlane *s,VirtQueue *vq);
hw/s390x/s390-virtio.h +1 -1
@@ -27,7 +27,7 @@ void s390_init_ipl_dev(const char *kernel_filename,const char *netboot_fw, bool enforce_bios);void s390_create_virtio_net (BusState *bus,const char *name); -void s390_nmi (NMIState *n,int cpu_index,Error **errp); +void s390_nmi (NMIState *n,int cpu_index,Error *errp[static 1 ]);void s390_machine_reset (void );void s390_memory_init (ram_addr_t mem_size);#endif
hw/timer/m48t59-internal.h +1 -1
@@ -70,7 +70,7 @@ typedef struct M48t59State {uint32_t m48t59_read (M48t59State *NVRAM ,uint32_t addr);void m48t59_write (M48t59State *NVRAM ,uint32_t addr,uint32_t val);void m48t59_reset_common (M48t59State *NVRAM ); -void m48t59_realize_common (M48t59State *s,Error **errp); +void m48t59_realize_common (M48t59State *s,Error *errp[static 1 ]);static inline void m48t59_toggle_lock (M48t59State *NVRAM ,int lock) {
hw/usb/hcd-ehci.h +2 -2
@@ -324,8 +324,8 @@ extern const VMStateDescription vmstate_ehci;void usb_ehci_init (EHCIState *s,DeviceState *dev);void usb_ehci_finalize (EHCIState *s); -void usb_ehci_realize (EHCIState *s,DeviceState *dev,Error **errp); -void usb_ehci_unrealize (EHCIState *s,DeviceState *dev,Error **errp); +void usb_ehci_realize (EHCIState *s,DeviceState *dev,Error *errp[static 1 ]); +void usb_ehci_unrealize (EHCIState *s,DeviceState *dev,Error *errp[static 1 ]);void ehci_reset (void *opaque);#define TYPE_PCI_EHCI "pci-ehci-usb"
hw/vfio/pci.h +2 -2
@@ -161,10 +161,10 @@ void vfio_bar_quirk_exit(VFIOPCIDevice *vdev, int nr);void vfio_bar_quirk_finalize (VFIOPCIDevice *vdev,int nr);void vfio_setup_resetfn_quirk (VFIOPCIDevice *vdev); -int vfio_populate_vga (VFIOPCIDevice *vdev,Error **errp); +int vfio_populate_vga (VFIOPCIDevice *vdev,Error *errp[static 1 ]);int vfio_pci_igd_opregion_init (VFIOPCIDevice *vdev,struct vfio_region_info *info, -Error **errp); +Error *errp[static 1 ]);#endif /* HW_VFIO_VFIO_PCI_H */
hw/xen/xen-host-pci-device.h +1 -1
@@ -38,7 +38,7 @@ typedef struct XenHostPCIDevice {void xen_host_pci_device_get (XenHostPCIDevice *d,uint16_t domain,uint8_t bus,uint8_t dev,uint8_t func, -Error **errp); +Error *errp[static 1 ]);void xen_host_pci_device_put (XenHostPCIDevice *pci_dev);bool xen_host_pci_device_closed (XenHostPCIDevice *d);
hw/xen/xen_pt.h +2 -2
@@ -230,7 +230,7 @@ struct XenPCIPassthroughState {bool listener_set; }; -void xen_pt_config_init (XenPCIPassthroughState *s,Error **errp); +void xen_pt_config_init (XenPCIPassthroughState *s,Error *errp[static 1 ]);void xen_pt_config_delete (XenPCIPassthroughState *s);XenPTRegGroup *xen_pt_find_reg_grp (XenPCIPassthroughState *s,uint32_t address);XenPTReg *xen_pt_find_reg (XenPTRegGroup *reg_grp,uint32_t address);
@@ -331,5 +331,5 @@ static inline bool is_igd_vga_passthrough(XenHostPCIDevice *dev)int xen_pt_register_vga_regions (XenHostPCIDevice *dev);int xen_pt_unregister_vga_regions (XenHostPCIDevice *dev);void xen_pt_setup_vga (XenPCIPassthroughState *s,XenHostPCIDevice *dev, -Error **errp); +Error *errp[static 1 ]);#endif /* XEN_PT_H */
include/block/aio.h +2 -2
@@ -156,7 +156,7 @@ struct AioContext {* They also provide bottom halves, a service to execute a piece of code * as soon as possible. */ -AioContext *aio_context_new (Error **errp); +AioContext *aio_context_new (Error *errp[static 1 ]);/** * aio_context_ref:
@@ -562,6 +562,6 @@ void aio_context_setup(AioContext *ctx);*/ void aio_context_set_poll_params (AioContext *ctx,int64_t max_ns,int64_t grow,int64_t shrink, -Error **errp); +Error *errp[static 1 ]);#endif
include/block/block.h +39 -30
163 lines not on this page · raw message
include/block/block_backup.h +1 -1
@@ -34,6 +34,6 @@ void backup_cow_request_begin(CowRequest *req, BlockJob *job, int nb_sectors);void backup_cow_request_end (CowRequest *req); -void backup_do_checkpoint (BlockJob *job,Error **errp); +void backup_do_checkpoint (BlockJob *job,Error *errp[static 1 ]);#endif
include/block/block_int.h +11 -8
@@ -785,7 +785,8 @@ int is_windows_drive(const char *filename);*/ void stream_start (const char *job_id,BlockDriverState *bs,BlockDriverState *base,const char *backing_file_str, -int64_t speed,BlockdevOnError on_error,Error **errp); +int64_t speed,BlockdevOnError on_error, +Error *errp[static 1 ]);/** * commit_start:
@@ -806,7 +807,7 @@ void stream_start(const char *job_id, BlockDriverState *bs,void commit_start (const char *job_id,BlockDriverState *bs,BlockDriverState *base,BlockDriverState *top,int64_t speed,BlockdevOnError on_error,const char *backing_file_str, -const char *filter_node_name,Error **errp); +const char *filter_node_name,Error *errp[static 1 ]);/** * commit_active_start: * @job_id: The id of the newly-created job, or %NULL to use the
@@ -831,7 +832,7 @@ void commit_active_start(const char *job_id, BlockDriverState *bs, int64_t speed, BlockdevOnError on_error, const char *filter_node_name, BlockCompletionFunc *cb, void *opaque, - bool auto_complete, Error **errp); + bool auto_complete, Error *errp[static 1]);/* * mirror_start: * @job_id: The id of the newly-created job, or %NULL to use the
@@ -864,7 +865,8 @@ void mirror_start(const char *job_id, BlockDriverState *bs, MirrorSyncMode mode, BlockMirrorBackingMode backing_mode, BlockdevOnError on_source_error, BlockdevOnError on_target_error, - bool unmap, const char *filter_node_name, Error **errp); + bool unmap, const char *filter_node_name, + Error *errp[static 1]);/* * backup_job_create:
@@ -895,7 +897,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,BlockdevOnError on_target_error, int creation_flags, BlockCompletionFunc *cb, void *opaque, - BlockJobTxn *txn, Error **errp); + BlockJobTxn *txn, Error *errp[static 1]);void hmp_drive_add_node (Monitor *mon,const char *optstr);
@@ -903,11 +905,11 @@ BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs,const char *child_name, const BdrvChildRole *child_role, uint64_t perm, uint64_t shared_perm, - void *opaque, Error **errp); + void *opaque, Error *errp[static 1]);void bdrv_root_unref_child (BdrvChild *child);int bdrv_child_try_set_perm (BdrvChild *c,uint64_t perm,uint64_t shared, -Error **errp); +Error *errp[static 1 ]);/* Default implementation for BlockDriver.bdrv_child_perm() that can be used by * block filters: Forward CONSISTENT_READ, WRITE, WRITE_UNCHANGED and RESIZE to
@@ -927,7 +929,8 @@ void bdrv_format_default_perms(BlockDriverState *bs, BdrvChild *c, uint64_t *nperm, uint64_t *nshared);const char *bdrv_get_parent_name (const BlockDriverState *bs); -void blk_dev_change_media_cb (BlockBackend *blk,bool load,Error **errp); +void blk_dev_change_media_cb (BlockBackend *blk,bool load, +Error *errp[static 1 ]);bool blk_dev_has_removable_media (BlockBackend *blk);bool blk_dev_has_tray (BlockBackend *blk);void blk_dev_eject_request (BlockBackend *blk,bool force);
include/block/blockjob.h +6 -5
@@ -178,7 +178,8 @@ BlockJob *block_job_get(const char *id);* @job exists. */ int block_job_add_bdrv (BlockJob *job,const char *name,BlockDriverState *bs, -uint64_t perm,uint64_t shared_perm,Error **errp); +uint64_t perm,uint64_t shared_perm, +Error *errp[static 1 ]);/** * block_job_remove_all_bdrv:
@@ -198,7 +199,7 @@ void block_job_remove_all_bdrv(BlockJob *job);* Set a rate-limiting parameter for the job; the actual meaning may * vary depending on the job type. */ -void block_job_set_speed (BlockJob *job,int64_t speed,Error **errp); +void block_job_set_speed (BlockJob *job,int64_t speed,Error *errp[static 1 ]);/** * block_job_start:
@@ -224,7 +225,7 @@ void block_job_cancel(BlockJob *job);* * Asynchronously complete the specified job. */ -void block_job_complete (BlockJob *job,Error **errp); +void block_job_complete (BlockJob *job,Error *errp[static 1 ]);/** * block_job_query:
@@ -232,7 +233,7 @@ void block_job_complete(BlockJob *job, Error **errp);* * Return information about a job. */ -BlockJobInfo *block_job_query (BlockJob *job,Error **errp); +BlockJobInfo *block_job_query (BlockJob *job,Error *errp[static 1 ]);/** * block_job_user_pause:
@@ -294,7 +295,7 @@ void block_job_cancel_sync_all(void);* * Returns the return value from the job. */ -int block_job_complete_sync (BlockJob *job,Error **errp); +int block_job_complete_sync (BlockJob *job,Error *errp[static 1 ]);/** * block_job_iostatus_reset:
include/block/blockjob_int.h +2 -1
@@ -134,7 +134,8 @@ struct BlockJobDriver {void *block_job_create (const char *job_id,const BlockJobDriver *driver,BlockDriverState *bs,uint64_t perm,uint64_t shared_perm,int64_t speed,int flags, -BlockCompletionFunc *cb,void *opaque,Error **errp); +BlockCompletionFunc *cb,void *opaque, +Error *errp[static 1 ]);/** * block_job_sleep_ns:
include/block/dirty-bitmap.h +4 -4
@@ -7,19 +7,19 @@BdrvDirtyBitmap *bdrv_create_dirty_bitmap (BlockDriverState *bs,uint32_t granularity,const char *name, -Error **errp); +Error *errp[static 1 ]);void bdrv_create_meta_dirty_bitmap (BdrvDirtyBitmap *bitmap,int chunk_size);void bdrv_release_meta_dirty_bitmap (BdrvDirtyBitmap *bitmap);int bdrv_dirty_bitmap_create_successor (BlockDriverState *bs,BdrvDirtyBitmap *bitmap, -Error **errp); +Error *errp[static 1 ]);BdrvDirtyBitmap *bdrv_dirty_bitmap_abdicate (BlockDriverState *bs,BdrvDirtyBitmap *bitmap, -Error **errp); +Error *errp[static 1 ]);BdrvDirtyBitmap *bdrv_reclaim_dirty_bitmap (BlockDriverState *bs,BdrvDirtyBitmap *bitmap, -Error **errp); +Error *errp[static 1 ]);BdrvDirtyBitmap *bdrv_find_dirty_bitmap (BlockDriverState *bs,const char *name);void bdrv_dirty_bitmap_make_anon (BdrvDirtyBitmap *bitmap);
include/block/nbd.h +7 -6
@@ -128,15 +128,16 @@ ssize_t nbd_wr_syncv(QIOChannel *ioc,size_t niov, size_t length, bool do_read, - Error **errp); + Error *errp[static 1]);int nbd_receive_negotiate (QIOChannel *ioc,const char *name,uint16_t *flags,QCryptoTLSCreds *tlscreds,const char *hostname,QIOChannel **outioc, -off_t *size,Error **errp); +off_t *size,Error *errp[static 1 ]);int nbd_init (int fd,QIOChannelSocket *sioc,uint16_t flags,off_t size, -Error **errp); +Error *errp[static 1 ]);ssize_t nbd_send_request (QIOChannel *ioc,NBDRequest *request); -ssize_t nbd_receive_reply (QIOChannel *ioc,NBDReply *reply,Error **errp); +ssize_t nbd_receive_reply (QIOChannel *ioc,NBDReply *reply, +Error *errp[static 1 ]);int nbd_client (int fd);int nbd_disconnect (int fd);
@@ -146,7 +147,7 @@ typedef struct NBDClient NBDClient;NBDExport *nbd_export_new (BlockDriverState *bs,off_t dev_offset,off_t size,uint16_t nbdflags,void (*close)(NBDExport *),bool writethrough,BlockBackend *on_eject_blk, -Error **errp); +Error *errp[static 1 ]);void nbd_export_close (NBDExport *exp);void nbd_export_get (NBDExport *exp);void nbd_export_put (NBDExport *exp);
@@ -167,6 +168,6 @@ void nbd_client_get(NBDClient *client);void nbd_client_put (NBDClient *client);void nbd_server_start (SocketAddress *addr,const char *tls_creds, -Error **errp); +Error *errp[static 1 ]);#endif
include/block/qapi.h +4 -3
@@ -30,13 +30,14 @@#include "block/snapshot.h" BlockDeviceInfo *bdrv_block_device_info (BlockBackend *blk, -BlockDriverState *bs,Error **errp); +BlockDriverState *bs, +Error *errp[static 1 ]);int bdrv_query_snapshot_info_list (BlockDriverState *bs,SnapshotInfoList **p_list, -Error **errp); +Error *errp[static 1 ]);void bdrv_query_image_info (BlockDriverState *bs,ImageInfo **p_info, -Error **errp); +Error *errp[static 1 ]);void bdrv_snapshot_dump (fprintf_function func_fprintf,void *f,QEMUSnapshotInfo *sn);
include/block/snapshot.h +6 -6
@@ -52,7 +52,7 @@ bool bdrv_snapshot_find_by_id_and_name(BlockDriverState *bs,const char *id, const char *name, QEMUSnapshotInfo *sn_info, - Error **errp); + Error *errp[static 1]);int bdrv_can_snapshot (BlockDriverState *bs);int bdrv_snapshot_create (BlockDriverState *bs,QEMUSnapshotInfo *sn_info);
@@ -61,19 +61,19 @@ int bdrv_snapshot_goto(BlockDriverState *bs,int bdrv_snapshot_delete (BlockDriverState *bs,const char *snapshot_id,const char *name, -Error **errp); +Error *errp[static 1 ]);int bdrv_snapshot_delete_by_id_or_name (BlockDriverState *bs,const char *id_or_name, -Error **errp); +Error *errp[static 1 ]);int bdrv_snapshot_list (BlockDriverState *bs,QEMUSnapshotInfo **psn_info);int bdrv_snapshot_load_tmp (BlockDriverState *bs,const char *snapshot_id,const char *name, -Error **errp); +Error *errp[static 1 ]);int bdrv_snapshot_load_tmp_by_id_or_name (BlockDriverState *bs,const char *id_or_name, -Error **errp); +Error *errp[static 1 ]);/* Group operations. All block drivers are involved.
@@ -82,7 +82,7 @@ int bdrv_snapshot_load_tmp_by_id_or_name(BlockDriverState *bs,bool bdrv_all_can_snapshot (BlockDriverState **first_bad_bs);int bdrv_all_delete_snapshot (const char *name,BlockDriverState **first_bsd_bs, -Error **err); +Error *err[static 1 ]);int bdrv_all_goto_snapshot (const char *name,BlockDriverState **first_bsd_bs);int bdrv_all_find_snapshot (const char *name,BlockDriverState **first_bad_bs); int bdrv_all_create_snapshot(QEMUSnapshotInfo *sn,
include/chardev/char-fd.h +1 -1
@@ -39,6 +39,6 @@ typedef struct FDChardev {#define FD_CHARDEV (obj) OBJECT_CHECK(FDChardev, (obj), TYPE_CHARDEV_FD)void qemu_chr_open_fd (Chardev *chr,int fd_in,int fd_out); -int qmp_chardev_open_file_source (char *src,int flags,Error **errp); +int qmp_chardev_open_file_source (char *src,int flags,Error *errp[static 1 ]);#endif /* CHAR_FD_H */
include/chardev/char-fe.h +2 -2
@@ -26,7 +26,7 @@ struct CharBackend {* * Returns: false on error. */ -bool qemu_chr_fe_init (CharBackend *b,Chardev *s,Error **errp); +bool qemu_chr_fe_init (CharBackend *b,Chardev *s,Error *errp[static 1 ]);/** * @qemu_chr_fe_deinit:
@@ -102,7 +102,7 @@ void qemu_chr_fe_disconnect(CharBackend *be);* Wait for characted backend to be connected, return < 0 on error or * if no assicated Chardev. */ -int qemu_chr_fe_wait_connected (CharBackend *be,Error **errp); +int qemu_chr_fe_wait_connected (CharBackend *be,Error *errp[static 1 ]);/** * @qemu_chr_fe_set_echo:
include/chardev/char-win.h +2 -1
@@ -45,7 +45,8 @@ typedef struct {#define WIN_CHARDEV (obj) OBJECT_CHECK(WinChardev, (obj), TYPE_CHARDEV_WIN)void win_chr_set_file (Chardev *chr,HANDLE file,bool keep_open); -int win_chr_serial_init (Chardev *chr,const char *filename,Error **errp); +int win_chr_serial_init (Chardev *chr,const char *filename, +Error *errp[static 1 ]);int win_chr_pipe_poll (void *opaque);#endif /* CHAR_WIN_H */
include/chardev/char.h +5 -4
@@ -68,7 +68,7 @@ struct Chardev {* Returns: a new character backend */ Chardev *qemu_chr_new_from_opts (QemuOpts *opts, -Error **errp); +Error *errp[static 1 ]);/** * @qemu_chr_parse_common:
@@ -166,7 +166,7 @@ void qemu_chr_set_feature(Chardev *chr,QemuOpts *qemu_chr_parse_compat (const char *label,const char *filename);int qemu_chr_write (Chardev *s,const uint8_t *buf,int len,bool write_all);#define qemu_chr_write_all (s, buf, len) qemu_chr_write(s, buf, len, true) -int qemu_chr_wait_connected (Chardev *chr,Error **errp); +int qemu_chr_wait_connected (Chardev *chr,Error *errp[static 1 ]);#define TYPE_CHARDEV "chardev"#define CHARDEV (obj) OBJECT_CHECK(Chardev, (obj), TYPE_CHARDEV)
@@ -219,11 +219,12 @@ typedef struct ChardevClass { } ChardevClass;Chardev *qemu_chardev_new (const char *id,const char *typename, -ChardevBackend *backend,Error **errp); +ChardevBackend *backend,Error *errp[static 1 ]);extern int term_escape_char;/* console.c */ -void qemu_chr_parse_vc (QemuOpts *opts,ChardevBackend *backend,Error **errp); +void qemu_chr_parse_vc (QemuOpts *opts,ChardevBackend *backend, +Error *errp[static 1 ]);#endif
include/crypto/afsplit.h +2 -2
@@ -108,7 +108,7 @@ int qcrypto_afsplit_encode(QCryptoHashAlgorithm hash,uint32_t stripes, const uint8_t *in, uint8_t *out, - Error **errp); + Error *errp[static 1]);/** * qcrypto_afsplit_decode:
@@ -130,6 +130,6 @@ int qcrypto_afsplit_decode(QCryptoHashAlgorithm hash,uint32_t stripes, const uint8_t *in, uint8_t *out, - Error **errp); + Error *errp[static 1]);#endif /* QCRYPTO_AFSPLIT_H */
include/crypto/block.h +5 -5
@@ -105,7 +105,7 @@ QCryptoBlock *qcrypto_block_open(QCryptoBlockOpenOptions *options,QCryptoBlockReadFunc readfunc, void *opaque, unsigned int flags, - Error **errp); + Error *errp[static 1]);/** * qcrypto_block_create:
@@ -136,7 +136,7 @@ QCryptoBlock *qcrypto_block_create(QCryptoBlockCreateOptions *options,QCryptoBlockInitFunc initfunc, QCryptoBlockWriteFunc writefunc, void *opaque, - Error **errp); + Error *errp[static 1]);/**
@@ -152,7 +152,7 @@ QCryptoBlock *qcrypto_block_create(QCryptoBlockCreateOptions *options,* Returns: a block encryption info object, or NULL on error */ QCryptoBlockInfo *qcrypto_block_get_info (QCryptoBlock *block, -Error **errp); +Error *errp[static 1 ]);/** * @qcrypto_block_decrypt:
@@ -171,7 +171,7 @@ int qcrypto_block_decrypt(QCryptoBlock *block,uint64_t startsector, uint8_t *buf, size_t len, - Error **errp); + Error *errp[static 1]);/** * @qcrypto_block_encrypt:
@@ -190,7 +190,7 @@ int qcrypto_block_encrypt(QCryptoBlock *block,uint64_t startsector, uint8_t *buf, size_t len, - Error **errp); + Error *errp[static 1]);/** * qcrypto_block_get_cipher:
include/crypto/cipher.h +4 -4
@@ -158,7 +158,7 @@ size_t qcrypto_cipher_get_iv_len(QCryptoCipherAlgorithm alg,QCryptoCipher *qcrypto_cipher_new (QCryptoCipherAlgorithm alg,QCryptoCipherMode mode,const uint8_t *key,size_t nkey, -Error **errp); +Error *errp[static 1 ]);/** * qcrypto_cipher_free:
@@ -188,7 +188,7 @@ int qcrypto_cipher_encrypt(QCryptoCipher *cipher,const void *in, void *out, size_t len, - Error **errp); + Error *errp[static 1]);/**
@@ -210,7 +210,7 @@ int qcrypto_cipher_decrypt(QCryptoCipher *cipher,const void *in, void *out, size_t len, - Error **errp); + Error *errp[static 1]);/** * qcrypto_cipher_setiv:
@@ -230,6 +230,6 @@ int qcrypto_cipher_decrypt(QCryptoCipher *cipher,*/ int qcrypto_cipher_setiv (QCryptoCipher *cipher,const uint8_t *iv,size_t niv, -Error **errp); +Error *errp[static 1 ]);#endif /* QCRYPTO_CIPHER_H */
include/crypto/hash.h +6 -6
@@ -70,7 +70,7 @@ int qcrypto_hash_bytesv(QCryptoHashAlgorithm alg,size_t niov, uint8_t **result, size_t *resultlen, - Error **errp); + Error *errp[static 1]);/** * qcrypto_hash_bytes:
@@ -95,7 +95,7 @@ int qcrypto_hash_bytes(QCryptoHashAlgorithm alg,size_t len, uint8_t **result, size_t *resultlen, - Error **errp); + Error *errp[static 1]);/** * qcrypto_hash_digestv:
@@ -118,7 +118,7 @@ int qcrypto_hash_digestv(QCryptoHashAlgorithm alg,const struct iovec *iov, size_t niov, char **digest, - Error **errp); + Error *errp[static 1]);/** * qcrypto_hash_digest:
@@ -141,7 +141,7 @@ int qcrypto_hash_digest(QCryptoHashAlgorithm alg,const char *buf, size_t len, char **digest, - Error **errp); + Error *errp[static 1]);/** * qcrypto_hash_base64v:
@@ -164,7 +164,7 @@ int qcrypto_hash_base64v(QCryptoHashAlgorithm alg,const struct iovec *iov, size_t niov, char **base64, - Error **errp); + Error *errp[static 1]);/** * qcrypto_hash_base64:
@@ -187,6 +187,6 @@ int qcrypto_hash_base64(QCryptoHashAlgorithm alg,const char *buf, size_t len, char **base64, - Error **errp); + Error *errp[static 1]);#endif /* QCRYPTO_HASH_H */
include/crypto/init.h +1 -1
@@ -21,6 +21,6 @@#ifndef QCRYPTO_INIT_H #define QCRYPTO_INIT_H -int qcrypto_init (Error **errp); +int qcrypto_init (Error *errp[static 1 ]);#endif /* QCRYPTO_INIT_H */
include/crypto/ivgen.h +1 -1
@@ -156,7 +156,7 @@ QCryptoIVGen *qcrypto_ivgen_new(QCryptoIVGenAlgorithm alg,int qcrypto_ivgen_calculate (QCryptoIVGen *ivgen,uint64_t sector,uint8_t *iv,size_t niv, -Error **errp); +Error *errp[static 1 ]);/**
include/crypto/pbkdf.h +2 -2
@@ -124,7 +124,7 @@ int qcrypto_pbkdf2(QCryptoHashAlgorithm hash, const uint8_t *salt, size_t nsalt, uint64_t iterations, uint8_t *out, size_t nout, - Error **errp); + Error *errp[static 1]);/** * qcrypto_pbkdf2_count_iters:
@@ -151,6 +151,6 @@ uint64_t qcrypto_pbkdf2_count_iters(QCryptoHashAlgorithm hash, const uint8_t *key, size_t nkey, const uint8_t *salt, size_t nsalt, size_t nout, - Error **errp); + Error *errp[static 1]);#endif /* QCRYPTO_PBKDF_H */
include/crypto/random.h +2 -2
@@ -38,7 +38,7 @@*/ int qcrypto_random_bytes (uint8_t *buf,size_t buflen, -Error **errp); +Error *errp[static 1 ]);/** * qcrypto_random_init:
@@ -48,6 +48,6 @@ int qcrypto_random_bytes(uint8_t *buf,* * Returns 0 on success, -1 on error */ -int qcrypto_random_init (Error **errp); +int qcrypto_random_init (Error *errp[static 1 ]);#endif /* QCRYPTO_RANDOM_H */
include/crypto/secret.h +3 -3
@@ -137,10 +137,10 @@ struct QCryptoSecretClass {extern int qcrypto_secret_lookup (const char *secretid,uint8_t **data,size_t *datalen, -Error **errp); +Error *errp[static 1 ]);extern char *qcrypto_secret_lookup_as_utf8 (const char *secretid, -Error **errp); +Error *errp[static 1 ]);extern char *qcrypto_secret_lookup_as_base64 (const char *secretid, -Error **errp); +Error *errp[static 1 ]);#endif /* QCRYPTO_SECRET_H */
include/crypto/tlssession.h +3 -3
@@ -173,7 +173,7 @@ void qcrypto_tls_session_free(QCryptoTLSSession *sess);* Returns 0 if the credentials validated, -1 on error */ int qcrypto_tls_session_check_credentials (QCryptoTLSSession *sess, -Error **errp); +Error *errp[static 1 ]); typedef ssize_t (*QCryptoTLSSessionWriteFunc)(const char *buf, size_t len,
@@ -264,7 +264,7 @@ ssize_t qcrypto_tls_session_read(QCryptoTLSSession *sess,* or write again */ int qcrypto_tls_session_handshake (QCryptoTLSSession *sess, -Error **errp); +Error *errp[static 1 ]); typedef enum { QCRYPTO_TLS_HANDSHAKE_COMPLETE,
@@ -300,7 +300,7 @@ qcrypto_tls_session_get_handshake_status(QCryptoTLSSession *sess);* or -1 on error */ int qcrypto_tls_session_get_key_size (QCryptoTLSSession *sess, -Error **errp); +Error *errp[static 1 ]);/** * qcrypto_tls_session_get_peer_name:
include/exec/memory.h +6 -6
@@ -408,7 +408,7 @@ void memory_region_init_ram(MemoryRegion *mr,struct Object *owner, const char *name, uint64_t size, - Error **errp); + Error *errp[static 1]);/** * memory_region_init_resizeable_ram: Initialize memory region with resizeable
@@ -434,7 +434,7 @@ void memory_region_init_resizeable_ram(MemoryRegion *mr,void (*resized)(const char *,uint64_t length,void *host), - Error **errp); + Error *errp[static 1]);#ifdef __linux__/** * memory_region_init_ram_from_file: Initialize RAM memory region with a
@@ -455,7 +455,7 @@ void memory_region_init_ram_from_file(MemoryRegion *mr,uint64_t size, bool share, const char *path, - Error **errp); + Error *errp[static 1]);#endif /**
@@ -537,7 +537,7 @@ void memory_region_init_rom(MemoryRegion *mr,struct Object *owner, const char *name, uint64_t size, - Error **errp); + Error *errp[static 1]);/** * memory_region_init_rom_device: Initialize a ROM memory region. Writes are
@@ -557,7 +557,7 @@ void memory_region_init_rom_device(MemoryRegion *mr,void *opaque, const char *name, uint64_t size, - Error **errp); + Error *errp[static 1]);/** * memory_region_init_reservation: Initialize a memory region that reserves
@@ -859,7 +859,7 @@ void *memory_region_get_ram_ptr(MemoryRegion *mr);* @errp: pointer to Error*, to store an error if it happens. */ void memory_region_ram_resize (MemoryRegion *mr,ram_addr_t newsize, -Error **errp); +Error *errp[static 1 ]);/** * memory_region_set_log: Turn dirty logging on or off for a region.
include/exec/ram_addr.h +7 -5
@@ -64,18 +64,20 @@ long qemu_getrampagesize(void);unsigned long last_ram_page (void );RAMBlock *qemu_ram_alloc_from_file (ram_addr_t size,MemoryRegion *mr,bool share,const char *mem_path, -Error **errp); +Error *errp[static 1 ]);RAMBlock *qemu_ram_alloc_from_ptr (ram_addr_t size,void *host, -MemoryRegion *mr,Error **errp); -RAMBlock *qemu_ram_alloc (ram_addr_t size,MemoryRegion *mr,Error **errp); +MemoryRegion *mr,Error *errp[static 1 ]); +RAMBlock *qemu_ram_alloc (ram_addr_t size,MemoryRegion *mr, +Error *errp[static 1 ]);RAMBlock *qemu_ram_alloc_resizeable (ram_addr_t size,ram_addr_t max_size,void (*resized)(const char *,uint64_t length,void *host), -MemoryRegion *mr,Error **errp); +MemoryRegion *mr,Error *errp[static 1 ]);void qemu_ram_free (RAMBlock *block); -int qemu_ram_resize (RAMBlock *block,ram_addr_t newsize,Error **errp); +int qemu_ram_resize (RAMBlock *block,ram_addr_t newsize, +Error *errp[static 1 ]);#define DIRTY_CLIENTS_ALL ((1 << DIRTY_MEMORY_NUM) - 1)#define DIRTY_CLIENTS_NOCODE (DIRTY_CLIENTS_ALL & ~(1 << DIRTY_MEMORY_CODE))
include/hw/acpi/acpi.h +2 -2
@@ -179,8 +179,8 @@ extern size_t acpi_tables_len;uint8_t *acpi_table_first (void );uint8_t *acpi_table_next (uint8_t *current);unsigned acpi_table_len (void *current); -void acpi_table_add (const QemuOpts *opts,Error **errp); -void acpi_table_add_builtin (const QemuOpts *opts,Error **errp); +void acpi_table_add (const QemuOpts *opts,Error *errp[static 1 ]); +void acpi_table_add_builtin (const QemuOpts *opts,Error *errp[static 1 ]);typedef struct AcpiSlicOem AcpiSlicOem ;struct AcpiSlicOem {
include/hw/acpi/cpu.h +4 -3
@@ -35,14 +35,15 @@ typedef struct CPUHotplugState { } CPUHotplugState;void acpi_cpu_plug_cb (HotplugHandler *hotplug_dev, -CPUHotplugState *cpu_st,DeviceState *dev,Error **errp); +CPUHotplugState *cpu_st,DeviceState *dev, +Error *errp[static 1 ]);void acpi_cpu_unplug_request_cb (HotplugHandler *hotplug_dev,CPUHotplugState *cpu_st, -DeviceState *dev,Error **errp); +DeviceState *dev,Error *errp[static 1 ]);void acpi_cpu_unplug_cb (CPUHotplugState *cpu_st, -DeviceState *dev,Error **errp); +DeviceState *dev,Error *errp[static 1 ]);void cpu_hotplug_hw_init (MemoryRegion *as,Object *owner,CPUHotplugState *state,hwaddr base_addr);
include/hw/acpi/cpu_hotplug.h +2 -1
@@ -26,7 +26,8 @@ typedef struct AcpiCpuHotplug { } AcpiCpuHotplug;void legacy_acpi_cpu_plug_cb (HotplugHandler *hotplug_dev, -AcpiCpuHotplug *g,DeviceState *dev,Error **errp); +AcpiCpuHotplug *g,DeviceState *dev, +Error *errp[static 1 ]);void legacy_acpi_cpu_hotplug_init (MemoryRegion *parent,Object *owner,AcpiCpuHotplug *gpe_cpu,uint16_t base);
include/hw/acpi/ich9.h +5 -4
@@ -70,14 +70,15 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,void ich9_pm_iospace_update (ICH9LPCPMRegs *pm,uint32_t pm_io_base);extern const VMStateDescription vmstate_ich9_pm; -void ich9_pm_add_properties (Object *obj,ICH9LPCPMRegs *pm,Error **errp); +void ich9_pm_add_properties (Object *obj,ICH9LPCPMRegs *pm, +Error *errp[static 1 ]);void ich9_pm_device_plug_cb (HotplugHandler *hotplug_dev,DeviceState *dev, -Error **errp); +Error *errp[static 1 ]);void ich9_pm_device_unplug_request_cb (HotplugHandler *hotplug_dev, -DeviceState *dev,Error **errp); +DeviceState *dev,Error *errp[static 1 ]);void ich9_pm_device_unplug_cb (HotplugHandler *hotplug_dev,DeviceState *dev, -Error **errp); +Error *errp[static 1 ]);void ich9_pm_ospm_status (AcpiDeviceIf *adev,ACPIOSTInfoList ***list);#endif /* HW_ACPI_ICH9_H */
include/hw/acpi/memory_hotplug.h +3 -3
@@ -32,12 +32,12 @@ void acpi_memory_hotplug_init(MemoryRegion *as, Object *owner, MemHotplugState *state, uint16_t io_base);void acpi_memory_plug_cb (HotplugHandler *hotplug_dev,MemHotplugState *mem_st, -DeviceState *dev,Error **errp); +DeviceState *dev,Error *errp[static 1 ]);void acpi_memory_unplug_request_cb (HotplugHandler *hotplug_dev,MemHotplugState *mem_st, -DeviceState *dev,Error **errp); +DeviceState *dev,Error *errp[static 1 ]);void acpi_memory_unplug_cb (MemHotplugState *mem_st, -DeviceState *dev,Error **errp); +DeviceState *dev,Error *errp[static 1 ]);extern const VMStateDescription vmstate_memory_hotplug;#define VMSTATE_MEMORY_HOTPLUG (memhp, state) \
include/hw/acpi/pcihp.h +2 -2
@@ -57,9 +57,9 @@ void acpi_pcihp_init(Object *owner, AcpiPciHpState *, PCIBus *root, MemoryRegion *address_space_io, bool bridges_enabled);void acpi_pcihp_device_plug_cb (HotplugHandler *hotplug_dev,AcpiPciHpState *s, -DeviceState *dev,Error **errp); +DeviceState *dev,Error *errp[static 1 ]);void acpi_pcihp_device_unplug_cb (HotplugHandler *hotplug_dev,AcpiPciHpState *s, -DeviceState *dev,Error **errp); +DeviceState *dev,Error *errp[static 1 ]);/* Called on reset */ void acpi_pcihp_reset (AcpiPciHpState *s);
include/hw/block/block.h +2 -2
@@ -74,10 +74,10 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)void blkconf_serial (BlockConf *conf,char **serial);void blkconf_geometry (BlockConf *conf,int *trans,unsigned cyls_max,unsigned heads_max,unsigned secs_max, -Error **errp); +Error *errp[static 1 ]);void blkconf_blocksizes (BlockConf *conf);void blkconf_apply_backend_options (BlockConf *conf,bool readonly, -bool resizable,Error **errp); +bool resizable,Error *errp[static 1 ]);/* Hard disk geometry */
include/hw/boards.h +1 -1
@@ -45,7 +45,7 @@ void machine_register_compat_props(MachineState *machine);HotpluggableCPUList *machine_query_hotpluggable_cpus (MachineState *machine);void machine_set_cpu_numa_node (MachineState *machine,const CpuInstanceProperties *props, -Error **errp); +Error *errp[static 1 ]);/** * CPUArchId:
include/hw/char/serial.h +1 -1
@@ -82,7 +82,7 @@ struct SerialState {extern const VMStateDescription vmstate_serial;extern const MemoryRegionOps serial_io_ops; -void serial_realize_core (SerialState *s,Error **errp); +void serial_realize_core (SerialState *s,Error *errp[static 1 ]);void serial_exit_core (SerialState *s);void serial_set_frequency (SerialState *s,uint32_t frequency);
include/hw/hotplug.h +4 -4
@@ -72,7 +72,7 @@ typedef struct HotplugHandlerClass {*/ void hotplug_handler_plug (HotplugHandler *plug_handler,DeviceState *plugged_dev, -Error **errp); +Error *errp[static 1 ]);/** * hotplug_handler_pre_plug:
@@ -81,7 +81,7 @@ void hotplug_handler_plug(HotplugHandler *plug_handler,*/ void hotplug_handler_pre_plug (HotplugHandler *plug_handler,DeviceState *plugged_dev, -Error **errp); +Error *errp[static 1 ]);/** * hotplug_handler_unplug_request:
@@ -90,7 +90,7 @@ void hotplug_handler_pre_plug(HotplugHandler *plug_handler,*/ void hotplug_handler_unplug_request (HotplugHandler *plug_handler,DeviceState *plugged_dev, -Error **errp); +Error *errp[static 1 ]);/** * hotplug_handler_unplug: *
@@ -98,5 +98,5 @@ void hotplug_handler_unplug_request(HotplugHandler *plug_handler,*/ void hotplug_handler_unplug (HotplugHandler *plug_handler,DeviceState *plugged_dev, -Error **errp); +Error *errp[static 1 ]);#endif
include/hw/i386/pc.h +1 -1
@@ -239,7 +239,7 @@ void pc_register_ferr_irq(qemu_irq irq);void pc_acpi_smi_interrupt (void *opaque,int irq,int level);void pc_cpus_init (PCMachineState *pcms); -void pc_hot_add_cpu (const int64_t id,Error **errp); +void pc_hot_add_cpu (const int64_t id,Error *errp[static 1 ]);void pc_acpi_init (const char *default_dsdt);void pc_guest_info_init (PCMachineState *pcms);
include/hw/isa/isa.h +1 -1
@@ -100,7 +100,7 @@ struct ISADevice { };ISABus *isa_bus_new (DeviceState *dev,MemoryRegion *address_space, -MemoryRegion *address_space_io,Error **errp); +MemoryRegion *address_space_io,Error *errp[static 1 ]);void isa_bus_irqs (ISABus *bus,qemu_irq *irqs);qemu_irq isa_get_irq (ISADevice *dev,int isairq);void isa_init_irq (ISADevice *dev,qemu_irq *p,int isairq);
include/hw/loader.h +2 -1
@@ -129,7 +129,8 @@ int load_elf(const char *filename, uint64_t (*translate_fn)(void *, uint64_t),* Inspect an ELF file's header. Read its full header contents into a * buffer and/or determine if the ELF is 64bit. */ -void load_elf_hdr (const char *filename,void *hdr,bool *is64,Error **errp); +void load_elf_hdr (const char *filename,void *hdr,bool *is64, +Error *errp[static 1 ]);int load_aout (const char *filename,hwaddr addr,int max_sz,int bswap_needed,hwaddr target_page_size);
include/hw/mem/pc-dimm.h +6 -4
@@ -89,14 +89,16 @@ typedef struct MemoryHotplugState {uint64_t pc_dimm_get_free_addr (uint64_t address_space_start,uint64_t address_space_size,uint64_t *hint,uint64_t align,uint64_t size, -Error **errp); +Error *errp[static 1 ]); -int pc_dimm_get_free_slot (const int *hint,int max_slots,Error **errp); +int pc_dimm_get_free_slot (const int *hint,int max_slots, +Error *errp[static 1 ]);int qmp_pc_dimm_device_list (Object *obj,void *opaque); -uint64_t pc_existing_dimms_capacity (Error **errp); +uint64_t pc_existing_dimms_capacity (Error *errp[static 1 ]);void pc_dimm_memory_plug (DeviceState *dev,MemoryHotplugState *hpms, -MemoryRegion *mr,uint64_t align,Error **errp); +MemoryRegion *mr,uint64_t align, +Error *errp[static 1 ]);void pc_dimm_memory_unplug (DeviceState *dev,MemoryHotplugState *hpms,MemoryRegion *mr);#endif
include/hw/nmi.h +1 -1
@@ -44,6 +44,6 @@ typedef struct NMIClass { void (*nmi_monitor_handler)(NMIState *n, int cpu_index, Error **errp); } NMIClass; -void nmi_monitor_handle (int cpu_index,Error **errp); +void nmi_monitor_handle (int cpu_index,Error *errp[static 1 ]);#endif /* NMI_H */
include/hw/pci/msi.h +1 -1
@@ -36,7 +36,7 @@ MSIMessage msi_get_message(PCIDevice *dev, unsigned int vector);bool msi_enabled (const PCIDevice *dev);int msi_init (struct PCIDevice *dev,uint8_t offset,unsigned int nr_vectors,bool msi64bit, -bool msi_per_vector_mask,Error **errp); +bool msi_per_vector_mask,Error *errp[static 1 ]);void msi_uninit (struct PCIDevice *dev);void msi_reset (PCIDevice *dev);void msi_notify (PCIDevice *dev,unsigned int vector);
include/hw/pci/msix.h +2 -2
@@ -10,9 +10,9 @@ int msix_init(PCIDevice *dev, unsigned short nentries, MemoryRegion *table_bar, uint8_t table_bar_nr, unsigned table_offset, MemoryRegion *pba_bar, uint8_t pba_bar_nr, unsigned pba_offset, uint8_t cap_pos, - Error **errp); + Error *errp[static 1]);int msix_init_exclusive_bar (PCIDevice *dev,unsigned short nentries, -uint8_t bar_nr,Error **errp); +uint8_t bar_nr,Error *errp[static 1 ]);void msix_write_config (PCIDevice *dev,uint32_t address,uint32_t val,int len);
include/hw/pci/pci.h +1 -1
@@ -359,7 +359,7 @@ int pci_add_capability(PCIDevice *pdev, uint8_t cap_id, uint8_t offset, uint8_t size);int pci_add_capability2 (PCIDevice *pdev,uint8_t cap_id,uint8_t offset,uint8_t size, -Error **errp); +Error *errp[static 1 ]);void pci_del_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size);
include/hw/pci/pcie.h +3 -2
@@ -131,7 +131,8 @@ void pcie_dev_ser_num_init(PCIDevice *dev, uint16_t offset, uint64_t ser_num);void pcie_ats_init (PCIDevice *dev,uint16_t offset);void pcie_cap_slot_hotplug_cb (HotplugHandler *hotplug_dev,DeviceState *dev, -Error **errp); +Error *errp[static 1 ]);void pcie_cap_slot_hot_unplug_request_cb (HotplugHandler *hotplug_dev, -DeviceState *dev,Error **errp); +DeviceState *dev, +Error *errp[static 1 ]);#endif /* QEMU_PCIE_H */
include/hw/pci/pcie_aer.h +1 -1
@@ -87,7 +87,7 @@ struct PCIEAERErr {extern const VMStateDescription vmstate_pcie_aer_log;int pcie_aer_init (PCIDevice *dev,uint8_t cap_ver,uint16_t offset, -uint16_t size,Error **errp); +uint16_t size,Error *errp[static 1 ]);void pcie_aer_exit (PCIDevice *dev);void pcie_aer_write_config (PCIDevice *dev,uint32_t addr,uint32_t val,int len);
include/hw/pci/shpc.h +3 -2
@@ -45,9 +45,10 @@ void shpc_cap_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int len);void shpc_device_hotplug_cb (HotplugHandler *hotplug_dev,DeviceState *dev, -Error **errp); +Error *errp[static 1 ]);void shpc_device_hot_unplug_request_cb (HotplugHandler *hotplug_dev, -DeviceState *dev,Error **errp); +DeviceState *dev, +Error *errp[static 1 ]);extern VMStateInfo shpc_vmstate_info;#define SHPC_VMSTATE (_field, _type, _test) \
include/hw/ppc/pnv_xscom.h +1 -1
@@ -66,7 +66,7 @@ typedef struct PnvXScomInterfaceClass {#define PNV_XSCOM_OCC_BASE 0x0066000#define PNV_XSCOM_OCC_SIZE 0x6000 -extern void pnv_xscom_realize (PnvChip *chip,Error **errp); +extern void pnv_xscom_realize (PnvChip *chip,Error *errp[static 1 ]);extern int pnv_xscom_populate (PnvChip *chip,void *fdt,int offset); extern void pnv_xscom_add_subregion(PnvChip *chip, hwaddr offset,
include/hw/ppc/xics.h +4 -3
@@ -174,9 +174,10 @@ typedef struct XICSFabricClass {#define XICS_IRQS_SPAPR 1024 -int spapr_ics_alloc (ICSState *ics,int irq_hint,bool lsi,Error **errp); +int spapr_ics_alloc (ICSState *ics,int irq_hint,bool lsi, +Error *errp[static 1 ]);int spapr_ics_alloc_block (ICSState *ics,int num,bool lsi,bool align, -Error **errp); +Error *errp[static 1 ]);void spapr_ics_free (ICSState *ics,int irq,int num);void spapr_dt_xics (int nr_servers,void *fdt,uint32_t phandle);
@@ -204,7 +205,7 @@ void icp_resend(ICPState *ss);typedef struct sPAPRMachineState sPAPRMachineState ; -int xics_kvm_init (sPAPRMachineState *spapr,Error **errp); +int xics_kvm_init (sPAPRMachineState *spapr,Error *errp[static 1 ]);void xics_spapr_init (sPAPRMachineState *spapr);#endif /* XICS_H */
include/hw/qdev-core.h +4 -4
@@ -271,9 +271,9 @@ void qdev_init_nofail(DeviceState *dev);void qdev_set_legacy_instance_id (DeviceState *dev,int alias_id,int required_for_version);HotplugHandler *qdev_get_hotplug_handler (DeviceState *dev); -void qdev_unplug (DeviceState *dev,Error **errp); +void qdev_unplug (DeviceState *dev,Error *errp[static 1 ]);void qdev_simple_device_unplug_cb (HotplugHandler *hotplug_dev, -DeviceState *dev,Error **errp); +DeviceState *dev,Error *errp[static 1 ]);void qdev_machine_creation_done (void );bool qdev_machine_modified (void );
@@ -382,9 +382,9 @@ char *qdev_get_dev_path(DeviceState *dev);GSList *qdev_build_hotpluggable_device_list (Object *peripheral);void qbus_set_hotplug_handler (BusState *bus,DeviceState *handler, -Error **errp); +Error *errp[static 1 ]); -void qbus_set_bus_hotplug_handler (BusState *bus,Error **errp); +void qbus_set_bus_hotplug_handler (BusState *bus,Error *errp[static 1 ]);static inline bool qbus_is_hotpluggable (BusState *bus) {
include/hw/qdev-properties.h +6 -4
@@ -187,7 +187,7 @@ void qdev_prop_set_string(DeviceState *dev, const char *name, const char *value)void qdev_prop_set_chr (DeviceState *dev,const char *name,Chardev *value);void qdev_prop_set_netdev (DeviceState *dev,const char *name,NetClientState *value);void qdev_prop_set_drive (DeviceState *dev,const char *name, -BlockBackend *value,Error **errp); +BlockBackend *value,Error *errp[static 1 ]);void qdev_prop_set_macaddr (DeviceState *dev,const char *name,const uint8_t *value);void qdev_prop_set_enum (DeviceState *dev,const char *name,int value);
@@ -211,7 +211,8 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,* On error, store error in @errp. Static properties access data in a struct. * The type of the QOM property is derived from prop->info. */ -void qdev_property_add_static (DeviceState *dev,Property *prop,Error **errp); +void qdev_property_add_static (DeviceState *dev,Property *prop, +Error *errp[static 1 ]);void qdev_alias_all_properties (DeviceState *target,Object *source);
@@ -226,7 +227,7 @@ void qdev_alias_all_properties(DeviceState *target, Object *source);* a friendly format identifying both the device and the property. */ void qdev_prop_set_after_realize (DeviceState *dev,const char *name, -Error **errp); +Error *errp[static 1 ]);/** * qdev_prop_allow_set_link_before_realize:
@@ -236,6 +237,7 @@ void qdev_prop_set_after_realize(DeviceState *dev, const char *name,* object_property_add_link(). */ void qdev_prop_allow_set_link_before_realize (Object *obj,const char *name, -Object *val,Error **errp); +Object *val, +Error *errp[static 1 ]);#endif
include/hw/s390x/css.h +2 -2
@@ -161,7 +161,7 @@ typedef enum {uint32_t css_get_adapter_id (CssIoAdapterType type,uint8_t isc);void css_register_io_adapters (CssIoAdapterType type,bool swap,bool maskable, -Error **errp); +Error *errp[static 1 ]);#ifndef CONFIG_USER_ONLY SubchDev *css_find_subch(uint8_t m, uint8_t cssid, uint8_t ssid,
@@ -218,5 +218,5 @@ extern PropertyInfo css_devid_ro_propinfo;* is responsible for unregistering and freeing it. */ SubchDev *css_create_sch (CssDevId bus_id,bool is_virtual,bool squash_mcss, -Error **errp); +Error *errp[static 1 ]);#endif
include/hw/scsi/scsi.h +2 -1
@@ -176,7 +176,8 @@ static inline SCSIBus *scsi_bus_from_device(SCSIDevice *d)SCSIDevice *scsi_bus_legacy_add_drive (SCSIBus *bus,BlockBackend *blk,int unit,bool removable,int bootindex, -const char *serial,Error **errp); +const char *serial, +Error *errp[static 1 ]);void scsi_bus_legacy_handle_cmdline (SCSIBus *bus,bool deprecated);void scsi_legacy_handle_cmdline (void );
include/hw/smbios/smbios.h +1 -1
@@ -257,7 +257,7 @@ struct smbios_type_127 {struct smbios_structure_header header; }QEMU_PACKED ; -void smbios_entry_add (QemuOpts *opts,Error **errp); +void smbios_entry_add (QemuOpts *opts,Error *errp[static 1 ]);void smbios_set_cpuid (uint32_t version,uint32_t features); void smbios_set_defaults(const char *manufacturer, const char *product, const char *version, bool legacy_mode,
include/hw/usb.h +4 -4
@@ -542,15 +542,15 @@ void usb_register_port(USBBus *bus, USBPort *port, void *opaque, int index,void usb_register_companion (const char *masterbus,USBPort *ports[],uint32_t portcount,uint32_t firstport,void *opaque,USBPortOps *ops,int speedmask, -Error **errp); +Error *errp[static 1 ]);void usb_port_location (USBPort *downstream,USBPort *upstream,int portnr);void usb_unregister_port (USBBus *bus,USBPort *port); -void usb_claim_port (USBDevice *dev,Error **errp); +void usb_claim_port (USBDevice *dev,Error *errp[static 1 ]);void usb_release_port (USBDevice *dev); -void usb_device_attach (USBDevice *dev,Error **errp); +void usb_device_attach (USBDevice *dev,Error *errp[static 1 ]);int usb_device_detach (USBDevice *dev);int usb_device_delete_addr (int busnr,int addr); -void usb_check_attach (USBDevice *dev,Error **errp); +void usb_check_attach (USBDevice *dev,Error *errp[static 1 ]);static inline USBBus *usb_bus_from_device (USBDevice *d) {
include/hw/vfio/vfio-common.h +3 -2
@@ -156,10 +156,11 @@ void vfio_region_mmaps_set_enabled(VFIORegion *region, bool enabled);void vfio_region_exit (VFIORegion *region);void vfio_region_finalize (VFIORegion *region);void vfio_reset_handler (void *opaque); -VFIOGroup *vfio_get_group (int groupid,AddressSpace *as,Error **errp); +VFIOGroup *vfio_get_group (int groupid,AddressSpace *as, +Error *errp[static 1 ]);void vfio_put_group (VFIOGroup *group);int vfio_get_device (VFIOGroup *group,const char *name, -VFIODevice *vbasedev,Error **errp); +VFIODevice *vbasedev,Error *errp[static 1 ]);extern const MemoryRegionOps vfio_region_ops; extern QLIST_HEAD(vfio_group_head, VFIOGroup) vfio_group_list;
include/hw/virtio/vhost-scsi-common.h +1 -1
@@ -43,6 +43,6 @@ char *vhost_scsi_common_get_fw_dev_path(FWPathProvider *p, BusState *bus, DeviceState *dev);void vhost_scsi_common_set_config (VirtIODevice *vdev,const uint8_t *config);uint64_t vhost_scsi_common_get_features (VirtIODevice *vdev,uint64_t features, -Error **errp); +Error *errp[static 1 ]);#endif /* VHOST_SCSI_COMMON_H */
include/hw/virtio/virtio-bus.h +1 -1
@@ -110,7 +110,7 @@ struct VirtioBusState {int ioeventfd_grabbed; }; -void virtio_bus_device_plugged (VirtIODevice *vdev,Error **errp); +void virtio_bus_device_plugged (VirtIODevice *vdev,Error *errp[static 1 ]);void virtio_bus_reset (VirtioBusState *bus);void virtio_bus_device_unplugged (VirtIODevice *bus);/* Get the device id of the plugged device. */
include/hw/virtio/virtio-scsi.h +3 -3
@@ -141,9 +141,9 @@ void virtio_scsi_common_realize(DeviceState *dev,VirtIOHandleOutput ctrl, VirtIOHandleOutput evt, VirtIOHandleOutput cmd, - Error **errp); + Error *errp[static 1]); -void virtio_scsi_common_unrealize (DeviceState *dev,Error **errp); +void virtio_scsi_common_unrealize (DeviceState *dev,Error *errp[static 1 ]);bool virtio_scsi_handle_event_vq (VirtIOSCSI *s,VirtQueue *vq);bool virtio_scsi_handle_cmd_vq (VirtIOSCSI *s,VirtQueue *vq);bool virtio_scsi_handle_ctrl_vq (VirtIOSCSI *s,VirtQueue *vq);
@@ -152,7 +152,7 @@ void virtio_scsi_free_req(VirtIOSCSIReq *req);void virtio_scsi_push_event (VirtIOSCSI *s,SCSIDevice *dev,uint32_t event,uint32_t reason); -void virtio_scsi_dataplane_setup (VirtIOSCSI *s,Error **errp); +void virtio_scsi_dataplane_setup (VirtIOSCSI *s,Error *errp[static 1 ]);int virtio_scsi_dataplane_start (VirtIODevice *s);void virtio_scsi_dataplane_stop (VirtIODevice *s);
include/hw/xen/xen.h +1 -1
@@ -43,7 +43,7 @@ void xenstore_store_pv_console_info(int i, struct Chardev *chr);void xen_hvm_init (PCMachineState *pcms,MemoryRegion **ram_memory);void xen_ram_alloc (ram_addr_t ram_addr,ram_addr_t size, -struct MemoryRegion *mr,Error **errp); +struct MemoryRegion *mr,Error *errp[static 1 ]);void xen_hvm_modified_memory (ram_addr_t start,ram_addr_t length);void xen_register_framebuffer (struct MemoryRegion *mr);
include/io/channel-command.h +1 -1
@@ -85,7 +85,7 @@ qio_channel_command_new_pid(int writefd,QIOChannelCommand *qio_channel_command_new_spawn (const char *const argv[],int flags, -Error **errp); +Error *errp[static 1 ]);#endif /* QIO_CHANNEL_COMMAND_H */
include/io/channel-file.h +1 -1
@@ -88,6 +88,6 @@ QIOChannelFile * qio_channel_file_new_path(const char *path, int flags, mode_t mode, - Error **errp); + Error *errp[static 1]);#endif /* QIO_CHANNEL_FILE_H */
include/io/channel-socket.h +7 -7
@@ -76,7 +76,7 @@ qio_channel_socket_new(void);*/ QIOChannelSocket *qio_channel_socket_new_fd (int fd, -Error **errp); +Error *errp[static 1 ]);/**
@@ -92,7 +92,7 @@ qio_channel_socket_new_fd(int fd,*/ int qio_channel_socket_connect_sync (QIOChannelSocket *ioc,SocketAddress *addr, -Error **errp); +Error *errp[static 1 ]);/** * qio_channel_socket_connect_async:
@@ -129,7 +129,7 @@ void qio_channel_socket_connect_async(QIOChannelSocket *ioc,*/ int qio_channel_socket_listen_sync (QIOChannelSocket *ioc,SocketAddress *addr, -Error **errp); +Error *errp[static 1 ]);/** * qio_channel_socket_listen_async:
@@ -169,7 +169,7 @@ void qio_channel_socket_listen_async(QIOChannelSocket *ioc,int qio_channel_socket_dgram_sync (QIOChannelSocket *ioc,SocketAddress *localAddr,SocketAddress *remoteAddr, -Error **errp); +Error *errp[static 1 ]);/** * qio_channel_socket_dgram_async:
@@ -212,7 +212,7 @@ void qio_channel_socket_dgram_async(QIOChannelSocket *ioc,*/ SocketAddress *qio_channel_socket_get_local_address (QIOChannelSocket *ioc, -Error **errp); +Error *errp[static 1 ]);/** * qio_channel_socket_get_remote_address:
@@ -229,7 +229,7 @@ qio_channel_socket_get_local_address(QIOChannelSocket *ioc,*/ SocketAddress *qio_channel_socket_get_remote_address (QIOChannelSocket *ioc, -Error **errp); +Error *errp[static 1 ]);/**
@@ -245,7 +245,7 @@ qio_channel_socket_get_remote_address(QIOChannelSocket *ioc,*/ QIOChannelSocket *qio_channel_socket_accept (QIOChannelSocket *ioc, -Error **errp); +Error *errp[static 1 ]);#endif /* QIO_CHANNEL_SOCKET_H */
include/io/channel-tls.h +2 -2
@@ -78,7 +78,7 @@ QIOChannelTLS *qio_channel_tls_new_server (QIOChannel *master, QCryptoTLSCreds *creds, const char *aclname, - Error **errp); + Error *errp[static 1]);/** * qio_channel_tls_new_client:
@@ -108,7 +108,7 @@ QIOChannelTLS *qio_channel_tls_new_client (QIOChannel *master, QCryptoTLSCreds *creds, const char *hostname, - Error **errp); + Error *errp[static 1]);/** * qio_channel_tls_handshake:
include/io/channel-util.h +1 -1
@@ -47,6 +47,6 @@* Returns: the channel object, or NULL on error */ QIOChannel *qio_channel_new_fd (int fd, -Error **errp); +Error *errp[static 1 ]);#endif /* QIO_CHANNEL_UTIL_H */
include/io/channel.h +10 -10
@@ -224,7 +224,7 @@ ssize_t qio_channel_readv_full(QIOChannel *ioc,size_t niov, int **fds, size_t *nfds, - Error **errp); + Error *errp[static 1]);/**
@@ -266,7 +266,7 @@ ssize_t qio_channel_writev_full(QIOChannel *ioc,size_t niov, int *fds, size_t nfds, - Error **errp); + Error *errp[static 1]);/** * qio_channel_readv:
@@ -281,7 +281,7 @@ ssize_t qio_channel_writev_full(QIOChannel *ioc,ssize_t qio_channel_readv (QIOChannel *ioc,const struct iovec *iov,size_t niov, -Error **errp); +Error *errp[static 1 ]);/** * qio_channel_writev:
@@ -296,7 +296,7 @@ ssize_t qio_channel_readv(QIOChannel *ioc,ssize_t qio_channel_writev (QIOChannel *ioc,const struct iovec *iov,size_t niov, -Error **errp); +Error *errp[static 1 ]);/** * qio_channel_readv:
@@ -312,7 +312,7 @@ ssize_t qio_channel_writev(QIOChannel *ioc,ssize_t qio_channel_read (QIOChannel *ioc,char *buf,size_t buflen, -Error **errp); +Error *errp[static 1 ]);/** * qio_channel_write:
@@ -328,7 +328,7 @@ ssize_t qio_channel_read(QIOChannel *ioc,ssize_t qio_channel_write (QIOChannel *ioc,const char *buf,size_t buflen, -Error **errp); +Error *errp[static 1 ]);/** * qio_channel_set_blocking:
@@ -345,7 +345,7 @@ ssize_t qio_channel_write(QIOChannel *ioc,*/ int qio_channel_set_blocking (QIOChannel *ioc,bool enabled, -Error **errp); +Error *errp[static 1 ]);/** * qio_channel_close:
@@ -357,7 +357,7 @@ int qio_channel_set_blocking(QIOChannel *ioc,* Returns: 0 on success, -1 on error */ int qio_channel_close (QIOChannel *ioc, -Error **errp); +Error *errp[static 1 ]);/** * qio_channel_shutdown:
@@ -378,7 +378,7 @@ int qio_channel_close(QIOChannel *ioc,*/ int qio_channel_shutdown (QIOChannel *ioc,QIOChannelShutdown how, -Error **errp); +Error *errp[static 1 ]);/** * qio_channel_set_delay:
@@ -457,7 +457,7 @@ void qio_channel_set_cork(QIOChannel *ioc,off_t qio_channel_io_seek (QIOChannel *ioc,off_t offset,int whence, -Error **errp); +Error *errp[static 1 ]);/**
include/io/dns-resolver.h +1 -1
@@ -180,7 +180,7 @@ int qio_dns_resolver_lookup_sync(QIODNSResolver *resolver, SocketAddress *addr, size_t *naddrs, SocketAddress ***addrs, - Error **errp); + Error *errp[static 1]);/** * qio_dns_resolver_lookup_async:
include/io/task.h +1 -1
@@ -276,7 +276,7 @@ void qio_task_set_error(QIOTask *task,* Returns: true if an error was propagated, false otherwise */ bool qio_task_propagate_error (QIOTask *task, -Error **errp); +Error *errp[static 1 ]);/**
include/migration/blocker.h +1 -1
@@ -23,7 +23,7 @@* * @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set. */ -int migrate_add_blocker (Error *reason,Error **errp); +int migrate_add_blocker (Error *reason,Error *errp[static 1 ]);/** * @migrate_del_blocker - remove a blocking error from migration
include/migration/failover.h +1 -1
@@ -20,7 +20,7 @@ void failover_init_state(void);FailoverStatus failover_set_state (FailoverStatus old_state,FailoverStatus new_state);FailoverStatus failover_get_state (void ); -void failover_request_active (Error **errp); +void failover_request_active (Error *errp[static 1 ]);bool failover_request_is_active (void );#endif
include/migration/migration.h +2 -2
@@ -149,7 +149,7 @@ void migrate_set_state(int *state, int old_state, int new_state);void migration_fd_process_incoming (QEMUFile *f); -void qemu_start_incoming_migration (const char *uri,Error **errp); +void qemu_start_incoming_migration (const char *uri,Error *errp[static 1 ]);uint64_t migrate_max_downtime (void );
@@ -160,7 +160,7 @@ void migrate_fd_connect(MigrationState *s);void add_migration_state_change_notifier (Notifier *notify);void remove_migration_state_change_notifier (Notifier *notify);MigrationState *migrate_init (void ); -bool migration_is_blocked (Error **errp); +bool migration_is_blocked (Error *errp[static 1 ]);bool migration_in_setup (MigrationState *);bool migration_is_idle (void );bool migration_has_finished (MigrationState *);
include/migration/snapshot.h +2 -2
@@ -15,7 +15,7 @@#ifndef QEMU_MIGRATION_SNAPSHOT_H #define QEMU_MIGRATION_SNAPSHOT_H -int save_snapshot (const char *name,Error **errp); -int load_snapshot (const char *name,Error **errp); +int save_snapshot (const char *name,Error *errp[static 1 ]); +int load_snapshot (const char *name,Error *errp[static 1 ]);#endif
include/migration/vmstate.h +1 -1
@@ -1025,7 +1025,7 @@ int vmstate_register_with_alias_id(DeviceState *dev, int instance_id,const VMStateDescription *vmsd, void *base, int alias_id, int required_for_version, - Error **errp); + Error *errp[static 1]);/* Returns: 0 on success, -1 on failure */ static inline int vmstate_register(DeviceState *dev, int instance_id,
include/monitor/monitor.h +3 -3
@@ -30,8 +30,8 @@ int monitor_read_block_device_key(Monitor *mon, const char *device, BlockCompletionFunc *completion_cb, void *opaque); -int monitor_get_fd (Monitor *mon,const char *fdname,Error **errp); -int monitor_fd_param (Monitor *mon,const char *fdname,Error **errp); +int monitor_get_fd (Monitor *mon,const char *fdname,Error *errp[static 1 ]); +int monitor_fd_param (Monitor *mon,const char *fdname,Error *errp[static 1 ]); void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0);
@@ -47,7 +47,7 @@ int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func,AddfdInfo *monitor_fdset_add_fd (int fd,bool has_fdset_id,int64_t fdset_id,bool has_opaque,const char *opaque, -Error **errp); +Error *errp[static 1 ]);int monitor_fdset_get_fd (int64_t fdset_id,int flags);int monitor_fdset_dup_fd_add (int64_t fdset_id,int dup_fd);void monitor_fdset_dup_fd_remove (int dup_fd);
include/monitor/qdev.h +2 -2
@@ -8,10 +8,10 @@void hmp_info_qtree (Monitor *mon,const QDict *qdict);void hmp_info_qdm (Monitor *mon,const QDict *qdict);void hmp_info_qom_tree (Monitor *mon,const QDict *dict); -void qmp_device_add (QDict *qdict,QObject **ret_data,Error **errp); +void qmp_device_add (QDict *qdict,QObject **ret_data,Error *errp[static 1 ]);int qdev_device_help (QemuOpts *opts); -DeviceState *qdev_device_add (QemuOpts *opts,Error **errp); +DeviceState *qdev_device_add (QemuOpts *opts,Error *errp[static 1 ]);void qdev_set_id (DeviceState *dev,const char *id);#endif
include/net/net.h +3 -3
@@ -201,15 +201,15 @@ extern const char *host_net_devices[];extern const char *legacy_tftp_prefix;extern const char *legacy_bootp_filename; -int net_client_init (QemuOpts *opts,bool is_netdev,Error **errp); +int net_client_init (QemuOpts *opts,bool is_netdev,Error *errp[static 1 ]);int net_client_parse (QemuOptsList *opts_list,const char *str);int net_init_clients (void );void net_check_clients (void );void net_cleanup (void );void hmp_host_net_add (Monitor *mon,const QDict *qdict);void hmp_host_net_remove (Monitor *mon,const QDict *qdict); -void netdev_add (QemuOpts *opts,Error **errp); -void qmp_netdev_add (QDict *qdict,QObject **ret,Error **errp); +void netdev_add (QemuOpts *opts,Error *errp[static 1 ]); +void qmp_netdev_add (QDict *qdict,QObject **ret,Error *errp[static 1 ]);int net_hub_id_for_client (NetClientState *nc,int *id);NetClientState *net_hub_port_find (int hub_id);
include/qapi/error.h +1 -1
@@ -283,7 +283,7 @@ void error_free(Error *err);/* * Convenience function to assert that *@errp is set, then silently free it. */ -void error_free_or_abort (Error **errp); +void error_free_or_abort (Error *errp[static 1 ]);/* * Convenience function to error_report() and free @err.
include/qapi/qmp/json-parser.h +2 -1
@@ -18,6 +18,7 @@#include "qapi/qmp/qlist.h" QObject *json_parser_parse (GQueue *tokens,va_list *ap); -QObject *json_parser_parse_err (GQueue *tokens,va_list *ap,Error **errp); +QObject *json_parser_parse_err (GQueue *tokens,va_list *ap, +Error *errp[static 1 ]);#endif
include/qapi/qmp/qdict.h +1 -1
@@ -81,7 +81,7 @@ void qdict_flatten(QDict *qdict);void qdict_extract_subqdict (QDict *src,QDict **dst,const char *start);void qdict_array_split (QDict *src,QList **dst);int qdict_array_entries (QDict *src,const char *subqdict); -QObject *qdict_crumple (const QDict *src,Error **errp); +QObject *qdict_crumple (const QDict *src,Error *errp[static 1 ]);void qdict_join (QDict *dest,QDict *src,bool overwrite);
include/qapi/qmp/qjson.h +3 -2
@@ -17,9 +17,10 @@#include "qapi/qmp/qobject.h" #include "qapi/qmp/qstring.h" -QObject *qobject_from_json (const char *string,Error **errp); +QObject *qobject_from_json (const char *string,Error *errp[static 1 ]);QObject *qobject_from_jsonf (const char *string, ...)GCC_FMT_ATTR (1 ,2 ); -QObject *qobject_from_jsonv (const char *string,va_list *ap,Error **errp) +QObject *qobject_from_jsonv (const char *string,va_list *ap, +Error *errp[static 1 ])GCC_FMT_ATTR (1 ,0 );QString *qobject_to_json (const QObject *obj);
include/qapi/qobject-input-visitor.h +1 -1
@@ -78,6 +78,6 @@ Visitor *qobject_input_visitor_new_keyval(QObject *obj);*/ Visitor *qobject_input_visitor_new_str (const char *str,const char *implied_key, -Error **errp); +Error *errp[static 1 ]);#endif
include/qapi/util.h +1 -1
@@ -12,7 +12,7 @@#define QAPI_UTIL_H int qapi_enum_parse (const char *const lookup[],const char *buf, -int max,int def,Error **errp); +int max,int def,Error *errp[static 1 ]);int parse_qapi_name (const char *name,bool complete);
include/qemu/base64.h +1 -1
@@ -52,7 +52,7 @@uint8_t *qbase64_decode (const char *input,size_t in_len,size_t *out_len, -Error **errp); +Error *errp[static 1 ]);#endif /* QEMU_BASE64_H */
include/qemu/config-file.h +2 -2
@@ -5,7 +5,7 @@#include "qapi/qmp/qdict.h" QemuOptsList *qemu_find_opts (const char *group); -QemuOptsList *qemu_find_opts_err (const char *group,Error **errp); +QemuOptsList *qemu_find_opts_err (const char *group,Error *errp[static 1 ]);QemuOpts *qemu_find_opts_singleton (const char *group);void qemu_add_opts (QemuOptsList *list);
@@ -21,6 +21,6 @@ int qemu_read_config_file(const char *filename);/* Parse QDict options as a replacement for a config file (allowing multiple enumerated (0..(n-1)) configuration "sections") */ void qemu_config_parse_qdict (QDict *options,QemuOptsList **lists, -Error **errp); +Error *errp[static 1 ]);#endif /* QEMU_CONFIG_FILE_H */
include/qemu/log.h +2 -2
@@ -123,8 +123,8 @@ extern const QEMULogItem qemu_log_items[];void qemu_set_log (int log_flags);void qemu_log_needs_buffers (void ); -void qemu_set_log_filename (const char *filename,Error **errp); -void qemu_set_dfilter_ranges (const char *ranges,Error **errp); +void qemu_set_log_filename (const char *filename,Error *errp[static 1 ]); +void qemu_set_dfilter_ranges (const char *ranges,Error *errp[static 1 ]);bool qemu_log_in_addr_range (uint64_t addr);int qemu_str_to_log_mask (const char *str);
include/qemu/main-loop.h +1 -1
@@ -42,7 +42,7 @@* * In the case of QEMU tools, this will also start/initialize timers. */ -int qemu_init_main_loop (Error **errp); +int qemu_init_main_loop (Error *errp[static 1 ]);/** * main_loop_wait: Run one iteration of the main loop.
include/qemu/option.h +16 -14
@@ -38,7 +38,7 @@ int get_param_value(char *buf, int buf_size,void parse_option_size (const char *name,const char *value, -uint64_t *ret,Error **errp); +uint64_t *ret,Error *errp[static 1 ]);bool has_help_option (const char *param);bool is_valid_option_list (const char *param);
@@ -89,16 +89,16 @@ uint64_t qemu_opt_get_size_del(QemuOpts *opts, const char *name, uint64_t defval);int qemu_opt_unset (QemuOpts *opts,const char *name);void qemu_opt_set (QemuOpts *opts,const char *name,const char *value, -Error **errp); +Error *errp[static 1 ]);void qemu_opt_set_bool (QemuOpts *opts,const char *name,bool val, -Error **errp); +Error *errp[static 1 ]);void qemu_opt_set_number (QemuOpts *opts,const char *name,int64_t val, -Error **errp); +Error *errp[static 1 ]);typedef int (*qemu_opt_loopfunc )(void *opaque,const char *name,const char *value,Error **errp);int qemu_opt_foreach (QemuOpts *opts,qemu_opt_loopfunc func,void *opaque, -Error **errp); +Error *errp[static 1 ]); typedef struct { QemuOpts *opts;
@@ -111,37 +111,39 @@ const char *qemu_opt_iter_next(QemuOptsIter *iter);QemuOpts *qemu_opts_find (QemuOptsList *list,const char *id);QemuOpts *qemu_opts_create (QemuOptsList *list,const char *id, -int fail_if_exists,Error **errp); +int fail_if_exists,Error *errp[static 1 ]);void qemu_opts_reset (QemuOptsList *list);void qemu_opts_loc_restore (QemuOpts *opts);void qemu_opts_set (QemuOptsList *list,const char *id, -const char *name,const char *value,Error **errp); +const char *name,const char *value,Error *errp[static 1 ]);const char *qemu_opts_id (QemuOpts *opts);void qemu_opts_set_id (QemuOpts *opts,char *id);void qemu_opts_del (QemuOpts *opts); -void qemu_opts_validate (QemuOpts *opts,const QemuOptDesc *desc,Error **errp); +void qemu_opts_validate (QemuOpts *opts,const QemuOptDesc *desc, +Error *errp[static 1 ]);void qemu_opts_do_parse (QemuOpts *opts,const char *params, -const char *firstname,Error **errp); +const char *firstname,Error *errp[static 1 ]);QemuOpts *qemu_opts_parse_noisily (QemuOptsList *list,const char *params,bool permit_abbrev);QemuOpts *qemu_opts_parse (QemuOptsList *list,const char *params, -bool permit_abbrev,Error **errp); +bool permit_abbrev,Error *errp[static 1 ]);void qemu_opts_set_defaults (QemuOptsList *list,const char *params,int permit_abbrev);QemuOpts *qemu_opts_from_qdict (QemuOptsList *list,const QDict *qdict, -Error **errp); +Error *errp[static 1 ]);QDict *qemu_opts_to_qdict (QemuOpts *opts,QDict *qdict); -void qemu_opts_absorb_qdict (QemuOpts *opts,QDict *qdict,Error **errp); +void qemu_opts_absorb_qdict (QemuOpts *opts,QDict *qdict, +Error *errp[static 1 ]);typedef int (*qemu_opts_loopfunc )(void *opaque,QemuOpts *opts,Error **errp);int qemu_opts_foreach (QemuOptsList *list,qemu_opts_loopfunc func, -void *opaque,Error **errp); +void *opaque,Error *errp[static 1 ]);void qemu_opts_print (QemuOpts *opts,const char *sep);void qemu_opts_print_help (QemuOptsList *list);void qemu_opts_free (QemuOptsList *list);QemuOptsList *qemu_opts_append (QemuOptsList *dst,QemuOptsList *list);QDict *keyval_parse (const char *params,const char *implied_key, -Error **errp); +Error *errp[static 1 ]);#endif
include/qemu/sockets.h +18 -15
@@ -33,24 +33,26 @@ int socket_set_fast_reuse(int fd);typedef void NonBlockingConnectHandler (int fd,Error *err,void *opaque);int inet_ai_family_from_address (InetSocketAddress *addr, -Error **errp); -int inet_parse (InetSocketAddress *addr,const char *str,Error **errp); -int inet_connect (const char *str,Error **errp); +Error *errp[static 1 ]); +int inet_parse (InetSocketAddress *addr,const char *str, +Error *errp[static 1 ]); +int inet_connect (const char *str,Error *errp[static 1 ]);int inet_connect_saddr (InetSocketAddress *saddr,NonBlockingConnectHandler *callback,void *opaque, -Error **errp); +Error *errp[static 1 ]);NetworkAddressFamily inet_netfamily (int family); -int unix_listen (const char *path,char *ostr,int olen,Error **errp); -int unix_connect (const char *path,Error **errp); +int unix_listen (const char *path,char *ostr,int olen,Error *errp[static 1 ]); +int unix_connect (const char *path,Error *errp[static 1 ]); -SocketAddress *socket_parse (const char *str,Error **errp); +SocketAddress *socket_parse (const char *str,Error *errp[static 1 ]);int socket_connect (SocketAddress *addr,NonBlockingConnectHandler *callback, -void *opaque,Error **errp); -int socket_listen (SocketAddress *addr,Error **errp); -void socket_listen_cleanup (int fd,Error **errp); -int socket_dgram (SocketAddress *remote,SocketAddress *local,Error **errp); +void *opaque,Error *errp[static 1 ]); +int socket_listen (SocketAddress *addr,Error *errp[static 1 ]); +void socket_listen_cleanup (int fd,Error *errp[static 1 ]); +int socket_dgram (SocketAddress *remote,SocketAddress *local, +Error *errp[static 1 ]);/* Old, ipv4 only bits. Don't use for new code. */ int parse_host_port (struct sockaddr_in *saddr,const char *str);
@@ -73,7 +75,7 @@ int socket_init(void);SocketAddress *socket_sockaddr_to_address (struct sockaddr_storage *sa,socklen_t salen, -Error **errp); +Error *errp[static 1 ]);/** * socket_local_address:
@@ -88,7 +90,7 @@ socket_sockaddr_to_address(struct sockaddr_storage *sa,* * Returns: the socket address struct, or NULL on error */ -SocketAddress *socket_local_address (int fd,Error **errp); +SocketAddress *socket_local_address (int fd,Error *errp[static 1 ]);/** * socket_remote_address:
@@ -103,7 +105,7 @@ SocketAddress *socket_local_address(int fd, Error **errp);* * Returns: the socket address struct, or NULL on error */ -SocketAddress *socket_remote_address (int fd,Error **errp); +SocketAddress *socket_remote_address (int fd,Error *errp[static 1 ]);/** * socket_address_to_string:
@@ -118,7 +120,8 @@ SocketAddress *socket_remote_address(int fd, Error **errp);* * Returns: the socket address in string format, or NULL on error */ -char *socket_address_to_string (struct SocketAddress *addr,Error **errp); +char *socket_address_to_string (struct SocketAddress *addr, +Error *errp[static 1 ]);/** * socket_address_flatten:
include/qemu/throttle.h +1 -1
@@ -136,7 +136,7 @@ bool throttle_timers_are_initialized(ThrottleTimers *tt);/* configuration */ bool throttle_enabled (ThrottleConfig *cfg); -bool throttle_is_valid (ThrottleConfig *cfg,Error **errp); +bool throttle_is_valid (ThrottleConfig *cfg,Error *errp[static 1 ]); void throttle_config(ThrottleState *ts, ThrottleTimers *tt,
include/qom/cpu.h +2 -2
@@ -446,7 +446,7 @@ bool cpu_paging_enabled(const CPUState *cpu);* @errp: Pointer for reporting an #Error. */ void cpu_get_memory_mapping (CPUState *cpu,MemoryMappingList *list, -Error **errp); +Error *errp[static 1 ]);/** * cpu_write_elf64_note:
@@ -1002,7 +1002,7 @@ AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx); void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...) GCC_FMT_ATTR(2, 3); void cpu_exec_initfn(CPUState *cpu); -void cpu_exec_realizefn (CPUState *cpu,Error **errp); +void cpu_exec_realizefn (CPUState *cpu,Error *errp[static 1 ]);void cpu_exec_unrealizefn (CPUState *cpu);#ifdef CONFIG_SOFTMMU
include/qom/object.h +47 -42
301 lines not on this page · raw message
include/qom/object_interfaces.h +6 -6
@@ -63,7 +63,7 @@ typedef struct UserCreatableClass {* from implements USER_CREATABLE interface, otherwise the call does * nothing. */ -void user_creatable_complete (Object *obj,Error **errp); +void user_creatable_complete (Object *obj,Error *errp[static 1 ]);/** * user_creatable_can_be_deleted:
@@ -73,7 +73,7 @@ void user_creatable_complete(Object *obj, Error **errp);* Wrapper to call can_be_deleted() method if one of types it's inherited * from implements USER_CREATABLE interface. */ -bool user_creatable_can_be_deleted (UserCreatable *uc,Error **errp); +bool user_creatable_can_be_deleted (UserCreatable *uc,Error *errp[static 1 ]);/** * user_creatable_add_type:
@@ -91,7 +91,7 @@ bool user_creatable_can_be_deleted(UserCreatable *uc, Error **errp);*/ Object *user_creatable_add_type (const char *type,const char *id,const QDict *qdict, -Visitor *v,Error **errp); +Visitor *v,Error *errp[static 1 ]);/** * user_creatable_add_opts:
@@ -106,7 +106,7 @@ Object *user_creatable_add_type(const char *type, const char *id,* * Returns: the newly created object or NULL on error */ -Object *user_creatable_add_opts (QemuOpts *opts,Error **errp); +Object *user_creatable_add_opts (QemuOpts *opts,Error *errp[static 1 ]);/**
@@ -136,7 +136,7 @@ typedef bool (*user_creatable_add_opts_predicate)(const char *type);* Returns: 0 on success, -1 when an error was reported. */ int user_creatable_add_opts_foreach (void *opaque, -QemuOpts *opts,Error **errp); +QemuOpts *opts,Error *errp[static 1 ]);/** * user_creatable_del:
@@ -146,6 +146,6 @@ int user_creatable_add_opts_foreach(void *opaque,* Delete an instance of the user creatable object identified * by @id. */ -void user_creatable_del (const char *id,Error **errp); +void user_creatable_del (const char *id,Error *errp[static 1 ]);#endif
include/qom/qom-qobject.h +2 -2
@@ -26,7 +26,7 @@* an error occurs. */ struct QObject *object_property_get_qobject (Object *obj,const char *name, -Error **errp); +Error *errp[static 1 ]);/** * object_property_set_qobject:
@@ -38,6 +38,6 @@ struct QObject *object_property_get_qobject(Object *obj, const char *name,* Writes a property to a object. */ void object_property_set_qobject (Object *obj,struct QObject *qobj, -const char *name,Error **errp); +const char *name,Error *errp[static 1 ]);#endif
include/sysemu/arch_init.h +4 -4
@@ -31,15 +31,15 @@ extern const uint32_t arch_type;int kvm_available (void );int xen_available (void ); -CpuDefinitionInfoList *arch_query_cpu_definitions (Error **errp); +CpuDefinitionInfoList *arch_query_cpu_definitions (Error *errp[static 1 ]);CpuModelExpansionInfo *arch_query_cpu_model_expansion (CpuModelExpansionType type,CpuModelInfo *mode, -Error **errp); +Error *errp[static 1 ]);CpuModelCompareInfo *arch_query_cpu_model_comparison (CpuModelInfo *modela,CpuModelInfo *modelb, -Error **errp); +Error *errp[static 1 ]);CpuModelBaselineInfo *arch_query_cpu_model_baseline (CpuModelInfo *modela,CpuModelInfo *modelb, -Error **errp); +Error *errp[static 1 ]);#endif
include/sysemu/block-backend.h +11 -8
@@ -94,7 +94,7 @@ typedef struct BlockBackendPublic {BlockBackend *blk_new (uint64_t perm,uint64_t shared_perm);BlockBackend *blk_new_open (const char *filename,const char *reference, -QDict *options,int flags,Error **errp); +QDict *options,int flags,Error *errp[static 1 ]);int blk_get_refcnt (BlockBackend *blk);void blk_ref (BlockBackend *blk);void blk_unref (BlockBackend *blk);
@@ -102,7 +102,8 @@ void blk_remove_all_bs(void);const char *blk_name (const BlockBackend *blk);BlockBackend *blk_by_name (const char *name);BlockBackend *blk_next (BlockBackend *blk); -bool monitor_add_blk (BlockBackend *blk,const char *name,Error **errp); +bool monitor_add_blk (BlockBackend *blk,const char *name, +Error *errp[static 1 ]);void monitor_remove_blk (BlockBackend *blk);BlockBackendPublic *blk_get_public (BlockBackend *blk);
@@ -110,11 +111,12 @@ BlockBackend *blk_by_public(BlockBackendPublic *public);BlockDriverState *blk_bs (BlockBackend *blk);void blk_remove_bs (BlockBackend *blk); -int blk_insert_bs (BlockBackend *blk,BlockDriverState *bs,Error **errp); +int blk_insert_bs (BlockBackend *blk,BlockDriverState *bs, +Error *errp[static 1 ]);bool bdrv_has_blk (BlockDriverState *bs);bool bdrv_is_root_node (BlockDriverState *bs);int blk_set_perm (BlockBackend *blk,uint64_t perm,uint64_t shared_perm, -Error **errp); +Error *errp[static 1 ]);void blk_get_perm (BlockBackend *blk,uint64_t *perm,uint64_t *shared_perm);void blk_set_allow_write_beyond_eof (BlockBackend *blk,bool allow);
@@ -129,7 +131,7 @@ void blk_attach_dev_legacy(BlockBackend *blk, void *dev);void blk_detach_dev (BlockBackend *blk,void *dev);void *blk_get_attached_dev (BlockBackend *blk);BlockBackend *blk_by_dev (void *dev); -BlockBackend *blk_by_qdev_id (const char *id,Error **errp); +BlockBackend *blk_by_qdev_id (const char *id,Error *errp[static 1 ]);void blk_set_dev_ops (BlockBackend *blk,const BlockDevOps *ops,void *opaque);int blk_pread_unthrottled (BlockBackend *blk,int64_t offset,uint8_t *buf,int count);
@@ -184,7 +186,7 @@ int blk_is_read_only(BlockBackend *blk);int blk_is_sg (BlockBackend *blk);int blk_enable_write_cache (BlockBackend *blk);void blk_set_enable_write_cache (BlockBackend *blk,bool wce); -void blk_invalidate_cache (BlockBackend *blk,Error **errp); +void blk_invalidate_cache (BlockBackend *blk,Error *errp[static 1 ]);bool blk_is_inserted (BlockBackend *blk);bool blk_is_available (BlockBackend *blk);void blk_lock_medium (BlockBackend *blk,bool locked);
@@ -195,7 +197,8 @@ int blk_get_max_iov(BlockBackend *blk);void blk_set_guest_block_size (BlockBackend *blk,int align);void *blk_try_blockalign (BlockBackend *blk,size_t size);void *blk_blockalign (BlockBackend *blk,size_t size); -bool blk_op_is_blocked (BlockBackend *blk,BlockOpType op,Error **errp); +bool blk_op_is_blocked (BlockBackend *blk,BlockOpType op, +Error *errp[static 1 ]);void blk_op_unblock (BlockBackend *blk,BlockOpType op,Error *reason);void blk_op_block_all (BlockBackend *blk,Error *reason);void blk_op_unblock_all (BlockBackend *blk,Error *reason);
@@ -225,7 +228,7 @@ int coroutine_fn blk_co_pwrite_zeroes(BlockBackend *blk, int64_t offset, int count, BdrvRequestFlags flags);int blk_pwrite_compressed (BlockBackend *blk,int64_t offset,const void *buf,int count); -int blk_truncate (BlockBackend *blk,int64_t offset,Error **errp); +int blk_truncate (BlockBackend *blk,int64_t offset,Error *errp[static 1 ]);int blk_pdiscard (BlockBackend *blk,int64_t offset,int count);int blk_save_vmstate (BlockBackend *blk,const uint8_t *buf,int64_t pos,int size);
include/sysemu/cpus.h +2 -2
@@ -11,7 +11,7 @@ void pause_all_vcpus(void);void cpu_stop_current (void );void cpu_ticks_init (void ); -void configure_icount (QemuOpts *opts,Error **errp); +void configure_icount (QemuOpts *opts,Error *errp[static 1 ]);extern int use_icount;extern int icount_align_option;
@@ -40,6 +40,6 @@ extern int smp_threads;void list_cpus (FILE *f,fprintf_function cpu_fprintf,const char *optarg); -void qemu_tcg_configure (QemuOpts *opts,Error **errp); +void qemu_tcg_configure (QemuOpts *opts,Error *errp[static 1 ]);#endif
include/sysemu/cryptodev.h +4 -4
@@ -244,7 +244,7 @@ void cryptodev_backend_free_client(*/ void cryptodev_backend_cleanup (CryptoDevBackend *backend, -Error **errp); +Error *errp[static 1 ]);/** * cryptodev_backend_sym_create_session:
@@ -260,7 +260,7 @@ void cryptodev_backend_cleanup(int64_t cryptodev_backend_sym_create_session (CryptoDevBackend *backend,CryptoDevBackendSymSessionInfo *sess_info, -uint32_t queue_index,Error **errp); +uint32_t queue_index,Error *errp[static 1 ]);/** * cryptodev_backend_sym_close_session:
@@ -277,7 +277,7 @@ int64_t cryptodev_backend_sym_create_session(int cryptodev_backend_sym_close_session (CryptoDevBackend *backend,uint64_t session_id, -uint32_t queue_index,Error **errp); +uint32_t queue_index,Error *errp[static 1 ]);/** * cryptodev_backend_crypto_operation:
@@ -295,7 +295,7 @@ int cryptodev_backend_sym_close_session(int cryptodev_backend_crypto_operation (CryptoDevBackend *backend,void *opaque, -uint32_t queue_index,Error **errp); +uint32_t queue_index,Error *errp[static 1 ]);/** * cryptodev_backend_set_used:
include/sysemu/device_tree.h +3 -3
@@ -41,7 +41,7 @@ void *load_device_tree_from_sysfs(void);* was encountered when parsing the blob, the function returns NULL */ char **qemu_fdt_node_path (void *fdt,const char *name,char *compat, -Error **errp); +Error *errp[static 1 ]);int qemu_fdt_setprop (void *fdt,const char *node_path,const char *property,const void *val,int size);
@@ -66,7 +66,7 @@ int qemu_fdt_setprop_phandle(void *fdt, const char *node_path,*/ const void *qemu_fdt_getprop (void *fdt,const char *node_path,const char *property,int *lenp, -Error **errp); +Error *errp[static 1 ]);/** * qemu_fdt_getprop_cell: retrieve the value of a given 4 byte property * @fdt: pointer to the device tree blob
@@ -80,7 +80,7 @@ const void *qemu_fdt_getprop(void *fdt, const char *node_path,*/ uint32_t qemu_fdt_getprop_cell (void *fdt,const char *node_path,const char *property,int *lenp, -Error **errp); +Error *errp[static 1 ]);uint32_t qemu_fdt_get_phandle (void *fdt,const char *path);uint32_t qemu_fdt_alloc_phandle (void *fdt);int qemu_fdt_nop_node (void *fdt,const char *node_path);
include/sysemu/hostmem.h +1 -1
@@ -64,7 +64,7 @@ struct HostMemoryBackend {bool host_memory_backend_mr_inited (HostMemoryBackend *backend);MemoryRegion *host_memory_backend_get_memory (HostMemoryBackend *backend, -Error **errp); +Error *errp[static 1 ]);void host_memory_backend_set_mapped (HostMemoryBackend *backend,bool mapped);bool host_memory_backend_is_mapped (HostMemoryBackend *backend);
include/sysemu/memory_mapping.h +1 -1
@@ -73,7 +73,7 @@ void guest_phys_blocks_append(GuestPhysBlockList *list);void qemu_get_guest_memory_mapping (MemoryMappingList *list,const GuestPhysBlockList *guest_phys_blocks, -Error **errp); +Error *errp[static 1 ]);/* get guest's memory mapping without do paging(virtual address is 0). */ void qemu_get_guest_simple_memory_mapping(MemoryMappingList *list,
include/sysemu/numa.h +3 -2
@@ -30,10 +30,11 @@ void query_numa_node_mem(uint64_t node_mem[]);extern QemuOptsList qemu_numa_opts;void numa_set_mem_node_id (ram_addr_t addr,uint64_t size,uint32_t node);void numa_unset_mem_node_id (ram_addr_t addr,uint64_t size,uint32_t node); -uint32_t numa_get_node (ram_addr_t addr,Error **errp); +uint32_t numa_get_node (ram_addr_t addr,Error *errp[static 1 ]);void numa_legacy_auto_assign_ram (MachineClass *mc,NodeInfo *nodes,int nb_nodes,ram_addr_t size);void numa_default_auto_assign_ram (MachineClass *mc,NodeInfo *nodes,int nb_nodes,ram_addr_t size); -void numa_cpu_pre_plug (const CPUArchId *slot,DeviceState *dev,Error **errp); +void numa_cpu_pre_plug (const CPUArchId *slot,DeviceState *dev, +Error *errp[static 1 ]);#endif
include/sysemu/qtest.h +2 -1
@@ -25,7 +25,8 @@ static inline bool qtest_enabled(void)bool qtest_driver (void ); -void qtest_init (const char *qtest_chrdev,const char *qtest_log,Error **errp); +void qtest_init (const char *qtest_chrdev,const char *qtest_log, +Error *errp[static 1 ]);static inline int qtest_available (void ) {
include/sysemu/sysemu.h +5 -5
@@ -176,19 +176,19 @@ void add_boot_device_path(int32_t bootindex, DeviceState *dev,char *get_boot_devices_list (size_t *size,bool ignore_suffixes);DeviceState *get_boot_device (uint32_t position); -void check_boot_index (int32_t bootindex,Error **errp); +void check_boot_index (int32_t bootindex,Error *errp[static 1 ]);void del_boot_device_path (DeviceState *dev,const char *suffix);void device_add_bootindex_property (Object *obj,int32_t *bootindex,const char *name,const char *suffix, -DeviceState *dev,Error **errp); +DeviceState *dev,Error *errp[static 1 ]);void restore_boot_order (void *opaque); -void validate_bootdevices (const char *devices,Error **errp); +void validate_bootdevices (const char *devices,Error *errp[static 1 ]);/* handler to set the boot_device order for a specific type of MachineClass */ typedef void QEMUBootSetHandler (void *opaque,const char *boot_order, -Error **errp); +Error *errp[static 1 ]);void qemu_register_boot_set (QEMUBootSetHandler *func,void *opaque); -void qemu_boot_set (const char *boot_order,Error **errp); +void qemu_boot_set (const char *boot_order,Error *errp[static 1 ]);QemuOpts *qemu_get_machine_opts (void );
include/sysemu/tpm_backend.h +1 -1
@@ -211,7 +211,7 @@ int tpm_backend_reset_tpm_established_flag(TPMBackend *s, uint8_t locty);* This function will open the backend if it is not already open. Calling this * function on an already opened backend will not result in an error. */ -void tpm_backend_open (TPMBackend *s,Error **errp); +void tpm_backend_open (TPMBackend *s,Error *errp[static 1 ]);/** * tpm_backend_get_tpm_version:
include/ui/console.h +8 -6
@@ -388,7 +388,8 @@ void qemu_console_early_init(void);QemuConsole *qemu_console_lookup_by_index (unsigned int index);QemuConsole *qemu_console_lookup_by_device (DeviceState *dev,uint32_t head);QemuConsole *qemu_console_lookup_by_device_name (const char *device_id, -uint32_t head,Error **errp); +uint32_t head, +Error *errp[static 1 ]);bool qemu_console_is_visible (QemuConsole *con);bool qemu_console_is_graphic (QemuConsole *con);bool qemu_console_is_fixedsize (QemuConsole *con);
@@ -463,13 +464,13 @@ static inline void cocoa_display_init(DisplayState *ds, int full_screen)/* vnc.c */ void vnc_display_init (const char *id); -void vnc_display_open (const char *id,Error **errp); +void vnc_display_open (const char *id,Error *errp[static 1 ]);void vnc_display_add_client (const char *id,int csock,bool skipauth);#ifdef CONFIG_VNC int vnc_display_password (const char *id,const char *password);int vnc_display_pw_expire (const char *id,time_t expires); -QemuOpts *vnc_parse (const char *str,Error **errp); -int vnc_init_func (void *opaque,QemuOpts *opts,Error **errp); +QemuOpts *vnc_parse (const char *str,Error *errp[static 1 ]); +int vnc_init_func (void *opaque,QemuOpts *opts,Error *errp[static 1 ]);#else static inline int vnc_display_password (const char *id,const char *password) {
@@ -479,12 +480,13 @@ static inline int vnc_display_pw_expire(const char *id, time_t expires) {return -ENODEV ; }; -static inline QemuOpts *vnc_parse (const char *str,Error **errp) +static inline QemuOpts *vnc_parse (const char *str,Error *errp[static 1 ]) {error_setg (errp,"VNC support is disabled" );return NULL ; } -static inline int vnc_init_func (void *opaque,QemuOpts *opts,Error **errp) +static inline int vnc_init_func (void *opaque,QemuOpts *opts, +Error *errp[static 1 ]) {error_setg (errp,"VNC support is disabled" );return -1 ;
include/ui/input.h +1 -1
@@ -32,7 +32,7 @@ void qemu_input_handler_deactivate(QemuInputHandlerState *s);void qemu_input_handler_unregister (QemuInputHandlerState *s);void qemu_input_handler_bind (QemuInputHandlerState *s,const char *device_id,int head, -Error **errp); +Error *errp[static 1 ]);void qemu_input_event_send (QemuConsole *src,InputEvent *evt);void qemu_input_event_send_impl (QemuConsole *src,InputEvent *evt);void qemu_input_event_sync (void );
include/ui/qemu-spice.h +1 -1
@@ -96,7 +96,7 @@ static inline void qemu_spice_init(void)#endif /* CONFIG_SPICE */ -static inline bool qemu_using_spice (Error **errp) +static inline bool qemu_using_spice (Error *errp[static 1 ]) {if (!using_spice) { error_set(errp, ERROR_CLASS_DEVICE_NOT_ACTIVE,
migration/block.h +1 -1
@@ -41,5 +41,5 @@ static inline uint64_t blk_mig_bytes_total(void) }#endif /* CONFIG_LIVE_BLOCK_MIGRATION */ -void migrate_set_block_enabled (bool value,Error **errp); +void migrate_set_block_enabled (bool value,Error *errp[static 1 ]);#endif /* MIGRATION_BLOCK_H */
migration/exec.h +3 -2
@@ -19,8 +19,9 @@#ifndef QEMU_MIGRATION_EXEC_H #define QEMU_MIGRATION_EXEC_H -void exec_start_incoming_migration (const char *host_port,Error **errp); +void exec_start_incoming_migration (const char *host_port, +Error *errp[static 1 ]);void exec_start_outgoing_migration (MigrationState *s,const char *host_port, -Error **errp); +Error *errp[static 1 ]);#endif
migration/fd.h +2 -2
@@ -16,8 +16,8 @@#ifndef QEMU_MIGRATION_FD_H #define QEMU_MIGRATION_FD_H -void fd_start_incoming_migration (const char *path,Error **errp); +void fd_start_incoming_migration (const char *path,Error *errp[static 1 ]);void fd_start_outgoing_migration (MigrationState *s,const char *fdname, -Error **errp); +Error *errp[static 1 ]);#endif
migration/rdma.h +3 -2
@@ -18,8 +18,9 @@#define QEMU_MIGRATION_RDMA_H void rdma_start_outgoing_migration (void *opaque,const char *host_port, -Error **errp); +Error *errp[static 1 ]); -void rdma_start_incoming_migration (const char *host_port,Error **errp); +void rdma_start_incoming_migration (const char *host_port, +Error *errp[static 1 ]);#endif
migration/savevm.h +1 -1
@@ -14,7 +14,7 @@#ifndef MIGRATION_SAVEVM_H #define MIGRATION_SAVEVM_H -bool qemu_savevm_state_blocked (Error **errp); +bool qemu_savevm_state_blocked (Error *errp[static 1 ]);void qemu_savevm_state_begin (QEMUFile *f);void qemu_savevm_state_header (QEMUFile *f);int qemu_savevm_state_iterate (QEMUFile *f,bool postcopy);
migration/socket.h +5 -4
@@ -16,13 +16,14 @@#ifndef QEMU_MIGRATION_SOCKET_H #define QEMU_MIGRATION_SOCKET_H -void tcp_start_incoming_migration (const char *host_port,Error **errp); +void tcp_start_incoming_migration (const char *host_port, +Error *errp[static 1 ]);void tcp_start_outgoing_migration (MigrationState *s,const char *host_port, -Error **errp); +Error *errp[static 1 ]); -void unix_start_incoming_migration (const char *path,Error **errp); +void unix_start_incoming_migration (const char *path,Error *errp[static 1 ]);void unix_start_outgoing_migration (MigrationState *s,const char *path, -Error **errp); +Error *errp[static 1 ]);#endif
migration/tls.h +2 -2
@@ -25,10 +25,10 @@void migration_tls_channel_process_incoming (MigrationState *s,QIOChannel *ioc, -Error **errp); +Error *errp[static 1 ]);void migration_tls_channel_connect (MigrationState *s,QIOChannel *ioc,const char *hostname, -Error **errp); +Error *errp[static 1 ]);#endif
nbd/nbd-internal.h +3 -3
@@ -101,7 +101,7 @@* iteratively. */ static inline ssize_t read_sync_eof (QIOChannel *ioc,void *buffer,size_t size, -Error **errp) +Error *errp[static 1 ]) {struct iovec iov = { .iov_base = buffer, .iov_len = size };/* Sockets are kept in blocking mode in the negotiation phase. After
@@ -116,7 +116,7 @@ static inline ssize_t read_sync_eof(QIOChannel *ioc, void *buffer, size_t size,* Reads @size bytes from @ioc. Returns 0 on success. */ static inline int read_sync (QIOChannel *ioc,void *buffer,size_t size, -Error **errp) +Error *errp[static 1 ]) {ssize_t ret =read_sync_eof (ioc, buffer, size, errp);
@@ -132,7 +132,7 @@ static inline int read_sync(QIOChannel *ioc, void *buffer, size_t size,* Writes @size bytes to @ioc. Returns 0 on success. */ static inline int write_sync (QIOChannel *ioc,const void *buffer,size_t size, -Error **errp) +Error *errp[static 1 ]) {struct iovec iov = { .iov_base = (void *) buffer, .iov_len = size };
net/clients.h +10 -10
@@ -28,38 +28,38 @@#include "qapi-types.h" int net_init_dump (const Netdev *netdev,const char *name, -NetClientState *peer,Error **errp); +NetClientState *peer,Error *errp[static 1 ]);#ifdef CONFIG_SLIRP int net_init_slirp (const Netdev *netdev,const char *name, -NetClientState *peer,Error **errp); +NetClientState *peer,Error *errp[static 1 ]);#endif int net_init_hubport (const Netdev *netdev,const char *name, -NetClientState *peer,Error **errp); +NetClientState *peer,Error *errp[static 1 ]);int net_init_socket (const Netdev *netdev,const char *name, -NetClientState *peer,Error **errp); +NetClientState *peer,Error *errp[static 1 ]);int net_init_tap (const Netdev *netdev,const char *name, -NetClientState *peer,Error **errp); +NetClientState *peer,Error *errp[static 1 ]);int net_init_bridge (const Netdev *netdev,const char *name, -NetClientState *peer,Error **errp); +NetClientState *peer,Error *errp[static 1 ]);int net_init_l2tpv3 (const Netdev *netdev,const char *name, -NetClientState *peer,Error **errp); +NetClientState *peer,Error *errp[static 1 ]);#ifdef CONFIG_VDE int net_init_vde (const Netdev *netdev,const char *name, -NetClientState *peer,Error **errp); +NetClientState *peer,Error *errp[static 1 ]);#endif #ifdef CONFIG_NETMAP int net_init_netmap (const Netdev *netdev,const char *name, -NetClientState *peer,Error **errp); +NetClientState *peer,Error *errp[static 1 ]);#endif int net_init_vhost_user (const Netdev *netdev,const char *name, -NetClientState *peer,Error **errp); +NetClientState *peer,Error *errp[static 1 ]);#endif /* QEMU_NET_CLIENTS_H */
net/tap_int.h +3 -2
@@ -30,11 +30,12 @@#include "qapi-types.h" int tap_open (char *ifname,int ifname_size,int *vnet_hdr, -int vnet_hdr_required,int mq_required,Error **errp); +int vnet_hdr_required,int mq_required,Error *errp[static 1 ]);ssize_t tap_read_packet (int tapfd,uint8_t *buf,int maxlen); -void tap_set_sndbuf (int fd,const NetdevTapOptions *tap,Error **errp); +void tap_set_sndbuf (int fd,const NetdevTapOptions *tap, +Error *errp[static 1 ]);int tap_probe_vnet_hdr (int fd);int tap_probe_vnet_hdr_len (int fd,int len);int tap_probe_has_ufo (int fd);
qga/guest-agent-core.h +2 -2
@@ -40,8 +40,8 @@ bool ga_is_frozen(GAState *s);void ga_set_frozen (GAState *s);void ga_unset_frozen (GAState *s);const char *ga_fsfreeze_hook (GAState *s); -int64_t ga_get_fd_handle (GAState *s,Error **errp); -int ga_parse_whence (GuestFileWhence *whence,Error **errp); +int64_t ga_get_fd_handle (GAState *s,Error *errp[static 1 ]); +int ga_parse_whence (GuestFileWhence *whence,Error *errp[static 1 ]);#ifndef _WIN32void reopen_fd_to_null (int fd);
qga/vss-win32.h +1 -1
@@ -22,6 +22,6 @@ bool vss_initialized(void);int ga_install_vss_provider (void );void ga_uninstall_vss_provider (void ); -void qga_vss_fsfreeze (int *nr_volume,bool freeze,Error **errp); +void qga_vss_fsfreeze (int *nr_volume,bool freeze,Error *errp[static 1 ]);#endif
replication.h +4 -4
@@ -143,7 +143,7 @@ void replication_remove(ReplicationState *rs);* * Note: the caller of the function MUST make sure vm stopped */ -void replication_start_all (ReplicationMode mode,Error **errp); +void replication_start_all (ReplicationMode mode,Error *errp[static 1 ]);/** * replication_do_checkpoint_all:
@@ -151,7 +151,7 @@ void replication_start_all(ReplicationMode mode, Error **errp);* * This interface is called after all VM state is transferred to Secondary QEMU */ -void replication_do_checkpoint_all (Error **errp); +void replication_do_checkpoint_all (Error *errp[static 1 ]);/** * replication_get_error_all:
@@ -159,7 +159,7 @@ void replication_do_checkpoint_all(Error **errp);* * This interface is called to check if error occurred during replication */ -void replication_get_error_all (Error **errp); +void replication_get_error_all (Error *errp[static 1 ]);/** * replication_stop_all:
@@ -169,6 +169,6 @@ void replication_get_error_all(Error **errp);* It is called on failover. The vm should be stopped before calling it, if you * use this API to shutdown the guest, or other things except failover */ -void replication_stop_all (bool failover,Error **errp); +void replication_stop_all (bool failover,Error *errp[static 1 ]);#endif /* REPLICATION_H */
target/i386/cpu.h +1 -1
@@ -1311,7 +1311,7 @@ int x86_cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu, void *opaque);void x86_cpu_get_memory_mapping (CPUState *cpu,MemoryMappingList *list, -Error **errp); +Error *errp[static 1 ]);void x86_cpu_dump_state (CPUState *cs,FILE *f,fprintf_function cpu_fprintf,int flags);
target/ppc/cpu.h +3 -2
@@ -1370,9 +1370,10 @@ static inline int cpu_mmu_index (CPUPPCState *env, bool ifetch)#if defined(TARGET_PPC64 )bool ppc_check_compat (PowerPCCPU *cpu,uint32_t compat_pvr,uint32_t min_compat_pvr,uint32_t max_compat_pvr); -void ppc_set_compat (PowerPCCPU *cpu,uint32_t compat_pvr,Error **errp); +void ppc_set_compat (PowerPCCPU *cpu,uint32_t compat_pvr, +Error *errp[static 1 ]);#if !defined(CONFIG_USER_ONLY ) -void ppc_set_compat_all (uint32_t compat_pvr,Error **errp); +void ppc_set_compat_all (uint32_t compat_pvr,Error *errp[static 1 ]);#endif int ppc_compat_max_threads (PowerPCCPU *cpu);#endif /* defined(TARGET_PPC64) */
target/s390x/cpu.h +4 -3
@@ -470,8 +470,9 @@ void trigger_pgm_exception(CPUS390XState *env, uint32_t code, uint32_t ilen);#endif S390CPU *cpu_s390x_init (const char *cpu_model); -S390CPU *s390x_new_cpu (const char *cpu_model,int64_t id,Error **errp); -S390CPU *cpu_s390x_create (const char *cpu_model,Error **errp); +S390CPU *s390x_new_cpu (const char *cpu_model,int64_t id, +Error *errp[static 1 ]); +S390CPU *cpu_s390x_create (const char *cpu_model,Error *errp[static 1 ]);void s390x_translate_init (void );/* you can call this signal handler from your SIGBUS and SIGSEGV
@@ -640,7 +641,7 @@ void s390_cpu_list(FILE *f, fprintf_function cpu_fprintf);#define cpu_list s390_cpu_listvoid s390_cpu_model_register_props (Object *obj);void s390_cpu_model_class_register_props (ObjectClass *oc); -void s390_realize_cpu_model (CPUState *cs,Error **errp);
Lines of this file are not shown. View the raw message.
qapi/qapi-visit-core.c +33 -25
58 lines not on this page · raw message
block.c +57 -46
103 lines not on this page · raw message
block/file-posix.c +23 -19
42 lines not on this page · raw message
blockdev.c +70 -59
129 lines not on this page · raw message
dump.c +27 -25
52 lines not on this page · raw message
hw/core/machine.c +51 -36
87 lines not on this page · raw message
hw/core/qdev-properties.c +32 -31
63 lines not on this page · raw message
hw/i386/pc.c +41 -32
73 lines not on this page · raw message
hw/ppc/spapr.c +35 -26
61 lines not on this page · raw message
hw/s390x/virtio-ccw.c +26 -15
41 lines not on this page · raw message
monitor.c +22 -21
43 lines not on this page · raw message
qapi/qobject-input-visitor.c +27 -21
48 lines not on this page · raw message
qga/commands-posix.c +75 -63
138 lines not on this page · raw message
qga/commands-win32.c +45 -38
83 lines not on this page · raw message
qmp.c +39 -37
76 lines not on this page · raw message
qom/object.c +71 -64
135 lines not on this page · raw message
stubs/arch-query-cpu-model-comparison.c +1 -1
Lines of this file are not shown. View the raw message.
target/i386/cpu.c +35 -31
66 lines not on this page · raw message
util/qemu-option.c +23 -19
42 lines not on this page · raw message
util/qemu-sockets.c +41 -35
76 lines not on this page · raw message
vl.c +26 -18
44 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.11.0.259.g40922b1
Part of the diff is not shown here. View the raw message.
A message that is not in the archive (sent off-list or not yet received): 20170615121407.GA2399@work-vm
Re: [Qemu-devel] [RFC 15/15] [test only] Use 'Error *err[static 1]' instead of 'Error **errp' to catch NULL errp arguments
Quoted 44 lines · Dr. David Alan Gilbert
Quoted 40 lines · * Eduardo Habkost ([email protected]) wrote:
This is being included in the RFC just to help validating the series, and ensure we don't use NULL errp anywhere.
I don't propose we actually change all code to use the 'Error *errp[static 1]' syntax because it confuses Cocinelle.
I am considering including a assert(errp) line in the
ERR_IS_SET()macro, so we can catch NULL errp at runtime in case somebody forgets about it.Generated by the following Coccinelle patch:
@@
typedef Error;
type T;
identifier FN !~ "os_mem_prealloc|qemu_fork";
identifier errp;
@@
T FN(...,
- Error **errp
+ Error *errp[STATIC_1]);@@
typedef Error;
type T;
identifier FN !~ "os_mem_prealloc|qemu_fork";
identifier errp;
@@
T FN(...,
- Error **errp
+ Error *errp[STATIC_1]) { ... }Followed by the following sed command:
$ sed -i -e 's/\[STATIC_1\]/[static 1]/g' $(g grep -w -l STATIC_1)Signed-off-by Eduardo Habkost <[email protected]>---
<snip>
Quoted 7 lines
Review
Quoted 4 lines
void visit_start_struct(Visitor *v, const char *name, void **obj,
(quoted diff) +1
-1- size_t size, Error **errp); + size_t size, Error *errp[static 1]);Is it possible to typedef that to something that hides the magic syntax?
Then we could get that down to QError errp or something like that?
Unfortunately it is not possible to hide it in a typedef: the "static" keyword inside the square brackets is a feature of function parameter declarations only. Using it on a typedef results in:
a.c:3:16: error: static or type qualifiers in non-parameter array declarator
typedef Error *ErrorPtr[static 1];
We could use a preprocessor macro, but I suspect this would also confuse Coccinelle.
Signature · 1 line
Eduardo
Re: [Qemu-devel] [RFC 15/15] [test only] Use 'Error *err[static 1]' instead of 'Error **errp' to catch NULL errp arguments
Quoted 53 lines · * Eduardo Habkost ([email protected]) wrote:
Quoted 44 lines · Dr. David Alan Gilbert
Quoted 40 lines · * Eduardo Habkost ([email protected]) wrote:
This is being included in the RFC just to help validating the series, and ensure we don't use NULL errp anywhere.
I don't propose we actually change all code to use the 'Error *errp[static 1]' syntax because it confuses Cocinelle.
I am considering including a assert(errp) line in the
ERR_IS_SET()macro, so we can catch NULL errp at runtime in case somebody forgets about it.Generated by the following Coccinelle patch:
@@
typedef Error;
type T;
identifier FN !~ "os_mem_prealloc|qemu_fork";
identifier errp;
@@
T FN(...,
- Error **errp
+ Error *errp[STATIC_1]);@@
typedef Error;
type T;
identifier FN !~ "os_mem_prealloc|qemu_fork";
identifier errp;
@@
T FN(...,
- Error **errp
+ Error *errp[STATIC_1]) { ... }Followed by the following sed command:
$ sed -i -e 's/\[STATIC_1\]/[static 1]/g' $(g grep -w -l STATIC_1)Signed-off-by Eduardo Habkost <[email protected]>---
<snip>
Quoted 7 lines
Review
Quoted 4 lines
void visit_start_struct(Visitor *v, const char *name, void **obj,
(quoted diff) +1
-1- size_t size, Error **errp); + size_t size, Error *errp[static 1]);Is it possible to typedef that to something that hides the magic syntax?
Then we could get that down to QError errp or something like that?
Quoted 7 lines
Unfortunately it is not possible to hide it in a typedef: the "static" keyword inside the square brackets is a feature of function parameter declarations only. Using it on a typedef results in:
a.c:3:16: error: static or type qualifiers in non-parameter array declarator
typedef Error *ErrorPtr[static 1];
That's a shame; it's rather odd looking; still I think it's worth it if it simplifies the error code.
Quoted 5 lines
We could use a preprocessor macro, but I suspect this would also confuse Coccinelle.
Signature · 1 line
Eduardo
Dave
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [Qemu-devel] [RFC 15/15] [test only] Use 'Error *err[static 1]' instead of 'Error **errp' to catch NULL errp arguments
Quoted 16 lines · Dr. David Alan Gilbert
Quoted 15 lines · * Eduardo Habkost ([email protected]) wrote:
Quoted 8 lines · Dr. David Alan Gilbert
Review
Quoted 4 lines · * Eduardo Habkost ([email protected]) wrote:
void visit_start_struct(Visitor *v, const char *name, void **obj,
(quoted diff) +1
-1- size_t size, Error **errp); + size_t size, Error *errp[static 1]);Is it possible to typedef that to something that hides the magic syntax?
Then we could get that down to QError errp or something like that?Unfortunately it is not possible to hide it in a typedef: the "static" keyword inside the square brackets is a feature of function parameter declarations only. Using it on a typedef results in:
Quoted 5 lines
Quoted 2 lines
a.c:3:16: error: static or type qualifiers in non-parameter array declarator
typedef Error *ErrorPtr[static 1];That's a shame; it's rather odd looking; still I think it's worth it if it simplifies the error code.
Is gcc's __attribute__((nonnull)) any better? It seems to apply to the whole function prototype rather than an individual argument though so probably not :-(
thanks
-- PMM
Re: [Qemu-devel] [RFC 15/15] [test only] Use 'Error *err[static 1]' instead of 'Error **errp' to catch NULL errp arguments
Quoted 20 lines · Peter Maydell
Quoted 19 lines · Dr. David Alan Gilbert
Quoted 17 lines · * Eduardo Habkost ([email protected]) wrote:
Quoted 8 lines · Dr. David Alan Gilbert
Review
Quoted 4 lines · * Eduardo Habkost ([email protected]) wrote:
void visit_start_struct(Visitor *v, const char *name, void **obj,
(quoted diff) +1
-1- size_t size, Error **errp); + size_t size, Error *errp[static 1]);Is it possible to typedef that to something that hides the magic syntax?
Then we could get that down to QError errp or something like that?Unfortunately it is not possible to hide it in a typedef: the "static" keyword inside the square brackets is a feature of function parameter declarations only. Using it on a typedef results in:
a.c:3:16: error: static or type qualifiers in non-parameter array declarator
typedef Error *ErrorPtr[static 1];
Quoted 6 lines
Quoted 2 lines
That's a shame; it's rather odd looking; still I think it's worth it if it simplifies the error code.
Is gcc's __attribute__((nonnull)) any better? It seems to apply to the whole function prototype rather than an individual argument though so probably not :-(
It's possible to specify which arguments are non-null with nonnull(<arg-index>, ...). It's harder to use, but probably more Coccinelle-friendly.
Signature · 1 line
Eduardo
Re: [Qemu-devel] [RFC 15/15] [test only] Use 'Error *err[static 1]' instead of 'Error **errp' to catch NULL errp arguments
Quoted 7 lines · Eduardo Habkost
Quoted 3 lines
Is gcc's __attribute__((nonnull)) any better? It seems to apply to the whole function prototype rather than an individual argument though so probably not :-(
It's possible to specify which arguments are non-null with
nonnull(<arg-index>, ...). It's harder to use, but probably more Coccinelle-friendly.
Libvirt uses it, wrapped in a macro; for example:
int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
virCPUDefCopyModel(virCPUDefPtr dst,
const virCPUDef *src,
bool resetPolicy)
{ ...
and at least Coverity is able to use that information (libvirt had problems in the past where older gcc _silently_ mis-optimized a program that used the attribute, and ended up having our macro defined only during Coverity and not during normal compilation; but I think that's finally been resolved now that newer gcc is saner in its behavior). I don't know how much smarts Coccinelle has for coming up with the right parameter number in an automated conversion patch, though.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [RFC 15/15] [test only] Use 'Error *err[static 1]' instead of 'Error **errp' to catch NULL errp arguments
Quoted 18 lines · Eric Blake
Quoted 7 lines · Eduardo Habkost
Quoted 3 lines
Is gcc's __attribute__((nonnull)) any better? It seems to apply to the whole function prototype rather than an individual argument though so probably not :-(
It's possible to specify which arguments are non-null with
nonnull(<arg-index>, ...). It's harder to use, but probably more Coccinelle-friendly.Libvirt uses it, wrapped in a macro; for example:
int
ATTRIBUTE_NONNULL(1)ATTRIBUTE_NONNULL(2)
virCPUDefCopyModel(virCPUDefPtr dst,
const virCPUDef *src,
bool resetPolicy)
{ ...
Quoted 7 lines
and at least Coverity is able to use that information (libvirt had problems in the past where older gcc _silently_ mis-optimized a program that used the attribute, and ended up having our macro defined only during Coverity and not during normal compilation; but I think that's finally been resolved now that newer gcc is saner in its behavior). I don't know how much smarts Coccinelle has for coming up with the right parameter number in an automated conversion patch, though.
In the worst case, the script could have a dozen transformations, one transformation for each possible number of function arguments.
However, I hit this Coccinelle bug when trying to implement that:
https://github.com/coccinelle/coccinelle/issues/107
Signature · 1 line
Eduardo
Quoted 19 lines · Eduardo Habkost
The Proposal
------------I'm proposing replacing NULL errp with a special macro:
IGNORE_ERRORS. The macro will trigger special behavior in the error API that will make it not save any error information in the error pointer, but still keep track of boolean error state in *errp.This will allow us to simplify the documented method to propagate errors from:
Error *err = NULL; foo(arg, &err); if (err) { handle the error... error_propagate(errp, err); }
Quoted 6 lines
to:
foo(arg, errp); if (ERR_IS_SET(errp)) { handle the error... }
Seems kind of neat to me!
Quoted 6 lines
This way, we can make
ERR_IS_SETwork even if errp wasIGNORE_ERRORS. The ERR_IS_* macros are reimplemented as:#define ERR_IS_SET(e) (*(e) && *(e) != &ignored_error_unset) #define ERR_IS_IGNORED(e) (!(e) || *(e) == &ignored_error_unset || *(e) == &ignored_error_set)
Where the initial NULL checks go away if you get your way with a final patch.
Quoted 9 lines
Ensuring errp is never NULL
---------------------------The last patch on this series changes the (Error **errp) parameters in functions to (Error *errp[static 1]), just to help validate the existing code, as clang warns about NULL arguments on that case. I don't think we should apply that patch, though, because the "[static 1]" syntax confuses Coccinelle.
Have you filed a bug report to the Coccinelle folks? But yeah, it is rather arcane C99 syntax that you don't see much of in common code.
Quoted 2 lines
(Probably the easiest solution for that is to add assert(errp) lines to the ERR_IS_*() macros.)
Or even having the macros use a forced dereference through errp->xxx may at least be enough for Coverity to catch things.
Quoted 18 lines
Git branch
----------This series depend on a few extra cleanups that I didn't submit to qemu-devel yet. A git branch including this series is available at:
git://github.com/ehabkost/qemu-hacks.gitwork/err-api-rework-ignore-ptr-v1Eduardo Habkost (15):
tests: Test cases for error API
error: NewIGNORE_ERRORSmacro
Addqapi/error.hincludes on files that will need it [coccinelle] UseIGNORE_ERRORSinstead of NULL as errp argument
qapi: UseIGNORE_ERRORSinstead of NULL on generated code
test-qapi-util: UseIGNORE_ERRORSinstead of NULL Manual changes to useIGNORE_ERRORSinstead of NULL
error: New ERR_IS_* macros for checking Error** values
Quoted 8 lines
[coccinelle] Use ERR_IS_* macros
test-qapi-util: Use ERR_IS_* macros
Manual changes to use ERR_IS_* macros
error: MakeIGNORED_ERRORSnot a NULL pointer
rdma: Simplify var declaration to avoid confusing Coccinelle [coccinelle] Eliminate unnecessary local_err/error_propagate() usage [test only] Use 'Error *err[static 1]' instead of 'Error **errp' to
catch NULL errp arguments
I have not reviewed the series yet, but the idea looks promising.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Quoted 5 lines · Eduardo Habkost
Rationale
---------I'm often bothered by the fact that we can't write the following:
Quoted 7 lines
foo(arg, errp); if (*errp) { handle the error... error_propagate(errp, err); }because errp can be NULL.
If foo() additionally returned an indication of success, you could write
if (!foo(arg, errp)) { // assuming foo() returns a bool
handle the error...
}
Nicely concise.
For what it's worth, this is how GLib wants GError to be used. We deviated from it, and it has turned out to be a self-inflicted wound.
Quoted 8 lines
I understand the reason we need to support errp==NULL, as it makes life simpler for callers that don't want any extra error information. However, this has the cost of making the functions that report errors more complex and error-prone.
(Evidence of that: the 34 ERR_IS_* cases handled by the "use ERR_IS_* macros" patches in the series. Where existing code will crash or behave differently if errp is NULL.)
Which of them could *not* use a suitable return value instead of *errp?
Quoted 4 lines
I considered suggesting forbidding NULL errp, and just changing all callers that use NULL to have an err variable and call
error_free(), but this would mean changing 690 function callers that pass NULL errp as argument.
Would also add lots of pointless malloc churn. The ability to ignore errors is a feature.
Quoted 25 lines
Here I'm proposing a mechanism to have the best of both worlds:
allow callers to ignore errors easily while allowing functions to propagate errors without an intermediatelocal_errvariable.The Proposal
------------I'm proposing replacing NULL errp with a special macro:
IGNORE_ERRORS. The macro will trigger special behavior in the error API that will make it not save any error information in the error pointer, but still keep track of boolean error state in *errp.This will allow us to simplify the documented method to propagate errors from:
Error *err = NULL; foo(arg, &err); if (err) { handle the error... error_propagate(errp, err); }to:
Quoted 7 lines
foo(arg, errp); if (ERR_IS_SET(errp)) { handle the error... }This will allow us to stop using
local_errvariables anderror_propagate()on hundreds of cases.
Getting rid of unnecessary local_err boilerplate is good. The question is how. A possible alternative to your proposal is to follow GLib and make functions return success/failure.
How do the two compare?
Quoted 8 lines
Implementation
--------------This replaces NULL errp arguments on function calls with a
IGNORE_ERRORSmacro. Checks for (!errp) are replaced byERR_IS_IGNORED(errp). Checks for (*errp) are replaced byERR_IS_SET(errp). No extra changes are required on function callers.
That's a lot of churn. One time pain, of course.
Quoted 31 lines
Then
IGNORE_ERRORSis implemend as:(& {
&ignored_error_unset})When
error_set()is called andIGNORE_ERRORSwas used, we set error state using:*errp = &ignored_error_set;This way, we can make
ERR_IS_SETwork even if errp wasIGNORE_ERRORS. The ERR_IS_* macros are reimplemented as:#define ERR_IS_SET(e) (*(e) && *(e) != &ignored_error_unset) #define ERR_IS_IGNORED(e) (!(e) || *(e) == &ignored_error_unset || *(e) == &ignored_error_set)Ensuring errp is never NULL
---------------------------The last patch on this series changes the (Error **errp) parameters in functions to (Error *errp[static 1]), just to help validate the existing code, as clang warns about NULL arguments on that case. I don't think we should apply that patch, though, because the "[static 1]" syntax confuses Coccinelle.
I have a branch where I experimented with the idea of replacing (Error **errp) parameters with an opaque type (void*, or a struct type). I gave up when I noticed it would require touching all callers to replace &err with a wrapper macro to convert to the right type. Suggestions to make NULL errp easier to detect at build time are welcome.
Quoted 2 lines
(Probably the easiest solution for that is to add assert(errp) lines to the ERR_IS_*() macros.)
We'll obviously struggle with null arguments until all the developers adjusted to the new interface. Possibly with occasional mistakes forever. Compile-time checking would really, really help.
Quoted 7 lines
Desirable side-effects
----------------------Some of additional benefits from parts of this series:
* Making code that ignore error information more visible and greppable (using
IGNORE_ERRORS).
True.
Drawback: Passing an address takes more code than passing null. Not sure it matters.
Quoted 3 lines
I believe many of those cases
are actually bugs and should use&error_abortor&error_fatalinstead.
I've seen such bugs.
Of course, making possible offenders more greppable doesn't necessarily mean existing ones will get fixed and new ones will be avoided.
Quoted 3 lines
* Making code that depends on errp more visible and greppable (using ERR_IS_* macros). Some of those cases are also likely to be bugs, and need to be investigated.
Grepping for (local_)?errp? works well enough, doesn't it?
Quoted 16 lines
TODO
----* Simplify more cases of local_error/error_propagate() to use errp directly.
* Update API documentation and code examples.
* Add a mechanism to ensure errp is never NULL.Git branch
----------This series depend on a few extra cleanups that I didn't submit to qemu-devel yet. A git branch including this series is available at:
git://github.com/ehabkost/qemu-hacks.gitwork/err-api-rework-ignore-ptr-v1
Quoted 17 lines · Markus Armbruster
Quoted 5 lines · Eduardo Habkost
Rationale
---------I'm often bothered by the fact that we can't write the following:
Quoted 7 lines
foo(arg, errp); if (*errp) { handle the error... error_propagate(errp, err); }because errp can be NULL.
If
foo()additionally returned an indication of success, you could write
Quoted 8 lines
if (!foo(arg, errp)) { // assuming
foo()returns a bool
handle the error...
}Nicely concise.
For what it's worth, this is how GLib wants GError to be used. We deviated from it, and it has turned out to be a self-inflicted wound.
Interesting, I didn't know about that.
Quoted 11 lines
Quoted 9 lines
I understand the reason we need to support errp==NULL, as it makes life simpler for callers that don't want any extra error information. However, this has the cost of making the functions that report errors more complex and error-prone.
(Evidence of that: the 34 ERR_IS_* cases handled by the "use ERR_IS_* macros" patches in the series. Where existing code will crash or behave differently if errp is NULL.)
Which of them could *not* use a suitable return value instead of *errp?
I don't know. But I'm not trying to improve those 34 ERR_IS_* cases. I am trying to improve the 700+ functions that need the local_err/error_propagate() boilerplate code today. This series already handles 346 of them automatically (see patch 14/15).
Quoted 8 lines
Quoted 5 lines
I considered suggesting forbidding NULL errp, and just changing all callers that use NULL to have an err variable and call
error_free(), but this would mean changing 690 function callers that pass NULL errp as argument.Would also add lots of pointless malloc churn. The ability to ignore errors is a feature.
Exactly. My proposal keeps that ability.
Quoted 31 lines
Quoted 31 lines
Here I'm proposing a mechanism to have the best of both worlds:
allow callers to ignore errors easily while allowing functions to propagate errors without an intermediatelocal_errvariable.The Proposal
------------I'm proposing replacing NULL errp with a special macro:
IGNORE_ERRORS. The macro will trigger special behavior in the error API that will make it not save any error information in the error pointer, but still keep track of boolean error state in *errp.This will allow us to simplify the documented method to propagate errors from:
Error *err = NULL; foo(arg, &err); if (err) { handle the error... error_propagate(errp, err); }to:
foo(arg, errp); if (ERR_IS_SET(errp)) { handle the error... }
Quoted 8 lines
Quoted 2 lines
This will allow us to stop using
local_errvariables anderror_propagate()on hundreds of cases.Getting rid of unnecessary
local_errboilerplate is good. The question is how. A possible alternative to your proposal is to follow GLib and make functions return success/failure.How do the two compare?
This proposal proposal already gets rid of 346 error_propagate() calls automatically, and we probably can get rid of many others with additional Coccinelle scripts.
Making functions return success/failure, on the other hand, would require rewriting them manually. This proposal doesn't even prevent that from happening. I'd say it helps on that, because we can now find cases that still need to be converted by grepping for ERR_IS_SET.
Quoted 11 lines
Quoted 9 lines
Implementation
--------------This replaces NULL errp arguments on function calls with a
IGNORE_ERRORSmacro. Checks for (!errp) are replaced byERR_IS_IGNORED(errp). Checks for (*errp) are replaced byERR_IS_SET(errp). No extra changes are required on function callers.That's a lot of churn. One time pain, of course.
Yes, and it was automated using Coccinelle.
Quoted 32 lines
Quoted 32 lines
Then
IGNORE_ERRORSis implemend as:(& {
&ignored_error_unset})When
error_set()is called andIGNORE_ERRORSwas used, we set error state using:*errp = &ignored_error_set;This way, we can make
ERR_IS_SETwork even if errp wasIGNORE_ERRORS. The ERR_IS_* macros are reimplemented as:#define ERR_IS_SET(e) (*(e) && *(e) != &ignored_error_unset) #define ERR_IS_IGNORED(e) (!(e) || *(e) == &ignored_error_unset || *(e) == &ignored_error_set)Ensuring errp is never NULL
---------------------------The last patch on this series changes the (Error **errp) parameters in functions to (Error *errp[static 1]), just to help validate the existing code, as clang warns about NULL arguments on that case. I don't think we should apply that patch, though, because the "[static 1]" syntax confuses Coccinelle.
I have a branch where I experimented with the idea of replacing (Error **errp) parameters with an opaque type (void*, or a struct type). I gave up when I noticed it would require touching all callers to replace &err with a wrapper macro to convert to the right type. Suggestions to make NULL errp easier to detect at build time are welcome.
Quoted 6 lines
Quoted 2 lines
(Probably the easiest solution for that is to add assert(errp) lines to the ERR_IS_*() macros.)
We'll obviously struggle with null arguments until all the developers adjusted to the new interface. Possibly with occasional mistakes forever. Compile-time checking would really, really help.
True. I'm investigating the possibility of using __attribute__((nonull(...))) with Coccinelle's help.
Quoted 6 lines
Quoted 6 lines
Desirable side-effects
----------------------Some of additional benefits from parts of this series:
Quoted 7 lines
Quoted 2 lines
* Making code that ignore error information more visible and greppable (using
IGNORE_ERRORS).True.
Drawback: Passing an address takes more code than passing null. Not sure it matters.
I don't know what you mean by "more code". It requires just replacing NULL with IGNORE_ERRORS. The magic is hidden behind the macro.
Quoted 7 lines
Quoted 4 lines
I believe many of those cases
are actually bugs and should use&error_abortor&error_fatalinstead.I've seen such bugs.
Quoted 8 lines
Of course, making possible offenders more greppable doesn't necessarily mean existing ones will get fixed and new ones will be avoided.
Quoted 3 lines
* Making code that depends on errp more visible and greppable (using ERR_IS_* macros). Some of those cases are also likely to be bugs, and need to be investigated.
Grepping for (local_)?errp? works well enough, doesn't it?
I don't see how. I'm talking about two cases:
1) Code like this:
int func1(..., Error **errp)
{
do_something(errp);
if (errp && *errp) {
/* handle error */
return;
}
/* do something else */
}func1() is buggy because it behaves differently if errp is NULL.
2) Code like this:
int func2(..., Error **errp)
{
do_something(errp);
if (*errp) {
/* handle error */
}
}func2() is buggy because if crashes if errp is NULL.
I don't see an easy way to grep for them with the current code. With this series, (1) can be detected by grepping for ERR_IS_IGNORED, and (2) is fixed because ERR_IS_SET(errp) will work even if errp is NULL.
Quoted 17 lines
Quoted 17 lines
TODO
----* Simplify more cases of local_error/error_propagate() to use errp directly.
* Update API documentation and code examples.
* Add a mechanism to ensure errp is never NULL.Git branch
----------This series depend on a few extra cleanups that I didn't submit to qemu-devel yet. A git branch including this series is available at:
git://github.com/ehabkost/qemu-hacks.gitwork/err-api-rework-ignore-ptr-v1
Signature · 1 line
Eduardo
Quoted 22 lines · Eduardo Habkost
Quoted 21 lines · Markus Armbruster
Quoted 5 lines · Eduardo Habkost
Rationale
---------I'm often bothered by the fact that we can't write the following:
Quoted 7 lines
foo(arg, errp); if (*errp) { handle the error... error_propagate(errp, err); }because errp can be NULL.
If
foo()additionally returned an indication of success, you could writeif (!foo(arg, errp)) { // assuming
foo()returns a bool
handle the error...
}
Quoted 6 lines
Quoted 4 lines
Nicely concise.
For what it's worth, this is how GLib wants GError to be used. We deviated from it, and it has turned out to be a self-inflicted wound.
Interesting, I didn't know about that.
See section "Description", in particular subsection "Rules for use of GError" at
https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
I understand the reason we need to support errp==NULL, as it makes life simpler for callers that don't want any extra error information. However, this has the cost of making the functions that report errors more complex and error-prone.
(Evidence of that: the 34 ERR_IS_* cases handled by the "use ERR_IS_* macros" patches in the series. Where existing code will crash or behave differently if errp is NULL.)
Quoted 6 lines
Quoted 1 line
Which of them could *not* use a suitable return value instead of *errp?
I don't know. But I'm not trying to improve those 34 ERR_IS_* cases. I am trying to improve the 700+ functions that need the local_err/error_propagate() boilerplate code today. This series already handles 346 of them automatically (see patch 14/15).
I agree the goal is reducing error_propagate() boilerplate. I latched onto the 34 ERR_IS_* cases only because you presented them as examples.
Quoted 49 lines
Quoted 7 lines
Quoted 4 lines
I considered suggesting forbidding NULL errp, and just changing all callers that use NULL to have an err variable and call
error_free(), but this would mean changing 690 function callers that pass NULL errp as argument.Would also add lots of pointless malloc churn. The ability to ignore errors is a feature.
Exactly. My proposal keeps that ability.
Quoted 38 lines
Quoted 26 lines
Here I'm proposing a mechanism to have the best of both worlds:
allow callers to ignore errors easily while allowing functions to propagate errors without an intermediatelocal_errvariable.The Proposal
------------I'm proposing replacing NULL errp with a special macro:
IGNORE_ERRORS. The macro will trigger special behavior in the error API that will make it not save any error information in the error pointer, but still keep track of boolean error state in *errp.This will allow us to simplify the documented method to propagate errors from:
Error *err = NULL; foo(arg, &err); if (err) { handle the error... error_propagate(errp, err); }to:
Quoted 7 lines
foo(arg, errp); if (ERR_IS_SET(errp)) { handle the error... }This will allow us to stop using
local_errvariables anderror_propagate()on hundreds of cases.Getting rid of unnecessary
local_errboilerplate is good. The question is how. A possible alternative to your proposal is to follow GLib and make functions return success/failure.
Quoted 8 lines
Quoted 1 line
How do the two compare?
This proposal proposal already gets rid of 346
error_propagate()calls automatically, and we probably can get rid of many others with additional Coccinelle scripts.Making functions return success/failure, on the other hand, would require rewriting them manually.
Yes, but how would the *result* compare? I feel we should at least explore this. I'll try to find some time to play with it.
Coccinelle might let us automate some, but determining success vs. failure will commonly require human smarts.
How many such functions we have? Hmm...
@r@
identifier fun, errp;
typedef Error;
position p;
@@
void fun(..., Error **errp)@p
{
...
}
@script:python@
p << r.p;
fun << r.fun;
@@
print("%s:%s:%s: %s()" % (p[0].file, p[0].line, p[0].column, fun))Finds 1525. Correcting the void mistake will be a huge pain, but procrastinating can only make it grow.
Quoted 3 lines
This proposal doesn't even prevent
that from happening. I'd say it helps on that, because we can now find cases that still need to be converted by grepping forERR_IS_SET.
I honestly doubt finding the cases is a problem. We just grep for error_propagate().
Quoted 65 lines
Quoted 10 lines
Quoted 8 lines
Implementation
--------------This replaces NULL errp arguments on function calls with a
IGNORE_ERRORSmacro. Checks for (!errp) are replaced byERR_IS_IGNORED(errp). Checks for (*errp) are replaced byERR_IS_SET(errp). No extra changes are required on function callers.That's a lot of churn. One time pain, of course.
Yes, and it was automated using Coccinelle.
Quoted 32 lines
Quoted 32 lines
Then
IGNORE_ERRORSis implemend as:(& {
&ignored_error_unset})When
error_set()is called andIGNORE_ERRORSwas used, we set error state using:*errp = &ignored_error_set;This way, we can make
ERR_IS_SETwork even if errp wasIGNORE_ERRORS. The ERR_IS_* macros are reimplemented as:#define ERR_IS_SET(e) (*(e) && *(e) != &ignored_error_unset) #define ERR_IS_IGNORED(e) (!(e) || *(e) == &ignored_error_unset || *(e) == &ignored_error_set)Ensuring errp is never NULL
---------------------------The last patch on this series changes the (Error **errp) parameters in functions to (Error *errp[static 1]), just to help validate the existing code, as clang warns about NULL arguments on that case. I don't think we should apply that patch, though, because the "[static 1]" syntax confuses Coccinelle.
I have a branch where I experimented with the idea of replacing (Error **errp) parameters with an opaque type (void*, or a struct type). I gave up when I noticed it would require touching all callers to replace &err with a wrapper macro to convert to the right type. Suggestions to make NULL errp easier to detect at build time are welcome.
Quoted 6 lines
Quoted 2 lines
(Probably the easiest solution for that is to add assert(errp) lines to the ERR_IS_*() macros.)
We'll obviously struggle with null arguments until all the developers adjusted to the new interface. Possibly with occasional mistakes forever. Compile-time checking would really, really help.
True. I'm investigating the possibility of using __attribute__((nonull(...))) with Coccinelle's help.
Quoted 9 lines
Quoted 8 lines
Desirable side-effects
----------------------Some of additional benefits from parts of this series:
* Making code that ignore error information more visible and greppable (using
IGNORE_ERRORS).
Quoted 7 lines
Quoted 4 lines
True.
Drawback: Passing an address takes more code than passing null. Not sure it matters.
I don't know what you mean by "more code". It requires just replacing NULL with
IGNORE_ERRORS. The magic is hidden behind the macro.
Creating the IGNORE_ERRORS value and passing it requires more machine instructions than passing NULL. When ignored_error_unset is in another DSO, it also requires a relocation.
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
I believe many of those cases
are actually bugs and should use&error_abortor&error_fatalinstead.I've seen such bugs.
Of course, making possible offenders more greppable doesn't necessarily mean existing ones will get fixed and new ones will be avoided.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
* Making code that depends on errp more visible and greppable (using ERR_IS_* macros). Some of those cases are also likely to be bugs, and need to be investigated.
Grepping for (local_)?errp? works well enough, doesn't it?
I don't see how.
Full list of possible Error ** variables not named errp:
$ git-grep -E '\bError \*\*' | grep -vE '\bError \*\*(errp\b|\))'
HACKING:the eyes than propagating an Error object through an Error ** parameter.
HACKING:only the function really knows, use Error **, and set suitable errors.
block/quorum.c: /* XXX - would be nice if we could pass in the Error **
block/snapshot.c: Error **err)
blockjob.c:/* A wrapper around block_job_cancel() taking an Error ** parameter so it may be
docs/devel/writing-qmp-commands.txt:3. It takes an "Error **" argument. This is required. Later we will see how to
hw/core/qdev.c:static bool check_only_migratable(Object *obj, Error **err)
hw/core/qdev.c: Error **local_errp = NULL;
hw/core/qdev.c:static bool device_get_hotplugged(Object *obj, Error **err)
hw/i386/amd_iommu.c:static void amdvi_realize(DeviceState *dev, Error **err)
hw/sd/sdhci.c:static void sdhci_sysbus_realize(DeviceState *dev, Error ** errp)
hw/usb/dev-network.c:static void usb_net_realize(USBDevice *dev, Error **errrp)
include/block/snapshot.h: Error **err);
include/qapi/error.h:void error_propagate(Error **dst_errp, Error *local_err);
include/qom/object.h: const uint64_t *v, Error **Errp);
include/qom/object.h: const uint64_t *v, Error **Errp);
qga/commands-posix.c:GuestUserList *qmp_guest_get_users(Error **err)
qga/commands-win32.c:GuestUserList *qmp_guest_get_users(Error **err)
qga/commands.c:GuestExecStatus *qmp_guest_exec_status(int64_t pid, Error **err)
qga/commands.c: Error **err)
qga/commands.c:GuestHostName *qmp_guest_get_host_name(Error **err)
qmp.c:void qmp_system_powerdown(Error **erp)
util/error.c:void error_propagate(Error **dst_errp, Error *local_err)I'll post a patch to rename the offenders.
Quoted 14 lines
I'm talking about two cases:
1) Code like this:
int func1(..., Error **errp) { do_something(errp); if (errp && *errp) { /* handle error */ return; } /* do something else */ }
Quoted 1 line
func1()is buggy because it behaves differently if errp is NULL.
Does your series fix any such bugs? We hunted them all down long ago... Perhaps a few new ones have crept in since. Hmm... I can see two:
$ git-grep -F 'errp && *errp'
exec.c: if (errp && *errp) {
hw/mem/pc-dimm.c: if (errp && *errp) {
util/error.c: assert(errp && *errp);Quoted 11 lines
2) Code like this:
int func2(..., Error **errp) { do_something(errp); if (*errp) { /* handle error */ } }
func2()is buggy because if crashes if errp is NULL.
Does your series fix any such bugs? grep coughs up quite a few candidates...
Quoted 2 lines
I don't see an easy way to grep for them with the current code. With this series, (1) can be detected by grepping for
ERR_IS_IGNORED,
How would example (1) look like then?
Quoted 19 lines
and (2)is fixed because
ERR_IS_SET(errp)will work even if errp is NULL.Quoted 16 lines
Quoted 16 lines
TODO
----* Simplify more cases of local_error/error_propagate() to use errp directly.
* Update API documentation and code examples.
* Add a mechanism to ensure errp is never NULL.Git branch
----------This series depend on a few extra cleanups that I didn't submit to qemu-devel yet. A git branch including this series is available at:
git://github.com/ehabkost/qemu-hacks.gitwork/err-api-rework-ignore-ptr-v1
Quoted 4 lines · Markus Armbruster
Quoted 2 lines · Eduardo Habkost
Quoted 1 line · Markus Armbruster
Eduardo Habkost <[email protected]> writes:
[...]
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 8 lines
I understand the reason we need to support errp==NULL, as it makes life simpler for callers that don't want any extra error information. However, this has the cost of making the functions that report errors more complex and error-prone.
(Evidence of that: the 34 ERR_IS_* cases handled by the "use ERR_IS_* macros" patches in the series. Where existing code will crash or behave differently if errp is NULL.)
Which of them could *not* use a suitable return value instead of *errp?
Quoted 7 lines
Quoted 4 lines
I don't know. But I'm not trying to improve those 34 ERR_IS_* cases. I am trying to improve the 700+ functions that need the local_err/error_propagate() boilerplate code today. This series already handles 346 of them automatically (see patch 14/15).
I agree the goal is reducing
error_propagate()boilerplate. I latched onto the 34 ERR_IS_* cases only because you presented them as examples.
The 34 ERR_IS_* cases were evidence of how easy it is to introduce mistakes with the current API. Probably most of them are instances of
(1) and (2) below.
Quoted 1 line
[...]
Quoted 39 lines
Quoted 39 lines
Quoted 26 lines
Quoted 26 lines
The Proposal
------------I'm proposing replacing NULL errp with a special macro:
IGNORE_ERRORS. The macro will trigger special behavior in the error API that will make it not save any error information in the error pointer, but still keep track of boolean error state in *errp.This will allow us to simplify the documented method to propagate errors from:
Error *err = NULL; foo(arg, &err); if (err) { handle the error... error_propagate(errp, err); }to:
foo(arg, errp); if (ERR_IS_SET(errp)) { handle the error... }Quoted 8 lines
Quoted 2 lines
This will allow us to stop using
local_errvariables anderror_propagate()on hundreds of cases.Getting rid of unnecessary
local_errboilerplate is good. The question is how. A possible alternative to your proposal is to follow GLib and make functions return success/failure.How do the two compare?
This proposal proposal already gets rid of 346
error_propagate()calls automatically, and we probably can get rid of many others with additional Coccinelle scripts.
Quoted 5 lines
Quoted 2 lines
Making functions return success/failure, on the other hand, would require rewriting them manually.
Yes, but how would the *result* compare? I feel we should at least explore this. I'll try to find some time to play with it.
I think the results of using the return value to indicate errors are possibly better. But even on that case, I think ERR_IS_SET will be useful to avoid error_propagate() boilerplate until we convert all of them.
Quoted 24 lines
Coccinelle might let us automate some, but determining success vs. failure will commonly require human smarts.
How many such functions we have? Hmm...
@r@ identifier fun, errp; typedef Error; position p; @@ void fun(..., Error **errp)@p { ... } @script:python@ p << r.p; fun << r.fun; @@ print("%s:%s:%s: %s()" % (p[0].file, p[0].line, p[0].column, fun))Finds 1525. Correcting the void mistake will be a huge pain, but procrastinating can only make it grow.
Quoted 6 lines
Quoted 3 lines
This proposal doesn't even prevent
that from happening. I'd say it helps on that, because we can now find cases that still need to be converted by grepping forERR_IS_SET.I honestly doubt finding the cases is a problem. We just grep for
error_propagate().
True. But I think finding low-hanging fruits will still be a problem. e.g.:
void f1(Error *errp);
void f2(Error *errp)
{
do_something();
f1(errp);
}The Coccinelle script above will find f1() and f2() (grep won't find either, but will probably find f2() callers). We will probably want to convert f1() before f2(), as converting f2() before f1() would require adding error_propagete() boilerplate to f2().
Quoted 1 line
[...]
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 7 lines
Desirable side-effects
----------------------Some of additional benefits from parts of this series:
* Making code that ignore error information more visible and greppable (using
IGNORE_ERRORS).True.
Drawback: Passing an address takes more code than passing null. Not sure it matters.
Quoted 6 lines
Quoted 2 lines
I don't know what you mean by "more code". It requires just replacing NULL with
IGNORE_ERRORS. The magic is hidden behind the macro.Creating the
IGNORE_ERRORSvalue and passing it requires more machine instructions than passing NULL. Whenignored_error_unsetis in another DSO, it also requires a relocation.
Yes, it requires a few more machine instructions. Is this a problem in practice?
Quoted 63 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
I believe many of those cases
are actually bugs and should use&error_abortor&error_fatalinstead.I've seen such bugs.
Of course, making possible offenders more greppable doesn't necessarily mean existing ones will get fixed and new ones will be avoided.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
* Making code that depends on errp more visible and greppable (using ERR_IS_* macros). Some of those cases are also likely to be bugs, and need to be investigated.
Grepping for (local_)?errp? works well enough, doesn't it?
I don't see how.
Full list of possible Error ** variables not named errp:
$ git-grep -E '\bError \*\*' | grep -vE '\bError \*\*(errp\b|\))' HACKING:the eyes than propagating an Error object through an Error ** parameter. HACKING:only the function really knows, use Error **, and set suitable errors. block/quorum.c: /* XXX - would be nice if we could pass in the Error ** block/snapshot.c: Error **err) blockjob.c:/* A wrapper around block_job_cancel() taking an Error ** parameter so it may be docs/devel/writing-qmp-commands.txt:3. It takes an "Error **" argument. This is required. Later we will see how to hw/core/qdev.c:static bool check_only_migratable(Object *obj, Error **err) hw/core/qdev.c: Error **local_errp = NULL; hw/core/qdev.c:static bool device_get_hotplugged(Object *obj, Error **err) hw/i386/amd_iommu.c:static void amdvi_realize(DeviceState *dev, Error **err) hw/sd/sdhci.c:static void sdhci_sysbus_realize(DeviceState *dev, Error ** errp) hw/usb/dev-network.c:static void usb_net_realize(USBDevice *dev, Error **errrp) include/block/snapshot.h: Error **err); include/qapi/error.h:void error_propagate(Error **dst_errp, Error *local_err); include/qom/object.h: const uint64_t *v, Error **Errp); include/qom/object.h: const uint64_t *v, Error **Errp); qga/commands-posix.c:GuestUserList *qmp_guest_get_users(Error **err) qga/commands-win32.c:GuestUserList *qmp_guest_get_users(Error **err) qga/commands.c:GuestExecStatus *qmp_guest_exec_status(int64_t pid, Error **err) qga/commands.c: Error **err) qga/commands.c:GuestHostName *qmp_guest_get_host_name(Error **err) qmp.c:void qmp_system_powerdown(Error **erp) util/error.c:void error_propagate(Error **dst_errp, Error *local_err)I'll post a patch to rename the offenders.
Quoted 14 lines
I'm talking about two cases:
1) Code like this:
int func1(..., Error **errp) { do_something(errp); if (errp && *errp) { /* handle error */ return; } /* do something else */ }Quoted 1 line
func1()is buggy because it behaves differently if errp is NULL.
Quoted 7 lines
Does your series fix any such bugs? We hunted them all down long ago... Perhaps a few new ones have crept in since. Hmm... I can see two:
$ git-grep -F 'errp && *errp' exec.c: if (errp && *errp) { hw/mem/pc-dimm.c: if (errp && *errp) { util/error.c: assert(errp && *errp);
This RFC doesn't fix those bugs, but just makes them more obvious and easier to fix. I plan to fix them in the final version of the series.
Quoted 13 lines
Quoted 11 lines
2) Code like this:
int func2(..., Error **errp) { do_something(errp); if (*errp) { /* handle error */ } }Quoted 1 line
func2()is buggy because if crashes if errp is NULL.
Quoted 7 lines
Does your series fix any such bugs? grep coughs up quite a few candidates...
Quoted 2 lines
I don't see an easy way to grep for them with the current code. With this series, (1) can be detected by grepping for
ERR_IS_IGNORED,How would example (1) look like then?
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index 92fb482..4e5e2c9 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -316,7 +316,7 @@ uint64_t pc_dimm_get_free_addr(uint64_t address_space_start,
uint64_t dimm_size = object_property_get_int(OBJECT(dimm),
PC_DIMM_SIZE_PROP, errp);
- if (errp && *errp) {
+ if (!ERR_IS_IGNORED(errp) && ERR_IS_SET(errp)) {
goto out;
}Without this series, the fix for (1) requires adding error_propagate() boilerplate. With this series, the fix is to just drop the !ERR_IS_IGNORED check and keep the ERR_IS_SET check
Quoted 20 lines
Quoted 20 lines
and (2)is fixed because
ERR_IS_SET(errp)will work even if errp is NULL.Quoted 16 lines
Quoted 16 lines
TODO
----* Simplify more cases of local_error/error_propagate() to use errp directly.
* Update API documentation and code examples.
* Add a mechanism to ensure errp is never NULL.Git branch
----------This series depend on a few extra cleanups that I didn't submit to qemu-devel yet. A git branch including this series is available at:
git://github.com/ehabkost/qemu-hacks.gitwork/err-api-rework-ignore-ptr-v1
Signature · 1 line
Eduardo
Quoted 22 lines · Eduardo Habkost
Quoted 4 lines · Markus Armbruster
Quoted 2 lines · Eduardo Habkost
Quoted 1 line · Markus Armbruster
Eduardo Habkost <[email protected]> writes:
[...]
Quoted 16 lines
Quoted 15 lines
Quoted 10 lines
Quoted 8 lines
I understand the reason we need to support errp==NULL, as it makes life simpler for callers that don't want any extra error information. However, this has the cost of making the functions that report errors more complex and error-prone.
(Evidence of that: the 34 ERR_IS_* cases handled by the "use ERR_IS_* macros" patches in the series. Where existing code will crash or behave differently if errp is NULL.)
Which of them could *not* use a suitable return value instead of *errp?
I don't know. But I'm not trying to improve those 34 ERR_IS_* cases. I am trying to improve the 700+ functions that need the local_err/error_propagate() boilerplate code today. This series already handles 346 of them automatically (see patch 14/15).
Quoted 6 lines
Quoted 2 lines
I agree the goal is reducing
error_propagate()boilerplate. I latched onto the 34 ERR_IS_* cases only because you presented them as examples.The 34 ERR_IS_* cases were evidence of how easy it is to introduce mistakes with the current API. Probably most of them are instances of
(1) and (2) below.
The current interface can be abused, but how much abuse actually creeps in? I think we've been doing reasonably well there since we got rid of the bad examples and improved documentation.
Moreover, the revised interface could also be abused. Nothing stops you from dereferencing errp before or after, the only thing that changes are the examples people see in code. I'm afraid the people who reinvent bad examples from scratch despite the documentation telling them not to will also bypass any macros the documentation tells them to use.
*Especially* if we use macros only sometimes. ERR_IS_SET(&err) makes no sense, so we'd still test err directly there, wouldn't we?
Quoted 43 lines
[...]
Quoted 42 lines
Quoted 41 lines
Quoted 26 lines
Quoted 26 lines
The Proposal
------------I'm proposing replacing NULL errp with a special macro:
IGNORE_ERRORS. The macro will trigger special behavior in the error API that will make it not save any error information in the error pointer, but still keep track of boolean error state in *errp.This will allow us to simplify the documented method to propagate errors from:
Error *err = NULL; foo(arg, &err); if (err) { handle the error... error_propagate(errp, err); }to:
foo(arg, errp); if (ERR_IS_SET(errp)) { handle the error... }Quoted 8 lines
Quoted 2 lines
This will allow us to stop using
local_errvariables anderror_propagate()on hundreds of cases.Getting rid of unnecessary
local_errboilerplate is good. The question is how. A possible alternative to your proposal is to follow GLib and make functions return success/failure.How do the two compare?
This proposal proposal already gets rid of 346
error_propagate()calls automatically, and we probably can get rid of many others with additional Coccinelle scripts.Making functions return success/failure, on the other hand, would require rewriting them manually.
Quoted 7 lines
Quoted 2 lines
Yes, but how would the *result* compare? I feel we should at least explore this. I'll try to find some time to play with it.
I think the results of using the return value to indicate errors are possibly better. But even on that case, I think
ERR_IS_SETwill be useful to avoiderror_propagate()boilerplate until we convert all of them.
See my assessment below.
Quoted 64 lines
Quoted 23 lines
Coccinelle might let us automate some, but determining success vs. failure will commonly require human smarts.
How many such functions we have? Hmm...
@r@ identifier fun, errp; typedef Error; position p; @@ void fun(..., Error **errp)@p { ... } @script:python@ p << r.p; fun << r.fun; @@ print("%s:%s:%s: %s()" % (p[0].file, p[0].line, p[0].column, fun))Finds 1525. Correcting the void mistake will be a huge pain, but procrastinating can only make it grow.
Quoted 6 lines
Quoted 3 lines
This proposal doesn't even prevent
that from happening. I'd say it helps on that, because we can now find cases that still need to be converted by grepping forERR_IS_SET.I honestly doubt finding the cases is a problem. We just grep for
error_propagate().True. But I think finding low-hanging fruits will still be a problem. e.g.:
void f1(Error *errp); void f2(Error *errp) { do_something(); f1(errp); }The Coccinelle script above will find
f1()andf2()(grep won't find either, but will probably findf2()callers). We will probably want to convertf1()beforef2(), as convertingf2()beforef1()would require addingerror_propagete()boilerplate tof2().Quoted 1 line
[...]
Quoted 16 lines
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Desirable side-effects
----------------------Some of additional benefits from parts of this series:
Quoted 7 lines
Quoted 2 lines
* Making code that ignore error information more visible and greppable (using
IGNORE_ERRORS).True.
Drawback: Passing an address takes more code than passing null. Not sure it matters.
I don't know what you mean by "more code". It requires just replacing NULL with
IGNORE_ERRORS. The magic is hidden behind the macro.
Quoted 6 lines
Quoted 3 lines
Creating the
IGNORE_ERRORSvalue and passing it requires more machine instructions than passing NULL. Whenignored_error_unsetis in another DSO, it also requires a relocation.Yes, it requires a few more machine instructions. Is this a problem in practice?
Quoting myself: "Not sure it matters."
Quoted 65 lines
Quoted 65 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
I believe many of those cases
are actually bugs and should use&error_abortor&error_fatalinstead.I've seen such bugs.
Of course, making possible offenders more greppable doesn't necessarily mean existing ones will get fixed and new ones will be avoided.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
* Making code that depends on errp more visible and greppable (using ERR_IS_* macros). Some of those cases are also likely to be bugs, and need to be investigated.
Grepping for (local_)?errp? works well enough, doesn't it?
I don't see how.
Full list of possible Error ** variables not named errp:
$ git-grep -E '\bError \*\*' | grep -vE '\bError \*\*(errp\b|\))' HACKING:the eyes than propagating an Error object through an Error ** parameter. HACKING:only the function really knows, use Error **, and set suitable errors. block/quorum.c: /* XXX - would be nice if we could pass in the Error ** block/snapshot.c: Error **err) blockjob.c:/* A wrapper around block_job_cancel() taking an Error ** parameter so it may be docs/devel/writing-qmp-commands.txt:3. It takes an "Error **" argument. This is required. Later we will see how to hw/core/qdev.c:static bool check_only_migratable(Object *obj, Error **err) hw/core/qdev.c: Error **local_errp = NULL; hw/core/qdev.c:static bool device_get_hotplugged(Object *obj, Error **err) hw/i386/amd_iommu.c:static void amdvi_realize(DeviceState *dev, Error **err) hw/sd/sdhci.c:static void sdhci_sysbus_realize(DeviceState *dev, Error ** errp) hw/usb/dev-network.c:static void usb_net_realize(USBDevice *dev, Error **errrp) include/block/snapshot.h: Error **err); include/qapi/error.h:void error_propagate(Error **dst_errp, Error *local_err); include/qom/object.h: const uint64_t *v, Error **Errp); include/qom/object.h: const uint64_t *v, Error **Errp); qga/commands-posix.c:GuestUserList *qmp_guest_get_users(Error **err) qga/commands-win32.c:GuestUserList *qmp_guest_get_users(Error **err) qga/commands.c:GuestExecStatus *qmp_guest_exec_status(int64_t pid, Error **err) qga/commands.c: Error **err) qga/commands.c:GuestHostName *qmp_guest_get_host_name(Error **err) qmp.c:void qmp_system_powerdown(Error **erp) util/error.c:void error_propagate(Error **dst_errp, Error *local_err)I'll post a patch to rename the offenders.
Quoted 14 lines
I'm talking about two cases:
1) Code like this:
int func1(..., Error **errp) { do_something(errp); if (errp && *errp) { /* handle error */ return; } /* do something else */ }Quoted 1 line
func1()is buggy because it behaves differently if errp is NULL.Does your series fix any such bugs? We hunted them all down long ago... Perhaps a few new ones have crept in since. Hmm... I can see two:
Quoted 7 lines
Quoted 4 lines
$ git-grep -F 'errp && *errp' exec.c: if (errp && *errp) { hw/mem/pc-dimm.c: if (errp && *errp) { util/error.c: assert(errp && *errp);This RFC doesn't fix those bugs, but just makes them more obvious and easier to fix. I plan to fix them in the final version of the series.
Well, these two are plenty obvious already :)
Quoted 30 lines
Quoted 12 lines
Quoted 11 lines
2) Code like this:
int func2(..., Error **errp) { do_something(errp); if (*errp) { /* handle error */ } }
func2()is buggy because if crashes if errp is NULL.Quoted 7 lines
Does your series fix any such bugs? grep coughs up quite a few candidates...
Quoted 2 lines
I don't see an easy way to grep for them with the current code. With this series, (1) can be detected by grepping for
ERR_IS_IGNORED,How would example (1) look like then?
diff --git
a/hw/mem/pc-dimm.cb/hw/mem/pc-dimm.c
index 92fb482..4e5e2c9 100644
---a/hw/mem/pc-dimm.c
+++b/hw/mem/pc-dimm.c
@@ -316,7 +316,7 @@uint64_tpc_dimm_get_free_addr(uint64_taddress_space_start,
uint64_tdimm_size= object_property_get_int(OBJECT(dimm),
PC_DIMM_SIZE_PROP, errp);
- if (errp && *errp) {
Quoted 7 lines
+ if (!ERR_IS_IGNORED(errp) && ERR_IS_SET(errp)) { goto out; }Without this series, the fix for (1) requires adding
error_propagate()boilerplate. With this series, the fix is to just drop the !ERR_IS_IGNORED check and keep theERR_IS_SETcheck
I think creating the fix is roughly the same work as before. The resulting code is a bit more compact: we avoid error_propagate() boilerplate, but pay for that with an ERR_IS_SET() macro.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
is fixed because
ERR_IS_SET(errp)will work even if errp is NULL.Quoted 8 lines
Quoted 8 lines
TODO
----* Simplify more cases of local_error/error_propagate() to use errp directly.
* Update API documentation and code examples.
* Add a mechanism to ensure errp is never NULL.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Git branch
----------This series depend on a few extra cleanups that I didn't submit to qemu-devel yet. A git branch including this series is available at:
git://github.com/ehabkost/qemu-hacks.gitwork/err-api-rework-ignore-ptr-v1
I doubt the macros make the bug fixing materially easier, and I doubt they can reduce future bugs of this kind. What they can do is letting us get rid of error_propagate() boilerplate with relative ease.
If we switch to returning success/failure (which also gets rid of the boilerplate), then the macros may still let us get rid of boilerplate more quickly, for some additional churn. Worthwhile? Depends on how long the return value change takes us.
I think the first order of business is to figure out whether we want to pursue returning success/failure.
Quoted 27 lines · Markus Armbruster
Quoted 25 lines · Eduardo Habkost
Quoted 4 lines · Markus Armbruster
Quoted 2 lines · Eduardo Habkost
Quoted 1 line · Markus Armbruster
Eduardo Habkost <[email protected]> writes:
[...]
Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
I understand the reason we need to support errp==NULL, as it makes life simpler for callers that don't want any extra error information. However, this has the cost of making the functions that report errors more complex and error-prone.
(Evidence of that: the 34 ERR_IS_* cases handled by the "use ERR_IS_* macros" patches in the series. Where existing code will crash or behave differently if errp is NULL.)
Quoted 6 lines
Quoted 1 line
Which of them could *not* use a suitable return value instead of *errp?
I don't know. But I'm not trying to improve those 34 ERR_IS_* cases. I am trying to improve the 700+ functions that need the local_err/error_propagate() boilerplate code today. This series already handles 346 of them automatically (see patch 14/15).
I agree the goal is reducing
error_propagate()boilerplate. I latched onto the 34 ERR_IS_* cases only because you presented them as examples.
Quoted 7 lines
Quoted 3 lines
The 34 ERR_IS_* cases were evidence of how easy it is to introduce mistakes with the current API. Probably most of them are instances of
(1) and (2) below.The current interface can be abused, but how much abuse actually creeps in? I think we've been doing reasonably well there since we got rid of the bad examples and improved documentation.
See the 30+ cases touched by patch 09/15. Except for the ones in error.c, all of them look like bugs to me.
I didn't investigate when each of them were introduced, though.
Quoted 9 lines
Moreover, the revised interface could also be abused. Nothing stops you from dereferencing errp before or after, the only thing that changes are the examples people see in code. I'm afraid the people who reinvent bad examples from scratch despite the documentation telling them not to will also bypass any macros the documentation tells them to use.
*Especially* if we use macros only sometimes.
ERR_IS_SET(&err)makes no sense, so we'd still test err directly there, wouldn't we?
Any interface can be abused. But I still believe a simpler and easier interface for propagating errors is less likely to be abused.
But in either case, tools to detect abuse would be welcome. We can write Coccinelle scripts to detect most abuse of the existing error API.
Quoted 1 line
[...]
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
is fixed because
ERR_IS_SET(errp)will work even if errp is NULL.Quoted 8 lines
Quoted 8 lines
TODO
----* Simplify more cases of local_error/error_propagate() to use errp directly.
* Update API documentation and code examples.
* Add a mechanism to ensure errp is never NULL.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Git branch
----------This series depend on a few extra cleanups that I didn't submit to qemu-devel yet. A git branch including this series is available at:
git://github.com/ehabkost/qemu-hacks.gitwork/err-api-rework-ignore-ptr-v1
Quoted 8 lines
I doubt the macros make the bug fixing materially easier, and I doubt they can reduce future bugs of this kind. What they can do is letting us get rid of
error_propagate()boilerplate with relative ease.If we switch to returning success/failure (which also gets rid of the boilerplate), then the macros may still let us get rid of boilerplate more quickly, for some additional churn. Worthwhile? Depends on how long the return value change takes us.
My assumption is that it will take a very long time.
Quoted 3 lines
I think the first order of business is to figure out whether we want to pursue returning success/failure.
OK. I will reply about that in a separate message.
Signature · 1 line
Eduardo
Quoted 48 lines · Eduardo Habkost
Quoted 27 lines · Markus Armbruster
Quoted 25 lines · Eduardo Habkost
Quoted 4 lines · Markus Armbruster
Quoted 2 lines · Eduardo Habkost
Quoted 1 line · Markus Armbruster
Eduardo Habkost <[email protected]> writes:
[...]
Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
I understand the reason we need to support errp==NULL, as it makes life simpler for callers that don't want any extra error information. However, this has the cost of making the functions that report errors more complex and error-prone.
(Evidence of that: the 34 ERR_IS_* cases handled by the "use ERR_IS_* macros" patches in the series. Where existing code will crash or behave differently if errp is NULL.)
Quoted 6 lines
Quoted 1 line
Which of them could *not* use a suitable return value instead of *errp?
I don't know. But I'm not trying to improve those 34 ERR_IS_* cases. I am trying to improve the 700+ functions that need the local_err/error_propagate() boilerplate code today. This series already handles 346 of them automatically (see patch 14/15).
I agree the goal is reducing
error_propagate()boilerplate. I latched onto the 34 ERR_IS_* cases only because you presented them as examples.Quoted 7 lines
Quoted 3 lines
The 34 ERR_IS_* cases were evidence of how easy it is to introduce mistakes with the current API. Probably most of them are instances of
(1) and (2) below.The current interface can be abused, but how much abuse actually creeps in? I think we've been doing reasonably well there since we got rid of the bad examples and improved documentation.
See the 30+ cases touched by patch 09/15. Except for the ones in
error.c, all of them look like bugs to me.I didn't investigate when each of them were introduced, though.
Quoted 7 lines
Moreover, the revised interface could also be abused. Nothing stops you from dereferencing errp before or after, the only thing that changes are the examples people see in code. I'm afraid the people who reinvent bad examples from scratch despite the documentation telling them not to will also bypass any macros the documentation tells them to use.
Quoted 5 lines
Quoted 2 lines
*Especially* if we use macros only sometimes.
ERR_IS_SET(&err)makes no sense, so we'd still test err directly there, wouldn't we?Any interface can be abused. But I still believe a simpler and easier interface for propagating errors is less likely to be abused.
Can you substantiate this claim with examples? I'm looking for arguments like "if existing code looks like $this, people could plausibly write $mistake, which is wrong. If it looks like $that, they could still write $related_mistake, but it seems far less likely."
Quoted 2 lines
But in either case, tools to detect abuse would be welcome. We can write Coccinelle scripts to detect most abuse of the existing error API.
checkpatch.pl would be nice, too. It's too stupid for rigorous checks. However, the ones you fix in PATCH 09 all involve *errp. Many of the *errp your patch doesn't touch look fishy to me. Should checkpatch.pl warn when it sees *errp in new code?
Quoted 24 lines
[...]
Quoted 23 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
is fixed because
ERR_IS_SET(errp)will work even if errp is NULL.Quoted 8 lines
Quoted 8 lines
TODO
----* Simplify more cases of local_error/error_propagate() to use errp directly.
* Update API documentation and code examples.
* Add a mechanism to ensure errp is never NULL.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Git branch
----------This series depend on a few extra cleanups that I didn't submit to qemu-devel yet. A git branch including this series is available at:
git://github.com/ehabkost/qemu-hacks.gitwork/err-api-rework-ignore-ptr-v1I doubt the macros make the bug fixing materially easier, and I doubt they can reduce future bugs of this kind. What they can do is letting us get rid of
error_propagate()boilerplate with relative ease.
Quoted 6 lines
Quoted 4 lines
If we switch to returning success/failure (which also gets rid of the boilerplate), then the macros may still let us get rid of boilerplate more quickly, for some additional churn. Worthwhile? Depends on how long the return value change takes us.
My assumption is that it will take a very long time.
"Very long time" would be bad, because unconverted code breeds more unconverted code by serving as bad example.
Big "convert from old way to do things to new way" tasks should only be started with a reasonable idea on how to end them. We've started too many such tasks sanguinely, and have had the darndest time ending any of them.
I'm investigating ways to automate parts of the job.
Quoted 4 lines
Quoted 2 lines
I think the first order of business is to figure out whether we want to pursue returning success/failure.
OK. I will reply about that in a separate message.
On Fri, Jun 30, 2017 at 01:40:58PM +0200, Markus Armbruster wrote:
[...]
Quoted 5 lines
I doubt the macros make the bug fixing materially easier, and I doubt they can reduce future bugs of this kind. What they can do is letting us get rid of
error_propagate()boilerplate with relative ease.
Quoted 7 lines
If we switch to returning success/failure (which also gets rid of the boilerplate), then the macros may still let us get rid of boilerplate more quickly, for some additional churn. Worthwhile? Depends on how long the return value change takes us.
I think the first order of business is to figure out whether we want to pursue returning success/failure.
About this, I'm unsure. Returning error information in two separate locations (the return value and *errp) makes it easier to introduce bugs that are hard to detect. Especially when the tree is an inconsistent state where we mix -1/0, -errno/0, FALSE/TRUE, NULL/non-NULL and void functions.
Signature · 1 line
Eduardo
Quoted 12 lines · Eduardo Habkost
On Fri, Jun 30, 2017 at 01:40:58PM +0200, Markus Armbruster wrote:
[...]Quoted 10 lines
I doubt the macros make the bug fixing materially easier, and I doubt they can reduce future bugs of this kind. What they can do is letting us get rid of
error_propagate()boilerplate with relative ease.If we switch to returning success/failure (which also gets rid of the boilerplate), then the macros may still let us get rid of boilerplate more quickly, for some additional churn. Worthwhile? Depends on how long the return value change takes us.
Quoted 6 lines
Quoted 2 lines
I think the first order of business is to figure out whether we want to pursue returning success/failure.
About this, I'm unsure. Returning error information in two separate locations (the return value and *errp) makes it easier to introduce bugs that are hard to detect.
I sympathize with this argument. It's exactly what that made us avoid returning a success/failure indication.
Except when we don't actually avoid it:
* Functions returning a pointer typically return non-null on success, null on failure. Has inconsistency between return value and Error setting been a problem in practice? Nope.
* Quite a few functions return 0 on success, -errno on failure, to let callers handle different errors differently. Has inconsistency been a problem in practice? Nope again.
Aside: the original Error plan was to have callers check ErrorClass, but that didn't work out.
* Functions with a side effect typically either do their side effect and succeed, or do nothing and fail. Inconsistency between side effect and claimed success is theoretically possible no matter how success is
claimed: it's possible if the function returns success/failure, it's possible if it sets an Error on failure and doesn't on success, and it's possible if it does both.
My point is: returning void instead of success/failure gets rid only of a part of a theoretical problem, which turns out not much of a problem in practice.
Quoted 3 lines
Especially when the tree is an inconsistent
state where we mix -1/0, -errno/0, FALSE/TRUE, NULL/non-NULL and void functions.
This is basically ret<0/ret>=0, !ret/ret, void.
Getting rid of void would improve matters, wouldn't it?
Quoted 44 lines · Markus Armbruster
Quoted 12 lines · Eduardo Habkost
On Fri, Jun 30, 2017 at 01:40:58PM +0200, Markus Armbruster wrote:
[...]Quoted 10 lines
I doubt the macros make the bug fixing materially easier, and I doubt they can reduce future bugs of this kind. What they can do is letting us get rid of
error_propagate()boilerplate with relative ease.If we switch to returning success/failure (which also gets rid of the boilerplate), then the macros may still let us get rid of boilerplate more quickly, for some additional churn. Worthwhile? Depends on how long the return value change takes us.
Quoted 6 lines
Quoted 2 lines
I think the first order of business is to figure out whether we want to pursue returning success/failure.
About this, I'm unsure. Returning error information in two separate locations (the return value and *errp) makes it easier to introduce bugs that are hard to detect.
I sympathize with this argument. It's exactly what that made us avoid returning a success/failure indication.
Except when we don't actually avoid it:
* Functions returning a pointer typically return non-null on success, null on failure. Has inconsistency between return value and Error setting been a problem in practice? Nope.
* Quite a few functions return 0 on success, -errno on failure, to let callers handle different errors differently. Has inconsistency been a problem in practice? Nope again.
Aside: the original Error plan was to have callers check ErrorClass, but that didn't work out.
* Functions with a side effect typically either do their side effect and succeed, or do nothing and fail. Inconsistency between side effect and claimed success is theoretically possible no matter how success is
claimed: it's possible if the function returns success/failure, it's possible if it sets an Error on failure and doesn't on success, and it's possible if it does both.
Quoted 4 lines
My point is: returning void instead of success/failure gets rid only of a part of a theoretical problem, which turns out not much of a problem in practice.
You are probably right. And I guess we will find out quickly if this is not the case and the conversion to bool starts introducing more complex or buggy code.
Quoted 7 lines
Quoted 3 lines
Especially when the tree is an inconsistent
state where we mix -1/0, -errno/0, FALSE/TRUE, NULL/non-NULL and void functions.This is basically ret<0/ret>=0, !ret/ret, void.
Getting rid of void would improve matters, wouldn't it?
Yes.
Signature · 1 line
Eduardo
Quoted 21 lines · Eduardo Habkost
Quoted 19 lines · Markus Armbruster
Quoted 18 lines
Ensuring errp is never NULL
---------------------------The last patch on this series changes the (Error **errp) parameters in functions to (Error *errp[static 1]), just to help validate the existing code, as clang warns about NULL arguments on that case. I don't think we should apply that patch, though, because the "[static 1]" syntax confuses Coccinelle.
I have a branch where I experimented with the idea of replacing (Error **errp) parameters with an opaque type (void*, or a struct type). I gave up when I noticed it would require touching all callers to replace &err with a wrapper macro to convert to the right type. Suggestions to make NULL errp easier to detect at build time are welcome.
(Probably the easiest solution for that is to add assert(errp) lines to the ERR_IS_*() macros.)
Quoted 6 lines
Quoted 3 lines
We'll obviously struggle with null arguments until all the developers adjusted to the new interface. Possibly with occasional mistakes forever. Compile-time checking would really, really help.
True. I'm investigating the possibility of using __attribute__((nonull(...))) with Coccinelle's help.
Beware that '__attribute__((nonnull))' has two distinct effects, one of which is a potentially nasty trap which leads to crashes....
The useful part is that it allows compilers & analysis tools like coverity to warn if you accidentally pass NULL into a method. These warnings, particularly from gcc, only catch a fraction of scenarios where you pass NULL in though.
The less useful part is that if GCC sees a nonnull annotation on a parameter, then in the body of the method, it will silently remove any code which does "if (!paramname)". So if you added a check for the parameter being NULL to avoid a crash, gcc will remove that protection, so you'll once again get a crash at runtime if passing NULL.
So if you use the nonnull annotation, they you probably want to make sure to pass -fno-delete-null-pointer-checks to GCC to stop it removing your protection code, or you need to be very confident that nothing will mistakenly pass NULL into the methods annotated nonnull.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 11 lines · Markus Armbruster
If
foo()additionally returned an indication of success, you could writeif (!foo(arg, errp)) { // assuming
foo()returns a bool
handle the error...
}Nicely concise.
For what it's worth, this is how GLib wants GError to be used. We deviated from it, and it has turned out to be a self-inflicted wound.
I find Eduardo's proposal better. With GLib's way it's easy to confuse functions that return 0/-1, 0/-errno, TRUE/FALSE, FALSE/TRUE or NULL/non-NULL.
Declaring and testing local_err doesn't introduce much boilerplate, it's propagation to errp that does. The disadvantage of Eduardo's mechanism is that it produces slightly worse code, but Error** is rarely used in hot code. It could also be improved slightly by changing ignored_error_unset and ignored_error_set to a 2-element array.
Paolo
Quoted 9 lines · Paolo Bonzini
Quoted 8 lines · Markus Armbruster
If
foo()additionally returned an indication of success, you could writeif (!foo(arg, errp)) { // assuming
foo()returns a bool
handle the error...
}Nicely concise.
Quoted 7 lines
Quoted 3 lines
For what it's worth, this is how GLib wants GError to be used. We deviated from it, and it has turned out to be a self-inflicted wound.
I find Eduardo's proposal better. With GLib's way it's easy to confuse functions that return 0/-1, 0/-errno, TRUE/FALSE, FALSE/TRUE or NULL/non-NULL.
NB, glib basically standardizes on just FALSE/TRUE and NULL/non-NULL, avoiding anything returning -1, or errno values, so in their usage there isn't really any confusion.
QEMU of course has lots of pre-existing code, but we could at least declare a preferred approach, and work towards it.
Having the return value indicate error is slightly shorter, and it avoids all the blackmagic with special Error values in Eduardo's series. Most usefully, it lets you use __attribute__(return_check) to get compile time checking of callers who forget to check for failure.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 22 lines · Daniel P. Berrange
Quoted 9 lines · Paolo Bonzini
Quoted 8 lines · Markus Armbruster
If
foo()additionally returned an indication of success, you could writeif (!foo(arg, errp)) { // assuming
foo()returns a bool
handle the error...
}Nicely concise.
Quoted 7 lines
Quoted 3 lines
For what it's worth, this is how GLib wants GError to be used. We deviated from it, and it has turned out to be a self-inflicted wound.
I find Eduardo's proposal better. With GLib's way it's easy to confuse functions that return 0/-1, 0/-errno, TRUE/FALSE, FALSE/TRUE or NULL/non-NULL.
NB, glib basically standardizes on just FALSE/TRUE and NULL/non-NULL, avoiding anything returning -1, or errno values, so in their usage there isn't really any confusion.
Quoted 8 lines
QEMU of course has lots of pre-existing code, but we could at least declare a preferred approach, and work towards it.
Having the return value indicate error is slightly shorter, and it avoids all the blackmagic with special Error values in Eduardo's series. Most usefully, it lets you use
__attribute__(return_check)to get compile time checking of callers who forget to check for failure.
I agree it's better when the return value is obvious, but I still think the Error value magic in IGNORE_ERRORS/ERR_IS_SET is preferable to the existing 700+ error_propagate() calls in the tree.
Signature · 1 line
Eduardo
Quoted 32 lines · Eduardo Habkost
Quoted 22 lines · Daniel P. Berrange
Quoted 9 lines · Paolo Bonzini
Quoted 8 lines · Markus Armbruster
If
foo()additionally returned an indication of success, you could writeif (!foo(arg, errp)) { // assuming
foo()returns a bool
handle the error...
}Nicely concise.
Quoted 7 lines
Quoted 3 lines
For what it's worth, this is how GLib wants GError to be used. We deviated from it, and it has turned out to be a self-inflicted wound.
I find Eduardo's proposal better. With GLib's way it's easy to confuse functions that return 0/-1, 0/-errno, TRUE/FALSE, FALSE/TRUE or NULL/non-NULL.
NB, glib basically standardizes on just FALSE/TRUE and NULL/non-NULL, avoiding anything returning -1, or errno values, so in their usage there isn't really any confusion.
Quoted 8 lines
QEMU of course has lots of pre-existing code, but we could at least declare a preferred approach, and work towards it.
Having the return value indicate error is slightly shorter, and it avoids all the blackmagic with special Error values in Eduardo's series. Most usefully, it lets you use
__attribute__(return_check)to get compile time checking of callers who forget to check for failure.
Quoted 3 lines
I agree it's better when the return value is obvious, but I still think the Error value magic in IGNORE_ERRORS/ERR_IS_SET is preferable to the existing 700+
error_propagate()calls in the tree.
Both approaches would let us kill the error_propagate() calls. I think we're all agreed those would be better off gone, no matter which approach is used.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 33 lines · Daniel P. Berrange
Quoted 32 lines · Eduardo Habkost
Quoted 30 lines · Daniel P. Berrange
Quoted 9 lines · Paolo Bonzini
Quoted 8 lines · Markus Armbruster
If
foo()additionally returned an indication of success, you could writeif (!foo(arg, errp)) { // assuming
foo()returns a bool
handle the error...
}Nicely concise.
Quoted 7 lines
Quoted 3 lines
For what it's worth, this is how GLib wants GError to be used. We deviated from it, and it has turned out to be a self-inflicted wound.
I find Eduardo's proposal better. With GLib's way it's easy to confuse functions that return 0/-1, 0/-errno, TRUE/FALSE, FALSE/TRUE or NULL/non-NULL.
NB, glib basically standardizes on just FALSE/TRUE and NULL/non-NULL, avoiding anything returning -1, or errno values, so in their usage there isn't really any confusion.
QEMU of course has lots of pre-existing code, but we could at least declare a preferred approach, and work towards it.
Having the return value indicate error is slightly shorter, and it avoids all the blackmagic with special Error values in Eduardo's series. Most usefully, it lets you use
__attribute__(return_check)to get compile time checking of callers who forget to check for failure.
Quoted 7 lines
Quoted 3 lines
I agree it's better when the return value is obvious, but I still think the Error value magic in IGNORE_ERRORS/ERR_IS_SET is preferable to the existing 700+
error_propagate()calls in the tree.Both approaches would let us kill the
error_propagate()calls. I think we're all agreed those would be better off gone, no matter which approach is used.
Changing the return value of the 1500+ void functions that return errors will take a very long while. I would like to get rid of the error_propagate() calls before that, even if the long term plan is to eventually get rid of ERR_IS_SET.
Signature · 1 line
Eduardo
Quoted 38 lines · Eduardo Habkost
Quoted 37 lines · Daniel P. Berrange
Quoted 35 lines · Eduardo Habkost
Quoted 22 lines · Daniel P. Berrange
Quoted 9 lines · Paolo Bonzini
Quoted 8 lines · Markus Armbruster
If
foo()additionally returned an indication of success, you could writeif (!foo(arg, errp)) { // assuming
foo()returns a bool
handle the error...
}Nicely concise.
Quoted 7 lines
Quoted 3 lines
For what it's worth, this is how GLib wants GError to be used. We deviated from it, and it has turned out to be a self-inflicted wound.
I find Eduardo's proposal better. With GLib's way it's easy to confuse functions that return 0/-1, 0/-errno, TRUE/FALSE, FALSE/TRUE or NULL/non-NULL.
NB, glib basically standardizes on just FALSE/TRUE and NULL/non-NULL, avoiding anything returning -1, or errno values, so in their usage there isn't really any confusion.
Quoted 8 lines
QEMU of course has lots of pre-existing code, but we could at least declare a preferred approach, and work towards it.
Having the return value indicate error is slightly shorter, and it avoids all the blackmagic with special Error values in Eduardo's series. Most usefully, it lets you use
__attribute__(return_check)to get compile time checking of callers who forget to check for failure.I agree it's better when the return value is obvious, but I still think the Error value magic in IGNORE_ERRORS/ERR_IS_SET is preferable to the existing 700+
error_propagate()calls in the tree.
Quoted 8 lines
Quoted 3 lines
Both approaches would let us kill the
error_propagate()calls. I think we're all agreed those would be better off gone, no matter which approach is used.Changing the return value of the 1500+ void functions that return errors will take a very long while. I would like to get rid of the
error_propagate()calls before that, even if the long term plan is to eventually get rid ofERR_IS_SET.
Ah, I see what you mean, that's fine.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 17 lines · Markus Armbruster
Quoted 5 lines · Eduardo Habkost
Rationale
---------I'm often bothered by the fact that we can't write the following:
Quoted 7 lines
foo(arg, errp); if (*errp) { handle the error... error_propagate(errp, err); }because errp can be NULL.
If
foo()additionally returned an indication of success, you could write
Quoted 8 lines
if (!foo(arg, errp)) { // assuming
foo()returns a bool
handle the error...
}Nicely concise.
For what it's worth, this is how GLib wants GError to be used. We deviated from it, and it has turned out to be a self-inflicted wound.
FWIW, I took that approach for the io & crypto layers - except returning 0 vs -1, rather than true/false, precisely because it lead to simpler code by not having to use local errors and propagation.
For added benefit you can potentially then also annotate the method as __attribute__(return_check) to force the caller to include a check for error conditions, which is often a useful compile time protection to have.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|