Re: [PATCH 2/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument
Le 11/01/2021 à 16:20, Philippe Mathieu-Daudé a écrit : > The 'running' argument from VMChangeStateHandler does not require > other value than 0 / 1. Make it a plain boolean. > > Signed-off-by: Philippe Mathieu-Daudé > --- > include/sysemu/runstate.h | 10 -- > target/arm/kvm_arm.h| 2 +- > target/ppc/cpu-qom.h| 2 +- > accel/xen/xen-all.c | 2 +- > audio/audio.c | 2 +- > block/block-backend.c | 2 +- > gdbstub.c | 2 +- > hw/block/pflash_cfi01.c | 2 +- > hw/block/virtio-blk.c | 2 +- > hw/display/qxl.c| 2 +- > hw/i386/kvm/clock.c | 2 +- > hw/i386/kvm/i8254.c | 2 +- > hw/i386/kvmvapic.c | 2 +- > hw/i386/xen/xen-hvm.c | 2 +- > hw/ide/core.c | 2 +- > hw/intc/arm_gicv3_its_kvm.c | 2 +- > hw/intc/arm_gicv3_kvm.c | 2 +- > hw/intc/spapr_xive_kvm.c| 2 +- > hw/misc/mac_via.c | 2 +- > hw/net/e1000e_core.c| 2 +- > hw/nvram/spapr_nvram.c | 2 +- > hw/ppc/ppc.c| 2 +- > hw/ppc/ppc_booke.c | 2 +- > hw/s390x/tod-kvm.c | 2 +- > hw/scsi/scsi-bus.c | 2 +- > hw/usb/hcd-ehci.c | 2 +- > hw/usb/host-libusb.c| 2 +- > hw/usb/redirect.c | 2 +- > hw/vfio/migration.c | 2 +- > hw/virtio/virtio-rng.c | 2 +- > hw/virtio/virtio.c | 2 +- > net/net.c | 2 +- > softmmu/memory.c| 2 +- > softmmu/runstate.c | 2 +- > target/arm/kvm.c| 2 +- > target/i386/kvm/kvm.c | 2 +- > target/i386/sev.c | 2 +- > target/i386/whpx/whpx-all.c | 2 +- > target/mips/kvm.c | 4 ++-- > ui/gtk.c| 2 +- > ui/spice-core.c | 2 +- > 41 files changed, 49 insertions(+), 43 deletions(-) > > diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h > index 3ab35a039a0..a5356915734 100644 > --- a/include/sysemu/runstate.h > +++ b/include/sysemu/runstate.h > @@ -10,7 +10,7 @@ bool runstate_is_running(void); > bool runstate_needs_reset(void); > bool runstate_store(char *str, size_t size); > > -typedef void VMChangeStateHandler(void *opaque, int running, RunState state); > +typedef void VMChangeStateHandler(void *opaque, bool running, RunState > state); > > VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler > *cb, > void *opaque); > @@ -20,7 +20,13 @@ VMChangeStateEntry > *qdev_add_vm_change_state_handler(DeviceState *dev, > VMChangeStateHandler > *cb, > void *opaque); > void qemu_del_vm_change_state_handler(VMChangeStateEntry *e); > -void vm_state_notify(int running, RunState state); > +/** > + * vm_state_notify: Notify the state of the VM > + * > + * @running: whether the VM is running or not. > + * @state: the #RunState of the VM. > + */ > +void vm_state_notify(bool running, RunState state); > > static inline bool shutdown_caused_by_guest(ShutdownCause cause) > { > diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h > index eb81b7059eb..68ec970c4f4 100644 > --- a/target/arm/kvm_arm.h > +++ b/target/arm/kvm_arm.h > @@ -352,7 +352,7 @@ void kvm_arm_get_virtual_time(CPUState *cs); > */ > void kvm_arm_put_virtual_time(CPUState *cs); > > -void kvm_arm_vm_state_change(void *opaque, int running, RunState state); > +void kvm_arm_vm_state_change(void *opaque, bool running, RunState state); > > int kvm_arm_vgic_probe(void); > > diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h > index 63b9e8632ca..118baf8d41f 100644 > --- a/target/ppc/cpu-qom.h > +++ b/target/ppc/cpu-qom.h > @@ -218,7 +218,7 @@ extern const VMStateDescription vmstate_ppc_timebase; > .offset = vmstate_offset_value(_state, _field, PPCTimebase), \ > } > > -void cpu_ppc_clock_vm_state_change(void *opaque, int running, > +void cpu_ppc_clock_vm_state_change(void *opaque, bool running, > RunState state); > #endif > > diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c > index 878a4089d97..3756aca27be 100644 > --- a/accel/xen/xen-all.c > +++ b/accel/xen/xen-all.c > @@ -122,7 +122,7 @@ static void xenstore_record_dm_state(struct xs_handle > *xs, const char *state) > } > > > -static void xen_change_state_handler(void *opaque, int running, > +static void xen_change_state_handler(void *opaque, bool running, > RunState state) > { > if (running) { > diff --git a/audio/audio.c b/audio/audio.c > index b48471bb3f6..f2d56e7e57d 100644 > --- a/audio/audio.c > +++ b/audio/audio.c > @@ -1549,7 +1549,7 @@ static int audio_driver_init(AudioState *s, struct > audio_driver *drv, > } > } > > -static void audio_vm_change_state_handler (void *opaque, int running, > +st
Re: [PATCH 2/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument
On Mon, Jan 11, 2021 at 04:20:20PM +0100, Philippe Mathieu-Daudé wrote: > The 'running' argument from VMChangeStateHandler does not require > other value than 0 / 1. Make it a plain boolean. > > Signed-off-by: Philippe Mathieu-Daudé ppc parts Acked-by: David Gibson > --- > include/sysemu/runstate.h | 10 -- > target/arm/kvm_arm.h| 2 +- > target/ppc/cpu-qom.h| 2 +- > accel/xen/xen-all.c | 2 +- > audio/audio.c | 2 +- > block/block-backend.c | 2 +- > gdbstub.c | 2 +- > hw/block/pflash_cfi01.c | 2 +- > hw/block/virtio-blk.c | 2 +- > hw/display/qxl.c| 2 +- > hw/i386/kvm/clock.c | 2 +- > hw/i386/kvm/i8254.c | 2 +- > hw/i386/kvmvapic.c | 2 +- > hw/i386/xen/xen-hvm.c | 2 +- > hw/ide/core.c | 2 +- > hw/intc/arm_gicv3_its_kvm.c | 2 +- > hw/intc/arm_gicv3_kvm.c | 2 +- > hw/intc/spapr_xive_kvm.c| 2 +- > hw/misc/mac_via.c | 2 +- > hw/net/e1000e_core.c| 2 +- > hw/nvram/spapr_nvram.c | 2 +- > hw/ppc/ppc.c| 2 +- > hw/ppc/ppc_booke.c | 2 +- > hw/s390x/tod-kvm.c | 2 +- > hw/scsi/scsi-bus.c | 2 +- > hw/usb/hcd-ehci.c | 2 +- > hw/usb/host-libusb.c| 2 +- > hw/usb/redirect.c | 2 +- > hw/vfio/migration.c | 2 +- > hw/virtio/virtio-rng.c | 2 +- > hw/virtio/virtio.c | 2 +- > net/net.c | 2 +- > softmmu/memory.c| 2 +- > softmmu/runstate.c | 2 +- > target/arm/kvm.c| 2 +- > target/i386/kvm/kvm.c | 2 +- > target/i386/sev.c | 2 +- > target/i386/whpx/whpx-all.c | 2 +- > target/mips/kvm.c | 4 ++-- > ui/gtk.c| 2 +- > ui/spice-core.c | 2 +- > 41 files changed, 49 insertions(+), 43 deletions(-) > > diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h > index 3ab35a039a0..a5356915734 100644 > --- a/include/sysemu/runstate.h > +++ b/include/sysemu/runstate.h > @@ -10,7 +10,7 @@ bool runstate_is_running(void); > bool runstate_needs_reset(void); > bool runstate_store(char *str, size_t size); > > -typedef void VMChangeStateHandler(void *opaque, int running, RunState state); > +typedef void VMChangeStateHandler(void *opaque, bool running, RunState > state); > > VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler > *cb, > void *opaque); > @@ -20,7 +20,13 @@ VMChangeStateEntry > *qdev_add_vm_change_state_handler(DeviceState *dev, > VMChangeStateHandler > *cb, > void *opaque); > void qemu_del_vm_change_state_handler(VMChangeStateEntry *e); > -void vm_state_notify(int running, RunState state); > +/** > + * vm_state_notify: Notify the state of the VM > + * > + * @running: whether the VM is running or not. > + * @state: the #RunState of the VM. > + */ > +void vm_state_notify(bool running, RunState state); > > static inline bool shutdown_caused_by_guest(ShutdownCause cause) > { > diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h > index eb81b7059eb..68ec970c4f4 100644 > --- a/target/arm/kvm_arm.h > +++ b/target/arm/kvm_arm.h > @@ -352,7 +352,7 @@ void kvm_arm_get_virtual_time(CPUState *cs); > */ > void kvm_arm_put_virtual_time(CPUState *cs); > > -void kvm_arm_vm_state_change(void *opaque, int running, RunState state); > +void kvm_arm_vm_state_change(void *opaque, bool running, RunState state); > > int kvm_arm_vgic_probe(void); > > diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h > index 63b9e8632ca..118baf8d41f 100644 > --- a/target/ppc/cpu-qom.h > +++ b/target/ppc/cpu-qom.h > @@ -218,7 +218,7 @@ extern const VMStateDescription vmstate_ppc_timebase; > .offset = vmstate_offset_value(_state, _field, PPCTimebase), \ > } > > -void cpu_ppc_clock_vm_state_change(void *opaque, int running, > +void cpu_ppc_clock_vm_state_change(void *opaque, bool running, > RunState state); > #endif > > diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c > index 878a4089d97..3756aca27be 100644 > --- a/accel/xen/xen-all.c > +++ b/accel/xen/xen-all.c > @@ -122,7 +122,7 @@ static void xenstore_record_dm_state(struct xs_handle > *xs, const char *state) > } > > > -static void xen_change_state_handler(void *opaque, int running, > +static void xen_change_state_handler(void *opaque, bool running, > RunState state) > { > if (running) { > diff --git a/audio/audio.c b/audio/audio.c > index b48471bb3f6..f2d56e7e57d 100644 > --- a/audio/audio.c > +++ b/audio/audio.c > @@ -1549,7 +1549,7 @@ static int audio_driver_init(AudioState *s, struct > audio_driver *drv, > } > } > > -static void audio_vm_ch
Re: [PATCH 2/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument
Philippe Mathieu-Daudé writes: > The 'running' argument from VMChangeStateHandler does not require > other value than 0 / 1. Make it a plain boolean. > > Signed-off-by: Philippe Mathieu-Daudé Seems reasonable Reviewed-by: Alex Bennée -- Alex Bennée
[PATCH 2/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument
The 'running' argument from VMChangeStateHandler does not require other value than 0 / 1. Make it a plain boolean. Signed-off-by: Philippe Mathieu-Daudé --- include/sysemu/runstate.h | 10 -- target/arm/kvm_arm.h| 2 +- target/ppc/cpu-qom.h| 2 +- accel/xen/xen-all.c | 2 +- audio/audio.c | 2 +- block/block-backend.c | 2 +- gdbstub.c | 2 +- hw/block/pflash_cfi01.c | 2 +- hw/block/virtio-blk.c | 2 +- hw/display/qxl.c| 2 +- hw/i386/kvm/clock.c | 2 +- hw/i386/kvm/i8254.c | 2 +- hw/i386/kvmvapic.c | 2 +- hw/i386/xen/xen-hvm.c | 2 +- hw/ide/core.c | 2 +- hw/intc/arm_gicv3_its_kvm.c | 2 +- hw/intc/arm_gicv3_kvm.c | 2 +- hw/intc/spapr_xive_kvm.c| 2 +- hw/misc/mac_via.c | 2 +- hw/net/e1000e_core.c| 2 +- hw/nvram/spapr_nvram.c | 2 +- hw/ppc/ppc.c| 2 +- hw/ppc/ppc_booke.c | 2 +- hw/s390x/tod-kvm.c | 2 +- hw/scsi/scsi-bus.c | 2 +- hw/usb/hcd-ehci.c | 2 +- hw/usb/host-libusb.c| 2 +- hw/usb/redirect.c | 2 +- hw/vfio/migration.c | 2 +- hw/virtio/virtio-rng.c | 2 +- hw/virtio/virtio.c | 2 +- net/net.c | 2 +- softmmu/memory.c| 2 +- softmmu/runstate.c | 2 +- target/arm/kvm.c| 2 +- target/i386/kvm/kvm.c | 2 +- target/i386/sev.c | 2 +- target/i386/whpx/whpx-all.c | 2 +- target/mips/kvm.c | 4 ++-- ui/gtk.c| 2 +- ui/spice-core.c | 2 +- 41 files changed, 49 insertions(+), 43 deletions(-) diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h index 3ab35a039a0..a5356915734 100644 --- a/include/sysemu/runstate.h +++ b/include/sysemu/runstate.h @@ -10,7 +10,7 @@ bool runstate_is_running(void); bool runstate_needs_reset(void); bool runstate_store(char *str, size_t size); -typedef void VMChangeStateHandler(void *opaque, int running, RunState state); +typedef void VMChangeStateHandler(void *opaque, bool running, RunState state); VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb, void *opaque); @@ -20,7 +20,13 @@ VMChangeStateEntry *qdev_add_vm_change_state_handler(DeviceState *dev, VMChangeStateHandler *cb, void *opaque); void qemu_del_vm_change_state_handler(VMChangeStateEntry *e); -void vm_state_notify(int running, RunState state); +/** + * vm_state_notify: Notify the state of the VM + * + * @running: whether the VM is running or not. + * @state: the #RunState of the VM. + */ +void vm_state_notify(bool running, RunState state); static inline bool shutdown_caused_by_guest(ShutdownCause cause) { diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h index eb81b7059eb..68ec970c4f4 100644 --- a/target/arm/kvm_arm.h +++ b/target/arm/kvm_arm.h @@ -352,7 +352,7 @@ void kvm_arm_get_virtual_time(CPUState *cs); */ void kvm_arm_put_virtual_time(CPUState *cs); -void kvm_arm_vm_state_change(void *opaque, int running, RunState state); +void kvm_arm_vm_state_change(void *opaque, bool running, RunState state); int kvm_arm_vgic_probe(void); diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h index 63b9e8632ca..118baf8d41f 100644 --- a/target/ppc/cpu-qom.h +++ b/target/ppc/cpu-qom.h @@ -218,7 +218,7 @@ extern const VMStateDescription vmstate_ppc_timebase; .offset = vmstate_offset_value(_state, _field, PPCTimebase), \ } -void cpu_ppc_clock_vm_state_change(void *opaque, int running, +void cpu_ppc_clock_vm_state_change(void *opaque, bool running, RunState state); #endif diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c index 878a4089d97..3756aca27be 100644 --- a/accel/xen/xen-all.c +++ b/accel/xen/xen-all.c @@ -122,7 +122,7 @@ static void xenstore_record_dm_state(struct xs_handle *xs, const char *state) } -static void xen_change_state_handler(void *opaque, int running, +static void xen_change_state_handler(void *opaque, bool running, RunState state) { if (running) { diff --git a/audio/audio.c b/audio/audio.c index b48471bb3f6..f2d56e7e57d 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1549,7 +1549,7 @@ static int audio_driver_init(AudioState *s, struct audio_driver *drv, } } -static void audio_vm_change_state_handler (void *opaque, int running, +static void audio_vm_change_state_handler (void *opaque, bool running, RunState state) { AudioState *s = opaque; diff --git a/block/block-backend.c b/block/block-backend.c index ce78d30794a..9175eb237a2 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -163