From nobody Fri May 3 21:36:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490014693901495.9017345038959; Mon, 20 Mar 2017 05:58:13 -0700 (PDT) Received: from localhost ([::1]:32818 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpwt2-00019i-Gh for importer@patchew.org; Mon, 20 Mar 2017 08:58:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44465) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpwqs-00004v-2c for qemu-devel@nongnu.org; Mon, 20 Mar 2017 08:55:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cpwqr-0005L5-4e for qemu-devel@nongnu.org; Mon, 20 Mar 2017 08:55:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46286) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cpwql-0005Cr-QA; Mon, 20 Mar 2017 08:55:51 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 16E3AC0094C4; Mon, 20 Mar 2017 12:55:51 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D151F71D59; Mon, 20 Mar 2017 12:55:50 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 4D8ED113864A; Mon, 20 Mar 2017 13:55:48 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 16E3AC0094C4 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 16E3AC0094C4 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 20 Mar 2017 13:55:44 +0100 Message-Id: <1490014548-15083-2-git-send-email-armbru@redhat.com> In-Reply-To: <1490014548-15083-1-git-send-email-armbru@redhat.com> References: <1490014548-15083-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 20 Mar 2017 12:55:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.9 1/5] test-keyval: Tweaks to improve list coverage X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We have a negative test case for a list index with leading zero. Add positive ones. Tweak the test case for list index greater or equal the number of elements: test "equal" instead of "greater" to guard against off-by-one mistakes. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- tests/test-keyval.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test-keyval.c b/tests/test-keyval.c index 71288b0..e97f6d5 100644 --- a/tests/test-keyval.c +++ b/tests/test-keyval.c @@ -218,14 +218,14 @@ static void test_keyval_parse_list(void) QDECREF(qdict); =20 /* Multiple indexes, last one wins */ - qdict =3D keyval_parse("list.1=3Dgoner,list.0=3Dnull,list.1=3Deins,lis= t.2=3Dzwei", + qdict =3D keyval_parse("list.1=3Dgoner,list.0=3Dnull,list.01=3Deins,li= st.2=3Dzwei", NULL, &error_abort); g_assert_cmpint(qdict_size(qdict), =3D=3D, 1); check_list012(qdict_get_qlist(qdict, "list")); QDECREF(qdict); =20 /* List at deeper nesting */ - qdict =3D keyval_parse("a.list.1=3Deins,a.list.0=3Dnull,a.list.2=3Dzwe= i", + qdict =3D keyval_parse("a.list.1=3Deins,a.list.00=3Dnull,a.list.2=3Dzw= ei", NULL, &error_abort); g_assert_cmpint(qdict_size(qdict), =3D=3D, 1); sub_qdict =3D qdict_get_qdict(qdict, "a"); @@ -242,7 +242,7 @@ static void test_keyval_parse_list(void) g_assert(!qdict); =20 /* Missing list indexes */ - qdict =3D keyval_parse("list.2=3Dlonely", NULL, &err); + qdict =3D keyval_parse("list.1=3Dlonely", NULL, &err); error_free_or_abort(&err); g_assert(!qdict); qdict =3D keyval_parse("list.0=3Dnull,list.2=3Deins,list.02=3Dzwei", N= ULL, &err); --=20 2.7.4 From nobody Fri May 3 21:36:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490015073577989.8054486772623; Mon, 20 Mar 2017 06:04:33 -0700 (PDT) Received: from localhost ([::1]:32889 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpwzA-0005t9-7i for importer@patchew.org; Mon, 20 Mar 2017 09:04:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpwqs-00005s-TI for qemu-devel@nongnu.org; Mon, 20 Mar 2017 08:56:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cpwqr-0005Mb-MM for qemu-devel@nongnu.org; Mon, 20 Mar 2017 08:55:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53022) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cpwql-0005Cq-Q0; Mon, 20 Mar 2017 08:55:51 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 186464DD7D; Mon, 20 Mar 2017 12:55:51 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D236B62931; Mon, 20 Mar 2017 12:55:50 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 4E7CF113864D; Mon, 20 Mar 2017 13:55:48 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 186464DD7D Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 186464DD7D From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 20 Mar 2017 13:55:45 +0100 Message-Id: <1490014548-15083-3-git-send-email-armbru@redhat.com> In-Reply-To: <1490014548-15083-1-git-send-email-armbru@redhat.com> References: <1490014548-15083-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 20 Mar 2017 12:55:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.9 2/5] keyval: Improve some comments X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- util/keyval.c | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/util/keyval.c b/util/keyval.c index f646b36..46cd540 100644 --- a/util/keyval.c +++ b/util/keyval.c @@ -21,22 +21,36 @@ * * Semantics defined by reduction to JSON: * - * key-vals is a tree of objects and arrays rooted at object R - * where for each key-val =3D key-fragment . ... =3D val in key-vals - * R op key-fragment op ... =3D val' - * where (left-associative) op is - * array subscript L[key-fragment] for numeric key-fragment - * member reference L.key-fragment otherwise - * val' is val with ',,' replaced by ',' - * and only R may be empty. + * key-vals specifies a JSON object, i.e. a tree whose root is an + * object, inner nodes other than the root are objects or arrays, + * and leaves are strings. * - * Duplicate keys are permitted; all but the last one are ignored. + * Each key-val =3D key-fragment '.' ... '=3D' val specifies a path from + * root to a leaf (left of '=3D'), and the leaf's value (right of + * '=3D'). * - * The equations must have a solution. Counter-example: a.b=3D1,a=3D2 - * doesn't have one, because R.a must be an object to satisfy a.b=3D1 - * and a string to satisfy a=3D2. + * A path from the root is defined recursively: + * L '.' key-fragment is a child of the node denoted by path L + * key-fragment is a child of the tree root + * If key-fragment is numeric, the parent is an array and the child + * is its key-fragment-th member, counting from zero. + * Else, the parent is an object, and the child is its member named + * key-fragment. * - * Key-fragments must be valid QAPI names or consist only of digits. + * This constrains inner nodes to be either array or object. The + * constraints must be satisfiable. Counter-example: a.b=3D1,a=3D2 is + * not, because root.a must be an object to satisfy a.b=3D1 and a + * string to satisfy a=3D2. + * + * Array subscripts can occur in any order, but the set of + * subscripts must not have gaps. For instance, a.1=3Dv is not okay, + * because root.a[0] is missing. + * + * If multiple key-val denote the same leaf, the last one determines + * the value. + * + * Key-fragments must be valid QAPI names or consist only of decimal + * digits. * * The length of any key-fragment must be between 1 and 127. * @@ -64,8 +78,8 @@ =20 /* * Convert @key to a list index. - * Convert all leading digits to a (non-negative) number, capped at - * INT_MAX. + * Convert all leading decimal digits to a (non-negative) number, + * capped at INT_MAX. * If @end is non-null, assign a pointer to the first character after * the number to *@end. * Else, fail if any characters follow. @@ -337,7 +351,8 @@ static QObject *keyval_listify(QDict *cur, GSList *key_= of_cur, Error **errp) } =20 /* - * Make a list from @elt[], reporting any missing elements. + * Make a list from @elt[], reporting the first missing element, + * if any. * If we dropped an index >=3D nelt in the previous loop, this loop * will run into the sentinel and report index @nelt missing. */ --=20 2.7.4 From nobody Fri May 3 21:36:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 149001491952046.0829428152407; Mon, 20 Mar 2017 06:01:59 -0700 (PDT) Received: from localhost ([::1]:32865 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpwwg-000464-1m for importer@patchew.org; Mon, 20 Mar 2017 09:01:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpwqs-00005d-Kl for qemu-devel@nongnu.org; Mon, 20 Mar 2017 08:55:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cpwqr-0005Lp-Bm for qemu-devel@nongnu.org; Mon, 20 Mar 2017 08:55:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46292) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cpwql-0005D1-Q5; Mon, 20 Mar 2017 08:55:52 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41BB1C0094CE; Mon, 20 Mar 2017 12:55:51 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D3AA089F6D; Mon, 20 Mar 2017 12:55:50 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 51C661138650; Mon, 20 Mar 2017 13:55:48 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 41BB1C0094CE Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 41BB1C0094CE From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 20 Mar 2017 13:55:46 +0100 Message-Id: <1490014548-15083-4-git-send-email-armbru@redhat.com> In-Reply-To: <1490014548-15083-1-git-send-email-armbru@redhat.com> References: <1490014548-15083-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 20 Mar 2017 12:55:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.9 3/5] test-keyval: Cover alternate and 'any' type X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- tests/Makefile.include | 2 +- tests/test-keyval.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 402e71c..86f9490 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -736,7 +736,7 @@ tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o= $(test-util-obj-y) \ $(chardev-obj-y) tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_s= cm_helper.o tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o $(test-util-obj-y) -tests/test-keyval$(EXESUF): tests/test-keyval.o $(test-util-obj-y) +tests/test-keyval$(EXESUF): tests/test-keyval.o $(test-util-obj-y) $(test-= qapi-obj-y) tests/test-write-threshold$(EXESUF): tests/test-write-threshold.o $(test-b= lock-obj-y) tests/test-netfilter$(EXESUF): tests/test-netfilter.o $(qtest-obj-y) tests/test-filter-mirror$(EXESUF): tests/test-filter-mirror.o $(qtest-obj-= y) diff --git a/tests/test-keyval.c b/tests/test-keyval.c index e97f6d5..ba19560 100644 --- a/tests/test-keyval.c +++ b/tests/test-keyval.c @@ -14,6 +14,7 @@ #include "qapi/error.h" #include "qapi/qmp/qstring.h" #include "qapi/qobject-input-visitor.h" +#include "test-qapi-visit.h" #include "qemu/cutils.h" #include "qemu/option.h" =20 @@ -608,6 +609,56 @@ static void test_keyval_visit_optional(void) visit_free(v); } =20 +static void test_keyval_visit_alternate(void) +{ + Error *err =3D NULL; + Visitor *v; + QDict *qdict; + AltNumStr *ans; + AltNumInt *ani; + + /* + * Can't do scalar alternate variants other than string. You get + * the string variant if there is one, else an error. + */ + qdict =3D keyval_parse("a=3D1,b=3D2", NULL, &error_abort); + v =3D qobject_input_visitor_new_keyval(QOBJECT(qdict)); + QDECREF(qdict); + visit_start_struct(v, NULL, NULL, 0, &error_abort); + visit_type_AltNumStr(v, "a", &ans, &error_abort); + g_assert_cmpint(ans->type, =3D=3D, QTYPE_QSTRING); + g_assert_cmpstr(ans->u.s, =3D=3D, "1"); + visit_type_AltNumInt(v, "a", &ani, &err); + error_free_or_abort(&err); + visit_end_struct(v, NULL); + visit_free(v); +} + +static void test_keyval_visit_any(void) +{ + Visitor *v; + QDict *qdict; + QObject *any; + QList *qlist; + QString *qstr; + + qdict =3D keyval_parse("a.0=3Dnull,a.1=3D1", NULL, &error_abort); + v =3D qobject_input_visitor_new_keyval(QOBJECT(qdict)); + QDECREF(qdict); + visit_start_struct(v, NULL, NULL, 0, &error_abort); + visit_type_any(v, "a", &any, &error_abort); + qlist =3D qobject_to_qlist(any); + g_assert(qlist); + qstr =3D qobject_to_qstring(qlist_pop(qlist)); + g_assert_cmpstr(qstring_get_str(qstr), =3D=3D, "null"); + qstr =3D qobject_to_qstring(qlist_pop(qlist)); + g_assert_cmpstr(qstring_get_str(qstr), =3D=3D, "1"); + g_assert(qlist_empty(qlist)); + visit_check_struct(v, &error_abort); + visit_end_struct(v, NULL); + visit_free(v); +} + int main(int argc, char *argv[]) { g_test_init(&argc, &argv, NULL); @@ -619,6 +670,8 @@ int main(int argc, char *argv[]) g_test_add_func("/keyval/visit/dict", test_keyval_visit_dict); g_test_add_func("/keyval/visit/list", test_keyval_visit_list); g_test_add_func("/keyval/visit/optional", test_keyval_visit_optional); + g_test_add_func("/keyval/visit/alternate", test_keyval_visit_alternate= ); + g_test_add_func("/keyval/visit/any", test_keyval_visit_any); g_test_run(); return 0; } --=20 2.7.4 From nobody Fri May 3 21:36:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490014628061935.6566875728035; Mon, 20 Mar 2017 05:57:08 -0700 (PDT) Received: from localhost ([::1]:32814 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpwry-0000BG-M9 for importer@patchew.org; Mon, 20 Mar 2017 08:57:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44517) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpwqt-00007a-VC for qemu-devel@nongnu.org; Mon, 20 Mar 2017 08:56:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cpwqt-0005O4-4b for qemu-devel@nongnu.org; Mon, 20 Mar 2017 08:55:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57496) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cpwql-0005Cv-Q7; Mon, 20 Mar 2017 08:55:51 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 198CBC04B944; Mon, 20 Mar 2017 12:55:51 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D53C21865C; Mon, 20 Mar 2017 12:55:50 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 54BC11138657; Mon, 20 Mar 2017 13:55:48 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 198CBC04B944 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 198CBC04B944 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 20 Mar 2017 13:55:47 +0100 Message-Id: <1490014548-15083-5-git-send-email-armbru@redhat.com> In-Reply-To: <1490014548-15083-1-git-send-email-armbru@redhat.com> References: <1490014548-15083-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 20 Mar 2017 12:55:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.9 4/5] keyval: Document issues with 'any' and alternate types X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- util/keyval.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/util/keyval.c b/util/keyval.c index 46cd540..93d5db6 100644 --- a/util/keyval.c +++ b/util/keyval.c @@ -61,6 +61,16 @@ * "key absent" already means "optional object/array absent", which * isn't the same as "empty object/array present". * + * Design flaw: scalar values can only be strings; there is no way to + * denote numbers, true, false or null. The special QObject input + * visitor returned by qobject_input_visitor_new_keyval() mostly hides + * this by automatically converting strings to the type the visitor + * expects. Breaks down for alternate types and type 'any', where the + * visitor's expectation isn't clear. Code visiting such types needs + * to do the conversion itself, but only when using this keyval + * visitor. Awkward. Alternate types without a string member don't + * work at all. + * * Additional syntax for use with an implied key: * * key-vals-ik =3D val-no-key [ ',' key-vals ] --=20 2.7.4 From nobody Fri May 3 21:36:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490014802173395.5803415045783; Mon, 20 Mar 2017 06:00:02 -0700 (PDT) Received: from localhost ([::1]:32828 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpwun-0002tF-08 for importer@patchew.org; Mon, 20 Mar 2017 09:00:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44476) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpwqs-00005C-Ak for qemu-devel@nongnu.org; Mon, 20 Mar 2017 08:55:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cpwqr-0005MF-Hf for qemu-devel@nongnu.org; Mon, 20 Mar 2017 08:55:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34307) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cpwqm-0005Db-Ld; Mon, 20 Mar 2017 08:55:52 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 92D9141A41; Mon, 20 Mar 2017 12:55:52 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5DCF71816E; Mon, 20 Mar 2017 12:55:52 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5786311386CE; Mon, 20 Mar 2017 13:55:48 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 92D9141A41 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 92D9141A41 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 20 Mar 2017 13:55:48 +0100 Message-Id: <1490014548-15083-6-git-send-email-armbru@redhat.com> In-Reply-To: <1490014548-15083-1-git-send-email-armbru@redhat.com> References: <1490014548-15083-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 20 Mar 2017 12:55:52 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.9 5/5] MAINTAINERS: Add myself for files I touched recently X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- MAINTAINERS | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index bf1aafb..3f20288 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1218,6 +1218,15 @@ M: Samuel Thibault S: Maintained F: backends/baum.c =20 +Command line option argument parsing +M: Markus Armbruster +S: Supported +F: include/qemu/option.h +F: tests/test-keyval.c +F: tests/test-qemu-opts.c +F: util/keyval.c +F: util/qemu-option.c + Coverity model M: Markus Armbruster S: Supported @@ -1352,7 +1361,9 @@ X: include/qapi/qmp/ F: include/qapi/qmp/dispatch.h F: tests/qapi-schema/ F: tests/test-*-visitor.c +F: tests/test-qapi-*.c F: tests/test-qmp-*.c +F: tests/test-visitor-serialization.c F: scripts/qapi* F: docs/qapi* T: git git://repo.or.cz/qemu/armbru.git qapi-next --=20 2.7.4