From nobody Sun Feb 8 19:55:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1633504601; cv=none; d=zohomail.com; s=zohoarc; b=lsohIl/A3Rq+mPIy5Upislfb0TYEXQyZ4nhaYPplYwarfkKVAW9t9d2ky6e7BjY2zMiYixVdMi/kTc88Xgp4mOdNk68oYLn8GPkXG7EALUUcU4UPy8w+c7mJrzPmiereHPkZTjnIYeKBpHyQwCPQxUXNpqLqbEvHoYUbfN0jMTc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633504601; h=Content-Type:Content-Transfer-Encoding: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=KNEaOVkiJUoDM+QBF+ZTnb9+4DHwxpNYteBwuz8Tcm8=; b=aubfi9heKXegzWYw8+MPKiiySD9rsh/nTKL7tKc4zmFSefa0fitsK2dvYe9x8wv+dFS6O3E/Ijx7EB6zQ4ND4ZHLBqbksbtVWjcYiJi/pl4yqBdqr9K9AwdWjkEqU6smsuIPEKHoOB62z+uRA1XnBq1TBWGq/CeUmiUWLNUaoU4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633504601652506.03747918498414; Wed, 6 Oct 2021 00:16:41 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-153-59V5NbdROnmxynEFgWDydA-1; Wed, 06 Oct 2021 03:16:38 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DDA088015C7; Wed, 6 Oct 2021 07:16:32 +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 B65555DEFB; Wed, 6 Oct 2021 07:16:32 +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 72CD64EA37; Wed, 6 Oct 2021 07:16:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1967Frb3007546 for ; Wed, 6 Oct 2021 03:15:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 92DEC60936; Wed, 6 Oct 2021 07:15:53 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id B64EF60622 for ; Wed, 6 Oct 2021 07:15:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633504600; h=from:from:sender:sender: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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=KNEaOVkiJUoDM+QBF+ZTnb9+4DHwxpNYteBwuz8Tcm8=; b=G74n49kgEwKy+CH5RpMM4rStomRLYd7nFy5c5/KJ9AKOxKi4tPs4JaK5A9G98706vNVyZZ E1K4VGifjce4vGmXoBUMQhjPbYS385RQ78U4WvjUaELeqs7saFPsgdlxzeFRybnAlvhCRV UE3mgj1PJLlj3iDaSm6KDgPXrjnU5JU= X-MC-Unique: 59V5NbdROnmxynEFgWDydA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 13/16] qemu: store logCtxt in domain private data Date: Wed, 6 Oct 2021 09:15:19 +0200 Message-Id: <9714017e89bf7cdad98dc33228d925ca871c90d0.1633504466.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com 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.14 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: 1633504602682100001 We might need it later for device hotplug. Signed-off-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.h | 11 +++++++---- src/qemu/qemu_process.c | 5 ++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 7e717cf2ad..fef6a2f39f 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -101,6 +101,9 @@ struct _qemuDomainSecretInfo { char *ciphertext; /* encoded/encrypted secret */ }; =20 +#define QEMU_TYPE_DOMAIN_LOG_CONTEXT qemu_domain_log_context_get_type() +G_DECLARE_FINAL_TYPE(qemuDomainLogContext, qemu_domain_log_context, QEMU, = DOMAIN_LOG_CONTEXT, GObject); + typedef struct _qemuDomainObjPrivate qemuDomainObjPrivate; struct _qemuDomainObjPrivate { virQEMUDriver *driver; @@ -193,6 +196,10 @@ struct _qemuDomainObjPrivate { * provided by QEMU. */ virCPUDef *origCPU; =20 + /* Log context. After startup, it is also used for hotplugging devices + * with a log file */ + qemuDomainLogContext *logCtxt; + /* If true virtlogd is used as stdio handler for character devices. */ bool chardevStdioLogd; =20 @@ -418,10 +425,6 @@ struct qemuProcessEvent { }; =20 void qemuProcessEventFree(struct qemuProcessEvent *event); - -#define QEMU_TYPE_DOMAIN_LOG_CONTEXT qemu_domain_log_context_get_type() -G_DECLARE_FINAL_TYPE(qemuDomainLogContext, qemu_domain_log_context, QEMU, = DOMAIN_LOG_CONTEXT, GObject); - typedef struct _qemuDomainSaveCookie qemuDomainSaveCookie; struct _qemuDomainSaveCookie { virObject parent; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 1d0165af6d..4a1fd753ee 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7179,7 +7179,7 @@ qemuProcessLaunch(virConnectPtr conn, int ret =3D -1; int rv; int logfile =3D -1; - g_autoptr(qemuDomainLogContext) logCtxt =3D NULL; + qemuDomainLogContext *logCtxt =3D NULL; qemuDomainObjPrivate *priv =3D vm->privateData; g_autoptr(virCommand) cmd =3D NULL; struct qemuProcessHookData hookData; @@ -7233,6 +7233,7 @@ qemuProcessLaunch(virConnectPtr conn, virLastErrorPrefixMessage("%s", _("can't connect to virtlogd")); goto cleanup; } + priv->logCtxt =3D logCtxt; logfile =3D qemuDomainLogContextGetWriteFD(logCtxt); =20 if (qemuProcessGenID(vm, flags) < 0) @@ -7966,6 +7967,8 @@ void qemuProcessStop(virQEMUDriver *driver, =20 qemuDBusStop(driver, vm); =20 + g_clear_object(&priv->logCtxt); + vm->def->id =3D -1; =20 /* Wake up anything waiting on domain condition */ --=20 2.31.1