From patchwork Mon Jan 9 22:54:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640703 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2398415pvb; Mon, 9 Jan 2023 14:54:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXvcwoi1qVjpUqSeC6cgxictxLI2xxkkH69Ni9Xp4huZ5KiDGwlrbdStJ2y4ilEXniBCP18G X-Received: by 2002:ac8:4e87:0:b0:3ac:c2b8:c with SMTP id 7-20020ac84e87000000b003acc2b8000cmr11743309qtp.25.1673304881461; Mon, 09 Jan 2023 14:54:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673304881; cv=none; d=google.com; s=arc-20160816; b=xTcKXwruCUbMwZAvOVqz3/bzn+Q4P9wQ0znCzRTq5Dq+iPAt+cr7dyrSXwKLj//150 /eXGGwnEdi2adIisB0olWq3qMkPzsljGxbETmS6PYMX9o25OM1+Ex2BMwVCmf6tmBawF n9XPPLOOKoJgnxClKa3ud+WmIqwGHaWAFwfQhGGCNmIs5JUDwXKP5kextwD5H/rHKaxM Llzho6XbBLVT/wYzwg3ZFJJRmrsU/OqDiugV+10AR9grHOxhc6W0AsCUldx+D5TIONJd LHGOjeKMIvmZ9TTiomzJQNzTxKDmNefEgg0xO7YyQRVeXMkRS6RZHrjDIVUyj2bw2icp iYYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YYqX/y2WSbzyv4/4voOdSyLCRImF1qkdyFcZzZnQoeE=; b=U2Rxlv3Mj9USPaq1EGwefg9ufpToUoK+upV/vuJArpfTYGvWimalFANvOJSIcEmjRZ 5/DkmFf4veqjccjDEi4+AX+2RZ7kZz3fBY2ysvN+LXkzORJM2UlM8H8Ucp6H8EE7zHQz Yej+0UkawhsppYv/+zODPEro9qhFY1dEyASGdz5uooEu57lO29B957aVpF+gKapljeo1 9wgljM5nU5wzWLmLbIRAfU93oVtsJ0EvGh8CgMtuA6IFxO0LsGVWDlQd+5bvti/onOY3 Lq3wjFdJwrATL/DSbxh35E28VIh1ZOzejaYtoySo3MfjNo6PlSsSvXfFvDGEVBPTn4D1 XIyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Dq7fc4x5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m16-20020ac866d0000000b003a819172b67si5113032qtp.443.2023.01.09.14.54.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 14:54:41 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Dq7fc4x5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pF12J-0004kU-6J; Mon, 09 Jan 2023 17:54:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pF12G-0004it-Ec for qemu-devel@nongnu.org; Mon, 09 Jan 2023 17:54:33 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pF12D-0007iY-3V for qemu-devel@nongnu.org; Mon, 09 Jan 2023 17:54:31 -0500 Received: by mail-wm1-x329.google.com with SMTP id m26-20020a05600c3b1a00b003d9811fcaafso8467487wms.5 for ; Mon, 09 Jan 2023 14:54:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YYqX/y2WSbzyv4/4voOdSyLCRImF1qkdyFcZzZnQoeE=; b=Dq7fc4x5FZ1XWqZnc6T4Crb+TaPfYsYP6/UfphB8+x3XH0s9JvcVR9FKqek7MH2JSB cmOqUUEodUX9tF55KNRortWRvrHqLjrK+o2bMsQh4xDZax9MlD5htzPtdcWpDoecrWuJ 4xZmtNRJJh4VYg0luJfMOLDtn8BG1xGI8qwHZ0va8TJx4gySm98922rBwyInTVVRex6x 7zp9bArJmxr3cBM7QlOJLI8LMivvntJEv1XCHgp0gFdDmUI6WLwakTl/iZYviidfGx3e n/iRAnuDXxWTdIrxJAnOfmyjG6+kJqemXB/ewKL13fUVvyvNqj63f6C3xZj4g2f0hbq6 obdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YYqX/y2WSbzyv4/4voOdSyLCRImF1qkdyFcZzZnQoeE=; b=bmfWVylhUtTlixU5UA/XxDi4H8/E7BqtSCTu2YANKdxoFAfIpEIrTZXn0Y17K4ABrO 9Lw54OV3VcTqTHs2y0DxGib1xs+rsUoLqOtMJro/d646MvMWM/f3eaTvJZkV1UNKrd/b 8u9zdMDoKGtneNwO0Up9pS2Dw83z7jf+yGzIIapUB7HnMrjJ0MQsjF1QaE0c/0wZ/XXa MFNgVKc1gFP2Nb8NNWBZSs9HHXTefr2cvdGheeYYJeuj6ptIG42aAyqIXplqkGp4WANI Qy3Xpz97bn9A3hPtBKHncH5zglp783k573WBDQW+KovZ7Vge52g4WtTNC/sC/lwvF0+A 3w3Q== X-Gm-Message-State: AFqh2kqlEnGnCfFgDiVLWDG/WdJPUUodXOBEpA8ACCfiVwh1FxzOSV3D hu33zjI8dVmvXQnGkupJEOixKxoYBrXTxxWB X-Received: by 2002:a05:600c:1d98:b0:3d3:3d51:7d4b with SMTP id p24-20020a05600c1d9800b003d33d517d4bmr48804528wms.29.1673304867632; Mon, 09 Jan 2023 14:54:27 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id 16-20020a05600c22d000b003b4a699ce8esm16335702wmg.6.2023.01.09.14.54.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 14:54:27 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost , Markus Armbruster , "Daniel P . Berrange" Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Stefan Hajnoczi , Kevin Wolf , qemu-block@nongnu.org, Paolo Bonzini , Hanna Reitz Subject: [RFC PATCH 1/4] qom: Introduce object_class_property_deprecate() Date: Mon, 9 Jan 2023 23:54:16 +0100 Message-Id: <20230109225419.22621-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109225419.22621-1-philmd@linaro.org> References: <20230109225419.22621-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Introduce object_class_property_deprecate() to register a QOM property as deprecated. When this property's getter / setter is called, a deprecation warning is displayed on the monitor. Inspired-by: Daniel P. Berrange Signed-off-by: Philippe Mathieu-Daudé --- include/qom/object.h | 17 +++++++++++++++++ qom/object.c | 23 +++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/include/qom/object.h b/include/qom/object.h index ef7258a5e1..b76724292c 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -97,6 +97,7 @@ struct ObjectProperty ObjectPropertyInit *init; void *opaque; QObject *defval; + const char *deprecation_reason; }; /** @@ -1075,6 +1076,22 @@ ObjectProperty *object_class_property_add(ObjectClass *klass, const char *name, ObjectPropertyRelease *release, void *opaque); +/** + * object_class_property_deprecate: + * @klass: the class to add a property to + * @name: the name of the property. This can contain any character except for + * a forward slash. In general, you should use hyphens '-' instead of + * underscores '_' when naming properties. + * @reason: the deprecation reason. + * @version_major: the major version since this property is deprecated. + * @version_minor: the minor version since this property is deprecated. + * + * Deprecate a class property. + */ +void object_class_property_deprecate(ObjectClass *klass, + const char *name, const char *reason, + int version_major, int version_minor); + /** * object_property_set_default_bool: * @prop: the property to set diff --git a/qom/object.c b/qom/object.c index e25f1e96db..05b97cd424 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1293,6 +1293,16 @@ object_class_property_add(ObjectClass *klass, return prop; } +void object_class_property_deprecate(ObjectClass *klass, + const char *name, const char *reason, + int version_major, int version_minor) +{ + ObjectProperty *prop = object_class_property_find(klass, name); + + assert(prop); + prop->deprecation_reason = reason; +} + ObjectProperty *object_property_find(Object *obj, const char *name) { ObjectProperty *prop; @@ -1382,6 +1392,17 @@ void object_property_del(Object *obj, const char *name) g_hash_table_remove(obj->properties, name); } +static void object_property_check_deprecation(const Object *obj, + const char *name, + const ObjectProperty *prop) +{ + if (!prop->deprecation_reason) { + return; + } + warn_report("Property '%s.%s' is deprecated (%s).", + object_get_typename(obj), name, prop->deprecation_reason); +} + bool object_property_get(Object *obj, const char *name, Visitor *v, Error **errp) { @@ -1392,6 +1413,7 @@ bool object_property_get(Object *obj, const char *name, Visitor *v, return false; } + object_property_check_deprecation(obj, name, prop); if (!prop->get) { error_setg(errp, "Property '%s.%s' is not readable", object_get_typename(obj), name); @@ -1412,6 +1434,7 @@ bool object_property_set(Object *obj, const char *name, Visitor *v, return false; } + object_property_check_deprecation(obj, name, prop); if (!prop->set) { error_setg(errp, "Property '%s.%s' is not writable", object_get_typename(obj), name); From patchwork Mon Jan 9 22:54:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640704 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2398439pvb; Mon, 9 Jan 2023 14:54:46 -0800 (PST) X-Google-Smtp-Source: AMrXdXvd8+3XCmlZyfKJcGp6fl9MdhHr3bBQET0RefLKpVmqSfzRXL0Q7UDsN+UBqJCubhXY3D0R X-Received: by 2002:a05:6214:1fc3:b0:531:a76d:eab6 with SMTP id jh3-20020a0562141fc300b00531a76deab6mr52060443qvb.6.1673304886560; Mon, 09 Jan 2023 14:54:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673304886; cv=none; d=google.com; s=arc-20160816; b=JeZi/FJvdHBDwLORXZhEX52pUxby2oAXScqRbvUBpn0ACgd51oHIfG6O1EsMtpyCkT YOEzpcHAHw3FYvsdvbZtIX7tOuoZ7PVHwutwAueJXhlolxA4SnVydQblh2IxmQfDXyvs Gtm4LpPZYYcDciAp4ZiwB1V4wm0D6CUzZIZLYFJw2gSy4GH1ulj9ONgPDFrlqPUTeUdM LF2jjuIbL1F+7oPnf6485Vshnawmm+QQrB9MXILHj7+AKXbqX5N6MyZPwL0luV82jBUS oCKXS5Fad0AdpQu9uArUujkvdvuc6bwppUHokouGjGEWqIpetE/OK/R8wVr95Pzlamh+ ngmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TEIyfTZu5Mi/i+A1aDFcrn/cc8NYJ3wg49JfcYmsmDE=; b=Cr+7X1D1zAbatf3HDRnTxymRJCzZ3v+YzcKBZaVClvUGYCouYw7BxXGL4ke4koAIej tDQwJYrrkjDjdSojD5++aA8q/pRZQ3Xrekg7JAnnrVBnv4eSaatBK6oNS3sNlu+TYM7e 51dNY6TKQZo61c9NxPbc6QT4NrPsabx+x0QWz1vtXHuU5wO2427zRtAunHv+q/tdKd+P CZ2xFtBUZCRZbZFI+kUjqgmHLyEsUg8XlGw3CJTe2oZQ7YR5iDzkzE5tFO7ewTld1F4m 743K1LeS8Rt1NeItISTTFkr+Tq4TvM6XxKxMpXhNKFZGPh6acpL3aDYJdPfwVV9k06Uk 2adA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HRpR2jNZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y3-20020a0ce803000000b004c6e68a7edfsi4731996qvn.405.2023.01.09.14.54.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 14:54:46 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HRpR2jNZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pF12M-0004tt-M5; Mon, 09 Jan 2023 17:54:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pF12K-0004nA-V3 for qemu-devel@nongnu.org; Mon, 09 Jan 2023 17:54:36 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pF12I-0007jB-9a for qemu-devel@nongnu.org; Mon, 09 Jan 2023 17:54:35 -0500 Received: by mail-wm1-x32b.google.com with SMTP id p1-20020a05600c1d8100b003d8c9b191e0so8465065wms.4 for ; Mon, 09 Jan 2023 14:54:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TEIyfTZu5Mi/i+A1aDFcrn/cc8NYJ3wg49JfcYmsmDE=; b=HRpR2jNZdY5XRSuS9ewBPJgZWnUTfB4+X7CL7Wjorn0m9hjGS+ybnj6+y1aaGN1/on XttWwAu4n+dMXqBcGV30NcDYylXasFl3jFD2O54JMN0Tzj0ZL3Q0/q0sgJw9vhfRQgNm Q6QlS1DSO898Bl1sl7DPWincv85QzOBjgb9kOPvebGCXlPA2Wu5qmVGc9AkrU06BNgKK 6tSeDgTlK6q8fJw/jAyx7glmEDfKI2F3gSdvJfG3Id1wEUVeBoPuSSlcO+IjfFuZB6zI esnuw602lJzOIEQwbtvadyU5iQTP4ApZnHn4GUWcykOiOsCfb1Ea+4t6cnT1AN70B8Yg K1RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TEIyfTZu5Mi/i+A1aDFcrn/cc8NYJ3wg49JfcYmsmDE=; b=y4+mhGiasIk3wYspYvTumtUKRKnZYsQzViUmeO4i1zJkd+RCMC5DkYwrvJ5QFh0O4g kxY8q2oOE/A6HJrNtWUXVADdhHb/SR/kIrlVHHRlrE++0+eE2ko3B8CgZYOpkzwOvKA6 nwDxRyVDPd+gAiUSfaWpyFdb1Qtd6Jita/lM7y13NHqVlsLfZDApK5Prdss/IAhNrqnm HqWA2sariBmZfgCbnL2xHjSviK1YfqQw80gDHpWr7d+UJjZ1oXxWbQxCCGhNvHPNS8EX D+dNt9PU6yheI6/2m6y0W9XXtB7zN9KvJsSUMiPQPZVS8eguj0hoqYDdtcSiMe7AjgY8 60sg== X-Gm-Message-State: AFqh2krcrsuUWWfYfEnNb+8QN4QZ3lAMJ8jqNr9Y9YGjrImoomRaNrAW VRHyvrC4O51skomZNza2QMn6qxG106l8ZpNp X-Received: by 2002:a05:600c:35ca:b0:3d1:f2de:195a with SMTP id r10-20020a05600c35ca00b003d1f2de195amr50942726wmq.32.1673304872811; Mon, 09 Jan 2023 14:54:32 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id t9-20020a05600c198900b003d9e74dd9b2sm9273003wmq.9.2023.01.09.14.54.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 14:54:32 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost , Markus Armbruster , "Daniel P . Berrange" Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Stefan Hajnoczi , Kevin Wolf , qemu-block@nongnu.org, Paolo Bonzini , Hanna Reitz Subject: [RFC PATCH 2/4] hw/block: Rename TYPE_PFLASH_CFI02 'width' property as 'device-width' Date: Mon, 9 Jan 2023 23:54:17 +0100 Message-Id: <20230109225419.22621-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109225419.22621-1-philmd@linaro.org> References: <20230109225419.22621-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the same property name than the TYPE_PFLASH_CFI01 model. Deprecate the current 'width' property and add the 'device-width' property pointing to the same field in PFlashCFI02. Signed-off-by: Philippe Mathieu-Daudé --- hw/block/pflash_cfi02.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c index 2a99b286b0..bbf78ad1e4 100644 --- a/hw/block/pflash_cfi02.c +++ b/hw/block/pflash_cfi02.c @@ -950,6 +950,7 @@ static Property pflash_cfi02_properties[] = { DEFINE_PROP_UINT32("num-blocks3", PFlashCFI02, nb_blocs[3], 0), DEFINE_PROP_UINT32("sector-length3", PFlashCFI02, sector_len[3], 0), DEFINE_PROP_UINT8("width", PFlashCFI02, width, 0), + DEFINE_PROP_UINT8("device-width", PFlashCFI02, width, 0), DEFINE_PROP_UINT8("mappings", PFlashCFI02, mappings, 0), DEFINE_PROP_UINT8("big-endian", PFlashCFI02, be, 0), DEFINE_PROP_UINT16("id0", PFlashCFI02, ident0, 0), @@ -978,6 +979,11 @@ static void pflash_cfi02_class_init(ObjectClass *klass, void *data) dc->unrealize = pflash_cfi02_unrealize; device_class_set_props(dc, pflash_cfi02_properties); set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); + + object_class_property_deprecate(klass, "width", + "renamed as '" + TYPE_PFLASH_CFI02 ".device-width'", + 8, 0); } static const TypeInfo pflash_cfi02_info = { @@ -1014,7 +1020,7 @@ PFlashCFI02 *pflash_cfi02_register(hwaddr base, assert(QEMU_IS_ALIGNED(size, sector_len)); qdev_prop_set_uint32(dev, "num-blocks", size / sector_len); qdev_prop_set_uint32(dev, "sector-length", sector_len); - qdev_prop_set_uint8(dev, "width", width); + qdev_prop_set_uint8(dev, "device-width", width); qdev_prop_set_uint8(dev, "mappings", nb_mappings); qdev_prop_set_uint8(dev, "big-endian", !!be); qdev_prop_set_uint16(dev, "id0", id0); From patchwork Mon Jan 9 22:54:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640707 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2398944pvb; Mon, 9 Jan 2023 14:56:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXv2SGuw2gEYODThA/YXawJ2eDymDU3Q2StDzyK0a0B9eRmOwzV8rBWTgJbSQOVvaxqpMMf2 X-Received: by 2002:ad4:5287:0:b0:532:3194:8433 with SMTP id v7-20020ad45287000000b0053231948433mr5525298qvr.35.1673304995990; Mon, 09 Jan 2023 14:56:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673304995; cv=none; d=google.com; s=arc-20160816; b=GcyGulja5RhNKAhvvih4SAf0x06zc+i9rfihqSymlp7OZtwQW+jsNmNdNADCFw3LaW 8Sg+pC4Lq5e+BTSmW2omEKqsEIvEsSHUs2QyEcLDdqF3nuaKUs7JKP4SMHRYLuo6apXi arINB6RQvGe25RrORX6z1mv7LzMzP5FmWuxOlHnKux/pRJhNzubqy8mxXCbSBNlhMgfl gtKFsfuOeK5mwA9eNoPslJqFvsTKuyFRexG7bxOdMg1oX8w9cmoH8p83lOYJLQBOsoMx 7y9Sn5qSQPPkbhTyfqw8komJq5USiXQPcc1GDXdegs7+VUB/vxqLtwWAYIziTT8n7K6d uWYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zmsiOvblx944I2vPr/ngo2q8F1qd2s6a6mFL2ICxK8U=; b=dMf1KbyTT90yGmR670Crs5IMY0ZZswTqpV4D9K9epca+nNoYNsKas5ENrZgNTSNoyu pODD7pq6aGQF6wOdIwTLXdT13tcORpvPddiD/XREOgMfm6JeG4PWuvRmA/8kjMOQuayH kUxu+SwbqaXfTjkq+JxwnYb+RZTQbFZQv3QesPQ6tL/N5GVMIlZTOjV/x205gWTSLRQH C+WoAwgaNjcTG1qyT553Xeh5WoGJFb0n/7g+6m1DygZtTusN2P8Uwfq7ecNNsPW+3qQE H+oeKakZtysuSAMOdC4WFYVizGhfIlnl/XGlmP7vVS2rhyVodqUglu22COuoUJCPolYf y1Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zBOlBtqP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m8-20020ad45dc8000000b00531de4aac51si5307714qvh.244.2023.01.09.14.56.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 14:56:35 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zBOlBtqP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pF12T-00058X-4L; Mon, 09 Jan 2023 17:54:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pF12Q-00051R-4W for qemu-devel@nongnu.org; Mon, 09 Jan 2023 17:54:42 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pF12N-0007jm-Pd for qemu-devel@nongnu.org; Mon, 09 Jan 2023 17:54:41 -0500 Received: by mail-wm1-x32a.google.com with SMTP id bi26-20020a05600c3d9a00b003d3404a89faso80472wmb.1 for ; Mon, 09 Jan 2023 14:54:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zmsiOvblx944I2vPr/ngo2q8F1qd2s6a6mFL2ICxK8U=; b=zBOlBtqPleDHf0VdO+y+cAIUshMH5wpIxsHdQ1/8Ysxewl1rpAxa0IohtYijfMmaFw 40lem8oQt0rbRt/u2PfxdcX4BcBBwHjzc+wxi3ZRb9IsSaLQo/xy79kali1Dz6fL+ZQ2 hHz8RwTTfKtBo/Tx9734tp7U+oNJCzbf8oStlbk6YwLz/dHpvKD5mAVLxCvkJ4GZ0N8K J5GdZjwR+HXN+tQXNgFjYi5gad0a4O2rHEWnotR8WsqfCrIrYmwryxDbYttxM2Jt/sNY B/0NZ2z+4RxUMOuGB4mEXhgTKJyKtzuV/FkJutV8BuwExV6ehmXhuhxJKMJyUExeWOPx 69BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zmsiOvblx944I2vPr/ngo2q8F1qd2s6a6mFL2ICxK8U=; b=pEwmIVELwcwbF3VbHDWl0eNfTNcWu0XfvHrbSkOZ9xPuy9cEvh0CQHlzn57jRRP/1x yep/E25EEa2gzmWQU7r/LlXoImv3z/Z5P6OhcbY6xkTzSdoZSCmBtPQxhC+ZSBmA7nL3 4UKhYXdO2HIuFbPl4f/QGQ8h4EO/IpeQrGQM5P/3cs/NjpVnysAX2DkrYY4x3T2AM28K 1/eJW/PLpOTWWFs56t9q0BMuvZZqBkQdBj7USljqH/77aj524eMbd4Rnm+jQrtYtDTzq 4Omq4Hp0KUq8CWMyCFhmor8k1D2H4HxiR+cIKPPvJvfOr7mAq0KzAOdpMIRIEMNPMrBq JueQ== X-Gm-Message-State: AFqh2kpxzgxbt9fG/x+eJ7+jf8grRRUs1z/q4MgDwJV/JE23SzvlnWuu LUQCWgl93g02JvnsGFPZC7+KxXCRVaDLMRDT X-Received: by 2002:a05:600c:348b:b0:3d2:2a72:2577 with SMTP id a11-20020a05600c348b00b003d22a722577mr46677666wmq.27.1673304878167; Mon, 09 Jan 2023 14:54:38 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id m25-20020a05600c3b1900b003d9ed49ee2bsm7266879wms.1.2023.01.09.14.54.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 14:54:37 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost , Markus Armbruster , "Daniel P . Berrange" Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Stefan Hajnoczi , Kevin Wolf , qemu-block@nongnu.org, Paolo Bonzini , Hanna Reitz Subject: [RFC PATCH 3/4] util: Introduce helpers to compare QEMU versions Date: Mon, 9 Jan 2023 23:54:18 +0100 Message-Id: <20230109225419.22621-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109225419.22621-1-philmd@linaro.org> References: <20230109225419.22621-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Add qemu_version_delta() to compare 2 QEMU versions, and qemu_version_delta_current() to compare with the current QEMU version. Signed-off-by: Philippe Mathieu-Daudé --- include/qemu/qemu-version.h | 36 ++++++++++++++++++++++++++++++++++++ util/meson.build | 1 + util/qemu-version.c | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 include/qemu/qemu-version.h create mode 100644 util/qemu-version.c diff --git a/include/qemu/qemu-version.h b/include/qemu/qemu-version.h new file mode 100644 index 0000000000..c9274bfaf0 --- /dev/null +++ b/include/qemu/qemu-version.h @@ -0,0 +1,36 @@ +/* + * Utility function around QEMU release version + * + * Copyright (c) 2023 Linaro Ltd + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef QEMU_UTIL_VERSION_H +#define QEMU_UTIL_VERSION_H + +/** + * qemu_version_delta - Return delta between two release versions ('A' and 'B'). + * @version_major_a: Version 'A' major number + * @version_minor_a: Version 'A' minor number + * @version_major_b: Version 'B' major number + * @version_minor_b: Version 'B' minor number + * + * Returns a negative number is returned if 'A' is older than 'B', or positive + * if 'A' is newer than 'B'. The number represents the number of minor versions. + */ +int qemu_version_delta(unsigned version_major_a, unsigned version_minor_a, + unsigned version_major_b, unsigned version_minor_b); + +/** + * qemu_version_delta_current - Return delta with current QEMU release version. + * @version_major: The major version + * @version_minor: The minor version + * + * Returns the number of minor versions between the current released + * version and the requested $major.$minor. A negative number is returned + * for older versions and positive for newer. + */ +int qemu_version_delta_current(unsigned version_major, unsigned version_minor); + +#endif diff --git a/util/meson.build b/util/meson.build index d8d109ff84..655debeec1 100644 --- a/util/meson.build +++ b/util/meson.build @@ -58,6 +58,7 @@ util_ss.add(files('yank.c')) util_ss.add(files('int128.c')) util_ss.add(files('memalign.c')) util_ss.add(files('interval-tree.c')) +util_ss.add(files('qemu-version.c')) if have_user util_ss.add(files('selfmap.c')) diff --git a/util/qemu-version.c b/util/qemu-version.c new file mode 100644 index 0000000000..d409a6e574 --- /dev/null +++ b/util/qemu-version.c @@ -0,0 +1,37 @@ +/* + * Utility function around QEMU release version + * + * Copyright (c) 2023 Linaro Ltd + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qemu/qemu-version.h" +#include "config-host.h" + +#define QEMU_FIRST_MAJOR_VERSION_SUPPORTED 4 +#define QEMU_MINOR_VERSIONS_PER_MAJOR 3 + +int qemu_version_delta(unsigned version_major_a, unsigned version_minor_a, + unsigned version_major_b, unsigned version_minor_b) +{ + int delta; + + assert(version_major_a >= QEMU_FIRST_MAJOR_VERSION_SUPPORTED); + assert(version_major_b >= QEMU_FIRST_MAJOR_VERSION_SUPPORTED); + assert(version_minor_a < QEMU_MINOR_VERSIONS_PER_MAJOR); + assert(version_minor_b < QEMU_MINOR_VERSIONS_PER_MAJOR); + + delta = version_major_b - version_major_a; + delta *= QEMU_MINOR_VERSIONS_PER_MAJOR; + delta += version_minor_b - version_minor_a; + + return delta; +} + +int qemu_version_delta_current(unsigned version_major, unsigned version_minor) +{ + return qemu_version_delta(QEMU_VERSION_MAJOR, QEMU_VERSION_MINOR, + version_major, version_minor); +} From patchwork Mon Jan 9 22:54:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640706 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2398629pvb; Mon, 9 Jan 2023 14:55:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXvs3KaooJpHbP3jgOSGvFpRJE1u8BxWKNKZAjRYfiTHmN6pr7zHUNBOmk+MeUAyBLP1SWhW X-Received: by 2002:ac8:5fcd:0:b0:3ae:64e0:58ef with SMTP id k13-20020ac85fcd000000b003ae64e058efmr5366236qta.13.1673304927489; Mon, 09 Jan 2023 14:55:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673304927; cv=none; d=google.com; s=arc-20160816; b=lBtcLMrTilXYbQDnFdQkBgpxXeAvtUC1NV5+Ri/skcD7fqCztZHWimscGvEVEZJHHv CAP/6BMYRjOqGMCAfkYLTfC1G/CYfFl2vfQx4PhFMUWd7Om6CkpsoHj72YZfNEfZeH6N L2Px9iBCllDtQWc837xJWk9hLlTqLF4Lrdwx8jRf9tMN9roqKzX4EHuCizh17B+sg0a/ Fap2TRTd04E6JX5T5E0oRpWOw5ebNvxM5sQcb2vmy+DG/2W6vv5+VFqjtgoKb3E6eQxk T+Q1u1PtABkxi5V5ynenOW8NBmyQVkAyYlUdQiC4FE/ZflxdgjyCBwW7EbjKamkGqQn+ FT5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xA2zJhQFDWndGaehXTKSbGgxfQUNaxn1ECLWbGBrK7I=; b=VqzOoz2jsyKEYbDaf/w0apZIu06h7soC25KlXU6QiMO+/E8M69lrRMUwd5pMX80/og kUrbDVC+jE/ripASJPC8dfVpyeQ0M/3+m1/1GZiHbGXaGJVa93tmdycqQdHCkiqYbwoO B0wZVTT+3A1Gccl4oVVbJG0XYj9RvB2DGIw3HIHI3hlQ6edjUtWf4FxeOSPi1OclCijH uOS3cFxjuGj10bdCS9nD/3dPyKAAaec51gA4O73JPd8BU/xzPS+zbB5iZ8WLzMr3vXia 1t3BsLY90L3O4QlF2EKN8bVP94pCB3wmPMY6NtzLHoNKWEGpT8k3FtCZtS43EppFPW/L BUOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZiWawKgd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c84-20020ae9ed57000000b006fb05de4731si4855065qkg.722.2023.01.09.14.55.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 14:55:27 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZiWawKgd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pF12W-0005Is-H5; Mon, 09 Jan 2023 17:54:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pF12U-0005Eh-Lb for qemu-devel@nongnu.org; Mon, 09 Jan 2023 17:54:46 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pF12S-0007j9-7h for qemu-devel@nongnu.org; Mon, 09 Jan 2023 17:54:46 -0500 Received: by mail-wm1-x32f.google.com with SMTP id g19-20020a05600c4ed300b003d9eb1dbc0aso5509072wmq.3 for ; Mon, 09 Jan 2023 14:54:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xA2zJhQFDWndGaehXTKSbGgxfQUNaxn1ECLWbGBrK7I=; b=ZiWawKgdap3V5zfR9jF6GYBvUIOaaNpcUKjMu0EgoEgehQ7RnKMffxlDsQHXnIuJEt Aau+SlfpAipUv5lqgt+GFGfogYu3dYt8IkjLseUWaWJXhfpHZaMVQcGAlgvb4BMszdfl T1eDCNDUWq/yH1YFc+c14ypDaPyxgRYI3Dk2G8TOPoGobQQb3v6L2/vhyVv3v1vftWhj vVRoXEklPmz8MN7UiYgZgC/MFkzCKv6Erz061b0BwZvxf6t9YOp8xfQkQnukiIyfuORK brvG7uD46HxxmgN/Re+E0jwL35sXxrejEoU2Bb5f+GaoBZo96wl0nDKz+eoSvW6Qz6ha /HYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xA2zJhQFDWndGaehXTKSbGgxfQUNaxn1ECLWbGBrK7I=; b=rnhdtZHePjzz42dl1oz2NuUT5RSTVMJQVKXuNlfPFEUDXgdGhj3pS/nuR4TdoP1ml6 loaxmSMrUoYaeVE6XfTkchtvZh6Ce8rxme9ACdhJHSRYgoJzVTKhY3r92oXtMEUhWorh OUgaOBhhPoT5hwepqbo4LMwTKm4XxRwirKrZvq05mV+bFVYuS5ClbFuyDeo+SCF6bZ/B kT/xDjsgIcXXrBhwyZLRe3X9q0gqUm+BPMFNefQ4WR1dES8yby8m4DZUohTMjErJIctz L7m+IuBf6Pj5k6oF2k9Iih0odi/RN7C+EnkITrbkRTY9MpSkisd3tO4wS5zcVMgjm2EO kQcg== X-Gm-Message-State: AFqh2krYyGIhKlATtEs11qlindrw8H2P11HO88TqxMDjVuS9DrrYrGRi RYw0aRsYjpAy+S3yi7hN1VVtOPk4VlM9b8ZP X-Received: by 2002:a1c:4c0e:0:b0:3d9:f836:3728 with SMTP id z14-20020a1c4c0e000000b003d9f8363728mr219439wmf.11.1673304883369; Mon, 09 Jan 2023 14:54:43 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id n23-20020a05600c3b9700b003cf71b1f66csm14602830wms.0.2023.01.09.14.54.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 14:54:43 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost , Markus Armbruster , "Daniel P . Berrange" Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Stefan Hajnoczi , Kevin Wolf , qemu-block@nongnu.org, Paolo Bonzini , Hanna Reitz Subject: [RFC PATCH 4/4] qom: Warn when deprecated class property can be removed Date: Mon, 9 Jan 2023 23:54:19 +0100 Message-Id: <20230109225419.22621-5-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109225419.22621-1-philmd@linaro.org> References: <20230109225419.22621-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Per docs/system/deprecated.rst, a deprecated feature can be removed after 2 releases. Since we commit when a class property is deprecated, we can warn when the deprecation period is over. See also commit ef1f5b0a96 ("docs: clarify deprecation schedule"). Signed-off-by: Philippe Mathieu-Daudé --- qom/object.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qom/object.c b/qom/object.c index 05b97cd424..cb829f1e44 100644 --- a/qom/object.c +++ b/qom/object.c @@ -17,6 +17,7 @@ #include "qom/object_interfaces.h" #include "qemu/cutils.h" #include "qemu/memalign.h" +#include "qemu/qemu-version.h" #include "qapi/visitor.h" #include "qapi/string-input-visitor.h" #include "qapi/string-output-visitor.h" @@ -1300,6 +1301,12 @@ void object_class_property_deprecate(ObjectClass *klass, ObjectProperty *prop = object_class_property_find(klass, name); assert(prop); + if (qemu_version_delta_current(version_major, version_minor) <= 2) { + warn_report_once("Property '%s.%s' has been deprecated in release" + " v%u.%u and can be removed.", + object_class_get_name(klass), name, + version_major, version_minor); + } prop->deprecation_reason = reason; }