From 23824eaeb4fed5e5af8bf4817378d0d3afcc3097 Mon Sep 17 00:00:00 2001 From: trapexit Date: Fri, 6 Jun 2025 19:10:19 -0500 Subject: [PATCH] Misc cleanup --- Makefile | 5 +++-- buildtools/containerfiles/debian.9.amd64 | 9 --------- buildtools/containerfiles/debian.9.arm64 | 9 --------- buildtools/containerfiles/debian.9.armhf | 9 --------- buildtools/containerfiles/debian.9.i386 | 9 --------- buildtools/containerfiles/ubuntu.18.04.amd64 | 9 --------- buildtools/containerfiles/ubuntu.18.04.arm64 | 9 --------- buildtools/containerfiles/ubuntu.18.04.armhf | 9 --------- buildtools/containerfiles/ubuntu.18.04.i386 | 9 --------- libfuse/Makefile | 2 +- libfuse/include/mutex_debug.hpp | 6 +++++- libfuse/include/mutex_ndebug.hpp | 4 ++++ libfuse/lib/debug.hpp | 3 +++ src/fs_wait_for_mount.cpp | 10 +++++----- src/fuse_statx_supported.icpp | 4 ++-- src/policy_mspmfs.cpp | 1 + 16 files changed, 24 insertions(+), 83 deletions(-) delete mode 100644 buildtools/containerfiles/debian.9.amd64 delete mode 100644 buildtools/containerfiles/debian.9.arm64 delete mode 100644 buildtools/containerfiles/debian.9.armhf delete mode 100644 buildtools/containerfiles/debian.9.i386 delete mode 100644 buildtools/containerfiles/ubuntu.18.04.amd64 delete mode 100644 buildtools/containerfiles/ubuntu.18.04.arm64 delete mode 100644 buildtools/containerfiles/ubuntu.18.04.armhf delete mode 100644 buildtools/containerfiles/ubuntu.18.04.i386 diff --git a/Makefile b/Makefile index 3bc8d8e0..f943f257 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ UGID_USE_RWLOCK = 0 ifeq ($(NDEBUG),1) OPT_FLAGS := -O2 -DNDEBUG else -OPT_FLAGS := -O0 -DDEBUG -g -fsanitize=undefined +OPT_FLAGS := -O0 -DDEBUG -g endif ifeq ($(STATIC),1) @@ -93,7 +93,8 @@ TESTS_FLAGS = \ LDFLAGS := \ ${LDFLAGS} \ -pthread \ - -lrt + -lrt \ + -lstdc++fs # https://www.gnu.org/prep/standards/html_node/Directory-Variables.html DESTDIR = diff --git a/buildtools/containerfiles/debian.9.amd64 b/buildtools/containerfiles/debian.9.amd64 deleted file mode 100644 index 9e583999..00000000 --- a/buildtools/containerfiles/debian.9.amd64 +++ /dev/null @@ -1,9 +0,0 @@ -FROM --platform=linux/amd64 debian:9 as build -COPY install-build-pkgs build-mergerfs /tmp/ -RUN /tmp/install-build-pkgs -ARG BUILD_TIMESTAMP=0 -ARG BRANCH=master -RUN /tmp/build-mergerfs $BRANCH - -FROM scratch -COPY --from=build /build/ / diff --git a/buildtools/containerfiles/debian.9.arm64 b/buildtools/containerfiles/debian.9.arm64 deleted file mode 100644 index f937c27b..00000000 --- a/buildtools/containerfiles/debian.9.arm64 +++ /dev/null @@ -1,9 +0,0 @@ -FROM --platform=linux/arm64 debian:9 as build -COPY install-build-pkgs build-mergerfs /tmp/ -RUN /tmp/install-build-pkgs -ARG BUILD_TIMESTAMP=0 -ARG BRANCH=master -RUN /tmp/build-mergerfs $BRANCH - -FROM scratch -COPY --from=build /build/ / diff --git a/buildtools/containerfiles/debian.9.armhf b/buildtools/containerfiles/debian.9.armhf deleted file mode 100644 index 0ad6ec72..00000000 --- a/buildtools/containerfiles/debian.9.armhf +++ /dev/null @@ -1,9 +0,0 @@ -FROM --platform=linux/armhf debian:9 as build -COPY install-build-pkgs build-mergerfs /tmp/ -RUN /tmp/install-build-pkgs -ARG BUILD_TIMESTAMP=0 -ARG BRANCH=master -RUN /tmp/build-mergerfs $BRANCH - -FROM scratch -COPY --from=build /build/ / diff --git a/buildtools/containerfiles/debian.9.i386 b/buildtools/containerfiles/debian.9.i386 deleted file mode 100644 index 9f159ec6..00000000 --- a/buildtools/containerfiles/debian.9.i386 +++ /dev/null @@ -1,9 +0,0 @@ -FROM --platform=linux/i386 debian:9 as build -COPY install-build-pkgs build-mergerfs /tmp/ -RUN /tmp/install-build-pkgs -ARG BUILD_TIMESTAMP=0 -ARG BRANCH=master -RUN /tmp/build-mergerfs $BRANCH - -FROM scratch -COPY --from=build /build/ / diff --git a/buildtools/containerfiles/ubuntu.18.04.amd64 b/buildtools/containerfiles/ubuntu.18.04.amd64 deleted file mode 100644 index d7926fcd..00000000 --- a/buildtools/containerfiles/ubuntu.18.04.amd64 +++ /dev/null @@ -1,9 +0,0 @@ -FROM --platform=linux/amd64 ubuntu:18.04 as build -COPY install-build-pkgs build-mergerfs /tmp/ -RUN /tmp/install-build-pkgs -ARG BUILD_TIMESTAMP=0 -ARG BRANCH=master -RUN /tmp/build-mergerfs $BRANCH - -FROM scratch -COPY --from=build /build/ / diff --git a/buildtools/containerfiles/ubuntu.18.04.arm64 b/buildtools/containerfiles/ubuntu.18.04.arm64 deleted file mode 100644 index a60a6aa6..00000000 --- a/buildtools/containerfiles/ubuntu.18.04.arm64 +++ /dev/null @@ -1,9 +0,0 @@ -FROM --platform=linux/arm64 ubuntu:18.04 as build -COPY install-build-pkgs build-mergerfs /tmp/ -RUN /tmp/install-build-pkgs -ARG BUILD_TIMESTAMP=0 -ARG BRANCH=master -RUN /tmp/build-mergerfs $BRANCH - -FROM scratch -COPY --from=build /build/ / diff --git a/buildtools/containerfiles/ubuntu.18.04.armhf b/buildtools/containerfiles/ubuntu.18.04.armhf deleted file mode 100644 index 806c9eb3..00000000 --- a/buildtools/containerfiles/ubuntu.18.04.armhf +++ /dev/null @@ -1,9 +0,0 @@ -FROM --platform=linux/armhf ubuntu:18.04 as build -COPY install-build-pkgs build-mergerfs /tmp/ -RUN /tmp/install-build-pkgs -ARG BUILD_TIMESTAMP=0 -ARG BRANCH=master -RUN /tmp/build-mergerfs $BRANCH - -FROM scratch -COPY --from=build /build/ / diff --git a/buildtools/containerfiles/ubuntu.18.04.i386 b/buildtools/containerfiles/ubuntu.18.04.i386 deleted file mode 100644 index f859d1fc..00000000 --- a/buildtools/containerfiles/ubuntu.18.04.i386 +++ /dev/null @@ -1,9 +0,0 @@ -FROM --platform=linux/i386 ubuntu:18.04 as build -COPY install-build-pkgs build-mergerfs /tmp/ -RUN /tmp/install-build-pkgs -ARG BUILD_TIMESTAMP=0 -ARG BRANCH=master -RUN /tmp/build-mergerfs $BRANCH - -FROM scratch -COPY --from=build /build/ / diff --git a/libfuse/Makefile b/libfuse/Makefile index ebc59d6e..59dcddc2 100644 --- a/libfuse/Makefile +++ b/libfuse/Makefile @@ -12,7 +12,7 @@ endif ifeq ($(NDEBUG),1) OPT_FLAGS := -O2 -DNDEBUG else -OPT_FLAGS := -O0 -DDEBUG -g -fsanitize=undefined +OPT_FLAGS := -O0 -DDEBUG -g endif ifeq ($(LTO),1) diff --git a/libfuse/include/mutex_debug.hpp b/libfuse/include/mutex_debug.hpp index 56e1869d..b90a1de7 100644 --- a/libfuse/include/mutex_debug.hpp +++ b/libfuse/include/mutex_debug.hpp @@ -7,6 +7,10 @@ #include #include +#ifndef PTHREAD_MUTEX_ADAPTIVE_NP +# define PTHREAD_MUTEX_ADAPTIVE_NP PTHREAD_MUTEX_NORMAL +#endif + #define mutex_init(M) _mutex_init(M,__FILE__,__func__,__LINE__) #define mutex_destroy(M) _mutex_destroy(M,__FILE__,__func__,__LINE__) #define mutex_lock(M) _mutex_lock(M,__FILE__,__func__,__LINE__) @@ -97,7 +101,7 @@ _mutex_lock(pthread_mutex_t *mutex_, case 0: return; case ETIMEDOUT: - cnt++; + cnt++; fmt::println(stderr, "NOTICE: pthread_mutex_timedlock expired - count={}; ({}:{}:{})", cnt, diff --git a/libfuse/include/mutex_ndebug.hpp b/libfuse/include/mutex_ndebug.hpp index fdb8c8ba..08825c8c 100644 --- a/libfuse/include/mutex_ndebug.hpp +++ b/libfuse/include/mutex_ndebug.hpp @@ -4,6 +4,10 @@ #include +#ifndef PTHREAD_MUTEX_ADAPTIVE_NP +# define PTHREAD_MUTEX_ADAPTIVE_NP PTHREAD_MUTEX_NORMAL +#endif + static inline diff --git a/libfuse/lib/debug.hpp b/libfuse/lib/debug.hpp index 35ff6020..f1ce235e 100644 --- a/libfuse/lib/debug.hpp +++ b/libfuse/lib/debug.hpp @@ -18,6 +18,8 @@ #pragma once +#include + #include "fuse_kernel.h" void debug_fuse_open_out(const uint64_t unique, @@ -51,5 +53,6 @@ void debug_fuse_bmap_out(const uint64_t unique, void debug_fuse_in_header(const struct fuse_in_header *hdr); std::string fuse_debug_init_flag_name(const uint64_t); + void fuse_syslog_fuse_init_in(const struct fuse_init_in *arg); void fuse_syslog_fuse_init_out(const struct fuse_init_out *arg); diff --git a/src/fs_wait_for_mount.cpp b/src/fs_wait_for_mount.cpp index 04069a24..47aada38 100644 --- a/src/fs_wait_for_mount.cpp +++ b/src/fs_wait_for_mount.cpp @@ -26,12 +26,12 @@ #include #include -#include +#include namespace fs { - typedef std::unordered_set PathSet; + typedef std::set PathSet; } constexpr std::chrono::milliseconds SLEEP_DURATION = std::chrono::milliseconds(333); @@ -99,9 +99,9 @@ _wait_for_mount(const struct stat &src_st_, const std::chrono::milliseconds &timeout_) { bool first_loop; - fs::PathVector successes; - fs::PathVector failures; - std::unordered_set tgt_paths; + fs::PathVector successes; + fs::PathVector failures; + fs::PathSet tgt_paths; std::chrono::time_point now; std::chrono::time_point deadline; diff --git a/src/fuse_statx_supported.icpp b/src/fuse_statx_supported.icpp index 2aa9db59..84726a68 100644 --- a/src/fuse_statx_supported.icpp +++ b/src/fuse_statx_supported.icpp @@ -24,7 +24,7 @@ _set_stat_if_leads_to_dir(const std::string &path_, int rv; struct fuse_statx st; - rv = fs::statx(AT_FDCWD,path_,AT_SYMLINK_FOLLOW,STATX_TYPE,st_); + rv = fs::statx(AT_FDCWD,path_,AT_SYMLINK_FOLLOW,STATX_TYPE,&st); if(rv < 0) return; @@ -42,7 +42,7 @@ _set_stat_if_leads_to_reg(const std::string &path_, int rv; struct fuse_statx st; - rv = fs::statx(AT_FDCWD,path_,AT_SYMLINK_FOLLOW,STATX_TYPE,st_); + rv = fs::statx(AT_FDCWD,path_,AT_SYMLINK_FOLLOW,STATX_TYPE,&st); if(rv < 0) return; diff --git a/src/policy_mspmfs.cpp b/src/policy_mspmfs.cpp index 3cbc6e50..0a756022 100644 --- a/src/policy_mspmfs.cpp +++ b/src/policy_mspmfs.cpp @@ -42,6 +42,7 @@ namespace mspmfs fs::info_t info; Branch *obranch; + obranch = nullptr; mfs = std::numeric_limits::min(); for(auto &branch : *branches_) {