From nobody Sun May 19 02:26:44 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=1649948317; cv=none; d=zohomail.com; s=zohoarc; b=A2cP2sTfvAU0IgPfm5/Q9GoL+yJiXI/8DkdlKBQ+be7CAl+fuzirV7FY62HQtEuAua9dBTYc5qQACDx7SPeIvTuckGJuvhkwQ9I4YhRyCf19gyaQX83mfzOlrkFcBCkHUhYIbDUUNSiEjv7folCj/oyncfXiF0lqDoudm7pm3uo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1649948317; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=fmmSNYkUJBDACNp9fqMqg9ewebaGDJCVNRLIFq/GDwU=; b=jFA7Nh+atmzU5NDnZekJSgbD4OyL/7pKH06d8jscYIZwCxXsxuykye+qUth3Ad5wrTWYT699vVBhjAzVCzBth41rZQm9aoMk00XITZhtFBIqzkDrbhDFn8JugmyRp+twj4tYkwcN3bvoLeKsmTtBbdOP0AaTIZ3cvZkvneVeiMk= 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 16499483172631014.6915730309348; Thu, 14 Apr 2022 07:58:37 -0700 (PDT) Received: from localhost ([::1]:59314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nf0vc-0007Go-AC for importer@patchew.org; Thu, 14 Apr 2022 10:58:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56112) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nf0ui-0005ts-0N for qemu-devel@nongnu.org; Thu, 14 Apr 2022 10:57:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:57392) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nf0ue-0008L6-6A for qemu-devel@nongnu.org; Thu, 14 Apr 2022 10:57:39 -0400 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-551-uVq4oxrHNmOo5cwJKmCSxQ-1; Thu, 14 Apr 2022 10:57:21 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 78C3E3C16187 for ; Thu, 14 Apr 2022 14:57:21 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 663B820296A5 for ; Thu, 14 Apr 2022 14:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649948242; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fmmSNYkUJBDACNp9fqMqg9ewebaGDJCVNRLIFq/GDwU=; b=SUdCn7y9CLYEJ2qrkr33EHCcHNBz3e5PKiLTo+sIVewMwcwPsmqiU3cvRf1/0gRfhKjUG6 Ysht/SPrFbErHG7NkC6u8gxhK5lCelsJKWUPesEoMjJbmPm0mrpxb0yEysOIkN7CVQ8ktQ xTwOrF9oVhWXqEBvXstyzZQ6IxRZ4Xc= X-MC-Unique: uVq4oxrHNmOo5cwJKmCSxQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH] remove -writeconfig Date: Thu, 14 Apr 2022 10:57:21 -0400 Message-Id: <20220414145721.326866-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=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" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1649948318203100001 Content-Type: text/plain; charset="utf-8" Like -set and -readconfig, it would not really be too hard to extend -writeconfig to parsing mechanisms other than QemuOpts. However, the uses of -writeconfig are substantially more limited, as it is generally easier to write the configuration by hand in the first place. In addition, -writeconfig does not even try to detect cases where it prints incorrect syntax (for example if values have a quote in them, since qemu_config_parse does not support any kind of escaping. Just remove it. Signed-off-by: Paolo Bonzini Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/about/deprecated.rst | 7 ------ docs/about/removed-features.rst | 6 +++++ include/qemu/config-file.h | 1 - qemu-options.hx | 8 ++----- softmmu/climain.c | 20 ---------------- util/qemu-config.c | 42 --------------------------------- 6 files changed, 8 insertions(+), 76 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 3fb330116d..bd1163eed1 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -79,13 +79,6 @@ library enabled as a cryptography provider. Neither the ``nettle`` library, or the built-in cryptography provider are supported on FIPS enabled hosts. =20 -``-writeconfig`` (since 6.0) -''''''''''''''''''''''''''''' - -The ``-writeconfig`` option is not able to serialize the entire contents -of the QEMU command line. It is thus considered a failed experiment -and deprecated, with no current replacement. - Userspace local APIC with KVM (x86, since 6.0) '''''''''''''''''''''''''''''''''''''''''''''' =20 diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.= rst index 4b831ea291..c313a22fd0 100644 --- a/docs/about/removed-features.rst +++ b/docs/about/removed-features.rst @@ -336,6 +336,12 @@ for the RISC-V ``virt`` machine and ``sifive_u`` machi= ne. The ``-no-quit`` was a synonym for ``-display ...,window-close=3Doff`` whi= ch should be used instead. =20 +``-writeconfig`` (removed in 7.1) +''''''''''''''''''''''''''''''''' + +The ``-writeconfig`` option was not able to serialize the entire contents +of the QEMU command line. It is thus considered a failed experiment +and removed without a replacement. =20 QEMU Machine Protocol (QMP) commands ------------------------------------ diff --git a/include/qemu/config-file.h b/include/qemu/config-file.h index f605423321..321e7c7c03 100644 --- a/include/qemu/config-file.h +++ b/include/qemu/config-file.h @@ -12,7 +12,6 @@ void qemu_add_opts(QemuOptsList *list); void qemu_add_drive_opts(QemuOptsList *list); int qemu_global_option(const char *str); =20 -void qemu_config_write(FILE *fp); int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname, Error **errp); =20 diff --git a/qemu-options.hx b/qemu-options.hx index 34e9b32a5c..4c8e47a73c 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4622,18 +4622,14 @@ SRST ERST =20 DEF("readconfig", HAS_ARG, QEMU_OPTION_readconfig, - "-readconfig \n", QEMU_ARCH_ALL) + "-readconfig \n" + " read config file\n", QEMU_ARCH_ALL) SRST ``-readconfig file`` Read device configuration from file. This approach is useful when you want to spawn QEMU process with many command line options but you don't want to exceed the command line character limit. ERST -DEF("writeconfig", HAS_ARG, QEMU_OPTION_writeconfig, - "-writeconfig \n" - " read/write config file (deprecated)\n", QEMU_ARCH_ALL) -SRST -ERST =20 DEF("no-user-config", 0, QEMU_OPTION_nouserconfig, "-no-user-config\n" diff --git a/softmmu/climain.c b/softmmu/climain.c index 92307b2bbd..160e4c201c 100644 --- a/softmmu/climain.c +++ b/softmmu/climain.c @@ -3534,26 +3534,6 @@ void qemu_init(int argc, char **argv, char **envp) display_remote++; break; #endif - case QEMU_OPTION_writeconfig: - { - FILE *fp; - warn_report("-writeconfig is deprecated and will go aw= ay without a replacement"); - if (strcmp(optarg, "-") =3D=3D 0) { - fp =3D stdout; - } else { - fp =3D fopen(optarg, "w"); - if (fp =3D=3D NULL) { - error_report("open %s: %s", optarg, - strerror(errno)); - exit(1); - } - } - qemu_config_write(fp); - if (fp !=3D stdout) { - fclose(fp); - } - break; - } case QEMU_OPTION_qtest: qtest_chrdev =3D optarg; break; diff --git a/util/qemu-config.c b/util/qemu-config.c index 436ab63b16..433488aa56 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -314,48 +314,6 @@ void qemu_add_opts(QemuOptsList *list) abort(); } =20 -struct ConfigWriteData { - QemuOptsList *list; - FILE *fp; -}; - -static int config_write_opt(void *opaque, const char *name, const char *va= lue, - Error **errp) -{ - struct ConfigWriteData *data =3D opaque; - - fprintf(data->fp, " %s =3D \"%s\"\n", name, value); - return 0; -} - -static int config_write_opts(void *opaque, QemuOpts *opts, Error **errp) -{ - struct ConfigWriteData *data =3D opaque; - const char *id =3D qemu_opts_id(opts); - - if (id) { - fprintf(data->fp, "[%s \"%s\"]\n", data->list->name, id); - } else { - fprintf(data->fp, "[%s]\n", data->list->name); - } - qemu_opt_foreach(opts, config_write_opt, data, NULL); - fprintf(data->fp, "\n"); - return 0; -} - -void qemu_config_write(FILE *fp) -{ - struct ConfigWriteData data =3D { .fp =3D fp }; - QemuOptsList **lists =3D vm_config_groups; - int i; - - fprintf(fp, "# qemu config file\n\n"); - for (i =3D 0; lists[i] !=3D NULL; i++) { - data.list =3D lists[i]; - qemu_opts_foreach(data.list, config_write_opts, &data, NULL); - } -} - /* Returns number of config groups on success, -errno on error */ static int qemu_config_foreach(FILE *fp, QEMUConfigCB *cb, void *opaque, const char *fname, Error **errp) --=20 2.31.1