[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 06/14] qapi: add SIZE type parser to string_inpu
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [RFC PATCH 06/14] qapi: add SIZE type parser to string_input_visitor |
Date: |
Wed, 11 Dec 2013 13:19:13 +0100 |
From: Igor Mammedov <address@hidden>
Signed-off-by: Igor Mammedov <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
qapi/string-input-visitor.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c
index 8f1bc41..a152f5d 100644
--- a/qapi/string-input-visitor.c
+++ b/qapi/string-input-visitor.c
@@ -97,6 +97,23 @@ static void parse_type_number(Visitor *v, double *obj, const
char *name,
*obj = val;
}
+static void parse_type_size(Visitor *v, uint64_t *obj, const char *name,
+ Error **errp)
+{
+ StringInputVisitor *siv = DO_UPCAST(StringInputVisitor, visitor, v);
+ int64_t val;
+ char *endp;
+
+ val = strtosz_suffix(siv->string ? siv->string : "", &endp,
+ STRTOSZ_DEFSUFFIX_B);
+ if (val < 0 || *endp != '\0') {
+ error_set(errp, QERR_INVALID_PARAMETER_VALUE, name,
+ "a size value representible as a non-negative int64");
+ return;
+ }
+ *obj = val;
+}
+
static void parse_start_optional(Visitor *v, bool *present,
const char *name, Error **errp)
{
@@ -131,6 +148,7 @@ StringInputVisitor *string_input_visitor_new(const char
*str)
v->visitor.type_bool = parse_type_bool;
v->visitor.type_str = parse_type_str;
v->visitor.type_number = parse_type_number;
+ v->visitor.type_size = parse_type_size;
v->visitor.start_optional = parse_start_optional;
v->string = str;
--
1.8.4.2
- [Qemu-devel] [RFC PATCH 00/14] Common base for memory hotplug and NUMA policy work, Paolo Bonzini, 2013/12/11
- [Qemu-devel] [RFC PATCH 01/14] NUMA: move numa related code to new file numa.c, Paolo Bonzini, 2013/12/11
- [Qemu-devel] [RFC PATCH 02/14] NUMA: check if the total numa memory size is equal to ram_size, Paolo Bonzini, 2013/12/11
- [Qemu-devel] [RFC PATCH 03/14] NUMA: Add numa_info structure to contain numa nodes info, Paolo Bonzini, 2013/12/11
- [Qemu-devel] [RFC PATCH 04/14] NUMA: convert -numa option to use OptsVisitor, Paolo Bonzini, 2013/12/11
- [Qemu-devel] [RFC PATCH 05/14] NUMA: expand MAX_NODES from 64 to 128, Paolo Bonzini, 2013/12/11
- [Qemu-devel] [RFC PATCH 06/14] qapi: add SIZE type parser to string_input_visitor,
Paolo Bonzini <=
- [Qemu-devel] [RFC PATCH 07/14] QemuOpts: introduce qemu_find_opts_singleton, Paolo Bonzini, 2013/12/11
- [Qemu-devel] [RFC PATCH 08/14] vl: convert -m to QemuOpts, Paolo Bonzini, 2013/12/11
- [Qemu-devel] [RFC PATCH 09/14] qom: fix leak for objects created with -object, Paolo Bonzini, 2013/12/11
- [Qemu-devel] [RFC PATCH 10/14] qom: catch errors in object_property_add_child, Paolo Bonzini, 2013/12/11
- [Qemu-devel] [RFC PATCH 11/14] pc: pass QEMUMachineInitArgs to pc_memory_init, Paolo Bonzini, 2013/12/11
- [Qemu-devel] [RFC PATCH 12/14] numa: introduce memory_region_allocate_system_memory, Paolo Bonzini, 2013/12/11
- [Qemu-devel] [RFC PATCH 13/14] add memdev backend infrastructure, Paolo Bonzini, 2013/12/11