From patchwork Tue Apr 18 16:21:28 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: 674517 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp58660wrs; Tue, 18 Apr 2023 09:22:58 -0700 (PDT) X-Google-Smtp-Source: AKy350bd4VDvTZB3V69gMRBWWampRuzrWQZlAVNDKjZ0AjUHeR44yDbi84qX7oUfs7wNjJ1eDddt X-Received: by 2002:ac8:574c:0:b0:3ef:3b04:b8dc with SMTP id 12-20020ac8574c000000b003ef3b04b8dcmr781197qtx.0.1681834977918; Tue, 18 Apr 2023 09:22:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681834977; cv=none; d=google.com; s=arc-20160816; b=HW2LBZvA7tI5B8AKU9q51TDUtC2yMjGaI/iNgnHNCcbf6ObmXTfsGOHUpZeNlqO/p7 qvQMps6LPNzrFVX6mKuPoxABtFNUooU1nBfjE0K/iI/+f+2uUxw9vp3F9ruqQK3wJfP/ /5pfen789j1cFjaGPvhIVzxKPp0db2TVKgAkK6ofDEyyzv58Q4g9eppd3XJ+C3KotGQ1 Kkuz32hGhl6F0Cyo5XblMvn8mSO/N2Vj4/6ZDlcX5qPHpx4n/MkCaLfLiiDb/h2g6oIg hsZywFuE2ofbe2nvcmQrtB01dBddRKxMVnI1dqWwmtlWBDVKpDFuTBHAuXo5M/Yq/Fig bS+g== 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=nVPcgNqV4+yTyF7JyxZthOMz/9y/APO3HAlemN7QWn4=; b=NgOgv+VfGr3ZR/pJNoBkqXo7xnPhKFD+kGkFAt/XSRsLT+oW92nvb9GyX+5O20rjuS 3nA9HcRuU29wZ1dEwCI1N9eRXA/QnxWKuEuCwlC/Z/IVKNQ2Rt9u90xuyYmI9iM0LXua n4UNONScAgyEZLzyRpPu/81PJcQx+MLDR3NbPHUCyKPjhrC3UWYrwCoNqz8yI01wKnpC Jhan9FfGeA09ZUek1zQ+HGzbVPhkPbsmrdMqdf8wIPqnJs5S882XQdz4wX1hN7yQwwNw ol0yMKmJm/og1PR6LGRoOoRtBYggY2ci4UfZzCOridUUkq9DjdWIFD8n+Im/4HXUA07H 9PZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lh3DoEsc; 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 t8-20020a37ea08000000b00746b5597206si7443621qkj.114.2023.04.18.09.22.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Apr 2023 09:22:57 -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=lh3DoEsc; 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 1poo5R-0006kE-Dj; Tue, 18 Apr 2023 12:21:45 -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 1poo5P-0006jd-TS for qemu-devel@nongnu.org; Tue, 18 Apr 2023 12:21:43 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1poo5O-00019i-EB for qemu-devel@nongnu.org; Tue, 18 Apr 2023 12:21:43 -0400 Received: by mail-wm1-x32c.google.com with SMTP id q5so15808824wmo.4 for ; Tue, 18 Apr 2023 09:21:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681834901; x=1684426901; 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=nVPcgNqV4+yTyF7JyxZthOMz/9y/APO3HAlemN7QWn4=; b=lh3DoEscXnSGZYVJilsLz7CrDv9jETtkrvXu+/jcvnYRChkSlFa0gMBrojRPrqfezm zcULKjJGS8RaT8aZhvGHhlkLwhnBEgfqiccMtVwvOrVhOM8VUDce9BEqe817a3fV++AF b8Fzoasw4jnYQEpCZZQA9Whf7zjpTx8k1hoMSuYQLXpB5O6aW94aX+BsxZcaWgcCtWFj GwHTSAjzwlWw0WxXnQ3Epi7KoMVB7gmS06TJ8BAcwtRpChb0T6/HFiPc7icqh5IbhDwx 7PWEGuQupe02XWKsNW52Us+WswQre3G1SkNN+/T+GlTiENr8BfRHfqOR7a+nTr1QLoOg vyUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681834901; x=1684426901; 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=nVPcgNqV4+yTyF7JyxZthOMz/9y/APO3HAlemN7QWn4=; b=FsWOXap0Z83qNrAiaKBL3jHS9tTYli2qP5pmS7ecG5FSKZXFAqM6wDHDWqMuTGdNVV YalLdpRi++uD/32+PCZmPd0syKmXyxfACuVh4f+m3JIVuQ7s3FF9ZKOo2r+1RcdGNcnO jqkry/n0K2/g+Z8h1YbLPpkuRJezvkwx3pzcI2gIn0vIssFOBy0EyYgxSRcIMWUoNIt+ YCy9FBNe/Uk+tXk4Plg+Cq3ml7TDJqR7W95TUCllP3UQ3Ej2FR4HBP+KHNSMnuq92eTS jspaJL4DWI4jRbJnzvgzp8D/IGwuJiu6tHWlYUr1SK9Lidzf39jeE1rLmEgtKkJE9acB 6rKQ== X-Gm-Message-State: AAQBX9fBuG34QdinNWrjmhrY8YpZbyzfEBGS/THtO6pQmnxdYccQmWem M+h/YIyGx9g1kGmTXJ9P5Nky9A== X-Received: by 2002:a7b:cd8c:0:b0:3f1:7440:f21d with SMTP id y12-20020a7bcd8c000000b003f17440f21dmr5088103wmj.33.1681834900875; Tue, 18 Apr 2023 09:21:40 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id l6-20020adfe586000000b002fe065da369sm1371456wrm.69.2023.04.18.09.21.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 09:21:40 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 3FA401FFB8; Tue, 18 Apr 2023 17:21:40 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Daniel_?= =?utf-8?q?P=2E_Berrang=C3=A9?= , Eduardo Habkost , Viresh Kumar , Mathieu Poirier , "Gonglei (Arei)" , Markus Armbruster , Erik Schilling , Jason Wang , Mark Cave-Ayland , Gerd Hoffmann , virtio-fs@redhat.com, =?utf-8?q?Marc-And?= =?utf-8?q?r=C3=A9_Lureau?= , Paolo Bonzini , "Michael S. Tsirkin" , Stefan Hajnoczi , Eric Blake Subject: [PATCH v2 01/13] include: attempt to document device_class_set_props Date: Tue, 18 Apr 2023 17:21:28 +0100 Message-Id: <20230418162140.373219-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230418162140.373219-1-alex.bennee@linaro.org> References: <20230418162140.373219-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32c.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, T_SCC_BODY_TEXT_LINE=-0.01 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); /**