From patchwork Thu Apr 20 15:57:22 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: 675635 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp394455wrs; Thu, 20 Apr 2023 08:58:01 -0700 (PDT) X-Google-Smtp-Source: AKy350biDXiC7P/esYub49w5MzfDICj4NK3WZ80mmIwqYn8Gr7UFedT33ChBzG2LklsPcGdSzdkD X-Received: by 2002:a05:6214:29cc:b0:5ca:6c32:f35 with SMTP id gh12-20020a05621429cc00b005ca6c320f35mr2001043qvb.39.1682006281390; Thu, 20 Apr 2023 08:58:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682006281; cv=none; d=google.com; s=arc-20160816; b=qSCN+DHX82A0eCyDtUB7W4OM0CaLAILiMgNkl8K47xUY9Mo13UVPhMaccez3nVZ/N7 rF4HGt593MvLxaFzuz2WmQYnjMO5dRJVCA3oQvmLQafyJ2LqO3JmA8MsvNQTGjl2dq4L /06rpj4RwsiTAd9pAlXJ4xJ+nc03phiAhmUnIkBXjdEaDmUbnX2csFDt+24CcEBFWH05 YRUZq35geNOvFuWFR87VSrNzZZCxtRsImwBG8j05FuqkpO9mm/noNPQKYQBqfL8BvLXM KC2RXMbK8gSsROe6o6tOXaT33bK+/jousxYuY4027gXsrqReTm5OlOUgj25PfwCAE8cK 9OLg== 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=4pZT3Il0Z6ehRMXrKuFjhJyb9HkLDoEsCo9Ux/XBJuc=; b=YtXrSxm7O8taOIKoQxiWcSxfLpn716B75qK87Gd44IkBmslJISUwqfTd44rzvYz0qo Wy/vlpcw263rybtqF8MVGFK+3WeNyQzzOUTyqUMP+sWauUzo+6BQr2vXWOpTpKGWdp+q pycfkYORWI8HF6vcb3dELjEde63a3c9l5sxma6/2ZYYjGDir4MreCqxCcscPxE9brsbH 4W5Gv9gld3eLMT5Y1stIRuklGaO/eq620owinSTzAXjJNDqxIZCQBstAPpb8bw3yCtNe IJW8vL9iwwCR8wDiyUDqfKVWppomP1Rl3aGvpQRheQHfyYYqpG2KNsbA6h36oeW8zE7+ 2ZIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D9VRfp9M; 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 ey3-20020a0562140b6300b005ef58580b80si1727897qvb.186.2023.04.20.08.58.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Apr 2023 08:58:01 -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=D9VRfp9M; 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 1ppWf7-0000CS-UU; Thu, 20 Apr 2023 11:57:33 -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 1ppWf6-0000BQ-FZ for qemu-devel@nongnu.org; Thu, 20 Apr 2023 11:57:32 -0400 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 1ppWf4-0007vB-KS for qemu-devel@nongnu.org; Thu, 20 Apr 2023 11:57:32 -0400 Received: by mail-wm1-x32f.google.com with SMTP id n43-20020a05600c502b00b003f17466a9c1so3310472wmr.2 for ; Thu, 20 Apr 2023 08:57:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682006248; x=1684598248; 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=4pZT3Il0Z6ehRMXrKuFjhJyb9HkLDoEsCo9Ux/XBJuc=; b=D9VRfp9MtT/vYu6qDryy8LitOvu8IXhgzR0NR7+vQ9PYVYymyiMnA+cZdfgX07MTr5 jmplAVwDpBwRlsUuQePfj9Oob+lSuqGKRPFUSLyqtGxg5bWerNE96RHpQLzylb3NrhgB ca/KDhDkfrE1n/5EgMFznQGSoyH50ysvxh0/cPltKi6HYO6XVlvK8xwkYe2rCXz07nnb iFJXArJU0sQ7H5EpJQv6chooNWL4IV4REujZHzXlYK/3u36ngxcywFtHXvvJOToUOqig gjwsCOLJgy/D5PcZVOshTkRxD6ijFqyiVQqXpdclycA/HYHdb4Qi48XJSni4RsKEpF5X nwuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682006248; x=1684598248; 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=4pZT3Il0Z6ehRMXrKuFjhJyb9HkLDoEsCo9Ux/XBJuc=; b=ln3kH+MOK3o+FytViW4MErNzL5hDMEbmN8hur9ifau1jjP9Xomh6Pm5G9UrjLudSLK BXgxWzo/sE7cWrOGyohiL111t4mQxYZbYkDg3jZFB4g49fq7js6c9giLmGEMZr8+xy+z /b1Ovo2lvsMXQGKehRpbhgXE2TQ5D4Tc04x2XsGlsO99RQ5+UrdkdBwYJkuV8p7H9oLY OuDUfsegJx5HkotElQiZKmpRWgqUxUHwSxz5Olbe/PIi686YiFw7+SshKuEGPG2ARczk jomEbRADH1hoR+kHenSsXzPyTeuTE8VElA9eVqXDXge8qTxbOnyClnkvxJbgL5YVoITo 5g4Q== X-Gm-Message-State: AAQBX9faEehHfst9ZEU8+mswBUAh+KZGAC06mbW7OtvsFXF4M/7MQ2fn rs86orQXk5y4UYlRm18A385Xi4MG7NsmZwo8g4c= X-Received: by 2002:a7b:cb8d:0:b0:3f1:789d:ad32 with SMTP id m13-20020a7bcb8d000000b003f1789dad32mr1836342wmi.11.1682006248649; Thu, 20 Apr 2023 08:57:28 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id bi26-20020a05600c3d9a00b003eddc6aa5fasm2024962wmb.39.2023.04.20.08.57.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 08:57:26 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 52CA31FFC0; Thu, 20 Apr 2023 16:57:24 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Elena Ufimtseva , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Daniel_P?= =?utf-8?q?=2E_Berrang=C3=A9?= , peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , Thomas Huth , Markus Armbruster , Alexandre Iooss , John G Johnson , Jagannathan Raman , Juan Quintela , Eduardo Habkost , Richard Henderson , Mahmoud Mandour , Mark Cave-Ayland Subject: [PATCH 8/9] docs/devel: mention the spacing requirement for QOM Date: Thu, 20 Apr 2023 16:57:22 +0100 Message-Id: <20230420155723.1711048-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230420155723.1711048-1-alex.bennee@linaro.org> References: <20230420155723.1711048-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=alex.bennee@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, 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 We have a more complete document on QOM but we should at least mention the style requirements in the style guide. Signed-off-by: Alex Bennée Cc: Mark Cave-Ayland Reviewed-by: Juan Quintela --- docs/devel/qom.rst | 2 ++ docs/devel/style.rst | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/docs/devel/qom.rst b/docs/devel/qom.rst index 3e34b07c98..c9237950d0 100644 --- a/docs/devel/qom.rst +++ b/docs/devel/qom.rst @@ -1,3 +1,5 @@ +.. _qom: + =========================== The QEMU Object Model (QOM) =========================== diff --git a/docs/devel/style.rst b/docs/devel/style.rst index 5bc6f2f095..0bd01f3fca 100644 --- a/docs/devel/style.rst +++ b/docs/devel/style.rst @@ -628,6 +628,35 @@ are still some caveats to beware of QEMU Specific Idioms ******************** +QEMU Object Model Declarations +============================== + +The QEMU Object Model (QOM) provides a framework for handling objects +in the base C language. The first declaration of a storage or class +structure should always be the parent and leave a visual space between +that declaration and the new code. + +.. code-block:: c + + typedef struct MyDeviceState { + DeviceState parent_obj; + + /* Properties */ + int prop_a; + char *prob_b; + /* Other stuff */ + int internal_state; + } MyDeviceState; + + typedef struct MyDeviceClass { + ObjectClass parent_class; + + void (*new_fn1)(void); + bool (*new_fn2)(CPUState *); + } MyDeviceClass; + +See :ref:`qom` for more details. + Error handling and reporting ============================