From nobody Sat Apr 27 05:35:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529311442797320.49229906866276; Mon, 18 Jun 2018 01:44:02 -0700 (PDT) Received: from localhost ([::1]:33477 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUplZ-0007OB-U8 for importer@patchew.org; Mon, 18 Jun 2018 04:44:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59759) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUpiA-0005ZX-Q6 for qemu-devel@nongnu.org; Mon, 18 Jun 2018 04:40:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fUpi8-0000JZ-9d for qemu-devel@nongnu.org; Mon, 18 Jun 2018 04:40:30 -0400 Received: from mail-db5eur01on0097.outbound.protection.outlook.com ([104.47.2.97]:43712 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fUpi7-0000FC-Qq for qemu-devel@nongnu.org; Mon, 18 Jun 2018 04:40:28 -0400 Received: from xantnef-ws.sw.ru (195.214.232.6) by AM6PR08MB3351.eurprd08.prod.outlook.com (2603:10a6:209:48::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.19; Mon, 18 Jun 2018 08:40:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZZ4cSfo97dZGW+0wYaoKI/OXzsUUIDVavN3tLKUtVFE=; b=iB0FINgWZCGXzNizjBqTe7nMungZQVwc4M1nTuMAp7phoAg497oP7tBQ22kg7UlkuRLMJFjY6/m9LQ7tsZLeoNfW3gMfkXjfgAHIYRUlh0tTXB/Sx1rq6ROmxq2vxWaQ8MyqwGad+QSiieIuU7CfAYXqlkIInMfsxRJxkZ0GujI= From: Anton Nefedov To: qemu-devel@nongnu.org Date: Mon, 18 Jun 2018 11:40:05 +0300 Message-Id: <1529311206-76847-2-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529311206-76847-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1529311206-76847-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0802CA0006.eurprd08.prod.outlook.com (2603:10a6:3:bd::16) To AM6PR08MB3351.eurprd08.prod.outlook.com (2603:10a6:209:48::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7fce3e7c-c1fa-4494-7ceb-08d5d4f721ea X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(711020)(2017052603328)(7153060)(7193020); SRVR:AM6PR08MB3351; X-Microsoft-Exchange-Diagnostics: 1; AM6PR08MB3351; 3:v+DtDIQMFysAWk2utUPf6CMa8OPQ0RO20P6IEWaKANRarwjDRuI41AZ7kIILgxnqL3FVwF31kXN2H78rT70B8q1mF44IqzsVpq75OQeawV+sWcaEwXP2f0c2f0vWDO5/99HZfys6ZCZ6BAaYwJjvACSYstvIUOCZk0gxPIXyC6xH3JBn1a9xAp9UZSL2FODIbcVU/11P9sAMZcE5pmCk9zNkfmv74MHiyrRfZHfwDiG2hRHY5Gep83a5sZOA/iEN; 25:vqjbGyX07flK0v2AwJH3JM9ZhHvHiFWbicZ4Rnsu3k95bQxbQtXG7moEBJZ/q7I50CIHi2I5ohiwwJvudgo9Y0NFXEUAsdqT3nkPljuFlaLrMXet/QQtD7/kxgVdkS6VkbGGvwfOmtvVqnNsQuWxh3vdUL3Fnt9MeY9NRP17JH5KdNIgaPwlAeKLETxrQyIGupbr1QA3C82c9E6HYTHUB0gLMr3oIbqh5Pf8ZsLujAuZPzr9bB/QTwkUFK96nwkWj7FLjAHBRxzsieqyJip8eu+jQncpYpjgWs+h10oqIYmGi4MtMip4kBvTqe4TSzQmD/sSZiR3qbtsul500k1Evw==; 31:9nWINJX0oeTpkXh/fZ8rFyZ4vw5dJjbomVguiZTRJXTQ5Rds72OmAi7nCDT8H9UDtItOYd1J43ulX/XbU53L83wtwVICAcV2pi67t0sbtPwB3pt9KKIxXlCLul/GxE8q0kiP/asBneoougDLs0jb+iTuzUDbHakOsr7kdT3+9R/NIzTsHe0srb9MW7Hm6Fp0mN+idUvSSyTYbOtaBKzFqLWOyf+7CLAUhajjQ1WvJMI= X-MS-TrafficTypeDiagnostic: AM6PR08MB3351: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; X-Microsoft-Exchange-Diagnostics: 1; AM6PR08MB3351; 20:XuGuilu7YVOhGfc9vyeeUNiivypZ5kMfDpfMkukK/j6GibYhcVVxJMJd8wwtO6ttVP5mswRwtGBX6Tb0TLM660iI3m1XjQ+qYPjSMmxmBF5txpncq5iZbUL2U5Sjzl04M6dOHMgaW62Bjnx/O77yAGZjrjrwYfX9F33XnYihaqaGhST7Ry1FqeaK1b4eFZcqP7cA6bgUcFRMSbPpe8G/Ucl2eev5aApX6hvZxn/fiwIARajOQNLFhrp0LAA4dnEKR5kg67Ypu5VqtUs7rmosi9ouGJpMkiSf8O0aqhDYd0v6tLTvS18cfKMEsImm+cR0AzsbQYX1XO/12QYWdHNLkcl5hdZGhcbWaS9fMf9XsjuugBp8rBAYQ10YaolfF1syBPovCVDjTdkiscPfRpyV8aCSdQCKKbf3LW0X7DhNVWGHsovrrpfFTpg/PqD0vtfW5Rkkem+LIVOfMi56tBCiIfyhqlo3lACxxlYE9QBha2Jrbg47vFgteXyPVxaVG9TU; 4:4XT4h2+9lnHEYQLOEN352quDu2Ur/9mg03MsJoE6gy/0351q7pCoKC0hlPhPODEY9ziKo+UXEH01tl1mwSSBlvzIknvyJGWT+cJM8CiklGjtLE5bMFm/+aQ+aWrbb5/gMJkL/xvczsvm+RHECO9qvEQk/ib5/c+FlnhXwDrtJIAHx1olx0tPSTLPBDhdFfPA+m66X04c9siKsjDNCGUc0u04iIOXl6g8o6hRS2IB3vIfC/RA7znWkSNUjlMlYubHqud+wv9zxZhb7Zf1uNtNLA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231254)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:AM6PR08MB3351; BCL:0; PCL:0; RULEID:; SRVR:AM6PR08MB3351; X-Forefront-PRVS: 0707248B64 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(366004)(39840400004)(376002)(346002)(396003)(39380400002)(189003)(199004)(16526019)(316002)(106356001)(11346002)(48376002)(956004)(2616005)(6512007)(2351001)(476003)(53416004)(8936002)(6486002)(4326008)(305945005)(97736004)(186003)(86362001)(26005)(25786009)(50226002)(575784001)(16586007)(69596002)(6116002)(3846002)(2906002)(55236004)(6666003)(47776003)(6506007)(105586002)(386003)(81166006)(66066001)(478600001)(107886003)(81156014)(44832011)(51416003)(50466002)(53936002)(6916009)(486006)(59450400001)(68736007)(8676002)(5660300001)(446003)(2361001)(36756003)(76176011)(52116002)(7736002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM6PR08MB3351; H:xantnef-ws.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; 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; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM6PR08MB3351; 23:idGSZSLfOWl3UAQOV4vfIK84jBm6TXI5NWnNeyUWI?= =?us-ascii?Q?80Ych6cjnubzNi/wVPBEpns6jUCwi9fpFK0Q/AnY8ZSTteqMuNUV+nTPKHkr?= =?us-ascii?Q?j0MYCDkXIBKV7jhh/wuAC65lDJGiyulOvP2Fm+Jx/2vZzoX1AmCUEkegnJ1z?= =?us-ascii?Q?oRpwrgsJLf+I4mKFxqciqvWQf7/qpS12UtUDHvNMXdpUkhe7EoHVW2qLYHdj?= =?us-ascii?Q?t9ga5NsgVLTKk/15OLk1cZSsiQu5EmkwUffFtVgxeGWbTXJDL1D+U9ni02u6?= =?us-ascii?Q?Sj0ZhhfVHtehw6VIWJHU5DnvHt1nObQ6jXoDoxDKvR3yp2U159UwLdrXJ2dG?= =?us-ascii?Q?ROZURmY4dcbLy38yxtdRgiO1sf9tl1c3KEaoVJJ1Pzb1W4bTYLAhPY5uGgm0?= =?us-ascii?Q?n2fi6unh8RDh1R6wUaxbMGOv41u9SiL6YAxUGCHmoUi5GX0e6OaeV+DSJI6A?= =?us-ascii?Q?rnYH1LncrFCr31yMdJr91Qhh/xNRlZb5/H8P2ai9aQXQnlffoXwkkbvvbgTg?= =?us-ascii?Q?4NaChiGBsZLQlLjlze80mloyIlEbTGGtoClLWhlMG9dyh2w8l8kB+O4QUIqz?= =?us-ascii?Q?f0L7XZR9DTPfLxj0H/kEtnG05qCgCRuY999Uz4k1wVnb8iN2W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ft-Exchange-Diagnostics: 1; AM6PR08MB3351; 7:c1GUEWSpUC82O2fIMQdC/rcqnqEMPUuRd1PGKMwIZes0PzJai/a5wu7oTmx4M9HrAS91baHOBuOXFKWN50HQ/briv09oWgL1RZp7SJxvpV17AmvWKbdFfvq1+q3GW00gxJI8DQTbhP+h4toHK36lCEURU5k4gNQ79dsSmMq4lvgcX6+RJDXslOvUKCQKnFMudUi5GJbgAoXQvyJWOtmcU+jDQzHnh0oGnFS5igLUbFrefnMin8AoHrn6EzOiAdZY; 20:SBwUcMBn3/hZPU3JaAxzVKmHFugIjTuknF8HoclbY5+qZdD6TDvo45/WBKMEl5Cdjo5cGjaoljBClk9EsSFJ9FuQEFmgUkqMVW7f8oXpESNkKAvW6McnE4mmOixBxC8SmK4Gq4j5jzaMYQJApnehtThX0KEG+OTSzixL2uRpqOQ= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2018 08:40:22.9896 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7fce3e7c-c1fa-4494-7ceb-08d5d4f721ea X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3351 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.2.97 Subject: [Qemu-devel] [PATCH v5 1/2] qapi: allow empty branches in flat unions 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: Anton Nefedov , armbru@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" It often happens that just a few discriminator values imply extra data in a flat union. Existing checks did not make possible to leave other values uncovered. Such cases had to be worked around by either stating a dummy (empty) type or introducing another (subset) discriminator enumeration. Both options create redundant entities in qapi files for little profit. With this patch it is not necessary anymore to add designated union fields for every possible value of a discriminator enumeration. Signed-off-by: Anton Nefedov Reviewed-by: Markus Armbruster --- docs/devel/qapi-code-gen.txt | 8 +++++--- tests/qapi-schema/flat-union-incomplete-branch.json | 9 --------- tests/qapi-schema/qapi-schema-test.json | 6 ++++-- scripts/qapi/common.py | 15 ++++++++------- scripts/qapi/types.py | 2 ++ scripts/qapi/visit.py | 19 ++++++++++++++---= -- tests/Makefile.include | 1 - tests/qapi-schema/flat-union-incomplete-branch.err | 1 - tests/qapi-schema/flat-union-incomplete-branch.exit | 1 - tests/qapi-schema/flat-union-incomplete-branch.out | 0 tests/qapi-schema/qapi-schema-test.out | 3 ++- 11 files changed, 35 insertions(+), 30 deletions(-) delete mode 100644 tests/qapi-schema/flat-union-incomplete-branch.json delete mode 100644 tests/qapi-schema/flat-union-incomplete-branch.err delete mode 100644 tests/qapi-schema/flat-union-incomplete-branch.exit delete mode 100644 tests/qapi-schema/flat-union-incomplete-branch.out diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt index 1366228..88a70e4 100644 --- a/docs/devel/qapi-code-gen.txt +++ b/docs/devel/qapi-code-gen.txt @@ -496,9 +496,11 @@ Resulting in these JSON objects: =20 Notice that in a flat union, the discriminator name is controlled by the user, but because it must map to a base member with enum type, the -code generator can ensure that branches exist for all values of the -enum (although the order of the keys need not match the declaration of -the enum). In the resulting generated C data types, a flat union is +code generator ensures that branches match the existing values of the +enum. The order of the keys need not match the declaration of the enum. +The keys need not cover all possible enum values. Omitted enum values +are still valid branches that add no additional members to the data type. +In the resulting generated C data types, a flat union is represented as a struct with the base members included directly, and then a union of structures for each branch of the struct. =20 diff --git a/tests/qapi-schema/flat-union-incomplete-branch.json b/tests/qa= pi-schema/flat-union-incomplete-branch.json deleted file mode 100644 index 25a411b..0000000 --- a/tests/qapi-schema/flat-union-incomplete-branch.json +++ /dev/null @@ -1,9 +0,0 @@ -# we require all branches of the union to be covered -{ 'enum': 'TestEnum', - 'data': [ 'value1', 'value2' ] } -{ 'struct': 'TestTypeA', - 'data': { 'string': 'str' } } -{ 'union': 'TestUnion', - 'base': { 'type': 'TestEnum' }, - 'discriminator': 'type', - 'data': { 'value1': 'TestTypeA' } } diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qa= pi-schema-test.json index 46c7282..7b59817 100644 --- a/tests/qapi-schema/qapi-schema-test.json +++ b/tests/qapi-schema/qapi-schema-test.json @@ -39,7 +39,7 @@ '*enum1': 'EnumOne' } } # intentional forward reference =20 { 'enum': 'EnumOne', - 'data': [ 'value1', 'value2', 'value3' ] } + 'data': [ 'value1', 'value2', 'value3', 'value4' ] } =20 { 'struct': 'UserDefZero', 'data': { 'integer': 'int' } } @@ -76,7 +76,9 @@ 'discriminator': 'enum1', 'data': { 'value1' : 'UserDefA', 'value2' : 'UserDefB', - 'value3' : 'UserDefB' } } + 'value3' : 'UserDefB' + # 'value4' defaults to empty + } } =20 { 'struct': 'UserDefUnionBase', 'base': 'UserDefZero', diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index 2462fc0..4b53f08 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -779,13 +779,6 @@ def check_union(expr, info): "enum '%s'" % (key, enum_define['enum'])) =20 - # If discriminator is user-defined, ensure all values are covered - if enum_define: - for value in enum_define['data']: - if value not in members.keys(): - raise QAPISemError(info, "Union '%s' data missing '%s' bra= nch" - % (name, value)) - =20 def check_alternate(expr, info): name =3D expr['alternate'] @@ -1357,6 +1350,14 @@ class QAPISchemaObjectTypeVariants(object): self.tag_member =3D seen[c_name(self._tag_name)] assert self._tag_name =3D=3D self.tag_member.name assert isinstance(self.tag_member.type, QAPISchemaEnumType) + if self._tag_name: # flat union + # branches that are not explicitly covered get an empty type + cases =3D set([v.name for v in self.variants]) + for val in self.tag_member.type.values: + if val.name not in cases: + v =3D QAPISchemaObjectTypeVariant(val.name, 'q_empty') + v.set_owner(self.tag_member.owner) + self.variants.append(v) for v in self.variants: v.check(schema) # Union names must match enum values; alternate names are diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py index 64d9c0f..a599352 100644 --- a/scripts/qapi/types.py +++ b/scripts/qapi/types.py @@ -125,6 +125,8 @@ def gen_variants(variants): c_name=3Dc_name(variants.tag_member.name)) =20 for var in variants.variants: + if var.type.name =3D=3D 'q_empty': + continue ret +=3D mcgen(''' %(c_type)s %(c_name)s; ''', diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py index 5d72d89..60ae8cf 100644 --- a/scripts/qapi/visit.py +++ b/scripts/qapi/visit.py @@ -81,15 +81,24 @@ void visit_type_%(c_name)s_members(Visitor *v, %(c_name= )s *obj, Error **errp) c_name=3Dc_name(variants.tag_member.name)) =20 for var in variants.variants: - ret +=3D mcgen(''' + case_str =3D c_enum_const(variants.tag_member.type.name, + var.name, + variants.tag_member.type.prefix) + if var.type.name =3D=3D 'q_empty': + # valid variant and nothing to do + ret +=3D mcgen(''' + case %(case)s: + break; +''', + case=3Dcase_str) + else: + ret +=3D mcgen(''' case %(case)s: visit_type_%(c_type)s_members(v, &obj->u.%(c_name)s, &err); break; ''', - case=3Dc_enum_const(variants.tag_member.type.name, - var.name, - variants.tag_member.type.prefix= ), - c_type=3Dvar.type.c_name(), c_name=3Dc_name(var.n= ame)) + case=3Dcase_str, + c_type=3Dvar.type.c_name(), c_name=3Dc_name(v= ar.name)) =20 ret +=3D mcgen(''' default: diff --git a/tests/Makefile.include b/tests/Makefile.include index ca91da2..114aab7 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -498,7 +498,6 @@ qapi-schema +=3D flat-union-base-any.json qapi-schema +=3D flat-union-base-union.json qapi-schema +=3D flat-union-clash-member.json qapi-schema +=3D flat-union-empty.json -qapi-schema +=3D flat-union-incomplete-branch.json qapi-schema +=3D flat-union-inline.json qapi-schema +=3D flat-union-int-branch.json qapi-schema +=3D flat-union-invalid-branch-key.json diff --git a/tests/qapi-schema/flat-union-incomplete-branch.err b/tests/qap= i-schema/flat-union-incomplete-branch.err deleted file mode 100644 index e826bf0..0000000 --- a/tests/qapi-schema/flat-union-incomplete-branch.err +++ /dev/null @@ -1 +0,0 @@ -tests/qapi-schema/flat-union-incomplete-branch.json:6: Union 'TestUnion' d= ata missing 'value2' branch diff --git a/tests/qapi-schema/flat-union-incomplete-branch.exit b/tests/qa= pi-schema/flat-union-incomplete-branch.exit deleted file mode 100644 index d00491f..0000000 --- a/tests/qapi-schema/flat-union-incomplete-branch.exit +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests/qapi-schema/flat-union-incomplete-branch.out b/tests/qap= i-schema/flat-union-incomplete-branch.out deleted file mode 100644 index e69de29..0000000 diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qap= i-schema-test.out index 542a19c..0dbcdaf 100644 --- a/tests/qapi-schema/qapi-schema-test.out +++ b/tests/qapi-schema/qapi-schema-test.out @@ -23,7 +23,7 @@ object UserDefOne base UserDefZero member string: str optional=3DFalse member enum1: EnumOne optional=3DTrue -enum EnumOne ['value1', 'value2', 'value3'] +enum EnumOne ['value1', 'value2', 'value3', 'value4'] object UserDefZero member integer: int optional=3DFalse object UserDefTwoDictDict @@ -52,6 +52,7 @@ object UserDefFlatUnion case value1: UserDefA case value2: UserDefB case value3: UserDefB + case value4: q_empty object UserDefUnionBase base UserDefZero member string: str optional=3DFalse --=20 2.7.4 From nobody Sat Apr 27 05:35:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529311343490790.7843660635941; Mon, 18 Jun 2018 01:42:23 -0700 (PDT) Received: from localhost ([::1]:33468 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUpjq-0006EY-32 for importer@patchew.org; Mon, 18 Jun 2018 04:42:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59757) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUpiA-0005ZV-PZ for qemu-devel@nongnu.org; Mon, 18 Jun 2018 04:40:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fUpi8-0000K5-QI for qemu-devel@nongnu.org; Mon, 18 Jun 2018 04:40:30 -0400 Received: from mail-db5eur01on0097.outbound.protection.outlook.com ([104.47.2.97]:43712 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fUpi8-0000FC-Eg for qemu-devel@nongnu.org; Mon, 18 Jun 2018 04:40:28 -0400 Received: from xantnef-ws.sw.ru (195.214.232.6) by AM6PR08MB3351.eurprd08.prod.outlook.com (2603:10a6:209:48::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.19; Mon, 18 Jun 2018 08:40:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CFpEbwjmT2HYWe6FYW1K3WdGoilAFc101GjIonRSk/o=; b=D/3wVE4G4rbVe056d0ARaG707iXIG6v7iR1j/6GZGgkWCgzXJ2q1mXcOiHly3TAhH13keX0CaHCbAbPZ8P9E6v2msrjMSc1fsuSsgUAqdDW5RssJ1EANgsR1rqDrsS8u9L+OFBz0F614xqeszTkdoYx39gsw6e1sqEMHzXX8d18= From: Anton Nefedov To: qemu-devel@nongnu.org Date: Mon, 18 Jun 2018 11:40:06 +0300 Message-Id: <1529311206-76847-3-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529311206-76847-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1529311206-76847-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0802CA0006.eurprd08.prod.outlook.com (2603:10a6:3:bd::16) To AM6PR08MB3351.eurprd08.prod.outlook.com (2603:10a6:209:48::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 96359349-5ee7-4d1b-3884-08d5d4f72255 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(711020)(2017052603328)(7153060)(7193020); SRVR:AM6PR08MB3351; X-Microsoft-Exchange-Diagnostics: 1; AM6PR08MB3351; 3:jALq8trLjzB4Ukv60UPLLfRk1X19djJcIqxWjd/N48+/tmTtjkK1VmBSezL9ctiSmpUkCzRPGJn9F+CWdpJcg8u6w/n4BpoT1nMvRbCdjkKSZkM3m1uEU4s6QGLQyChz8bYAF4zeKPdQp9ANPb+yxVEW7K3QjzgnoqHSO51nEogEVseJaa7tQ7AVj5A9D56EOtKtjgEFfjCYl1bGsxU1KkcWhzsyPDJG9c3ezusk3X40YJ/Dnt2QIwXfjphXvhWH; 25:THUkvqS4X1nRuFqoLiiSCvMEu9IHGRKJYYb40pPDQHeSkxDniLuL66BGV/pg2gKNiiFFXHuZgq/zCEXuY3UmNTRE8mw+JjZR+c5kGEaeheOedaCKK/wgrWGz7YLA94I+dSDnsk5RCXyHCJ9EpRubANyts7m+p8SLil/JzNyQW1Jslcx/g1yrggZQF/BvWSkM+42nFJD1+fR6qvNBjS6cHkUhhLIOrmcrTLPaN/t3AdUHOB7DocG193FcuFs67oVG+nc2gli+hyLgCXZYXtPw7TRgHQ7RO42VZzPbjQy/jlbsSiZZOcTfSFj1inZJaDCBg75kucpqbrF46Zlyp+Qsng==; 31:9qZfXQRQpagUH1EFkY4/q9tfyxDtZkjYeSVvBYkXZuWzc/gPn53+sHEj0vQjo+5LslJRpkndN9ThGlx9K4XnqTHPtRhBAiY/SjW/fTIovEe5Qvmo8ndvr/mzX1Y3Z8HTwBqy8QShNV4zEXuyXj6pvWw1rFTyVWSCe8MNE8Qu1PSnGI722pYHNrRUozUpLDHahEh5SMnD/m1uWGcWz6Ysdr4qldsD/5SYkKVNBgAjXvk= X-MS-TrafficTypeDiagnostic: AM6PR08MB3351: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; X-Microsoft-Exchange-Diagnostics: 1; AM6PR08MB3351; 20:iF7C3AHB8PYxXlHKOn8A7NycozdIU7WHB2bsrZ87kchWefD4kNIcNZWKIImQYOXSMddBN0oBXTM1sNEW4h8sepPkH/ACTBm4P/WC0IdHY5K8xVq80p/ffYRzD0hX43hkHaOizGB8FosFBaGmaLJMly6sdftQZ5Bn60F6cXqUbtnAqEmlCoo/NWu9JMhAvx+nOxsaTwyXi1H4GduHo0E6AIEIts8jZBII17HEvzE8LopJhrxlaI00YRIPDWotWmSTqUeIzy4KoEaAMAIsmpXwIb/8MXurRW3t9e4ts7sh++2bEVwR5tXEzS1CA/iMycTJqZ3VYlsRbDEuBWGhNU94Bp5fkTLw5TBrFpa5vf8u42AJlAz8WvAXCSk6lAaWPE/WHtV4v7nAJkMs/fEVc07LbOGlISBdQWd4jWg6soUatvJQMytcnIF6s8pTJJxBBMUbeokfti05n2iIDfnqi7jPSTjQJMclw8IBrkrhrN+XphgxNNmarU3KhZsz3wHKeP7O; 4:2/BGrUGcOYXf84p4+HWj0RSuizfkg6C0E1ToXC4LM7q5HLTxKJ8x3+ylJQoJTIB0sf9aG0r5zNrayhQfXXAVQnEmuuKeRXmPnck+j4Jsb5rBx0xHEiyhmMtQYeWu8+f+uzULutrAYspL3F6Fl9lBptgA9Yd+vBOdTtH8IbG6Td1HFCR+DQQvzrLHqfL9AUPtb98QmN3LGFk2Z7LRBuvpwQMROMMgjiFlx5+p7BWmvYMmY5TMlrIMOqXMDnipVZcN57NGZyZDYaEH4gtkehudTQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231254)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:AM6PR08MB3351; BCL:0; PCL:0; RULEID:; SRVR:AM6PR08MB3351; X-Forefront-PRVS: 0707248B64 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(366004)(39840400004)(376002)(346002)(396003)(39380400002)(189003)(199004)(16526019)(316002)(106356001)(11346002)(48376002)(956004)(2616005)(6512007)(2351001)(476003)(53416004)(8936002)(6486002)(4326008)(305945005)(97736004)(186003)(86362001)(26005)(25786009)(50226002)(16586007)(69596002)(6116002)(3846002)(2906002)(55236004)(6666003)(47776003)(6506007)(105586002)(386003)(81166006)(66066001)(478600001)(107886003)(81156014)(44832011)(51416003)(50466002)(53936002)(6916009)(486006)(59450400001)(68736007)(8676002)(5660300001)(446003)(2361001)(36756003)(76176011)(52116002)(7736002)(357404004); DIR:OUT; SFP:1102; SCL:1; SRVR:AM6PR08MB3351; H:xantnef-ws.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; 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; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM6PR08MB3351; 23:2JUAbSXDZSDzHNs5s64fFb/rnJre0eJ4ZEOC/g1Sp?= =?us-ascii?Q?w0wW3ZYLAjGBDTH8OoQh0seBp8kOzdg7lXPzh38MtiCw1V5+wPWN0I50o81i?= =?us-ascii?Q?Zo1yuenUPfmjv1EFH+z8q4ZG3fCwSjcDvcVCEM4AYRi9PLePXaJikSWVuXuO?= =?us-ascii?Q?7NbnIDeDyqmLRIOflUzZU7LCRCg6LjsM177D70c82Tznn8WvII1To8v/Z5tP?= =?us-ascii?Q?Oh6boeAJ0tCqxcJKYBkJEvXUo3PELDBa0BQgEKcMJGfafVho7Oz8AKP52qHh?= =?us-ascii?Q?SdKTSep40ZOkKfSSXne64SlQdh52wSbf+sUrtnHZkoFwCtvNi5eY6nNv6yfd?= =?us-ascii?Q?9U9+VVeV5b9DiEwDQBn4GnO2zYVpcemo3eLx1oYg2iCgC5r0axwlLB8ICsfO?= =?us-ascii?Q?ewzsNBmbjFYLtQpcTvWkG4vUY3CODIIbeUl2bUNmxZUsHC+uCUH4kZ7/55x7?= =?us-ascii?Q?/QmIBwcLBIEqBTrTWt0ERkObSojzJPQzVdbL6MNI0NCdo/Aut31hASRBEnED?= =?us-ascii?Q?bW8+KwjyFhba/vEbL640yEtbYeuDtLpARmBLi8ncUWsyHnBpXJ0E4Ze5K7fw?= =?us-ascii?Q?pNPskeV/ZhQNNfLMedfTXzaoKPkbZHr5B4572QEmMQgshONs2mkbjiMgvVYe?= =?us-ascii?Q?1AV3icOOitw+xbsGKMXdktXlZe+28Cll0MpWOzy0+VrKkd/DK+5arYNncvv0?= =?us-ascii?Q?OCNutMTPADIDBwG5Ja2ygxOVKIkYFVXtXOVot0lDw8DHVMYD+2BO6cMKvesT?= =?us-ascii?Q?GyQht0VdrqTBB6tAl/27c5oDH332lVGSIkvG2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QmTUXCw== X-Microsoft-Exchange-Diagnostics: 1; AM6PR08MB3351; 6:L27VRK3fidXycCnPMblnkx2x4HraLKlrBBPcwEZW8EaQjW0VTKCclTXuSZMInnnP/akfY/X8UY5RO8weRVaSLL13cIWnemCtNppwlW3U/LyLxLgKnRvi4sHN9V45FFlKk4O7on7sM4s5sJc0PvRWnhUtlvkari0T3kjLJ6uItYwqJvZuKDfbVupnARyGPm04/ywycn5OSHnGpeEXag21vfv2LPOEDrIFatd+/FCla5GCBgpOz7YzGAXJ68PtCFsfhz9DPA5SAPoTjQFv6yKob2I9FdA1f5HpY+Nx6V/Gs5Xda34F5FhKA0RDoOQCJfiJ3w0urEgMZgo7ZBWwE/1RWrm56dY7aNrFYKMgsjOyqRmTvbqXv/AEPfdMWhvDYMZtVuXSMoi/AZkW0DRJfsJ8uKZkE3iBQPjYPQ5WrN24kjC3FJp1ZXe5eWtA4V/fzNf3kuJ2RALRq6l0rqgK1aqXrw==; 5:P2YV18uL8u4kr/5EEwoXJvQBkPC0nSjY97wjNEDO/tB2BMGwfGwMFukc0LtQuaXCxiCjwr1k3OoY68DdianQbIxIW2nihEzopv8o6bbLSj057M/VAbyUC4+bdAgwTPkr3pEbqXAqvqLfDUKc2lfh8TxeGyUmkb9bra92zFFtrkw=; 24:5mM+Gy+v9fYbKlhuAR9qLGIrn6ECLn39gxfmza4x8GF1Ub1LnLyYJjP21G6MrwdhqcNRKSdolr2VNvUss1UaSp6rwCJ6Dv4S7GszRXqcpxE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM6PR08MB3351; 7:D4FOmEdWLHSAziy2CMAKngPIpRbZClKcNcHr3EQoiaZBQavGYgGjin3RlsbcuhOVn6tGbSYxOhpxlSgqw4GQP7KYrUBiv2d54mIHj+mIxKhlUVXcbt2j816Yka7z2RSaxrC4YIhgO+se6En7idMirMPaId8isjFHNsT7pEg4PvoAfhowi+tO8X49vetp/uDz3HrgNBNDL/mBY5C9QNsj0vsuu9EGjV+y4vTMbxb2F6jf/8RgigbxWXFAxFmSwtMl; 20:1e74QcyGpybRgPf47s9kIfZmRhfQDGzkpI9zN84zuPo7leiZT9eG9iGXKq7X5rsZoe/e6+oRSkjKZQN3UK/VsBwaEEa61Nu9PvxuIWyqcO6M1KpQHu6srL0IM5kWAYz/+avann362Zm9Oo9nSYTOg8wx41KWkHuKOSMZ6GPXT54= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2018 08:40:23.6881 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 96359349-5ee7-4d1b-3884-08d5d4f72255 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3351 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.2.97 Subject: [Qemu-devel] [PATCH v5 2/2] qapi: remove empty flat union branches and 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: Anton Nefedov , armbru@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Flat unions may now have uncovered branches, so it is possible to get rid of empty types defined for that purpose only. Signed-off-by: Anton Nefedov Reviewed-by: Markus Armbruster --- qapi/block-core.json | 52 +++---------------------------------------------= ---- qapi/crypto.json | 13 +------------ qapi/misc.json | 46 ++-------------------------------------------- qapi/net.json | 12 ------------ qapi/ui.json | 19 +------------------ block/qcow2.c | 1 - cpus.c | 2 -- 7 files changed, 7 insertions(+), 138 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index ab629d1..23c88f5 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -52,8 +52,7 @@ { 'union': 'ImageInfoSpecificQCow2Encryption', 'base': 'ImageInfoSpecificQCow2EncryptionBase', 'discriminator': 'format', - 'data': { 'aes': 'QCryptoBlockInfoQCow', - 'luks': 'QCryptoBlockInfoLUKS' } } + 'data': { 'luks': 'QCryptoBlockInfoLUKS' } } =20 ## # @ImageInfoSpecificQCow2: @@ -2853,16 +2852,6 @@ 'hash': 'str' }} =20 ## -# @SshHostKeyDummy: -# -# For those union branches that don't need additional fields. -# -# Since: 2.12 -## -{ 'struct': 'SshHostKeyDummy', - 'data': {} } - -## # @SshHostKeyCheck: # # Since: 2.12 @@ -2870,9 +2859,7 @@ { 'union': 'SshHostKeyCheck', 'base': { 'mode': 'SshHostKeyCheckMode' }, 'discriminator': 'mode', - 'data': { 'none': 'SshHostKeyDummy', - 'hash': 'SshHostKeyHash', - 'known_hosts': 'SshHostKeyDummy' } } + 'data': { 'hash': 'SshHostKeyHash' } } =20 ## # @BlockdevOptionsSsh: @@ -4051,15 +4038,6 @@ '*force-size': 'bool' } } =20 ## -# @BlockdevCreateNotSupported: -# -# This is used for all drivers that don't support creating images. -# -# Since: 2.12 -## -{ 'struct': 'BlockdevCreateNotSupported', 'data': {}} - -## # @BlockdevCreateOptions: # # Options for creating an image format on a given node. @@ -4073,44 +4051,20 @@ 'driver': 'BlockdevDriver' }, 'discriminator': 'driver', 'data': { - 'blkdebug': 'BlockdevCreateNotSupported', - 'blkverify': 'BlockdevCreateNotSupported', - 'bochs': 'BlockdevCreateNotSupported', - 'cloop': 'BlockdevCreateNotSupported', - 'copy-on-read': 'BlockdevCreateNotSupported', - 'dmg': 'BlockdevCreateNotSupported', 'file': 'BlockdevCreateOptionsFile', - 'ftp': 'BlockdevCreateNotSupported', - 'ftps': 'BlockdevCreateNotSupported', 'gluster': 'BlockdevCreateOptionsGluster', - 'host_cdrom': 'BlockdevCreateNotSupported', - 'host_device': 'BlockdevCreateNotSupported', - 'http': 'BlockdevCreateNotSupported', - 'https': 'BlockdevCreateNotSupported', - 'iscsi': 'BlockdevCreateNotSupported', 'luks': 'BlockdevCreateOptionsLUKS', - 'nbd': 'BlockdevCreateNotSupported', 'nfs': 'BlockdevCreateOptionsNfs', - 'null-aio': 'BlockdevCreateNotSupported', - 'null-co': 'BlockdevCreateNotSupported', - 'nvme': 'BlockdevCreateNotSupported', 'parallels': 'BlockdevCreateOptionsParallels', 'qcow': 'BlockdevCreateOptionsQcow', 'qcow2': 'BlockdevCreateOptionsQcow2', 'qed': 'BlockdevCreateOptionsQed', - 'quorum': 'BlockdevCreateNotSupported', - 'raw': 'BlockdevCreateNotSupported', 'rbd': 'BlockdevCreateOptionsRbd', - 'replication': 'BlockdevCreateNotSupported', 'sheepdog': 'BlockdevCreateOptionsSheepdog', 'ssh': 'BlockdevCreateOptionsSsh', - 'throttle': 'BlockdevCreateNotSupported', 'vdi': 'BlockdevCreateOptionsVdi', 'vhdx': 'BlockdevCreateOptionsVhdx', - 'vmdk': 'BlockdevCreateNotSupported', - 'vpc': 'BlockdevCreateOptionsVpc', - 'vvfat': 'BlockdevCreateNotSupported', - 'vxhs': 'BlockdevCreateNotSupported' + 'vpc': 'BlockdevCreateOptionsVpc' } } =20 ## diff --git a/qapi/crypto.json b/qapi/crypto.json index 288bc05..a51b434 100644 --- a/qapi/crypto.json +++ b/qapi/crypto.json @@ -297,16 +297,6 @@ 'uuid': 'str', 'slots': [ 'QCryptoBlockInfoLUKSSlot' ] }} =20 -## -# @QCryptoBlockInfoQCow: -# -# Information about the QCow block encryption options -# -# Since: 2.7 -## -{ 'struct': 'QCryptoBlockInfoQCow', - 'data': { }} - =20 ## # @QCryptoBlockInfo: @@ -318,5 +308,4 @@ { 'union': 'QCryptoBlockInfo', 'base': 'QCryptoBlockInfoBase', 'discriminator': 'format', - 'data': { 'qcow': 'QCryptoBlockInfoQCow', - 'luks': 'QCryptoBlockInfoLUKS' } } + 'data': { 'luks': 'QCryptoBlockInfoLUKS' } } diff --git a/qapi/misc.json b/qapi/misc.json index f83a63a..39f4dc1 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -395,8 +395,7 @@ 'mips': 'CpuInfoMIPS', 'tricore': 'CpuInfoTricore', 's390': 'CpuInfoS390', - 'riscv': 'CpuInfoRISCV', - 'other': 'CpuInfoOther' } } + 'riscv': 'CpuInfoRISCV' } } =20 ## # @CpuInfoX86: @@ -467,16 +466,6 @@ { 'struct': 'CpuInfoRISCV', 'data': { 'pc': 'int' } } =20 ## -# @CpuInfoOther: -# -# No additional information is available about the virtual CPU -# -# Since: 2.6 -# -## -{ 'struct': 'CpuInfoOther', 'data': { } } - -## # @CpuS390State: # # An enumeration of cpu states that can be assumed by a virtual @@ -577,38 +566,7 @@ 'arch' : 'CpuInfoArch', 'target' : 'SysEmuTarget' }, 'discriminator' : 'target', - 'data' : { 'aarch64' : 'CpuInfoOther', - 'alpha' : 'CpuInfoOther', - 'arm' : 'CpuInfoOther', - 'cris' : 'CpuInfoOther', - 'hppa' : 'CpuInfoOther', - 'i386' : 'CpuInfoOther', - 'lm32' : 'CpuInfoOther', - 'm68k' : 'CpuInfoOther', - 'microblaze' : 'CpuInfoOther', - 'microblazeel' : 'CpuInfoOther', - 'mips' : 'CpuInfoOther', - 'mips64' : 'CpuInfoOther', - 'mips64el' : 'CpuInfoOther', - 'mipsel' : 'CpuInfoOther', - 'moxie' : 'CpuInfoOther', - 'nios2' : 'CpuInfoOther', - 'or1k' : 'CpuInfoOther', - 'ppc' : 'CpuInfoOther', - 'ppc64' : 'CpuInfoOther', - 'ppcemb' : 'CpuInfoOther', - 'riscv32' : 'CpuInfoOther', - 'riscv64' : 'CpuInfoOther', - 's390x' : 'CpuInfoS390', - 'sh4' : 'CpuInfoOther', - 'sh4eb' : 'CpuInfoOther', - 'sparc' : 'CpuInfoOther', - 'sparc64' : 'CpuInfoOther', - 'tricore' : 'CpuInfoOther', - 'unicore32' : 'CpuInfoOther', - 'x86_64' : 'CpuInfoOther', - 'xtensa' : 'CpuInfoOther', - 'xtensaeb' : 'CpuInfoOther' } } + 'data' : { 's390x' : 'CpuInfoS390' } } =20 ## # @query-cpus-fast: diff --git a/qapi/net.json b/qapi/net.json index 6b7d93c..c86f351 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -89,16 +89,6 @@ { 'command': 'netdev_del', 'data': {'id': 'str'} } =20 ## -# @NetdevNoneOptions: -# -# Use it alone to have zero network devices. -# -# Since: 1.2 -## -{ 'struct': 'NetdevNoneOptions', - 'data': { } } - -## # @NetLegacyNicOptions: # # Create a new Network Interface Card. @@ -477,7 +467,6 @@ 'base': { 'id': 'str', 'type': 'NetClientDriver' }, 'discriminator': 'type', 'data': { - 'none': 'NetdevNoneOptions', 'nic': 'NetLegacyNicOptions', 'user': 'NetdevUserOptions', 'tap': 'NetdevTapOptions', @@ -530,7 +519,6 @@ 'base': { 'type': 'NetLegacyOptionsType' }, 'discriminator': 'type', 'data': { - 'none': 'NetdevNoneOptions', 'nic': 'NetLegacyNicOptions', 'user': 'NetdevUserOptions', 'tap': 'NetdevTapOptions', diff --git a/qapi/ui.json b/qapi/ui.json index fc18a05..f48d2a0 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -996,17 +996,6 @@ =20 =20 ## -# @DisplayNoOpts: -# -# Empty struct for displays without config options. -# -# Since: 2.12 -# -## -{ 'struct' : 'DisplayNoOpts', - 'data' : { } } - -## # @DisplayGTK: # # GTK display options. @@ -1068,10 +1057,4 @@ '*window-close' : 'bool', '*gl' : 'DisplayGLMode' }, 'discriminator' : 'type', - 'data' : { 'default' : 'DisplayNoOpts', - 'none' : 'DisplayNoOpts', - 'gtk' : 'DisplayGTK', - 'sdl' : 'DisplayNoOpts', - 'egl-headless' : 'DisplayNoOpts', - 'curses' : 'DisplayNoOpts', - 'cocoa' : 'DisplayNoOpts' } } + 'data' : { 'gtk' : 'DisplayGTK' } } diff --git a/block/qcow2.c b/block/qcow2.c index 945132f..a3a3aa2 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -4166,7 +4166,6 @@ static ImageInfoSpecific *qcow2_get_specific_info(Blo= ckDriverState *bs) switch (encrypt_info->format) { case Q_CRYPTO_BLOCK_FORMAT_QCOW: qencrypt->format =3D BLOCKDEV_QCOW2_ENCRYPTION_FORMAT_AES; - qencrypt->u.aes =3D encrypt_info->u.qcow; break; case Q_CRYPTO_BLOCK_FORMAT_LUKS: qencrypt->format =3D BLOCKDEV_QCOW2_ENCRYPTION_FORMAT_LUKS; diff --git a/cpus.c b/cpus.c index d1f1629..19c5d37 100644 --- a/cpus.c +++ b/cpus.c @@ -2273,8 +2273,6 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp) info->value->target =3D target; if (target =3D=3D SYS_EMU_TARGET_S390X) { cpustate_to_cpuinfo_s390(&info->value->u.s390x, cpu); - } else { - /* do nothing for @CpuInfoOther */ } =20 if (!cur_item) { --=20 2.7.4