From nobody Thu Nov 14 07:15:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1621520954; cv=pass; d=zohomail.com; s=zohoarc; b=VUSBeAivSgh25NbPKkrj67zgFj39dxiu9ksceJl/sXey1Wi9nzgj2+x6FuIixi0UdB0cJPyr9Jg51Q7o+ABdl0zEEqqtu9jEcCwnTNdFJdGre0Fic01pKWoAIqDpvchhs+RwxijvQEphwTrzgirabiWEA1fQgseKbrFLknP3MA0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621520954; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jzDbbNYEnbdBoSVH23LkmSfDqFedKSi8vW+/wTVhglY=; b=FAEqB+bWAitwKpQRIfWuSV07Eizp60BlJUCx/VNsGQY6p982/2vMd/g+pyVhQiW0BkxDX8iMdLaaI6K2wc2wjytd1j8TW+GjY/P065OdYgW4yhTaE8AKk9EoRmLuYw7A5TSEZi55fU51l34GLVkT0pT5G6gYH+fAiZ5QH2ATuoU= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621520954335905.4479314085565; Thu, 20 May 2021 07:29:14 -0700 (PDT) Received: from localhost ([::1]:33424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljjfl-0003Bl-8E for importer@patchew.org; Thu, 20 May 2021 10:29:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljjZQ-0005TB-LX; Thu, 20 May 2021 10:22:40 -0400 Received: from mail-vi1eur05on2115.outbound.protection.outlook.com ([40.107.21.115]:23648 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljjZO-0005Yx-Qe; Thu, 20 May 2021 10:22:40 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB7009.eurprd08.prod.outlook.com (2603:10a6:20b:34c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.26; Thu, 20 May 2021 14:22:29 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133%7]) with mapi id 15.20.4129.033; Thu, 20 May 2021 14:22:29 +0000 Received: from localhost.localdomain (185.215.60.197) by HE1P190CA0034.EURP190.PROD.OUTLOOK.COM (2603:10a6:7:52::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.23 via Frontend Transport; Thu, 20 May 2021 14:22:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K2mDLhZQtIHTMPyen9K3ok8C7tSsTysLdCXbmzEl7N6tPL4+SeLDG9D8sU08cPax7QtKnpdazvbzkYLnnzfnAkBUrsmcrh32urNZKz7gON/4c+psZrYd5kde4IjDGkqcJABz/h4Kc5T1mLyLXTwAVAgquj4/Pjkl0A8n5GpIcZ/rHQ06888C1hNFyH2nlLKwy2J04iSeXCgvoavIwxGNJdd9WYte83Ts2RsKSKQ4wJMM1UMLnjo6r6MlV9wqkqZOxHBvaOlwgp1J05bgIMKIYaAiGXGRSMMysvJgtpgPlsOOBTV0OZa7qWQBG97huiSFXzTF7HUZzjqhMRe0R0bvsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jzDbbNYEnbdBoSVH23LkmSfDqFedKSi8vW+/wTVhglY=; b=UbX8hJSefybfEfV+l7BS1UzFkJJMOqRUd/6yifoBglR+dtKiUUPWyYvxSmTnlnxrQJGLNCvlJzk8sYfPzPcJAo4Ya2PUgYfbQPICFHjFXAb5U/yCzgBjSKkomkzNH7yrpUo/g4GRUXDydM8Tx9LsTbD8SXhi3VYSh7dScakUt9tOzi2jtiNGlsBoBLn5gxvVd3JFnjgY6LS73fYoE1VPQ9wXXV+5+0q+bWqOUpOv9SDHBa12b3a+d5DBH0ugAqlTVyyoD6dUA863YGJMoXNlkEaSMtGGK56uOOEAY6QaFnLxAiVvHiICkZabM/7sceoPsK7A6SQfzcKnLvoUyCVevA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jzDbbNYEnbdBoSVH23LkmSfDqFedKSi8vW+/wTVhglY=; b=EY+2S6W2UYSbvf5pLgQNnftr/HgXdX1QEifCmnljJl8sNcTRNjAMcmX06brFJODTmFKqq5b25jR6qedmw+2zfU/VU4cw+B45t44bRxic3O/3bLBokun0tuIIfWH1zr/xYEw8sl34+XShbCDx/lanUeKgSAcsziFEuQbDT+9LFaQ= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, eblake@redhat.com, armbru@redhat.com, crosa@redhat.com, ehabkost@redhat.com, berrange@redhat.com, pbonzini@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, mreitz@redhat.com, kwolf@redhat.com, den@openvz.org Subject: [PATCH v2 05/33] qdev-properties: PropertyInfo: add realized_set_allowed field Date: Thu, 20 May 2021 17:21:37 +0300 Message-Id: <20210520142205.607501-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210520142205.607501-1-vsementsov@virtuozzo.com> References: <20210520142205.607501-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.197] X-ClientProxiedBy: HE1P190CA0034.EURP190.PROD.OUTLOOK.COM (2603:10a6:7:52::23) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 76a90f6d-cdef-451a-dcb2-08d91b9ab328 X-MS-TrafficTypeDiagnostic: AS8PR08MB7009: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:595; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BH0cQtrRTu08FA4F07BwG4rJtP8B5Elg9TpI87lYm7V+p6vOh44WRl4mtmojqSjvfd+EPHLNa41XFPqPhwCOltoR2GUQUEU6FfqQY76xtLGxYvytYcE4uLsTn+F+mW0UVxlsZAfXapjzMj/WfinL0U2DuuWgSdMfdKUTj96LmJLmUQa+NVQy0fCtN96GO00FKdrNEskaeBniXRjD9lDRJW3+amZRPaCHAiPLqNt078rEuuBKPHUorAqawQOXNchVxgYIwSVbWtOM31wiKLsrsXcnxW0aWCnnFIzii6tdwrjfdgHNfUtixlOWJgboyyKb0x47v9bUPxIYbdU4b7M4MP05LpSmWdQDGw890wNbVQHtFaXxS/8wml/3okHL5UvEE27cGoR6i2DYfOstZSF+dySxkv5rPr4/LZityIkRrmhkzI6xL77lD0cBB3ZId5QfOnhlgk23utIexRMyCGM0KoFlbfsRBQXItzziVd4xiWmcAnqqnHIxwUZiWw9XssTODS2yMofIPdUshZ265jzQR5UhbyAkCkX8S74PfXISdiAnFMX5+m86Fjq/vlwjUQnylHTOIlbSIhyeu1yn4ljLqscB8WVDYvuJ7pMJr2+pcDzOdvrejhZcAD4bUw+ULw2W31bQP0zEuj5OKtqTtz/WwwXfqMQjOpUW4uB39ODKeedsycNVGnOtE+wQB6uGcvuT X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(136003)(39840400004)(376002)(346002)(366004)(38100700002)(38350700002)(478600001)(86362001)(6916009)(6486002)(36756003)(83380400001)(107886003)(8676002)(186003)(6666004)(4326008)(16526019)(316002)(1076003)(5660300002)(8936002)(26005)(6506007)(7416002)(66556008)(66476007)(66946007)(2906002)(956004)(2616005)(6512007)(52116002)(69590400013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?ziioi9qmdrR2Kgj2mlX+2ud/gVBE/28aINtK+MzXBPI9F6c0derFrneXvXoG?= =?us-ascii?Q?4nCFIzLw4YQmOU57yTirjIQDIWw3fwbxvo7uNaveiiBrXSMm6gI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kv0l97m+Dy7P3FPXH2dxZgNZbfoPq+l?= =?us-ascii?Q?yAL0p6GwX7RRDoagbbG/7bHVB8ScmLQcbhcB1cNXANthoXGFuCWc//iEf8iP?= =?us-ascii?Q?d37u733Z4owNkIQ31sZbT2SOLb3tNThBn+bsn4Tt+lEYrBlRrzkky/KPlQA+?= =?us-ascii?Q?cBKHozx9Vt5jcEhEnKF1lj1O8BRTLCaV61bK0lU0PbkwIqZ99bq5aIgmWuVm?= =?us-ascii?Q?OjqyhdLJzKFbaTAAsBOuo9n7IcY0nFDcDN5A148yO7Ko6ftJ9+L159xrK6t7?= =?us-ascii?Q?+Up1fqV12mCtQrBbUOzDberaKv3gbyOhbU2o31yJqyvjwnxphjXctEjXsk6W?= =?us-ascii?Q?zmz185rrsX71DWA2yjgJBylk?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76a90f6d-cdef-451a-dcb2-08d91b9ab328 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2021 14:22:29.5603 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yBwXlASC/eYF/QhFPn7D3hM0wjxQ13E+FDj3but9pt9VtJp2wmEmTYMBeGHQANhHjv8xTcf+kia49F4VpFlqoP9MpUu6CzpSBEaB3H9VWlc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB7009 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.21.115; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" Add field, so property can declare support for setting the property when device is realized. To be used in the following commit. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- include/hw/qdev-properties.h | 1 + hw/core/qdev-properties.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 0ef97d60ce..f7925f67d0 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -32,6 +32,7 @@ struct PropertyInfo { const char *name; const char *description; const QEnumLookup *enum_table; + bool realized_set_allowed; /* allow setting property on realized devic= e */ int (*print)(Object *obj, Property *prop, char *dest, size_t len); void (*set_default_value)(ObjectProperty *op, const Property *prop); ObjectProperty *(*create)(ObjectClass *oc, const char *name, diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 50f40949f5..c34aac6ebc 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -26,11 +26,11 @@ void qdev_prop_set_after_realize(DeviceState *dev, cons= t char *name, =20 /* returns: true if property is allowed to be set, false otherwise */ static bool qdev_prop_allow_set(Object *obj, const char *name, - Error **errp) + const PropertyInfo *info, Error **errp) { DeviceState *dev =3D DEVICE(obj); =20 - if (dev->realized) { + if (dev->realized && !info->realized_set_allowed) { qdev_prop_set_after_realize(dev, name, errp); return false; } @@ -79,7 +79,7 @@ static void field_prop_set(Object *obj, Visitor *v, const= char *name, { Property *prop =3D opaque; =20 - if (!qdev_prop_allow_set(obj, name, errp)) { + if (!qdev_prop_allow_set(obj, name, prop->info, errp)) { return; } =20 --=20 2.29.2