From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: dgilbert@redhat.com, lvivier@redhat.com, peterx@redhat.com,
eblake@redhat.com, armbru@redhat.com
Subject: [Qemu-devel] [PATCH 1/5] hmp: Use visitor api for hmp_migrate_set_parameter()
Date: Tue, 16 May 2017 13:11:19 +0200 [thread overview]
Message-ID: <20170516111123.17692-2-quintela@redhat.com> (raw)
In-Reply-To: <20170516111123.17692-1-quintela@redhat.com>
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 <quintela@redhat.com>
---
hmp.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/hmp.c b/hmp.c
index b9dd933..acbbc5c 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"
@@ -1523,8 +1524,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;
@@ -1582,9 +1584,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
@@ -1608,6 +1609,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
}
cleanup:
+ visit_free(v);
if (err) {
error_report_err(err);
}
--
2.9.3
next prev parent reply other threads:[~2017-05-16 11:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-16 11:11 [Qemu-devel] [PATCH v4 0/5] Remove old MigrationParams Juan Quintela
2017-05-16 11:11 ` Juan Quintela [this message]
2017-05-16 12:29 ` [Qemu-devel] [PATCH 1/5] hmp: Use visitor api for hmp_migrate_set_parameter() Markus Armbruster
2017-05-16 11:11 ` [Qemu-devel] [PATCH 2/5] migration: Create block capability Juan Quintela
2017-05-16 14:20 ` Markus Armbruster
2017-05-16 14:34 ` Juan Quintela
2017-05-16 16:00 ` Markus Armbruster
2017-05-16 16:08 ` Eric Blake
2017-05-16 16:42 ` Markus Armbruster
2017-05-16 16:48 ` Eric Blake
2017-05-16 17:07 ` Markus Armbruster
2017-05-16 17:37 ` Juan Quintela
2017-05-16 11:11 ` [Qemu-devel] [PATCH 3/5] migration: Remove use of old MigrationParams Juan Quintela
2017-05-16 14:22 ` Markus Armbruster
2017-05-16 14:36 ` Juan Quintela
2017-05-16 15:35 ` Markus Armbruster
2017-05-16 11:11 ` [Qemu-devel] [PATCH 4/5] migration: Remove " Juan Quintela
2017-05-16 11:11 ` [Qemu-devel] [PATCH 5/5] block migration: Allow compile time disable Juan Quintela
-- strict thread matches above, loose matches on Subject: below --
2017-05-17 15:38 [Qemu-devel] [PATCH v5 0/5] Remove old MigrationParams Juan Quintela
2017-05-17 15:38 ` [Qemu-devel] [PATCH 1/5] hmp: Use visitor api for hmp_migrate_set_parameter() Juan Quintela
2017-05-18 11:18 [Qemu-devel] [PATCH 0/5] Remove old MigrationParams Juan Quintela
2017-05-18 11:18 ` [Qemu-devel] [PATCH 1/5] hmp: Use visitor api for hmp_migrate_set_parameter() Juan Quintela
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170516111123.17692-2-quintela@redhat.com \
--to=quintela@redhat.com \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=lvivier@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).