[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/18] hmp: Use visitor api for hmp_migrate_set_param
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PULL 03/18] hmp: Use visitor api for hmp_migrate_set_parameter() |
Date: |
Thu, 18 May 2017 19:24:47 +0200 |
We only use it for int64 at this point, I am not able to find a way to
parse an int with MiB units.
Signed-off-by: Juan Quintela <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
---
hmp.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/hmp.c b/hmp.c
index 3dceaf8..83e45c8 100644
--- a/hmp.c
+++ b/hmp.c
@@ -29,6 +29,7 @@
#include "monitor/qdev.h"
#include "qapi/opts-visitor.h"
#include "qapi/qmp/qerror.h"
+#include "qapi/string-input-visitor.h"
#include "qapi/string-output-visitor.h"
#include "qapi/util.h"
#include "qapi-visit.h"
@@ -1524,8 +1525,9 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict
*qdict)
{
const char *param = qdict_get_str(qdict, "parameter");
const char *valuestr = qdict_get_str(qdict, "value");
+ Visitor *v = string_input_visitor_new(valuestr);
uint64_t valuebw = 0;
- long valueint = 0;
+ int64_t valueint = 0;
Error *err = NULL;
bool use_int_value = false;
int i, ret;
@@ -1583,9 +1585,8 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict
*qdict)
}
if (use_int_value) {
- if (qemu_strtol(valuestr, NULL, 10, &valueint) < 0) {
- error_setg(&err, "Unable to parse '%s' as an int",
- valuestr);
+ visit_type_int(v, param, &valueint, &err);
+ if (err) {
goto cleanup;
}
/* Set all integers; only one has_FOO will be set, and
@@ -1609,6 +1610,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict
*qdict)
}
cleanup:
+ visit_free(v);
if (err) {
error_report_err(err);
}
--
2.9.3
- [Qemu-devel] [PULL 00/18] Migration pull request, Juan Quintela, 2017/05/18
- [Qemu-devel] [PULL 01/18] migration: Fix non-multiple of page size migration, Juan Quintela, 2017/05/18
- [Qemu-devel] [PULL 02/18] postcopy: Require RAMBlocks that are whole pages, Juan Quintela, 2017/05/18
- [Qemu-devel] [PULL 03/18] hmp: Use visitor api for hmp_migrate_set_parameter(),
Juan Quintela <=
- [Qemu-devel] [PULL 04/18] migration: Create block capability, Juan Quintela, 2017/05/18
- [Qemu-devel] [PULL 05/18] migration: Remove use of old MigrationParams, Juan Quintela, 2017/05/18
- [Qemu-devel] [PULL 06/18] migration: Remove old MigrationParams, Juan Quintela, 2017/05/18
- [Qemu-devel] [PULL 07/18] block migration: Allow compile time disable, Juan Quintela, 2017/05/18
- [Qemu-devel] [PULL 08/18] migration: Create migration/xbzrle.h, Juan Quintela, 2017/05/18
- [Qemu-devel] [PULL 09/18] migration: Split migration/channel.c for channel operations, Juan Quintela, 2017/05/18
- Re: [Qemu-devel] [PULL 00/18] Migration pull request, Stefan Hajnoczi, 2017/05/19