From nobody Fri Mar 29 09:16:43 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 152890542930390.02372053039983; Wed, 13 Jun 2018 08:57:09 -0700 (PDT) Received: from localhost ([::1]:35309 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fT88v-00018L-As for importer@patchew.org; Wed, 13 Jun 2018 11:57:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fT864-0007VC-5h for qemu-devel@nongnu.org; Wed, 13 Jun 2018 11:54:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fT860-0000lJ-I4 for qemu-devel@nongnu.org; Wed, 13 Jun 2018 11:54:08 -0400 Received: from mail-he1eur04on0719.outbound.protection.outlook.com ([2a01:111:f400:fe0d::719]:12324 helo=EUR04-HE1-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 1fT860-0000d6-40 for qemu-devel@nongnu.org; Wed, 13 Jun 2018 11:54:04 -0400 Received: from xantnef-ws.sw.ru (195.214.232.6) by VI1PR08MB3360.eurprd08.prod.outlook.com (2603:10a6:803:3f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.16; Wed, 13 Jun 2018 15:54:01 +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=hZ1APnLVnwSxfRyGNh8a1RgYyA4XRfATTgaNP6I5rrQ=; b=ZIMketcDpG/VSKtBSyV5Quu7LtMD/ceVWZgvSDTb2YXdMEBCTaS5ug0Oyo46qkAB2PZYQG7mXiUpvKA9BKWg5G/ZRHsNtbxTOcNRXrPEUPVWfJaLzf+JaSPZUbpP4Bdip1+lmPJO/98HLi1Bg+Q8AQEuoWDFjKEm1OUmeulugvw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; From: Anton Nefedov To: qemu-devel@nongnu.org Date: Wed, 13 Jun 2018 18:53:47 +0300 Message-Id: <1528905228-25694-2-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528905228-25694-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1528905228-25694-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1P190CA0003.EURP190.PROD.OUTLOOK.COM (2603:10a6:3:bc::13) To VI1PR08MB3360.eurprd08.prod.outlook.com (2603:10a6:803:3f::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 122f4a47-7d04-4d6c-6baf-08d5d145e1f2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:VI1PR08MB3360; X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB3360; 3:PSDVBS8L5l2da6exaYGcCw0BEF8g2YcusDkRcRaZjqIlrOGNVvH/GDFgmTFsJV9x/77LdfrlWG1lIpjKlc6BZxwRgrSTaDIxMWd6e+rw/R7M60FjTQBHxsMlsKQDrmSnPa5V1A8wU5I1MJIwfXzkxeEv1PkZrRMoNhTEp0bywjof4ZL+SymX2jrxSACt1R5R2WnUWcE+ZE8IAX+Nxq9t6L4B9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V4AYP92Richon1VnK131XnkWGApcPxiYz246J3V8OmUF0SKUp1VBsoHMv18/ZwZA8Pk63/D3hQyvkex5ocGU9/dM0zRYt7ceVUbT4+f4TMHWZXbzBCRWXvnD3fCqmEXZP01lWJxTAFxXq; 4:3ZKFU84qkyEacXXM6xgxXYgD/2HKhHh+WUXjwcLDL5u90Bl7ZWQ3BybmuVRjsHKmaJAleHA6fS3O458mCZE5mj+ckg3tGLpvZMLPLzsV8fiL3i4ico1J37t1rhF9K0OqGk/oI/7pfQtEI51Rc12xNIoCEa20TWTwZx65X2AJ5KuXlyVKlIvKnGAPlZDeXf5UuAM9oCh3n+iG0YOEpbtjMAw3FcN8gRrn3WKwLcge1UdIp2qe6nn3LSjfVG7O+XJbLMg8aszf2DJhwNyATxnHlA== 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)(5005006)(8121501046)(3231254)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(149027)(150027)(6041310)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:VI1PR08MB3360; BCL:0; PCL:0; RULEID:; SRVR:VI1PR08MB3360; X-Forefront-PRVS: 07025866F6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39380400002)(396003)(39850400004)(376002)(366004)(346002)(199004)(189003)(5660300001)(446003)(97736004)(956004)(11346002)(81156014)(575784001)(2351001)(7736002)(44832011)(26005)(2616005)(69596002)(2906002)(66066001)(476003)(50226002)(6116002)(8936002)(86362001)(36756003)(3846002)(478600001)(81166006)(6666003)(486006)(6916009)(47776003)(8676002)(316002)(16586007)(55236004)(305945005)(6512007)(68736007)(76176011)(48376002)(6506007)(16526019)(107886003)(53936002)(4326008)(51416003)(25786009)(186003)(6486002)(50466002)(53416004)(52116002)(2361001)(59450400001)(106356001)(105586002)(386003); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR08MB3360; H:xantnef-ws.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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; VI1PR08MB3360; 23:HKhY0Ht3A3ZSZ78HX0BRThNpdOPfnCnXsib7kR2+e?= =?us-ascii?Q?Uhqx4yMCgEljEsO5jjzCKCT0OL3+Set7Lg8y+mVDBYeDQaC6OitzAV/4A/iy?= =?us-ascii?Q?il+KwEIXfX3D/1HfSMgxB6oyc8Ok8iCaAa+NngnTf6zpH/wJ3zpD1JhLhalQ?= =?us-ascii?Q?beUrSkGXi5S9LwwRR+XkVQko7RFWZPVdEuKL0yArtxY9saX8D1qF0ngfbihR?= =?us-ascii?Q?648PFM3eKWS6ubv4EXwfxYdV9u/GZi1SqNjyRDXhQMdH/X3x24Fo3NKTMwla?= =?us-ascii?Q?f0zYPxqWW9vrNza/PM9X2zE9MQi4k+0GDQGgWx/HYukDg4VAN/yHYzd+lyB8?= =?us-ascii?Q?ZtzDoRqX0xdE+umd7YVKTuPza5zMc/XN1471uK6OTmIWBBkvyyDlc7Pt8UVQ?= =?us-ascii?Q?aJegyqa+nRiBsz12I6ahE05DjaKya5SPzc7u1fnqUTNVGgwR/bx6JdP9YCOs?= =?us-ascii?Q?6WIgyvvuyKZQw7A8rcejkHvB9OvTNpAX0VT5irrrhQA8Y9pv41T0RytbUbj7?= =?us-ascii?Q?GXe1oQAfo2+kplhM2RD2xBsPQGGZXcDDmcE1yAT3Ene7sAZ7wvz7nboOB6m2?= =?us-ascii?Q?nRg1cZ0j8+049QTovk1sVqa0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thtv5WnyzSxpcn1dIfBxZPL4PQ/futYx4LegdPaacoVjMvWuGlNWSSISlULQXVBIgnmsce6dFu1vFUMbhCJXssQKebFLuo41uGKbTBPQQ X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB3360; 6:mpYUkWoPWCpf9uEC5rIrQNZ65IKx8r7iMjgz34lDaXHKeu4TgZG6QFMSyvCUfFaEYMQqbm2YxCW/m7EjwrIuWNjrexBZHQj9khQXTu9rL04IGHBz5I5BLYY7O1Pv6P8rJkzrjOMJfvZyNLJi3ZzdNRkSk26EpYSclb9HzoRRbHCUZDqPla0YQcIfK4rjpgnIH/DOPC16SCMut9hYv40feLzOd/leBIdYG82ARcB/Gx1eWpbTaW1W9d1qd88tywnysSryXJsG/IHxoQmTktw/Fw5HzuhKPq+gYISm/5gSkQHkNyP2xqreOFG0t8nfLY85x7ypGY8ZfMn/ABW/mKBvDaRBEfE4t+EoZN+imPidZC8IxTI5n/xyEKHuAa4xNMNzkKXgNMMDIazeRF9SkJ4i63T/mrXjqFrfrwuDeHT5ccvYQmvYMnDgAYBgUrf76ddpoZgF6u0fNauHogskrlo2oA==; 5:lDovHrY61abIyrsC8ZeuGtO5Dlo0OZNIy6XntM6TY9noDs5t2kQeUGR7H550hm3j9eDBpRoYIAHgNciveKOlT21n8WRbhl8WJc8ggNFflwI+Bx7/TnsIqpdOjRfAUlfbeYNcC/dfzQMQgcqnWzFprVZ/pb7q90jSb0I+yf2IwmI=; 24:J4iUeVVOaMkUKnX0n0dznz0NPK6piH8ATE7IrwQxtd/oYSMfScfiPOAZBiA67q72icEW23+lpxuL5XwGwLJsOIYzNFNlEwOTivEF9AGI414= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB3360; 7:cPIDOpNaKUDIrdqUt1ltks1FKuj56/G9WPVN6Xh2fU/A1rMGpiAaEN+bv5whAdRWPrrU8E0G1264k69x+yr3BFCPqMqgNXYoI99YiOMW76uaEd3leHmdBY1yTFx0EWF09afTOulk/6Ej0AiKQBwc+Oleetx6f4PCqCYTP6j9lbHtY/qUu/gZ6EcqzQjtWTpiYvU5V7ko/4RVPxLMshmt/L8wFVb2VaVLT5lqHdyB6G4pzPdV+dPOxkX9BbDa0cMp; 20:YVKRAbYG5K2b1Hbtu6bkjh96/ZbIfsWP63GaFXDadPUWDcSXxWMrYuEESRE7sQfMiggz4w1QXkBxVgW7W1rMPgrEZb5UYuR10U31LuPeDjO6gY+dO7gsFjUyPIIRYUTEYy5u8NXQTC+/Y6w9pvdvfvexg6D5I07Qzflgn1B1a/k= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2018 15:54:01.1749 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 122f4a47-7d04-4d6c-6baf-08d5d145e1f2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3360 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe0d::719 Subject: [Qemu-devel] [PATCH v4 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: Eric Blake --- docs/devel/qapi-code-gen.txt | 8 +++++--- tests/qapi-schema/flat-union-incomplete-branch.json | 9 --------- tests/qapi-schema/qapi-schema-test.json | 4 ++-- scripts/qapi/common.py | 11 ++++------- scripts/qapi/types.py | 4 +++- scripts/qapi/visit.py | 17 +++++++++++++---- 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, 29 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..881b53b 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,7 @@ 'discriminator': 'enum1', 'data': { 'value1' : 'UserDefA', 'value2' : 'UserDefB', - 'value3' : 'UserDefB' } } + 'value3' : 'UserDefB' } } # skip 'value4' =20 { 'struct': 'UserDefUnionBase', 'base': 'UserDefZero', diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index 2462fc0..0f3d89b 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'] @@ -1644,6 +1637,10 @@ class QAPISchema(object): if tag_name: variants =3D [self._make_variant(key, value) for (key, value) in data.items()] + # branches that are not explicitly covered get an empty type + variants +=3D [self._make_variant(key, 'q_empty') + for key in discriminator_find_enum_define(expr)['= data'] + if key not in data.keys()] members =3D [] else: variants =3D [self._make_simple_variant(key, value, info) diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py index 64d9c0f..1fb2b6d 100644 --- a/scripts/qapi/types.py +++ b/scripts/qapi/types.py @@ -124,7 +124,9 @@ def gen_variants(variants): ''', c_name=3Dc_name(variants.tag_member.name)) =20 - for var in variants.variants: + # filter out the empty types + for var in filter(lambda var: var.type.name !=3D 'q_empty', + variants.variants): ret +=3D mcgen(''' %(c_type)s %(c_name)s; ''', diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py index 5d72d89..96bd32c 100644 --- a/scripts/qapi/visit.py +++ b/scripts/qapi/visit.py @@ -81,14 +81,23 @@ 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= ), + case=3Dcase_str, c_type=3Dvar.type.c_name(), c_name=3Dc_name(var.n= ame)) =20 ret +=3D mcgen(''' diff --git a/tests/Makefile.include b/tests/Makefile.include index bb08e37..afdd0db 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -496,7 +496,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 Fri Mar 29 09:16:43 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 1528905387042173.0249717986976; Wed, 13 Jun 2018 08:56:27 -0700 (PDT) Received: from localhost ([::1]:35307 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fT88B-0000UD-G2 for importer@patchew.org; Wed, 13 Jun 2018 11:56:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fT864-0007VB-5W for qemu-devel@nongnu.org; Wed, 13 Jun 2018 11:54:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fT861-0000mZ-4V for qemu-devel@nongnu.org; Wed, 13 Jun 2018 11:54:08 -0400 Received: from mail-he1eur04on0719.outbound.protection.outlook.com ([2a01:111:f400:fe0d::719]:12324 helo=EUR04-HE1-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 1fT860-0000d6-RA for qemu-devel@nongnu.org; Wed, 13 Jun 2018 11:54:05 -0400 Received: from xantnef-ws.sw.ru (195.214.232.6) by VI1PR08MB3360.eurprd08.prod.outlook.com (2603:10a6:803:3f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.16; Wed, 13 Jun 2018 15:54:02 +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=7ezm76D8pXDOBwO0N5y6zrrUu1YgJC7GrENe67Hz0Xg=; b=KMPfucVLB5xTofOdjWeAxHnahQxGP7XOE5469INq5e4Vdj2WpLKkYn9jlyFDncU2pe3VTCRbFhlXx2xKqxoUDU23kDF04dNdOGSDOOCwchB7PgLglzaFgLOBXCN94x6uWMayywclw+YYYXFHgFGJPA/g6BwGaZTvcMDBUFBdapk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; From: Anton Nefedov To: qemu-devel@nongnu.org Date: Wed, 13 Jun 2018 18:53:48 +0300 Message-Id: <1528905228-25694-3-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528905228-25694-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1528905228-25694-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1P190CA0003.EURP190.PROD.OUTLOOK.COM (2603:10a6:3:bc::13) To VI1PR08MB3360.eurprd08.prod.outlook.com (2603:10a6:803:3f::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 29955a51-9ccb-4fcf-9b74-08d5d145e2ba X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:VI1PR08MB3360; X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB3360; 3:OE//1ByGww9gMqdJvqKTm5A+wN6Z2NvnE3EyOGo0Xf04VWSXmPUAXh3UB4JasASeKV7SNOCXorryWKt+OA6DWTpjmfv/OGs4vL+ayd3tial+mfmkCkPE0YTRCJEpg17Alfofixtcff3OvWKT0ygCUUn3zWfXhcqjnglcFLFB+4a89921b0KJPhQ6ReN+V51yK/nfYWdTG9PWBz8jLdsqvDWH3sx7ytyXt51gevdEUila/Gpirmu+Ll9auChSx5uM; 25:lxAW2kBGdD2D4X1FFFa/+ORGPVoSM06xEHUOkKINaOF2urfj7iCIkFlVcjo3U9N75EV/LLxwxJowsNI3/ok9BoSNUh9tBvUHvUiNMBJF0YmLBfv3JhVQtfH5S3hVGoBBUDANd9idQTUhg76YZhHhhaSCBqpSn/1H+LKR0dQkprXuzMdyBKOnwLYk4+AU9FcAZs7RQX/QzuR1CtWqb7iDqox4RjWh/n7y3D5z7F1Q8EuobthR5X+ShALP8Tj0Xm8QODdWLyfm4CFQ5vbZP6rpERMgr3+JcJMGY23abVNJCZeVLBOd7z4RrgTTaXyMwWSburkiYwUkervySa7GISac2A==; 31:cyG6WFqQuh4VLl0i11lFqHjoKqeNgOAYKVBmtu18zpp826IQSqjzPuxupXM9yvlYtRNr+HJ+to1J8qEbFabfJ6daa3WcO9uQYaSHKIKH0/oRAqzxJoj04XcBYLB98b1ISm69ofXCZtW2P8zGRu6KyPiXnqEwRktHXqNBqpkUwnQz1E0rNV4fkZwhEUaSgoHDvmUB8SNJSjK3lSAJCkQiwWbQ8PlHxDkD9FfmW2bUjX4= X-MS-TrafficTypeDiagnostic: VI1PR08MB3360: X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB3360; 20:n3+euqQbAT4FBo7py05bdF/1vOKEOUHfzOrX+ruZeUCm1KjDAkbo566ceYpP00HI7ZnJpasnK/QZi3DehNPzIwfONMzL+i34rBclQyCI3LXsq/TYh55TPqJQFGfBqUcZCUlmD0ApmDIMjGHDooxghu1uCpPq3JMcFbhr5SC3WY4cjuciDkItwXNRPaNa322LFZklsbRNDTQ8CB9wEhrD7M7cYGi5zBTU1rh45EstIhazNwYJEnRu6bQCQtgxdWheFafXlyCzsZnfAWPHkc1mc2jZveeFKbPeLNB7hFvcNMyED+bdbbfVB83CsY1C60R+81XDzqoiqb0YkhIu+hI8ibIu+d5iARBcVo+QPohZczBcR49/sl1LKNfUllFAUwwFtYDs8cbxuQSFcs5HSocrdsQrXNBYqw8/ViSCnCkVuq58Tq0vcBX/9BXhWoWklRQ/Xq4A16HH00W7MBZ6qq47Q/o4hT3N1vLpIR8OA+7r3/l/sNs4z7iB7w8pRhh3YA9r; 4:X+3tP3MbY4lsdbB1u7Vz+dFOSyqLcH8Emj521IP4Dr6DW2eJ/uEd8F71ac7ir6pvaxlp0Zt+eNcWvAN3PQdefAWpzt4lvTLgOVtfwmXlkmfJJRVYaHRIjspphbYrZddXKDgTE5O2rWuib/zvQrIkys7aPgqsHk4GIWAD+n0+ov3Rf6jKJq2Yq2DY4bpDL7CNIxNiOBoirPNwVzgFWQeSPoBSjgNJ0Q4a0ntjSRK8wh4Cg2k/ikYMc9vmIoelJCsiOGbd0cw0jP8tAaqZmCa79w== 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)(5005006)(8121501046)(3231254)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(149027)(150027)(6041310)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:VI1PR08MB3360; BCL:0; PCL:0; RULEID:; SRVR:VI1PR08MB3360; X-Forefront-PRVS: 07025866F6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39380400002)(396003)(39850400004)(376002)(366004)(346002)(199004)(189003)(5660300001)(446003)(97736004)(956004)(11346002)(81156014)(2351001)(7736002)(44832011)(26005)(2616005)(69596002)(2906002)(66066001)(476003)(50226002)(6116002)(8936002)(86362001)(36756003)(3846002)(478600001)(81166006)(6666003)(486006)(6916009)(47776003)(8676002)(316002)(16586007)(55236004)(305945005)(6512007)(68736007)(76176011)(48376002)(6506007)(16526019)(107886003)(53936002)(4326008)(51416003)(25786009)(186003)(6486002)(50466002)(53416004)(52116002)(2361001)(59450400001)(106356001)(105586002)(386003)(357404004); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR08MB3360; H:xantnef-ws.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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; VI1PR08MB3360; 23:0QJRT34APCy0pQHIIZlXPbwy2dh87Qi2kK6cxI4Xl?= =?us-ascii?Q?OtpDiTowZeWTqHD3ZkQT1VnEzhDUjXYIj090R/Fngf4GchwXs+tLy2KB9YlP?= =?us-ascii?Q?InJtjVyGajy2QwzdXb3dvjZjYQM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cPmOTwR9L/m4iP9opyGCMEv4XoiNk8/ayzWF+sJ/5s3NZyLQdvRO9c6P?= =?us-ascii?Q?z+UroOLLPIpaVg57zw+fwW3FPt1TBEur0yVE2baBnH/SVsZGSqm8tWL7SbEr?= =?us-ascii?Q?jRpkKFtXhHt/8942QTTbOqixGK6ggZXSaIiQHRxyAy73D89jHvVtIwqs+wLK?= =?us-ascii?Q?XVvLxyeOxALIXbumGHkuvxN5TvCsjeNnb3BhY+td2/2ITEj6+efJm9we+YIH?= =?us-ascii?Q?KBvysGqK9y85ANtyKtLV7Gl0qV6oLSGhRb2iYICOTMZWFbO8IQ+0bZnQSA8w?= =?us-ascii?Q?/kys3okGEhdCbq4JZnn3L6A9M9RZH+yKyRCAHXLgbXPizf68OO9XfDIWxt2q?= =?us-ascii?Q?L/+rVjXHIcb9TnCIap5pQbUjfE=3D?= X-Microsoft-Antispam-Message-Info: US5sUfpv2uAinh1E0NTmwp7YuuArxez/tYgW+pCOUMgw1l0Fxi9GwAT22L3a3Jq86Gq+zKeXStAwGuxztZ9v/URGn66z12/10e83qD6rKKIrP7oLaUA2xeNp0W9nG3m4lOzrMfUKAutzFs0k11ORltlUX0AW4dKrJAFbn7vDj4UnGz9kpJmXzBPqsf1oH+84 X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB3360; 6:/3RqWfIoat6sqapb+36Uh/8bOldepWPoWr5AmQaZpPFH7Rv6NY8nV+sWEQ2/j8aRYREHxZkckQqUlbbZZHU9U6BU3/cbaPSC/y+7rpSZ8Ncn3tWhJPeP/oKUrvKHSJlTCMm0684YgHey+uNF7iCEZCl4dYKMJQua3m4JKWPlNabgZ+96YXJUkKwGPN6YHh4gyim1DXmUktRPkXv2SPiDEdDguBkgLplJmzCAxVT94NLk8L/D7k7zK506cto8hXVD7w82szh8r7DiQqW8Ov0dPTgEHX0vXghwbHAI4MMVlOeHq1SCYEBc80fe+HQukTReuzDeWPRDTIDk54jc8ixIjwB7dY6NvcQoljBVjhoeqWJA+5QuI4B/fpnvCRKdpUSGdVEocT8mSgM90erynuPsv2UMAURsmkMBMLOA5QZOCjwvo8SmaiWVT7nVLgdScu+dagOwa8VvSuJF98lNF/ZsXw==; 5:UtktCkWusG82VPcURPSxFf4jY+8XJ5LFWHUiEm6WqEmXuhC2F9Z/D+Y3grLGQFh02qWHtLRCC9hfYLiMCnfxq1QtVUdjUdtIc4UQtoC3EVNR1gReShQn+JhLtsaMChG2b/3YhuZDsMA4OkQS6/9Glu7lAitoBHafSJ7qPF+GbdY=; 24:TywMhnKLPpCWFA5LQ77sIUn62oRjasttdeGat1J7uow26EFPiWlQ3jEHLkGtZ2lbFfllyP6RmaG+tTj3GfO/vfTRUHNo/Rlyr7ziQdoCK+0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB3360; 7:1AN3nGXjoGkJeZWfDJUEQJKJZndk70G2miTiMFz8by0thkbWJUvjIUQOfbHAW5DWKSrQC8vsZvpfcHk5HiGMMjN0TDQQlBA+mkr3EVTlmKz56Rd4pKLeif2G3HVuwHpcNFqvP9wZ4zjWfKU6HcrGnzos2NSliGBrEqyp4CDVd2pz5S9MO7y12mVhE4p+lFFwNQJTxtFWEmwf8Izc4DM3qa8htN4caCAzn7PpxCGR7ZCrHpJB92X8lmxfpFDU3m+v; 20:Okw6U5GXBEMwJVul6Xieb5sBvnC2dNq7ZPNqy7kq6WqJGgWGxbWJBz7ukmVIkVQy5kXyKO3l3EVXFvqJRfilEDN16b1OWm+s10EdHFu8UVwXxu57JKpd06k5I6caayiWN6H+0453RpZ2MSYrE9zVvcENeBDl6zr0le6RdEEiUus= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2018 15:54:02.4868 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 29955a51-9ccb-4fcf-9b74-08d5d145e2ba X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3360 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe0d::719 Subject: [Qemu-devel] [PATCH v4 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 fff23fc..b3e94d8 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: @@ -4032,15 +4019,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. @@ -4054,44 +4032,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 6fa5e1d..b44e100 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -4169,7 +4169,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