From patchwork Mon Nov 23 19:47:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 11926167 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6906C63697 for ; Mon, 23 Nov 2020 19:52:28 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E4B7920717 for ; Mon, 23 Nov 2020 19:52:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Iq+2YLQd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E4B7920717 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:54818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1khHsw-00088G-Mj for qemu-devel@archiver.kernel.org; Mon, 23 Nov 2020 14:52:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58732) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1khHpQ-0006Cp-92 for qemu-devel@nongnu.org; Mon, 23 Nov 2020 14:48:48 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:44693) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1khHpO-0007lk-4Z for qemu-devel@nongnu.org; Mon, 23 Nov 2020 14:48:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606160923; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KCJ3F5piHSCFTXqtybKk/yRZJKA7CcQobZuLyCQSt3A=; b=Iq+2YLQdcHnCeuCcwiEj11v3uFzL9/fBmLKBPrFTD7p0QXe/NrpDDMSYKDQf/kSsF+kkAW TMu8FrLHCn1vhkvRdyVchVWHTDFkZQ2Y4froTYDbhBfqaPqbBo3o7OiVBaRvifU6f5Cgzt Yo0USpa8RrBdgsoH22KHICaKR0PDOMI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-308-OENu5oftPtCFt-jTQnm3vg-1; Mon, 23 Nov 2020 14:48:36 -0500 X-MC-Unique: OENu5oftPtCFt-jTQnm3vg-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id D0E8484A5F2 for ; Mon, 23 Nov 2020 19:48:20 +0000 (UTC) Received: from localhost (unknown [10.10.67.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67D4560C04; Mon, 23 Nov 2020 19:48:20 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 00/19] qom: Use qlit to represent property defaults Date: Mon, 23 Nov 2020 14:47:59 -0500 Message-Id: <20201123194818.2773508-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Based-on: 20201104160021.2342108-1-ehabkost@redhat.com Git branch: https://gitlab.com/ehabkost/qemu/-/commits/work/qdev-qlit-defaults This extend qlit.h to support all QNum types (signed int, unsigned int, and double), and use QLitObject to represent field property defaults. It allows us to get rid of most type-specific .set_default_value functions for QOM property types. The only remaining .set_default_value function in the code is field_prop_set_default_value_enum(). This will take a bit more work because the default is currently stored as int, but parsed as string, so it will be addressed in a separate series. Changes v2 -> v3: * qnum/qlit patches: * Variable naming in qnum code * Coding style changes in qnum code * Split "qlit: Support all types of QNums" in smaller patches * Replace QLIT_QNUM with QLIT_QNUM_INT * Extend test cases, move most of the new test case code to check-qlit.c * Remove qnum_get_value() and qlit_get_type() function * Removed kernel-doc conversion patch, to reduce noise in series review * qom patches: * Split "qom: Use qlit to represent property defaults" in smaller patches, hopefully making review easier * Small changes in UUID property code (See "qom: Don't ignore defval on UUID property" and "qom: Fix documentation of UUID property type") Changes v1 -> v2: * Rebase to latest version of field properties series * Fix unit test failure * Coding style changes Eduardo Habkost (19): qnum: Make qnum_get_double() get const pointer qnum: Make num_x/num_y variables at qnum_is_equal() const qnum: QNumValue type for QNum value literals qnum: qnum_value_is_equal() function qlit: Use qnum_value_is_equal() when comparing QNums qlit: Rename QLIT_QNUM to QLIT_QNUM_INT qlit: Use QNumValue to represent QNums qlit: Move qlit_equal_qobject() reference values to array qlit: Add more test literals to qlit_equal_qobject() test case qlit: Support all types of QNums qom: field_prop_set_default_value() helper qom: Replace defval value in Property with QLitObject qom: Fix documentation of UUID property type qom: Don't ignore defval on UUID property qom: Make object_property_set_default() public qom: Make PropertyInfo.set_default_value optional qom: Delete field_prop_set_default_value_*int() qom: Delete set_default_uuid() qom: Delete set_default_value_bool() include/hw/qdev-properties-system.h | 4 +- include/qapi/qmp/qlit.h | 11 ++- include/qapi/qmp/qnum.h | 26 +++++- include/qom/field-property-internal.h | 7 +- include/qom/field-property.h | 30 +++---- include/qom/object.h | 11 +++ include/qom/property-types.h | 18 ++-- hw/core/qdev-properties-system.c | 13 +-- qobject/qlit.c | 5 +- qobject/qnum.c | 113 ++++++++++++++------------ qom/field-property.c | 36 ++++++-- qom/object.c | 2 +- qom/property-types.c | 37 ++------- tests/check-qjson.c | 30 +++---- tests/check-qlit.c | 72 +++++++++++++--- tests/check-qnum.c | 14 ++-- 16 files changed, 253 insertions(+), 176 deletions(-)