From nobody Mon Feb 9 08:28:26 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1579779846; cv=none; d=zohomail.com; s=zohoarc; b=JzBiAm6pKQDu4TxkWjUG8DVf7Oz4aIYMHW7c5uzpbYGdO2Wzt9hn8UmuZyaW5iBUKd+PqJwKVf1qoBmj3MO4HuhFPY//AAuRCPBqXjMosuVimYwZ7r2AZIJPsKe9K+2cS+3SSthVEZqvyIY6J23hw6u/Hb/zoRzf+9d9q8G1JGM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579779846; 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=DxG6rAUx9XMuQ96twSPrUEZlJ1r2h+2Xe8YHsIo2Owg=; b=kmcWNfQ/0OIuTC9ZvtC9Cd60nyOPeG379A7MDnnuUFu2RuEyQSqBVK1NjvA7voFXjCCKNqTRQhhQrtNnBgpfOhxx3+35kYKuEGngikV92N8z7T4rw1fs686q3nNiz/q3KMynMVlbuhsmOIzvhxFR0vI/NCcmaZbD3mb3X8VdjPE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1579779846514127.49087477132218; Thu, 23 Jan 2020 03:44:06 -0800 (PST) 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-334-waiPnKdlOy29kAe2ZFeoRA-1; Thu, 23 Jan 2020 06:44:02 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E7A7B190D347; Thu, 23 Jan 2020 11:43:55 +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 C041485759; Thu, 23 Jan 2020 11:43:55 +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 7DFE58590A; Thu, 23 Jan 2020 11:43:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00NBhp9e025373 for ; Thu, 23 Jan 2020 06:43:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9599885750; Thu, 23 Jan 2020 11:43:51 +0000 (UTC) Received: from domokun.gsslab.fab.redhat.com (unknown [10.33.8.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id F362885783; Thu, 23 Jan 2020 11:43:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579779845; 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=DxG6rAUx9XMuQ96twSPrUEZlJ1r2h+2Xe8YHsIo2Owg=; b=bZZK0Yu4KgOPY/p9nAxqYVufpTkO5NpEBfnSrbwEK2CG3fAphJ/S6eA7xwhhOWlZ0KytAk WqyFBz4QUK/q3Al8inqagwHKEJko1jgUYRxDvgvvZchSlSvKFelH9gBEAvOHP1W/rgPVYv ubF9RuWyw5LCJev1bSjhVZ2fUeSOooI= From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 10/32] storage: remove use of stat-time.h headers Date: Thu, 23 Jan 2020 11:43:03 +0000 Message-Id: <20200123114325.3860881-11-berrange@redhat.com> In-Reply-To: <20200123114325.3860881-1-berrange@redhat.com> References: <20200123114325.3860881-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.11 X-MC-Unique: waiPnKdlOy29kAe2ZFeoRA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The gnulib stat-time.h header provides wrapper functions to hide the differences in 'struct stat' between various platforms. Linux and FreeBSD support the same names, except for birthtime which Linux only provides in the new 'statx()' syscall we're not using. macOS has completely different naming. Since we only rely on this code in one place we just use conditionals at time of need. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Pavel Hrdina --- src/storage/storage_util.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index 987d937b04..7bbcfde064 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -71,7 +71,6 @@ #include "virfile.h" #include "virjson.h" #include "virqemu.h" -#include "stat-time.h" #include "virstring.h" #include "virxml.h" #include "virfdstream.h" @@ -1830,10 +1829,22 @@ virStorageBackendUpdateVolTargetInfoFD(virStorageSo= urcePtr target, =20 if (!target->timestamps && VIR_ALLOC(target->timestamps) < 0) return -1; - target->timestamps->atime =3D get_stat_atime(sb); - target->timestamps->btime =3D get_stat_birthtime(sb); - target->timestamps->ctime =3D get_stat_ctime(sb); - target->timestamps->mtime =3D get_stat_mtime(sb); + +#ifdef __APPLE__ + target->timestamps->atime =3D sb->st_atimespec; + target->timestamps->btime =3D sb->st_birthtimespec; + target->timestamps->ctime =3D sb->st_ctimespec; + target->timestamps->mtime =3D sb->st_mtimespec; +#else /* ! __APPLE__ */ + target->timestamps->atime =3D sb->st_atim; +# ifdef __linux__ + target->timestamps->btime =3D (struct timespec){0, 0}; +# else /* ! __linux__ */ + target->timestamps->btime =3D sb->st_birthtim; +# endif /* ! __linux__ */ + target->timestamps->ctime =3D sb->st_ctim; + target->timestamps->mtime =3D sb->st_mtim; +#endif /* ! __APPLE__ */ =20 target->type =3D VIR_STORAGE_TYPE_FILE; =20 --=20 2.24.1