From nobody Mon Feb 9 09:33:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1646420449; cv=none; d=zohomail.com; s=zohoarc; b=HGq+AwEjP/Vu/P9smWYlyiuq7iVMh0xqClkeRV5kXSL7NZpH6ksWXOd2X4aqKX0LyxiTc7t+2ULT/96QSBY4yQsdefVkWZITBqEKBrysb2nu2TlzS1DtjCpWWepDFPp+ZzSkPKmx3Lm8zxpsRsw+GbXoe7nSpkP2MVtj5UkBb70= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646420449; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=J+4zVysEcH5X9wYmMvh9Z1fHPc+GKyI+QDU8VO1cPfw=; b=PJDjW88bjd2SttXRk8+rbdPbR+cDdNmTqtXB8L9REiiKgnNU7AVnsI7bt/VpinXZrOLKuOYs54p+pAMJGbZIMtxrCcMsKHqgQWDAgLRnq4Jor/r0blBtzs1kEoVWnMYRZcziM+68Zp629uZAZDCnOa5oOul7KVxInljcPlv7fLg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 164642044958666.65720895442973; Fri, 4 Mar 2022 11:00:49 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-443-D5zzt7WEMWC_eDAfe-CTJQ-1; Fri, 04 Mar 2022 14:00:47 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B1C171091DA0; Fri, 4 Mar 2022 19:00:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8BEEE5C22B; Fri, 4 Mar 2022 19:00:41 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5EEE54BB40; Fri, 4 Mar 2022 19:00:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 224J0eqL032007 for ; Fri, 4 Mar 2022 14:00:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3B5ED60C04; Fri, 4 Mar 2022 19:00:40 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.194.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id A735987B90; Fri, 4 Mar 2022 18:59:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646420449; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=J+4zVysEcH5X9wYmMvh9Z1fHPc+GKyI+QDU8VO1cPfw=; b=M6y4eGdfDrqGLBidGWaKCvjAjefZ/dvGTwJoiXINcKr860EL+96GuWfZfhhfzCbdKpALLw C0HYLSr1ldRiCIvVbMx2BmGSboS2y8eFjKlT5QroUVs27o4oDgdBVj1cC9UjnkF1vn3eBN Ij0DPbKuC0xcaHDCzRsA/63EP+iTQVI= X-MC-Unique: D5zzt7WEMWC_eDAfe-CTJQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 5/8] softmmu: refactor use of is_daemonized() method Date: Fri, 4 Mar 2022 18:56:17 +0000 Message-Id: <20220304185620.3272401-6-berrange@redhat.com> In-Reply-To: <20220304185620.3272401-1-berrange@redhat.com> References: <20220304185620.3272401-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , libvir-list@redhat.com, Stefan Weil , Hanna Reitz , Gerd Hoffmann , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Eric Blake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1646420451368100001 Use of the is_daemonized() method is isolated to allow it to be more easily eliminated in a future change. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake --- softmmu/vl.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index f6f33e15e4..30342b9df2 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -1371,11 +1371,11 @@ static void qemu_disable_default_devices(void) } } =20 -static void qemu_create_default_devices(void) +static void qemu_create_default_devices(bool daemonize) { MachineClass *machine_class =3D MACHINE_GET_CLASS(current_machine); =20 - if (is_daemonized()) { + if (daemonize) { /* According to documentation and historically, -nographic redirec= ts * serial port, parallel port and monitor to stdio, which does not= work * with -daemonize. We can redirect these to null instead, but si= nce @@ -2455,7 +2455,8 @@ static void create_default_memdev(MachineState *ms, c= onst char *path) &error_fatal); } =20 -static void qemu_validate_options(const QDict *machine_opts) +static void qemu_validate_options(const QDict *machine_opts, + bool daemonize) { const char *kernel_filename =3D qdict_get_try_str(machine_opts, "kerne= l"); const char *initrd_filename =3D qdict_get_try_str(machine_opts, "initr= d"); @@ -2484,7 +2485,7 @@ static void qemu_validate_options(const QDict *machin= e_opts) } =20 #ifdef CONFIG_CURSES - if (is_daemonized() && dpy.type =3D=3D DISPLAY_TYPE_CURSES) { + if (daemonize && dpy.type =3D=3D DISPLAY_TYPE_CURSES) { error_report("curses display cannot be used with -daemonize"); exit(1); } @@ -3676,7 +3677,7 @@ void qemu_init(int argc, char **argv, char **envp) */ loc_set_none(); =20 - qemu_validate_options(machine_opts_dict); + qemu_validate_options(machine_opts_dict, is_daemonized()); qemu_process_sugar_options(); =20 /* @@ -3714,7 +3715,7 @@ void qemu_init(int argc, char **argv, char **envp) suspend_mux_open(); =20 qemu_disable_default_devices(); - qemu_create_default_devices(); + qemu_create_default_devices(is_daemonized()); qemu_create_early_backends(); =20 qemu_apply_legacy_machine_options(machine_opts_dict); --=20 2.34.1