From nobody Tue Nov 26 08:53:32 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=1709035039; cv=none; d=zohomail.com; s=zohoarc; b=BZDn/yK0GW4C83BFO/XciXGqqmWd3Va9qYydevITLGh84wQj4+2yeVKxR9jYyDLgEUm1aQJ1CRcCnluNPj+91KbjD2k2saktubnZvraEsTmnKY5C55JSDBwfdw3kbbsfFlrVybrNv5uuDH27BbPt3IjfvSRyCfT5D+bP4tl+YzQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709035039; 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=ZT6nN0Dt7c8P0z0WjxnNRz2cJWnsqyLhgXnGzR93vLQ=; b=UndvtnJbNz4HHIXqLsZNbfIzT/hUi5/MWmQJC35Ez6y/g7Qh7u/nUucvNIkdr6jwWs9W3gaxcLZBZgNeBS9xkzRBD7+L6B9Vkz9E2chGiVT8NDV9yOwwUbXwYfq9kCsmB1mUWZgsPz6uUhI8IoyKB9H2HWwV/UuTM/rzzJO5lNA= 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 1709035039324795.2368168136146; Tue, 27 Feb 2024 03:57:19 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rew4P-0005FF-E9; Tue, 27 Feb 2024 06:56:25 -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 1rew4N-0005Ec-RA for qemu-devel@nongnu.org; Tue, 27 Feb 2024 06:56:23 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rew4L-0000MR-82 for qemu-devel@nongnu.org; Tue, 27 Feb 2024 06:56:23 -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-139-lV-yQZm6ND612-DidJ1Nww-1; Tue, 27 Feb 2024 06:56:18 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 54CFF1C05AA3 for ; Tue, 27 Feb 2024 11:56:18 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.193.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 169E3492BC9 for ; Tue, 27 Feb 2024 11:56:18 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 1DCAA21E6682; Tue, 27 Feb 2024 12:56:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709034979; 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=ZT6nN0Dt7c8P0z0WjxnNRz2cJWnsqyLhgXnGzR93vLQ=; b=en6RqN6FlsST2nJ9yhVm08UsCOOwIq7fvBuvLjPOPJlU4mdMhGvsiNsqP6cU46Uh7tJoe6 SRewIUMrSGDdn4CVNrbJfRNP+53rxPaaUNk0nKQHeFDdjAuWkURPfu4D+7TzdM5npinfJj Jx+wEjaJi0e5bpW3OQ91vh9NivSGZX0= X-MC-Unique: lV-yQZm6ND612-DidJ1Nww-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: eblake@redhat.com, berrange@redhat.com Subject: [PATCH 2/2] docs/devel/writing-monitor-commands: Minor improvements Date: Tue, 27 Feb 2024 12:56:17 +0100 Message-ID: <20240227115617.237875-3-armbru@redhat.com> In-Reply-To: <20240227115617.237875-1-armbru@redhat.com> References: <20240227115617.237875-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 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.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.088, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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: 1709035041146100006 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 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 047c6f42bb..d2045b66b3 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.43.0