Message ID | 20200127103647.17761-7-mlevitsk@redhat.com |
---|---|
State | New |
Headers | show |
Series | RFC: [for 5.0]: HMP monitor handlers cleanups | expand |
* Maxim Levitsky (mlevitsk@redhat.com) wrote: > Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> > --- > block/monitor/block-hmp-cmds.c | 52 ++++++++++++++++++++++++++++++ > include/block/block-hmp-commands.h | 6 ++++ > include/monitor/hmp.h | 5 --- > monitor/hmp-cmds.c | 52 ------------------------------ > 4 files changed, 58 insertions(+), 57 deletions(-) > > diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c > index ae3890aaab..ed3c350143 100644 > --- a/block/monitor/block-hmp-cmds.c > +++ b/block/monitor/block-hmp-cmds.c > @@ -228,3 +228,55 @@ void hmp_drive_backup(Monitor *mon, const QDict *qdict) > qmp_drive_backup(&backup, &err); > hmp_handle_error(mon, err); > } > + > +void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict) > +{ > + Error *error = NULL; > + const char *device = qdict_get_str(qdict, "device"); > + int64_t value = qdict_get_int(qdict, "speed"); > + > + qmp_block_job_set_speed(device, value, &error); > + > + hmp_handle_error(mon, error); > +} > + > +void hmp_block_job_cancel(Monitor *mon, const QDict *qdict) > +{ > + Error *error = NULL; > + const char *device = qdict_get_str(qdict, "device"); > + bool force = qdict_get_try_bool(qdict, "force", false); > + > + qmp_block_job_cancel(device, true, force, &error); > + > + hmp_handle_error(mon, error); > +} > + > +void hmp_block_job_pause(Monitor *mon, const QDict *qdict) > +{ > + Error *error = NULL; > + const char *device = qdict_get_str(qdict, "device"); > + > + qmp_block_job_pause(device, &error); > + > + hmp_handle_error(mon, error); > +} > + > +void hmp_block_job_resume(Monitor *mon, const QDict *qdict) > +{ > + Error *error = NULL; > + const char *device = qdict_get_str(qdict, "device"); > + > + qmp_block_job_resume(device, &error); > + > + hmp_handle_error(mon, error); > +} > + > +void hmp_block_job_complete(Monitor *mon, const QDict *qdict) > +{ > + Error *error = NULL; > + const char *device = qdict_get_str(qdict, "device"); > + > + qmp_block_job_complete(device, &error); > + > + hmp_handle_error(mon, error); > +} > diff --git a/include/block/block-hmp-commands.h b/include/block/block-hmp-commands.h > index fcaf753118..ea6578a5f6 100644 > --- a/include/block/block-hmp-commands.h > +++ b/include/block/block-hmp-commands.h > @@ -11,4 +11,10 @@ void hmp_drive_del(Monitor *mon, const QDict *qdict); > void hmp_drive_mirror(Monitor *mon, const QDict *qdict); > void hmp_drive_backup(Monitor *mon, const QDict *qdict); > > +void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict); > +void hmp_block_job_cancel(Monitor *mon, const QDict *qdict); > +void hmp_block_job_pause(Monitor *mon, const QDict *qdict); > +void hmp_block_job_resume(Monitor *mon, const QDict *qdict); > +void hmp_block_job_complete(Monitor *mon, const QDict *qdict); > + > #endif > diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h > index c1b363ee57..592ce0ccfe 100644 > --- a/include/monitor/hmp.h > +++ b/include/monitor/hmp.h > @@ -87,11 +87,6 @@ void hmp_eject(Monitor *mon, const QDict *qdict); > void hmp_change(Monitor *mon, const QDict *qdict); > void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict); > void hmp_block_stream(Monitor *mon, const QDict *qdict); > -void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict); > -void hmp_block_job_cancel(Monitor *mon, const QDict *qdict); > -void hmp_block_job_pause(Monitor *mon, const QDict *qdict); > -void hmp_block_job_resume(Monitor *mon, const QDict *qdict); > -void hmp_block_job_complete(Monitor *mon, const QDict *qdict); > void hmp_migrate(Monitor *mon, const QDict *qdict); > void hmp_device_add(Monitor *mon, const QDict *qdict); > void hmp_device_del(Monitor *mon, const QDict *qdict); > diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c > index a70bcb1d16..996ce96430 100644 > --- a/monitor/hmp-cmds.c > +++ b/monitor/hmp-cmds.c > @@ -1975,58 +1975,6 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict) > hmp_handle_error(mon, error); > } > > -void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict) > -{ > - Error *error = NULL; > - const char *device = qdict_get_str(qdict, "device"); > - int64_t value = qdict_get_int(qdict, "speed"); > - > - qmp_block_job_set_speed(device, value, &error); > - > - hmp_handle_error(mon, error); > -} > - > -void hmp_block_job_cancel(Monitor *mon, const QDict *qdict) > -{ > - Error *error = NULL; > - const char *device = qdict_get_str(qdict, "device"); > - bool force = qdict_get_try_bool(qdict, "force", false); > - > - qmp_block_job_cancel(device, true, force, &error); > - > - hmp_handle_error(mon, error); > -} > - > -void hmp_block_job_pause(Monitor *mon, const QDict *qdict) > -{ > - Error *error = NULL; > - const char *device = qdict_get_str(qdict, "device"); > - > - qmp_block_job_pause(device, &error); > - > - hmp_handle_error(mon, error); > -} > - > -void hmp_block_job_resume(Monitor *mon, const QDict *qdict) > -{ > - Error *error = NULL; > - const char *device = qdict_get_str(qdict, "device"); > - > - qmp_block_job_resume(device, &error); > - > - hmp_handle_error(mon, error); > -} > - > -void hmp_block_job_complete(Monitor *mon, const QDict *qdict) > -{ > - Error *error = NULL; > - const char *device = qdict_get_str(qdict, "device"); > - > - qmp_block_job_complete(device, &error); > - > - hmp_handle_error(mon, error); > -} > - > typedef struct HMPMigrationStatus > { > QEMUTimer *timer; > -- > 2.17.2 > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
* Maxim Levitsky (mlevitsk@redhat.com) wrote: > Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> > --- > block/monitor/block-hmp-cmds.c | 52 ++++++++++++++++++++++++++++++ > include/block/block-hmp-commands.h | 6 ++++ > include/monitor/hmp.h | 5 --- > monitor/hmp-cmds.c | 52 ------------------------------ > 4 files changed, 58 insertions(+), 57 deletions(-) > > diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c > index ae3890aaab..ed3c350143 100644 > --- a/block/monitor/block-hmp-cmds.c > +++ b/block/monitor/block-hmp-cmds.c > @@ -228,3 +228,55 @@ void hmp_drive_backup(Monitor *mon, const QDict *qdict) > qmp_drive_backup(&backup, &err); > hmp_handle_error(mon, err); > } > + > +void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict) > +{ > + Error *error = NULL; > + const char *device = qdict_get_str(qdict, "device"); > + int64_t value = qdict_get_int(qdict, "speed"); > + > + qmp_block_job_set_speed(device, value, &error); > + > + hmp_handle_error(mon, error); > +} > + > +void hmp_block_job_cancel(Monitor *mon, const QDict *qdict) > +{ > + Error *error = NULL; > + const char *device = qdict_get_str(qdict, "device"); > + bool force = qdict_get_try_bool(qdict, "force", false); > + > + qmp_block_job_cancel(device, true, force, &error); > + > + hmp_handle_error(mon, error); > +} > + > +void hmp_block_job_pause(Monitor *mon, const QDict *qdict) > +{ > + Error *error = NULL; > + const char *device = qdict_get_str(qdict, "device"); > + > + qmp_block_job_pause(device, &error); > + > + hmp_handle_error(mon, error); > +} > + > +void hmp_block_job_resume(Monitor *mon, const QDict *qdict) > +{ > + Error *error = NULL; > + const char *device = qdict_get_str(qdict, "device"); > + > + qmp_block_job_resume(device, &error); > + > + hmp_handle_error(mon, error); > +} > + > +void hmp_block_job_complete(Monitor *mon, const QDict *qdict) > +{ > + Error *error = NULL; > + const char *device = qdict_get_str(qdict, "device"); > + > + qmp_block_job_complete(device, &error); > + > + hmp_handle_error(mon, error); > +} > diff --git a/include/block/block-hmp-commands.h b/include/block/block-hmp-commands.h > index fcaf753118..ea6578a5f6 100644 > --- a/include/block/block-hmp-commands.h > +++ b/include/block/block-hmp-commands.h > @@ -11,4 +11,10 @@ void hmp_drive_del(Monitor *mon, const QDict *qdict); > void hmp_drive_mirror(Monitor *mon, const QDict *qdict); > void hmp_drive_backup(Monitor *mon, const QDict *qdict); > > +void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict); > +void hmp_block_job_cancel(Monitor *mon, const QDict *qdict); > +void hmp_block_job_pause(Monitor *mon, const QDict *qdict); > +void hmp_block_job_resume(Monitor *mon, const QDict *qdict); > +void hmp_block_job_complete(Monitor *mon, const QDict *qdict); > + > #endif > diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h > index c1b363ee57..592ce0ccfe 100644 > --- a/include/monitor/hmp.h > +++ b/include/monitor/hmp.h > @@ -87,11 +87,6 @@ void hmp_eject(Monitor *mon, const QDict *qdict); > void hmp_change(Monitor *mon, const QDict *qdict); > void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict); > void hmp_block_stream(Monitor *mon, const QDict *qdict); > -void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict); > -void hmp_block_job_cancel(Monitor *mon, const QDict *qdict); > -void hmp_block_job_pause(Monitor *mon, const QDict *qdict); > -void hmp_block_job_resume(Monitor *mon, const QDict *qdict); > -void hmp_block_job_complete(Monitor *mon, const QDict *qdict); > void hmp_migrate(Monitor *mon, const QDict *qdict); > void hmp_device_add(Monitor *mon, const QDict *qdict); > void hmp_device_del(Monitor *mon, const QDict *qdict); > diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c > index a70bcb1d16..996ce96430 100644 > --- a/monitor/hmp-cmds.c > +++ b/monitor/hmp-cmds.c > @@ -1975,58 +1975,6 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict) > hmp_handle_error(mon, error); > } > > -void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict) > -{ > - Error *error = NULL; > - const char *device = qdict_get_str(qdict, "device"); > - int64_t value = qdict_get_int(qdict, "speed"); > - > - qmp_block_job_set_speed(device, value, &error); > - > - hmp_handle_error(mon, error); > -} > - > -void hmp_block_job_cancel(Monitor *mon, const QDict *qdict) > -{ > - Error *error = NULL; > - const char *device = qdict_get_str(qdict, "device"); > - bool force = qdict_get_try_bool(qdict, "force", false); > - > - qmp_block_job_cancel(device, true, force, &error); > - > - hmp_handle_error(mon, error); > -} > - > -void hmp_block_job_pause(Monitor *mon, const QDict *qdict) > -{ > - Error *error = NULL; > - const char *device = qdict_get_str(qdict, "device"); > - > - qmp_block_job_pause(device, &error); > - > - hmp_handle_error(mon, error); > -} > - > -void hmp_block_job_resume(Monitor *mon, const QDict *qdict) > -{ > - Error *error = NULL; > - const char *device = qdict_get_str(qdict, "device"); > - > - qmp_block_job_resume(device, &error); > - > - hmp_handle_error(mon, error); > -} > - > -void hmp_block_job_complete(Monitor *mon, const QDict *qdict) > -{ > - Error *error = NULL; > - const char *device = qdict_get_str(qdict, "device"); > - > - qmp_block_job_complete(device, &error); > - > - hmp_handle_error(mon, error); > -} > - > typedef struct HMPMigrationStatus > { > QEMUTimer *timer; > -- > 2.17.2 > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index ae3890aaab..ed3c350143 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -228,3 +228,55 @@ void hmp_drive_backup(Monitor *mon, const QDict *qdict) qmp_drive_backup(&backup, &err); hmp_handle_error(mon, err); } + +void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict) +{ + Error *error = NULL; + const char *device = qdict_get_str(qdict, "device"); + int64_t value = qdict_get_int(qdict, "speed"); + + qmp_block_job_set_speed(device, value, &error); + + hmp_handle_error(mon, error); +} + +void hmp_block_job_cancel(Monitor *mon, const QDict *qdict) +{ + Error *error = NULL; + const char *device = qdict_get_str(qdict, "device"); + bool force = qdict_get_try_bool(qdict, "force", false); + + qmp_block_job_cancel(device, true, force, &error); + + hmp_handle_error(mon, error); +} + +void hmp_block_job_pause(Monitor *mon, const QDict *qdict) +{ + Error *error = NULL; + const char *device = qdict_get_str(qdict, "device"); + + qmp_block_job_pause(device, &error); + + hmp_handle_error(mon, error); +} + +void hmp_block_job_resume(Monitor *mon, const QDict *qdict) +{ + Error *error = NULL; + const char *device = qdict_get_str(qdict, "device"); + + qmp_block_job_resume(device, &error); + + hmp_handle_error(mon, error); +} + +void hmp_block_job_complete(Monitor *mon, const QDict *qdict) +{ + Error *error = NULL; + const char *device = qdict_get_str(qdict, "device"); + + qmp_block_job_complete(device, &error); + + hmp_handle_error(mon, error); +} diff --git a/include/block/block-hmp-commands.h b/include/block/block-hmp-commands.h index fcaf753118..ea6578a5f6 100644 --- a/include/block/block-hmp-commands.h +++ b/include/block/block-hmp-commands.h @@ -11,4 +11,10 @@ void hmp_drive_del(Monitor *mon, const QDict *qdict); void hmp_drive_mirror(Monitor *mon, const QDict *qdict); void hmp_drive_backup(Monitor *mon, const QDict *qdict); +void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict); +void hmp_block_job_cancel(Monitor *mon, const QDict *qdict); +void hmp_block_job_pause(Monitor *mon, const QDict *qdict); +void hmp_block_job_resume(Monitor *mon, const QDict *qdict); +void hmp_block_job_complete(Monitor *mon, const QDict *qdict); + #endif diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index c1b363ee57..592ce0ccfe 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -87,11 +87,6 @@ void hmp_eject(Monitor *mon, const QDict *qdict); void hmp_change(Monitor *mon, const QDict *qdict); void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict); void hmp_block_stream(Monitor *mon, const QDict *qdict); -void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict); -void hmp_block_job_cancel(Monitor *mon, const QDict *qdict); -void hmp_block_job_pause(Monitor *mon, const QDict *qdict); -void hmp_block_job_resume(Monitor *mon, const QDict *qdict); -void hmp_block_job_complete(Monitor *mon, const QDict *qdict); void hmp_migrate(Monitor *mon, const QDict *qdict); void hmp_device_add(Monitor *mon, const QDict *qdict); void hmp_device_del(Monitor *mon, const QDict *qdict); diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index a70bcb1d16..996ce96430 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -1975,58 +1975,6 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, error); } -void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict) -{ - Error *error = NULL; - const char *device = qdict_get_str(qdict, "device"); - int64_t value = qdict_get_int(qdict, "speed"); - - qmp_block_job_set_speed(device, value, &error); - - hmp_handle_error(mon, error); -} - -void hmp_block_job_cancel(Monitor *mon, const QDict *qdict) -{ - Error *error = NULL; - const char *device = qdict_get_str(qdict, "device"); - bool force = qdict_get_try_bool(qdict, "force", false); - - qmp_block_job_cancel(device, true, force, &error); - - hmp_handle_error(mon, error); -} - -void hmp_block_job_pause(Monitor *mon, const QDict *qdict) -{ - Error *error = NULL; - const char *device = qdict_get_str(qdict, "device"); - - qmp_block_job_pause(device, &error); - - hmp_handle_error(mon, error); -} - -void hmp_block_job_resume(Monitor *mon, const QDict *qdict) -{ - Error *error = NULL; - const char *device = qdict_get_str(qdict, "device"); - - qmp_block_job_resume(device, &error); - - hmp_handle_error(mon, error); -} - -void hmp_block_job_complete(Monitor *mon, const QDict *qdict) -{ - Error *error = NULL; - const char *device = qdict_get_str(qdict, "device"); - - qmp_block_job_complete(device, &error); - - hmp_handle_error(mon, error); -} - typedef struct HMPMigrationStatus { QEMUTimer *timer;
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> --- block/monitor/block-hmp-cmds.c | 52 ++++++++++++++++++++++++++++++ include/block/block-hmp-commands.h | 6 ++++ include/monitor/hmp.h | 5 --- monitor/hmp-cmds.c | 52 ------------------------------ 4 files changed, 58 insertions(+), 57 deletions(-)