From patchwork Mon Mar 27 13:15:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 667396 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp1095213wrt; Mon, 27 Mar 2023 06:16:11 -0700 (PDT) X-Google-Smtp-Source: AKy350YjPi43qut7YZ6KR4y7QFsNZOIyiX6/9e42ce32l9MvATxh5U6ndpuokyRIWDcl5TCFKqtS X-Received: by 2002:a05:6214:20ea:b0:5a9:609d:e239 with SMTP id 10-20020a05621420ea00b005a9609de239mr17287688qvk.48.1679922970937; Mon, 27 Mar 2023 06:16:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679922970; cv=none; d=google.com; s=arc-20160816; b=sUou1ve0q1hUT5x4AieCDLd0IqXa0TZUf0SpdYzzImeDa/Bju6H2NUiXHtwF7wbwk2 ml1ebf++qOGLEiWGJ6nNhtDdBauonObSOm05/DVGwA/rO/afPOMivck23Bn71YMoeRsq xbujMO5aSUN3ssWup1lNtjmK8ONr8dEeqLT9kKEc81E+05fc/n2ad5URZdDHvTab7OBf Ygq5pjcaAbk1Vv8zRVNGIp9yTrdBe30i1xFiaW5nYDBGDwzcxbx0Tj9SXnhpsqydQfZm gxoLU6fww8kwa3SoqlZ0y7T0SM63GtIxfWaCG1XaQJwgSQG1Z6ISYV58nARPYOwRPG9Y o8vg== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=nVPcgNqV4+yTyF7JyxZthOMz/9y/APO3HAlemN7QWn4=; b=rqvCCxq3w3tN3ThcEGa9zZe4HNfDFVc7zgjM394J9CkU1fN2+PkqK5Wc/3NYCxYDwx ZlRe6MpGNwbwWGdieFKhwvgdwYpRbixGxuChLzUXMGgtU+LBblsfIWKZDimK5Mphtzg+ w1Y1brlXsb5GhUcTY2/+LqSHk+aKESnfjff231YcaYs8Ruz6bUW9wJOm7MnziVySlNHd +18hOZ5ps6Xi+kdgxEZvC8n+SOVPwExtmSqI9UmggL7/yjVWB5haT8VMw8bAiHGhmHI0 Z5wL6jilIokkDnEqvKY6IZ/zbj2VSGwJySYoZvNCDydCqyor0D6+Lt900t+Ib2ZrEmnp P8Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MIILrSg8; 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 kc8-20020a056214410800b005ca5decd352si15072865qvb.450.2023.03.27.06.16.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Mar 2023 06:16:10 -0700 (PDT) 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=MIILrSg8; 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 1pgmhZ-0003MS-VG; Mon, 27 Mar 2023 09:15:57 -0400 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 1pgmhX-0003H6-VW for qemu-devel@nongnu.org; Mon, 27 Mar 2023 09:15:55 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pgmhV-0002EG-TD for qemu-devel@nongnu.org; Mon, 27 Mar 2023 09:15:55 -0400 Received: by mail-wr1-x434.google.com with SMTP id l12so8736503wrm.10 for ; Mon, 27 Mar 2023 06:15:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679922952; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=nVPcgNqV4+yTyF7JyxZthOMz/9y/APO3HAlemN7QWn4=; b=MIILrSg8ZQLQ07GY+TgJRUI8mbTVDgVxfrkQiytHeqInKIoDaVxMm7Hw7azJrMx35T efId33cCjQFfRjEKGU45g07BwPNF8trvj/BrZY6/5qO673fAe1sF6I/e/fusjBCeamIx EdtTKXd8WH3NjG/oYB3DNTF6e6XtEEglLHfkVkfW5tljtUT17vGwTtFfXaaJ3nB4lQZy 1GNQ1G7ukHvk1UxhuiKycOvD0XXmrJYMTTtwcum0/JJa4KO6F3ty4gaD8z+RcoolBxbk /gd8Gx7G7sZCxBGjG7HshDL+g6FU03Q9WadnDKdtj8TVwc3jtMhBMOZ7Vmf7iPdf87Ow Xj7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679922952; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nVPcgNqV4+yTyF7JyxZthOMz/9y/APO3HAlemN7QWn4=; b=JuNFhp00yJkKQoO/s1FDjvIyZdhSIxCoZuH45iC4U5W3GZKNQ4zVyaInUnoW3Z2hud Olm94Kt4Z55DvU8TC86Z7hEPcEjwEuiUA5EavAG0QwzCzEXm1mIQFBJGfCIQnzFuflee CxdLsStyOcpByXetRGnBG+FYEO0gid58zqRME3GZ/oHROj+IzjulJ70AZLXfw5JOFwQ2 jWUmSkc+gziXNhX6ABrWpJ3RBOZm37ABfMaQPKdNNWao25FgwL1vLNfuHyGprxfB03Bj UuHWF1vqnNyubmiYj1HxWIpnTEjXnfoDSEvOY568gX9bc9/+MMyrX2rWBuF0V2beYlzF E8Qg== X-Gm-Message-State: AAQBX9f/ZGqtzu6erqNWrsrsladJfcTmbVMV45qfl515b3qMUcWK6kzc V6E8A2gHeYitBKoSxWqNE29W0Q== X-Received: by 2002:a5d:4b42:0:b0:2c7:454:cee8 with SMTP id w2-20020a5d4b42000000b002c70454cee8mr9928980wrs.1.1679922952052; Mon, 27 Mar 2023 06:15:52 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id s13-20020a5d510d000000b002c794495f6fsm22054021wrt.117.2023.03.27.06.15.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 06:15:51 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 089A11FFB7; Mon, 27 Mar 2023 14:15:51 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost Subject: [Socratic RFC PATCH] include: attempt to document device_class_set_props Date: Mon, 27 Mar 2023 14:15:43 +0100 Message-Id: <20230327131543.2857052-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x434.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 I'm still not sure how I achieve by use case of the parent class defining the following properties: static Property vud_properties[] = { DEFINE_PROP_CHR("chardev", VHostUserDevice, chardev), DEFINE_PROP_UINT16("id", VHostUserDevice, id, 0), DEFINE_PROP_UINT32("num_vqs", VHostUserDevice, num_vqs, 1), DEFINE_PROP_END_OF_LIST(), }; But for the specialisation of the class I want the id to default to the actual device id, e.g.: static Property vu_rng_properties[] = { DEFINE_PROP_UINT16("id", VHostUserDevice, id, VIRTIO_ID_RNG), DEFINE_PROP_UINT32("num_vqs", VHostUserDevice, num_vqs, 1), DEFINE_PROP_END_OF_LIST(), }; And so far the API for doing that isn't super clear. Signed-off-by: Alex Bennée --- include/hw/qdev-core.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index bd50ad5ee1..d4bbc30c92 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -776,6 +776,15 @@ BusState *sysbus_get_default(void); char *qdev_get_fw_dev_path(DeviceState *dev); char *qdev_get_own_fw_dev_path_from_handler(BusState *bus, DeviceState *dev); +/** + * device_class_set_props(): add a set of properties to an device + * @dc: the parent DeviceClass all devices inherit + * @props: an array of properties, terminate by DEFINE_PROP_END_OF_LIST() + * + * This will add a set of properties to the object. It will fault if + * you attempt to add an existing property defined by a parent class. + * To modify an inherited property you need to use???? + */ void device_class_set_props(DeviceClass *dc, Property *props); /**