From nobody Tue Mar 3 04:54:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1771343776; cv=none; d=zohomail.com; s=zohoarc; b=ca7IDjgD38tusod7U8y2/pS+YZCUzB9bmFwFTKuwxogfFq7DMrc7DAx8h3X8s74hTUENXIMkXjHgZ0SEOomerH4OknfpxGN4FwZiIDdudgUuurdikRe5zuvs1XwKED1qqfbQSpty1uaJLKUkc3aI/YgU7Ie3UhnejEYR9036Iik= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771343776; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=SuKMpvsz3qDMH2NgG4/ySm9qkhEnJG3qqJD3zEHeVTg=; b=flrAVD5W8IRjb6rH5AAPsZrmMh1v7d60pkd7fgqf0f3spUChAUN4Zn3NbQxEhb1fP+AL+BHPKBAc4eXiJczNdtQMYmoTWG6pYyXbYkhRklmHh3aKhJ6q6fLO4WissAOPy/2hsC2FrmAG/YVS+32jo+skN87GnFnJ396ucQpVf8w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1771343776284485.85093226170875; Tue, 17 Feb 2026 07:56:16 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 653C63F94D; Tue, 17 Feb 2026 10:56:16 -0500 (EST) Received: from [172.19.199.9] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 3F5B041A0A; Tue, 17 Feb 2026 10:53:56 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id D58974188B; Tue, 17 Feb 2026 10:53:52 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 22CE94180D for ; Tue, 17 Feb 2026 10:53:01 -0500 (EST) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-324-2sAhIYMtMIWaxH6JpGF3ZA-1; Tue, 17 Feb 2026 10:52:58 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EAF9518002E6 for ; Tue, 17 Feb 2026 15:52:57 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.39]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 276131800361 for ; Tue, 17 Feb 2026 15:52:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HELO_MISC_IP,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771343580; 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: in-reply-to:in-reply-to:references:references; bh=SuKMpvsz3qDMH2NgG4/ySm9qkhEnJG3qqJD3zEHeVTg=; b=FLfPPmSK8j/04tyCGWosKyJw6TxhejYYdptAZxDCwGUKOVPwVx+hbx6joNO46JfA8/YxWl Tas7v2NUdTOSyRwo2SCNd+1fubcaXtU1d/vqwXko/OnmcOjQOGUCG/ly70tf74/k0qvrJH DImNT+Jfdm0b2XXS8vvOZ4n4dBHFa0g= X-MC-Unique: 2sAhIYMtMIWaxH6JpGF3ZA-1 X-Mimecast-MFC-AGG-ID: 2sAhIYMtMIWaxH6JpGF3ZA_1771343578 To: devel@lists.libvirt.org Subject: [PATCH 3/6] virfile: Introduce 'virFileFDIsRegular' Date: Tue, 17 Feb 2026 16:52:48 +0100 Message-ID: <7e7ec31d03475885f2f3b9d712cab66dac4549ef.1771343375.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 3VItadOluKgabt6jLfgAyZ7ErM7qL6vpDhW7C6WsGjE_1771343578 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: RQCSCXSQIIVRDKZFFBQXCKCJBK7JPBT7 X-Message-ID-Hash: RQCSCXSQIIVRDKZFFBQXCKCJBK7JPBT7 X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1771343778362158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Similarly to 'virFileIsRegular' return if the FD is a regular file. Signed-off-by: Peter Krempa --- src/libvirt_private.syms | 1 + src/util/virfile.c | 8 ++++++++ src/util/virfile.h | 1 + 3 files changed, 10 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index d8ae4f46cd..b200037189 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2375,6 +2375,7 @@ virFileDeleteTree; virFileDirectFdFlag; virFileExists; virFileFclose; +virFileFDIsRegular; virFileFdopen; virFileFindHugeTLBFS; virFileFindMountPoint; diff --git a/src/util/virfile.c b/src/util/virfile.c index 9316606ce8..65b04beb8c 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -2031,6 +2031,14 @@ virFileIsRegular(const char *path) } +bool +virFileFDIsRegular(int fd) +{ + struct stat s; + return (fstat(fd, &s) =3D=3D 0) && S_ISREG(s.st_mode); +} + + /** * virFileExists: Check for presence of file * @path: Path of file to check diff --git a/src/util/virfile.h b/src/util/virfile.h index ce2ffb8ed4..8c9ad59898 100644 --- a/src/util/virfile.h +++ b/src/util/virfile.h @@ -218,6 +218,7 @@ bool virFileIsDir (const char *file) ATTRIBUTE_NONNULL(= 1); bool virFileExists(const char *file) ATTRIBUTE_NONNULL(1) ATTRIBUTE_MOCKAB= LE; bool virFileIsExecutable(const char *file) ATTRIBUTE_NONNULL(1); bool virFileIsRegular(const char *file) ATTRIBUTE_NONNULL(1); +bool virFileFDIsRegular(int fd); enum { VIR_FILE_SHFS_NFS =3D (1 << 0), --=20 2.53.0