From nobody Tue Nov 26 08:26: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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1709534100; cv=none; d=zohomail.com; s=zohoarc; b=G6YeFKXqkuN1Nm72wWw1jpm1R2JeyOvfE4sKNtk5+7kbFHrqTHT9JxXjcvN+cw2AsZqx4SyBdTEefRf3hSe2DsLNXxeZuV/vxIl26GEOsyR6NtK8G+DZNF6QGyoY45uktAXJiTfydBdL9nArqTZoF3KxXRuqA0UUv2UAUf9HDrM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709534100; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=1k05FKtNN7IYC6F5eocShFpTw77V9Va5LeseCiYOTB8=; b=FAAf9Z5W28zTTSnGyHwfW5s4XarHqikLG481yIDHi/eF1YBVM/d78QcGXp+vv03qQYQ3DDT56L/mzCq+2WD4MIbdY69Y1sgNWLNnOTR8M3Djblz5fOYQYJ5o2Ne4BdqK1RsAYckeWR2e1OwgXhR6UrGpGL33bnv1OMhOQk10uKY= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1709534100360340.2603084265446; Sun, 3 Mar 2024 22:35:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rh1tA-0005v6-Sz; Mon, 04 Mar 2024 01:33:28 -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 1rh1sd-0005aT-Rr for qemu-devel@nongnu.org; Mon, 04 Mar 2024 01:32:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rh1sR-00009K-DD for qemu-devel@nongnu.org; Mon, 04 Mar 2024 01:32:55 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-418-d5ZDgEysO4eIm5UnCBz9ug-1; Mon, 04 Mar 2024 01:32:40 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9FFE21C0BB41; Mon, 4 Mar 2024 06:32:40 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5E1A6C04323; Mon, 4 Mar 2024 06:32:40 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 9477821E682D; Mon, 4 Mar 2024 07:32:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709533962; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1k05FKtNN7IYC6F5eocShFpTw77V9Va5LeseCiYOTB8=; b=Nh2kiWl0hV4BT94U3PCKqspMgC4vHq9MXXqyQudZWEW4YRXgUy55TmujIYzOCxJa2jAQM9 mv8MKhC69XA5YPEvK2aZm3B8sKok5KAHpmmXm7y/LHXVePajsAtQYwfjpLKWG3/W39QmT9 /6ZFqDGqV9phswqi+SMPk9Kht8sgHgI= X-MC-Unique: d5ZDgEysO4eIm5UnCBz9ug-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Eric Blake Subject: [PULL 15/18] docs/devel/writing-monitor-commands: Minor improvements Date: Mon, 4 Mar 2024 07:32:33 +0100 Message-ID: <20240304063236.213955-16-armbru@redhat.com> In-Reply-To: <20240304063236.213955-1-armbru@redhat.com> References: <20240304063236.213955-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 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=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.589, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1709534101733100003 Content-Type: text/plain; charset="utf-8" Avoid "JSON" when talking about the QAPI schema syntax. Capitalize QEMU. Don't claim all HMP commands live in monitor/hmp-cmds.c (this was never true). Fix punctuation and drop inappropriate "the" here and there. Signed-off-by: Markus Armbruster Message-ID: <20240227115617.237875-3-armbru@redhat.com> Reviewed-by: Eric Blake --- docs/devel/writing-monitor-commands.rst | 32 ++++++++++++------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/docs/devel/writing-monitor-commands.rst b/docs/devel/writing-m= onitor-commands.rst index cd57f46082..930da5cd06 100644 --- a/docs/devel/writing-monitor-commands.rst +++ b/docs/devel/writing-monitor-commands.rst @@ -115,8 +115,7 @@ the bottom:: ## { 'command': 'hello-world' } =20 -The "command" keyword defines a new QMP command. It's an JSON object. All -schema entries are JSON objects. The line above will instruct the QAPI to +The "command" keyword defines a new QMP command. It instructs QAPI to generate any prototypes and the necessary code to marshal and unmarshal protocol data. =20 @@ -138,16 +137,16 @@ There are a few things to be noticed: 3. It takes an "Error \*\*" argument. This is required. Later we will see = how to return errors and take additional arguments. The Error argument should = not be touched if the command doesn't return errors -4. We won't add the function's prototype. That's automatically done by the= QAPI +4. We won't add the function's prototype. That's automatically done by QAPI 5. Printing to the terminal is discouraged for QMP commands, we do it here because it's the easiest way to demonstrate a QMP command =20 -You're done. Now build qemu, run it as suggested in the "Testing" section, +You're done. Now build QEMU, run it as suggested in the "Testing" section, and then type the following QMP command:: =20 { "execute": "hello-world" } =20 -Then check the terminal running qemu and look for the "Hello, world" strin= g. If +Then check the terminal running QEMU and look for the "Hello, world" strin= g. If you don't see it then something went wrong. =20 =20 @@ -201,7 +200,7 @@ There are two important details to be noticed: 2. The C implementation signature must follow the schema's argument orderi= ng, which is defined by the "data" member =20 -Time to test our new version of the "hello-world" command. Build qemu, run= it as +Time to test our new version of the "hello-world" command. Build QEMU, run= it as described in the "Testing" section and then send two commands:: =20 { "execute": "hello-world" } @@ -210,13 +209,13 @@ described in the "Testing" section and then send two = commands:: } } =20 - { "execute": "hello-world", "arguments": { "message": "We love qemu" } } + { "execute": "hello-world", "arguments": { "message": "We love QEMU" } } { "return": { } } =20 -You should see "Hello, world" and "We love qemu" in the terminal running q= emu, +You should see "Hello, world" and "We love QEMU" in the terminal running Q= EMU, if you don't see these strings, then something went wrong. =20 =20 @@ -246,7 +245,7 @@ The first argument to the error_setg() function is the = Error pointer to pointer, which is passed to all QMP functions. The next argument is a h= uman description of the error, this is a free-form printf-like string. =20 -Let's test the example above. Build qemu, run it as defined in the "Testin= g" +Let's test the example above. Build QEMU, run it as defined in the "Testin= g" section, and then issue the following command:: =20 { "execute": "hello-world", "arguments": { "message": "all you need is lo= ve" } } @@ -279,9 +278,8 @@ Implementing the HMP command Now that the QMP command is in place, we can also make it available in the= human monitor (HMP). =20 -With the introduction of the QAPI, HMP commands make QMP calls. Most of the -time HMP commands are simple wrappers. All HMP commands implementation exi= st in -the monitor/hmp-cmds.c file. +With the introduction of QAPI, HMP commands make QMP calls. Most of the +time HMP commands are simple wrappers. =20 Here's the implementation of the "hello-world" HMP command:: =20 @@ -332,17 +330,17 @@ To test this you have to open a user monitor and issu= e the "hello-world" command. It might be instructive to check the command's documentation with HMP's "help" command. =20 -Please, check the "-monitor" command-line option to know how to open a user +Please check the "-monitor" command-line option to know how to open a user monitor. =20 =20 Writing more complex commands ----------------------------- =20 -A QMP command is capable of returning any data the QAPI supports like inte= gers, +A QMP command is capable of returning any data QAPI supports like integers, strings, booleans, enumerations and user defined types. =20 -In this section we will focus on user defined types. Please, check the QAPI +In this section we will focus on user defined types. Please check the QAPI documentation for information about the other types. =20 =20 @@ -463,7 +461,7 @@ There are a number of things to be noticed: member, it comes with a 'has_bootindex' member that needs to be set by the implementation, as shown above =20 -Time to test the new command. Build qemu, run it as described in the "Test= ing" +Time to test the new command. Build QEMU, run it as described in the "Test= ing" section and try this:: =20 { "execute": "query-option-rom" } @@ -532,7 +530,7 @@ option-roms" follows:: Show the option ROMs. ERST =20 -To test this, run qemu and type "info option-roms" in the user monitor. +To test this, run QEMU and type "info option-roms" in the user monitor. =20 =20 Writing a debugging aid returning unstructured text --=20 2.44.0