From nobody Tue Feb 10 11:55:37 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=1674252337; cv=none; d=zohomail.com; s=zohoarc; b=K245nqwnkFsPN6bq8Ko3BYOwt82m101eDtS5FOvSHtJohhVagmDpG5LwGXoUEfz6yV/yr9TR7i18t+gpwlUOZN/ovb3Zt7c9VTOPHoTDeBya8dBLijoDjDbUB4prRHrS5PihTrZQcqrdJra2RT2S9acsCQbKn1vnvcvpxUJ/B1c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674252337; 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=9ENYsZJsyr4jtSLzoZCWkvQtvMvq2/bV/0AdTo75kFk=; b=ZjM1pveevFCuKn+5ZORZufegXeYVOZNqzcapHY0bY3UDjTK6xI0YqPriqcuj7SpDt90A9LeodogrmHDZyOxabSRTpcftn7k5GYgcAww1Sc5OF5SJY5w7QzZpiVbWbp4FjSrrA8CAYpNKixDuVrQqn+EErukdJOpzBEhDlDyckcI= 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 1674252337413584.4927012008684; Fri, 20 Jan 2023 14:05:37 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-323-hxJBtkujNYCobCGzD0QjkQ-1; Fri, 20 Jan 2023 17:03:49 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2CD2086C176; Fri, 20 Jan 2023 22:03:34 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1566C14171C8; Fri, 20 Jan 2023 22:03:34 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0BD9C1946A7C; Fri, 20 Jan 2023 22:03:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6880A19465B6 for ; Fri, 20 Jan 2023 22:03:28 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5BFEE140EBF6; Fri, 20 Jan 2023 22:03:28 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.18.185]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3AB5D1415113 for ; Fri, 20 Jan 2023 22:03:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674252335; 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=9ENYsZJsyr4jtSLzoZCWkvQtvMvq2/bV/0AdTo75kFk=; b=L/Y5YbOhYPFpwgTiGpWyukAYxs1mAdJ+/2jU2HMVBNG6M8EWCeA1gcqKCVCj+A7NvSTMRN w2975cs04U/rxhGJsDi5rnsTaDit1GzNWcr9oKqoYUrrkkSbDnAyWhRJN/i+FIhZKz/L/r 8q+uIbAsh1sTRZNT7aBFbFTeAYOMXjs= X-MC-Unique: hxJBtkujNYCobCGzD0QjkQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v4 11/31] qemu: remove unused 'mode' param from qemuDomainLogContextNew() Date: Fri, 20 Jan 2023 16:03:05 -0600 Message-Id: <20230120220325.1015090-12-jjongsma@redhat.com> In-Reply-To: <20230120220325.1015090-1-jjongsma@redhat.com> References: <20230120220325.1015090-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674252338237100001 Content-Type: text/plain; charset="utf-8"; x-default="true" The only use of this function always passes QEMU_DOMAIN_LOG_CONTEXT_MODE_START. The other enum values are never used anywhere in the code. Remove them. Signed-off-by: Jonathon Jongsma Reviewed-by: Peter Krempa --- src/qemu/qemu_domain.c | 26 +++++++++++--------------- src/qemu/qemu_domain.h | 9 +-------- src/qemu/qemu_process.c | 3 +-- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index bcf051d6b1..b01f035718 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6791,8 +6791,7 @@ void qemuDomainObjCheckNetTaint(virQEMUDriver *driver, =20 =20 qemuDomainLogContext *qemuDomainLogContextNew(virQEMUDriver *driver, - virDomainObj *vm, - qemuDomainLogContextMode m= ode) + virDomainObj *vm) { g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); qemuDomainLogContext *ctxt =3D QEMU_DOMAIN_LOG_CONTEXT(g_object_new(QE= MU_TYPE_DOMAIN_LOG_CONTEXT, NULL)); @@ -6833,25 +6832,22 @@ qemuDomainLogContext *qemuDomainLogContextNew(virQE= MUDriver *driver, /* For unprivileged startup we must truncate the file since * we can't rely on logrotate. We don't use O_TRUNC since * it is better for SELinux policy if we truncate afterwards */ - if (mode =3D=3D QEMU_DOMAIN_LOG_CONTEXT_MODE_START && - !driver->privileged && + if (!driver->privileged && ftruncate(ctxt->writefd, 0) < 0) { virReportSystemError(errno, _("failed to truncate %s"), ctxt->path); goto error; } =20 - if (mode =3D=3D QEMU_DOMAIN_LOG_CONTEXT_MODE_START) { - if ((ctxt->readfd =3D open(ctxt->path, O_RDONLY)) < 0) { - virReportSystemError(errno, _("failed to open logfile %s"), - ctxt->path); - goto error; - } - if (virSetCloseExec(ctxt->readfd) < 0) { - virReportSystemError(errno, _("failed to set close-on-exec= flag on %s"), - ctxt->path); - goto error; - } + if ((ctxt->readfd =3D open(ctxt->path, O_RDONLY)) < 0) { + virReportSystemError(errno, _("failed to open logfile %s"), + ctxt->path); + goto error; + } + if (virSetCloseExec(ctxt->readfd) < 0) { + virReportSystemError(errno, _("failed to set close-on-exec fla= g on %s"), + ctxt->path); + goto error; } =20 if ((ctxt->pos =3D lseek(ctxt->writefd, 0, SEEK_END)) < 0) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index a3b9acab70..37482a59f3 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -657,15 +657,8 @@ void qemuDomainObjCheckNetTaint(virQEMUDriver *driver, virDomainNetDef *net, qemuDomainLogContext *logCtxt); =20 -typedef enum { - QEMU_DOMAIN_LOG_CONTEXT_MODE_START, - QEMU_DOMAIN_LOG_CONTEXT_MODE_ATTACH, - QEMU_DOMAIN_LOG_CONTEXT_MODE_STOP, -} qemuDomainLogContextMode; - qemuDomainLogContext *qemuDomainLogContextNew(virQEMUDriver *driver, - virDomainObj *vm, - qemuDomainLogContextMode m= ode); + virDomainObj *vm); int qemuDomainLogContextWrite(qemuDomainLogContext *ctxt, const char *fmt, ...) G_GNUC_PRINTF(2, 3); ssize_t qemuDomainLogContextRead(qemuDomainLogContext *ctxt, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ee9f0784d3..fb3369b6a5 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7683,8 +7683,7 @@ qemuProcessLaunch(virConnectPtr conn, hookData.cfg =3D cfg; =20 VIR_DEBUG("Creating domain log file"); - if (!(logCtxt =3D qemuDomainLogContextNew(driver, vm, - QEMU_DOMAIN_LOG_CONTEXT_MODE_S= TART))) { + if (!(logCtxt =3D qemuDomainLogContextNew(driver, vm))) { virLastErrorPrefixMessage("%s", _("can't connect to virtlogd")); goto cleanup; } --=20 2.39.0