From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A1781C05027 for ; Fri, 20 Jan 2023 14:09:35 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIs4b-00013j-Us; Fri, 20 Jan 2023 09:08:53 -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 1pIs4a-00013P-Qi for qemu-devel@nongnu.org; Fri, 20 Jan 2023 09:08:52 -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 1pIs4Y-0003bd-OD for qemu-devel@nongnu.org; Fri, 20 Jan 2023 09:08:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674223729; 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=xHa1ddJnSX9BJLtvtDuD9evZwO9wP7wlNir6LphCSVU=; b=WKh35Ws1f4w5xjM2lNflXhB+SFuXiPb7eQMChmH3CIQbgTQDhct3ym8wL66OQNAqCB2eM7 DaNL+UgndeX7Z+laG5Fs5dcTIsyrvxxmfDBkUVrDGkMxkAe0Lq1B6skD4vyiH1dVJiHWB5 dhuHLWkNU8x1S2wDgX/YdXbHUm06lDQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-398-FD12xBW9PLCb4patlvTO9w-1; Fri, 20 Jan 2023 09:08:47 -0500 X-MC-Unique: FD12xBW9PLCb4patlvTO9w-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EB0851C189C3; Fri, 20 Jan 2023 14:08:44 +0000 (UTC) Received: from redhat.com (unknown [10.39.193.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 05300492B02; Fri, 20 Jan 2023 14:08:43 +0000 (UTC) Date: Fri, 20 Jan 2023 15:08:42 +0100 From: Kevin Wolf To: Hanna Czenczek Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, Eric Blake , Markus Armbruster Subject: Re: [PATCH v2 01/12] block: Improve empty format-specific info dump Message-ID: References: <20220620162704.80987-1-hreitz@redhat.com> <20220620162704.80987-2-hreitz@redhat.com> <758f3547-f727-28b8-48d3-a44306897d13@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <758f3547-f727-28b8-48d3-a44306897d13@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass client-ip=170.10.133.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Am 20.01.2023 um 14:35 hat Hanna Czenczek geschrieben: > On 19.01.23 15:00, Kevin Wolf wrote: > > Am 20.06.2022 um 18:26 hat Hanna Reitz geschrieben: > > > When a block driver supports obtaining format-specific information, but > > > that object only contains optional fields, it is possible that none of > > > them are present, so that dump_qobject() (called by > > > bdrv_image_info_specific_dump()) will not print anything. > > > > > > The callers of bdrv_image_info_specific_dump() put a header above this > > > information ("Format specific information:\n"), which will look strange > > > when there is nothing below. Modify bdrv_image_info_specific_dump() to > > > print this header instead of its callers, and only if there is indeed > > > something to be printed. > > > > > > Signed-off-by: Hanna Reitz > > > diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c > > > index 2f0d8ac25a..084ec44d3b 100644 > > > --- a/qemu-io-cmds.c > > > +++ b/qemu-io-cmds.c > > > @@ -1819,8 +1819,8 @@ static int info_f(BlockBackend *blk, int argc, char **argv) > > > return -EIO; > > > } > > > if (spec_info) { > > > - printf("Format specific information:\n"); > > > - bdrv_image_info_specific_dump(spec_info); > > > + bdrv_image_info_specific_dump(spec_info, > > > + "Format specific information:\n"); > > > qapi_free_ImageInfoSpecific(spec_info); > > > } > > Interesting observation here: That qemu-io uses printf() instead of > > qemu_printf() for the top level, but then dump_qobject() (which results > > in qemu_printf()) for the format specific information, means that if you > > use the 'qemu-io' HMP command, you'll get half of the output on stdout > > and the other half in the monitor. > > Hu.  I can’t find a single instance of qemu_printf() in qemu-io-cmds.c, but > then I assume all printf()s there should really be qemu_printf()? That would probably be the most consistent way. I expect it would change the output of some qemu-iotests cases, but we can explicitly print whatever was returned in QMP to keep the same information in the test output. Kevin