From d103eaeae169708ca567f092182a89b79e5ab9db Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sun, 20 Oct 2024 07:52:33 -0700 Subject: [PATCH 1/2] Include linux/types.h for __u16/__u32/__u64 type This header is included indirectly with glibc but when using musl it ends up with compilation failure BcachefsUtils.cc:85:20: error: use of undeclared identifier '__u32' 85 | args.dirfd = (__u32) fddst; | ^ --- snapper/BcachefsUtils.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/snapper/BcachefsUtils.cc b/snapper/BcachefsUtils.cc index e9163ffb..1d328a78 100644 --- a/snapper/BcachefsUtils.cc +++ b/snapper/BcachefsUtils.cc @@ -24,6 +24,7 @@ #include #include +#include #include #include From 0b39f4484553c796cb300fb4933ea314e91d913b Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sun, 20 Oct 2024 07:55:23 -0700 Subject: [PATCH 2/2] Use statvfs instead of statvfs64 when using LFS64 these functions are same and also on 64bit systems they are same. musl is using 64bit off_t by default and does not define LFS64 variants of these functions and it ends up in build errors --- snapper/FileUtils.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/snapper/FileUtils.cc b/snapper/FileUtils.cc index d4034279..4c8578a1 100644 --- a/snapper/FileUtils.cc +++ b/snapper/FileUtils.cc @@ -387,9 +387,9 @@ namespace snapper std::pair SDir::statvfs() const { - struct statvfs64 fsbuf; - if (fstatvfs64(dirfd, &fsbuf) != 0) - SN_THROW(IOErrorException(sformat("statvfs64 failed path:%s errno:%d (%s)", base_path.c_str(), + struct statvfs fsbuf; + if (fstatvfs(dirfd, &fsbuf) != 0) + SN_THROW(IOErrorException(sformat("statvfs failed path:%s errno:%d (%s)", base_path.c_str(), errno, stringerror(errno).c_str()))); // f_bavail is used (not f_bfree) since df seems to do the