diff --git a/Makefile b/Makefile index 83e25ab6..a7eeaa00 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,8 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +$(info mergerfs MAKEFLAGS: $(MAKEFLAGS)) + ifeq ($(shell id -u),0) FAKEROOT ?= endif @@ -188,7 +190,7 @@ $(BUILDDIR)/tests: $(BUILDDIR)/mergerfs $(TESTS_OBJS) .PHONY: libfuse $(LIBFUSE): libfuse: - $(MAKE) NDEBUG=$(NDEBUG) -C libfuse + $(MAKE) -C libfuse tests: $(BUILDDIR)/tests diff --git a/buildtools/build-release b/buildtools/build-release index 146abd61..51443b15 100755 --- a/buildtools/build-release +++ b/buildtools/build-release @@ -19,7 +19,7 @@ def build(git_repo, if os.path.exists(git_repo): git_repo = os.path.realpath(git_repo) args += ['-v',f'{git_repo}:/tmp/mergerfs.git:ro'] - args += ['--build-arg=GIT_REPO=/tmp/mergerfs.git'] + args += ['--build-arg=GIT_REPO=file:///tmp/mergerfs.git'] else: args += [f'--build-arg=GIT_REPO={git_repo}'] args += ['-o',pkgdirpath, diff --git a/buildtools/containerfiles/static.amd64 b/buildtools/containerfiles/static.amd64 index e7b50015..4f886fff 100644 --- a/buildtools/containerfiles/static.amd64 +++ b/buildtools/containerfiles/static.amd64 @@ -1,13 +1,15 @@ -ARG BUILD_TIMESTAMP=0 FROM --platform=linux/amd64 alpine:latest as build COPY install-build-pkgs /tmp/ RUN /tmp/install-build-pkgs -ARG BRANCH=master -RUN git clone --single-branch --depth=1 https://github.com/trapexit/mergerfs /tmp/mergerfs --branch="${BRANCH}" +ARG BUILD_TIMESTAMP=0 +ARG GIT_REPO +ARG BRANCH +RUN git clone --single-branch --branch="${BRANCH}" ${GIT_REPO} /tmp/mergerfs WORKDIR /tmp/mergerfs RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install RUN mkdir /build -RUN tar cvfz /build/mergerfs-static-linux_amd64.tar.gz --directory=/tmp usr sbin +RUN /tmp/usr/local/bin/mergerfs --version | head -n1 | cut -c 11- | tee /tmp/version +RUN tar cvfz /build/mergerfs-$(cat /tmp/version)-static-linux_amd64.tar.gz --directory=/tmp usr sbin FROM scratch COPY --from=build /build/ / diff --git a/buildtools/containerfiles/static.arm64 b/buildtools/containerfiles/static.arm64 index ad57d8e4..d2d421eb 100644 --- a/buildtools/containerfiles/static.arm64 +++ b/buildtools/containerfiles/static.arm64 @@ -1,13 +1,15 @@ -ARG BUILD_TIMESTAMP=0 FROM --platform=linux/arm64 alpine:latest as build COPY install-build-pkgs /tmp/ RUN /tmp/install-build-pkgs -ARG BRANCH=master -RUN git clone --single-branch --depth=1 https://github.com/trapexit/mergerfs /tmp/mergerfs --branch="${BRANCH}" +ARG BUILD_TIMESTAMP=0 +ARG GIT_REPO +ARG BRANCH +RUN git clone --single-branch --branch="${BRANCH}" ${GIT_REPO} /tmp/mergerfs WORKDIR /tmp/mergerfs RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install RUN mkdir /build -RUN tar cvfz /build/mergerfs-static-linux_arm64.tar.gz --directory=/tmp usr sbin +RUN /tmp/usr/local/bin/mergerfs --version | head -n1 | cut -c 11- | tee /tmp/version +RUN tar cvfz /build/mergerfs-$(cat /tmp/version)-static-linux_arm64.tar.gz --directory=/tmp usr sbin FROM scratch COPY --from=build /build/ / diff --git a/buildtools/containerfiles/static.armhf b/buildtools/containerfiles/static.armhf index cf418139..6f67c3fc 100644 --- a/buildtools/containerfiles/static.armhf +++ b/buildtools/containerfiles/static.armhf @@ -1,13 +1,15 @@ -ARG BUILD_TIMESTAMP=0 FROM --platform=linux/armhf alpine:latest as build COPY install-build-pkgs /tmp/ RUN /tmp/install-build-pkgs -ARG BRANCH=master -RUN git clone --single-branch --depth=1 https://github.com/trapexit/mergerfs /tmp/mergerfs --branch="${BRANCH}" +ARG BUILD_TIMESTAMP=0 +ARG GIT_REPO +ARG BRANCH +RUN git clone --single-branch --branch="${BRANCH}" ${GIT_REPO} /tmp/mergerfs WORKDIR /tmp/mergerfs RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install RUN mkdir /build -RUN tar cvfz /build/mergerfs-static-linux_armhf.tar.gz --directory=/tmp usr sbin +RUN /tmp/usr/local/bin/mergerfs --version | head -n1 | cut -c 11- | tee /tmp/version +RUN tar cvfz /build/mergerfs-$(cat /tmp/version)-static-linux_armhf.tar.gz --directory=/tmp usr sbin FROM scratch COPY --from=build /build/ / diff --git a/buildtools/containerfiles/static.i386 b/buildtools/containerfiles/static.i386 index 10ee3d71..b55c12b1 100644 --- a/buildtools/containerfiles/static.i386 +++ b/buildtools/containerfiles/static.i386 @@ -1,13 +1,15 @@ -ARG BUILD_TIMESTAMP=0 FROM --platform=linux/i386 alpine:latest as build COPY install-build-pkgs /tmp/ RUN /tmp/install-build-pkgs -ARG BRANCH=master -RUN git clone --single-branch --depth=1 https://github.com/trapexit/mergerfs /tmp/mergerfs --branch="${BRANCH}" +ARG BUILD_TIMESTAMP=0 +ARG GIT_REPO +ARG BRANCH +RUN git clone --single-branch --branch="${BRANCH}" ${GIT_REPO} /tmp/mergerfs WORKDIR /tmp/mergerfs RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install RUN mkdir /build -RUN tar cvfz /build/mergerfs-static-linux_i386.tar.gz --directory=/tmp usr sbin +RUN /tmp/usr/local/bin/mergerfs --version | head -n1 | cut -c 11- | tee /tmp/version +RUN tar cvfz /build/mergerfs-$(cat /tmp/version)-static-linux_i386.tar.gz --directory=/tmp usr sbin FROM scratch COPY --from=build /build/ / diff --git a/buildtools/containerfiles/static.riscv64 b/buildtools/containerfiles/static.riscv64 index e6c5fd65..4583f55f 100644 --- a/buildtools/containerfiles/static.riscv64 +++ b/buildtools/containerfiles/static.riscv64 @@ -1,13 +1,15 @@ -ARG BUILD_TIMESTAMP=0 FROM --platform=linux/riscv64 alpine:latest as build COPY install-build-pkgs /tmp/ RUN /tmp/install-build-pkgs -ARG BRANCH=master -RUN git clone --single-branch --depth=1 https://github.com/trapexit/mergerfs /tmp/mergerfs --branch="${BRANCH}" +ARG BUILD_TIMESTAMP=0 +ARG GIT_REPO +ARG BRANCH +RUN git clone --single-branch --branch="${BRANCH}" ${GIT_REPO} /tmp/mergerfs WORKDIR /tmp/mergerfs RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install RUN mkdir /build -RUN tar cvfz /build/mergerfs-static-linux_riscv64.tar.gz --directory=/tmp usr sbin +RUN /tmp/usr/local/bin/mergerfs --version | head -n1 | cut -c 11- | tee /tmp/version +RUN tar cvfz /build/mergerfs-$(cat /tmp/version)-static-linux_riscv64.tar.gz --directory=/tmp usr sbin FROM scratch COPY --from=build /build/ / diff --git a/libfuse/Makefile b/libfuse/Makefile index e1e6f222..85b94af4 100644 --- a/libfuse/Makefile +++ b/libfuse/Makefile @@ -12,6 +12,8 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +$(info libfuse MAKEFLAGS: $(MAKEFLAGS)) + AR ?= ar CHMOD ?= chmod CHOWN ?= chown @@ -88,10 +90,17 @@ OBJS += $(SRC_CXX:lib/%.cpp=$(BUILDDIR)/.objs/%.cpp.o) DEPS := $(SRC_C:lib/%.c=$(BUILDDIR)/.objs/%.c.d) DEPS += $(SRC_CXX:lib/%.cpp=$(BUILDDIR)/.objs/%.cpp.d) +ifdef STATIC +STATIC_FLAGS := -static +else +STATIC_FLAGS := +endif + CPPFLAGS ?= CFLAGS ?= \ $(OPT_FLAGS) \ $(LTO_FLAGS) \ + $(STATIC_FLAGS) \ -Wall \ -pipe override CFLAGS += \ @@ -101,6 +110,7 @@ override CFLAGS += \ CXXFLAGS ?= \ $(OPT_FLAGS) \ $(LTO_FLAGS) \ + $(STATIC_FLAGS) \ -Wall \ -pipe override CXXFLAGS += \ @@ -138,6 +148,7 @@ $(BUILDDIR)/mergerfs-fusermount: util/fusermount.c lib/mount_util.c mergerfs-fusermount: $(BUILDDIR)/mergerfs-fusermount $(BUILDDIR)/mount.mergerfs: $(BUILDDIR)/libfuse.a util/mount.mergerfs.c + echo STATIC=$(STATIC) $(STATIC_FLAGS) $(CC) $(CFLAGS) $(FUSE_FLAGS) -o $(BUILDDIR)/mount.mergerfs util/mount.mergerfs.c $(BUILDDIR)/libfuse.a $(LDFLAGS) mount.mergerfs: $(BUILDDIR)/mount.mergerfs diff --git a/libfuse/lib/fuse_lowlevel.cpp b/libfuse/lib/fuse_lowlevel.cpp index c82e95a5..bf580195 100644 --- a/libfuse/lib/fuse_lowlevel.cpp +++ b/libfuse/lib/fuse_lowlevel.cpp @@ -1863,7 +1863,7 @@ fuse_ll_opt_proc(void *data_, int key_, struct fuse_args *outargs_) { - fmt::print(stderr, "* ERROR: unknown option '{}'\n", arg_); + fmt::print(stderr, "fuse: ERROR - unknown option - '{}'\n", arg_); return -1; } diff --git a/src/config.cpp b/src/config.cpp index ac0fc901..8acdb553 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -173,6 +173,7 @@ Config::Config() nullrw.ro = pid.ro = pin_threads.ro = + posix_acl.ro = process_thread_count.ro = process_thread_queue_depth.ro = read_thread_count.ro = @@ -180,9 +181,9 @@ Config::Config() srcmounts.ro = version.ro = true; - congestion_threshold.ro = + congestion_threshold.display = gid.display = - max_background.ro = + max_background.display = threads.display = _mount.display = uid.display = @@ -389,6 +390,7 @@ Config::get(const std::string &key_, key = str::replace(key_,'_','-'); + i = _map.find(key); if(i == _map.end()) return -ENOATTR; @@ -434,8 +436,6 @@ Config::from_stream(std::istream &istrm_) { int rv; std::string line; - std::string key; - std::string val; Config::ErrVec new_errs; while(std::getline(istrm_,line,'\n')) @@ -444,13 +444,9 @@ Config::from_stream(std::istream &istrm_) if(line.empty() || (line[0] == '#')) continue; - str::splitkv(line,'=',&key,&val); - key = str::trim(key); - val = str::trim(val); - - rv = set(key,val); + rv = set(line); if(rv < 0) - new_errs.push_back({-rv,key+'='+val}); + new_errs.push_back({-rv,line}); } rv = (new_errs.empty() ? 0 : -EINVAL); diff --git a/src/mergerfs.cpp b/src/mergerfs.cpp index 63d6c146..826ca36f 100644 --- a/src/mergerfs.cpp +++ b/src/mergerfs.cpp @@ -324,7 +324,7 @@ _main(int argc_, std::string s = err.to_string(); SysLog::error("error: {}",s); - fmt::println(stderr,"* ERROR: {}",s); + fmt::println(stderr,"mergerfs: ERROR - {}",s); } return 1; diff --git a/src/option_parser.cpp b/src/option_parser.cpp index 9d3e3786..4d9459d2 100644 --- a/src/option_parser.cpp +++ b/src/option_parser.cpp @@ -121,37 +121,19 @@ _set_default_options(fuse_args *args_) static int -_parse_and_process_kv_arg(const std::string &key_, - const std::string &val_) +_process_opt(const std::string &arg_) { int rv; - std::string key(key_); - std::string val(val_); - - if(cfg.has_key(key) == false) - return 1; - rv = cfg.set(key,val); + rv = cfg.set(arg_); + if(rv == -ENOATTR) + return OPT_KEEP; if(rv < 0) - cfg.errs.push_back({-rv,key+'='+val}); + cfg.errs.push_back({-rv,arg_}); return OPT_DISCARD; } -static -int -_process_opt(const std::string &arg_) -{ - std::string key; - std::string val; - - str::splitkv(arg_,'=',&key,&val); - key = str::trim(key); - val = str::trim(val); - - return ::_parse_and_process_kv_arg(key,val); -} - static void _usage(void)