From nobody Mon Feb 9 10:29:09 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=1675182781; cv=none; d=zohomail.com; s=zohoarc; b=BIiM2GvVbEjnixv+Cnqngv6ZbLM+pdN/yAw/4whZM+/WefoMxr2+O9xay67k5zIZGSPmKwID7B/ka7LUOQGxAX0bXMOiU6Q1ITNQv+gLRSzTdJTFyhudx5bYW4jSGVSvphS1Do8cy5ZdvqvpgdprRD3KHn9ww+4lW/xi0y+0o/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675182781; 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=5g3u5Q36L8U3mQT/wjQoZslAgTuwN1iVgbZwWrKcW2o=; b=YH9ykcUMDmh8RKl4lTt3db6/zyJDk/466eJjK07ornuXoCXib/kUvmJITuoZc0c+ajuOSM2uWa+yAkJvx52AOnnamOgbkY+5fu3oT1uu7bkvEBgm+6I0uFEPba9KPvNZgdpLtPeWO+Qp/AxtdTzjDGaGCUDQLpceWK7rjax2+8g= 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 1675182781031632.446528415813; Tue, 31 Jan 2023 08:33:01 -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-45-QOjAXys-M0S7lTN7-7vbsQ-1; Tue, 31 Jan 2023 11:32:47 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 18A8D1818E46; Tue, 31 Jan 2023 16:32:26 +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 058AE2166B33; Tue, 31 Jan 2023 16:32:26 +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 D7EC01946589; Tue, 31 Jan 2023 16:32:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D706D1946587 for ; Tue, 31 Jan 2023 16:32:22 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id BBA4E175A2; Tue, 31 Jan 2023 16:32:22 +0000 (UTC) Received: from speedmetal.lan (ovpn-208-29.brq.redhat.com [10.40.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id B51ED43FB3 for ; Tue, 31 Jan 2023 16:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675182780; 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=5g3u5Q36L8U3mQT/wjQoZslAgTuwN1iVgbZwWrKcW2o=; b=Q+6UNiYQjYLfFeGC0mNUvWoF4UntIgfiPB9SCuf19KgdqeQl/NHa0SjG3dQ6PR6+HWRO8M 6l6yULPHacpoY6Dzcs+xvXOzq3CUo5li52rZtotzu3XrodkQbB3fwukThsUN9pkAszgquM E6PYXHTm22lJqc20IZWb4eeKZDw7qlI= X-MC-Unique: QOjAXys-M0S7lTN7-7vbsQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 5/7] qemu: fd: Add helpers allowing storing FD set data in status XML Date: Tue, 31 Jan 2023 17:32:11 +0100 Message-Id: <70b4e9f4371c0351588b1c7074ba3cdc28ccb95a.1675182670.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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.6 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: 1675182782248100001 Content-Type: text/plain; charset="utf-8" Rollback of FD sets passed to qemu is also needed after possible restart of libvirtd when we need to serialize the data into status XML. For this purpose we need to access the fdset ID once it was passed to qemu and potentially re-create a 'qemuFDPass' struct in passed state. Introduce 'qemuFDPassNewPassed' and 'qemuFDPassIsPassed'. Signed-off-by: Peter Krempa --- src/qemu/qemu_fd.c | 41 +++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_fd.h | 7 +++++++ 2 files changed, 48 insertions(+) diff --git a/src/qemu/qemu_fd.c b/src/qemu/qemu_fd.c index ebeeb65505..9eaaa098ee 100644 --- a/src/qemu/qemu_fd.c +++ b/src/qemu/qemu_fd.c @@ -96,6 +96,47 @@ qemuFDPassNew(const char *prefix, } +/** + * qemuFDPassNewPassed: + * @fdSetID: ID of an FDset which was allready passed to qemu + * + * Create qemuFDPass pointing to an already passed FD. Useful to usw with + * qemuFDPassTransferMonitorRollback, when restoring after restart. + */ +qemuFDPass * +qemuFDPassNewPassed(unsigned int fdSetID) +{ + qemuFDPass *fdpass =3D g_new0(qemuFDPass, 1); + + fdpass->fdSetID =3D fdSetID; + fdpass->passed =3D true; + + return fdpass; +} + + +/** + * qemuFDPassIsPassed: + * @fdpass: The fd passing helper struct + * @id: when non-NULL filled with the fdset ID + * + * Returns true if @fdpass was passed to qemu. In such case @id is also fi= lled + * with the ID of the fdset if non-NULL. + */ +bool +qemuFDPassIsPassed(qemuFDPass *fdpass, + unsigned *id) +{ + if (!fdpass) + return false; + + if (id) + *id =3D fdpass->fdSetID; + + return true; +} + + /** * qemuFDPassAddFD: * @fdpass: The fd passing helper struct diff --git a/src/qemu/qemu_fd.h b/src/qemu/qemu_fd.h index 032b9442ee..cd0ff2c690 100644 --- a/src/qemu/qemu_fd.h +++ b/src/qemu/qemu_fd.h @@ -31,6 +31,13 @@ qemuFDPass * qemuFDPassNew(const char *prefix, void *dompriv); +qemuFDPass * +qemuFDPassNewPassed(unsigned int fdSetID); + +bool +qemuFDPassIsPassed(qemuFDPass *fdpass, + unsigned *id); + void qemuFDPassAddFD(qemuFDPass *fdpass, int *fd, --=20 2.39.1