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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 95D82C433EF for ; Mon, 27 Dec 2021 15:57:06 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.252017.433034 (Exim 4.92) (envelope-from ) id 1n1sMj-0001nz-5B; Mon, 27 Dec 2021 15:56:49 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 252017.433034; Mon, 27 Dec 2021 15:56:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1n1sMj-0001nm-1O; Mon, 27 Dec 2021 15:56:49 +0000 Received: by outflank-mailman (input) for mailman id 252017; Mon, 27 Dec 2021 15:56:47 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1n1sMh-0007zI-48 for xen-devel@lists.xenproject.org; Mon, 27 Dec 2021 15:56:47 +0000 Received: from mailhost.m5p.com (mailhost.m5p.com [74.104.188.4]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 973dfb0a-672d-11ec-9e60-abaf8a552007; Mon, 27 Dec 2021 16:56:46 +0100 (CET) Received: from m5p.com (mailhost.m5p.com [IPv6:2001:470:1f07:15ff:0:0:0:f7]) by mailhost.m5p.com (8.16.1/8.15.2) with ESMTPS id 1BRFuaGj054512 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 27 Dec 2021 10:56:42 -0500 (EST) (envelope-from ehem@m5p.com) Received: (from ehem@localhost) by m5p.com (8.16.1/8.15.2/Submit) id 1BRFuaVn054511; Mon, 27 Dec 2021 07:56:36 -0800 (PST) (envelope-from ehem) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 973dfb0a-672d-11ec-9e60-abaf8a552007 Message-Id: <8f95e4a6664a24fd990cbb8162a1855c95cb6b66.1640590794.git.ehem+xen@m5p.com> In-Reply-To: References: From: Elliott Mitchell To: xen-devel@lists.xenproject.org Cc: Wei Liu Cc: Anthony PERARD Date: Thu, 17 Dec 2020 17:42:42 -0800 Subject: [PATCH 4/5] tools/xl: Merge down debug/dry-run section of create_domain() create_domain()'s use of printf_info_sexp() could be merged down to a single dump_by_config(), do so. This results in an extra JSON dictionary in output, but I doubt that is an issue for dry-run or debugging output. Signed-off-by: Elliott Mitchell --- tools/xl/xl_vmcontrol.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c index 435155a033..4b95e7e463 100644 --- a/tools/xl/xl_vmcontrol.c +++ b/tools/xl/xl_vmcontrol.c @@ -856,19 +856,7 @@ int create_domain(struct domain_create *dom_info) if (debug || dom_info->dryrun) { FILE *cfg_print_fh = (debug && !dom_info->dryrun) ? stderr : stdout; - if (default_output_format == OUTPUT_FORMAT_SXP) { - printf_info_sexp(-1, &d_config, cfg_print_fh); - } else { - char *json = libxl_domain_config_to_json(ctx, &d_config); - if (!json) { - fprintf(stderr, - "Failed to convert domain configuration to JSON\n"); - exit(1); - } - fputs(json, cfg_print_fh); - free(json); - flush_stream(cfg_print_fh); - } + dump_by_config(default_output_format, cfg_print_fh, &d_config, -1); } -- 2.30.2