mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-19 16:16:48 +00:00
Add podman release build tooling + misc build fixes (#1455)
This commit is contained in:
@@ -23,9 +23,7 @@ FIND = find
|
||||
INSTALL = install
|
||||
MKTEMP = mktemp
|
||||
STRIP = strip
|
||||
PANDOC = pandoc
|
||||
SED = sed
|
||||
RPMBUILD = rpmbuild
|
||||
GIT2DEBCL = ./buildtools/git2debcl
|
||||
PKGCONFIG = pkg-config
|
||||
|
||||
@@ -39,10 +37,10 @@ endif
|
||||
USE_XATTR = 1
|
||||
UGID_USE_RWLOCK = 0
|
||||
|
||||
ifeq ($(DEBUG),1)
|
||||
OPT_FLAGS := -O0 -g -fsanitize=undefined
|
||||
else
|
||||
ifeq ($(NDEBUG),1)
|
||||
OPT_FLAGS := -O2 -DNDEBUG
|
||||
else
|
||||
OPT_FLAGS := -O0 -DDEBUG -g -fsanitize=undefined
|
||||
endif
|
||||
|
||||
ifeq ($(STATIC),1)
|
||||
@@ -187,7 +185,7 @@ install-mount-tools: install-base
|
||||
$(MKDIR) -p "$(INSTALLBINDIR)"
|
||||
$(MAKE) -C libfuse install
|
||||
|
||||
install-man: $(MANPAGE)
|
||||
install-man: man/$(MANPAGE)
|
||||
$(MKDIR) -p "$(INSTALLMAN1DIR)"
|
||||
$(INSTALL) -v -m 0644 "man/$(MANPAGE)" "$(INSTALLMAN1DIR)/$(MANPAGE)"
|
||||
|
||||
@@ -210,17 +208,8 @@ uninstall-mount.mergerfs:
|
||||
uninstall-man:
|
||||
$(RM) -f "$(INSTALLMAN1DIR)/$(MANPAGE)"
|
||||
|
||||
$(MANPAGE): README.md
|
||||
ifneq ($(shell $(PANDOC) --version 2> /dev/null),)
|
||||
$(PANDOC) -s -t man -o "man/$(MANPAGE)" README.md
|
||||
else
|
||||
$(warning "pandoc does not appear available: unable to build manpage")
|
||||
endif
|
||||
|
||||
man: $(MANPAGE)
|
||||
|
||||
.PHONY: tarball
|
||||
tarball: man changelog version
|
||||
tarball: changelog version
|
||||
$(eval VERSION := $(shell cat VERSION))
|
||||
$(eval VERSION := $(subst -,_,$(VERSION)))
|
||||
$(eval FILENAME := mergerfs-$(VERSION))
|
||||
@@ -260,7 +249,7 @@ rpm: tarball
|
||||
$(SED) 's/__VERSION__/$(VERSION)/g' mergerfs.spec > \
|
||||
rpmbuild/SOURCES/mergerfs.spec
|
||||
cp -ar mergerfs-$(VERSION).tar.gz rpmbuild/SOURCES
|
||||
$(RPMBUILD) -ba rpmbuild/SOURCES/mergerfs.spec \
|
||||
rpmbuild -ba rpmbuild/SOURCES/mergerfs.spec \
|
||||
--define "_topdir $(CURDIR)/rpmbuild"
|
||||
|
||||
.PHONY: install-build-pkgs
|
||||
@@ -269,6 +258,29 @@ install-build-pkgs:
|
||||
|
||||
.PHONY: libfuse
|
||||
libfuse:
|
||||
$(MAKE) DEBUG=$(DEBUG) -C libfuse
|
||||
$(MAKE) NDEBUG=$(NDEBUG) -C libfuse
|
||||
|
||||
.PHONY: release release-amd64
|
||||
release:
|
||||
./buildtools/build-release \
|
||||
--target=all \
|
||||
--cleanup \
|
||||
--branch=$(shell git branch --show-current)
|
||||
release-amd64:
|
||||
./buildtools/build-release \
|
||||
--target=amd64 \
|
||||
--cleanup \
|
||||
--branch=$(shell git branch --show-current)
|
||||
release-arm64:
|
||||
./buildtools/build-release \
|
||||
--target=arm64 \
|
||||
--cleanup \
|
||||
--branch=$(shell git branch --show-current)
|
||||
release-static:
|
||||
./buildtools/build-release \
|
||||
--target=static \
|
||||
--cleanup \
|
||||
--branch=$(shell git branch --show-current)
|
||||
|
||||
|
||||
-include $(DEPS)
|
||||
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/bin/sh
|
||||
|
||||
BRANCH="${1:-master}"
|
||||
SRCDIR="/tmp/mergerfs"
|
||||
|
||||
git clone https://github.com/trapexit/mergerfs "${SRCDIR}" -b "${BRANCH}"
|
||||
|
||||
cd "${SRCDIR}"
|
||||
|
||||
git log HEAD^1..
|
||||
|
||||
mkdir /build
|
||||
if [ -e /usr/bin/apt-get ]; then
|
||||
make deb
|
||||
if [ $? -ne 0 ]; then
|
||||
. /etc/lsb-release
|
||||
cp -v /etc/lsb-release "/build/${DISTRIB_ID}.${DISTRIB_CODENAME}.${DISTRIB_RELEASE}.$(arch).FAILED"
|
||||
fi
|
||||
find /tmp/ \
|
||||
-type f \
|
||||
-name "*.deb" \
|
||||
-not -name "*dbgsym*" \
|
||||
-exec cp -v {} /build/ \;
|
||||
elif [ -e /usr/bin/dnf ]; then
|
||||
make rpm
|
||||
if [ $? -ne 0 ]; then
|
||||
. /etc/lsb-release
|
||||
cp -v /etc/lsb-release "/build/${DISTRIB_ID}.${DISTRIB_CODENAME}.${DISTRIB_RELEASE}.$(arch).FAILED"
|
||||
fi
|
||||
find /tmp/ \
|
||||
-type f \
|
||||
-name "*.rpm" \
|
||||
-not -name "*sym*" \
|
||||
-not -name "*src.rpm" \
|
||||
-exec cp -v {} /build/ \;
|
||||
elif [ -e /usr/bin/yum ]; then
|
||||
. /opt/rh/devtoolset-9/enable
|
||||
make rpm
|
||||
find /tmp/ \
|
||||
-type f \
|
||||
-name "*.rpm" \
|
||||
-not -name "*sym*" \
|
||||
-not -name "*src.rpm" \
|
||||
-exec cp -v {} /build/ \;
|
||||
elif [ -e /sbin/apk ]; then
|
||||
echo "NOT YET SUPPORTED"
|
||||
elif [ -e /usr/sbin/pkg ]; then
|
||||
echo "NOT YET SUPPORTED"
|
||||
fi
|
||||
Executable
+101
@@ -0,0 +1,101 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
import argparse
|
||||
import time
|
||||
|
||||
|
||||
def build(containerfile,
|
||||
pkgdirpath,
|
||||
branch):
|
||||
timestamp = time.time_ns()
|
||||
args = ['podman',
|
||||
'build',
|
||||
'--pull=always',
|
||||
'--force-rm',
|
||||
'-o',pkgdirpath,
|
||||
'-f',containerfile,
|
||||
f'--build-arg=BRANCH={branch}',
|
||||
f'--build-arg=BUILD_TIMESTAMP={timestamp}',
|
||||
'buildtools/']
|
||||
print(args)
|
||||
subprocess.run(args)
|
||||
|
||||
|
||||
def setup():
|
||||
args = ['sudo',
|
||||
'apt-get',
|
||||
'install',
|
||||
'-fy',
|
||||
'qemu-user-static',
|
||||
'qemu-user-binfmt']
|
||||
print(args)
|
||||
subprocess.run(args)
|
||||
|
||||
|
||||
def podman_cleanup():
|
||||
args = ['podman',
|
||||
'system',
|
||||
'prune',
|
||||
'-af']
|
||||
print(args)
|
||||
subprocess.run(args)
|
||||
|
||||
|
||||
def parse_args():
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument('--target',
|
||||
default='debian.12.amd64')
|
||||
p.add_argument('--pkgdirpath',
|
||||
default='build/pkgs/')
|
||||
p.add_argument('--branch',
|
||||
default='master')
|
||||
p.add_argument('--setup',
|
||||
required=False,
|
||||
action='store_true')
|
||||
p.add_argument('--cleanup',
|
||||
required=False,
|
||||
action='store_true')
|
||||
|
||||
return p.parse_args()
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
print(args)
|
||||
|
||||
if args.setup:
|
||||
setup()
|
||||
sys.exit(0)
|
||||
|
||||
containerfiles = []
|
||||
basepath = 'buildtools/containerfiles'
|
||||
if os.path.exists(f'{basepath}/{args.target}'):
|
||||
containerfiles.append(f'{basepath}/{args.target}')
|
||||
elif args.target == 'all':
|
||||
for root,dirnames,filenames in os.walk(basepath):
|
||||
for filename in filenames:
|
||||
containerfile = f'buildtools/containerfiles/{filename}'
|
||||
containerfiles.append(containerfile)
|
||||
else:
|
||||
for root,dirnames,filenames in os.walk(basepath):
|
||||
for filename in filenames:
|
||||
if args.target not in filename:
|
||||
continue
|
||||
containerfile = f'buildtools/containerfiles/{filename}'
|
||||
containerfiles.append(containerfile)
|
||||
|
||||
for containerfile in containerfiles:
|
||||
if args.cleanup:
|
||||
podman_cleanup()
|
||||
build(containerfile,
|
||||
args.pkgdirpath,
|
||||
args.branch)
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/amd64 debian:10 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/arm64 debian:10 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/armhf debian:10 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/i386 debian:10 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/amd64 debian:11 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/arm64 debian:11 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/armhf debian:11 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/i386 debian:11 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/amd64 debian:12 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/arm64 debian:12 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/armhf debian:12 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/i386 debian:12 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/amd64 fedora:37 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/arm64 fedora:37 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/armhf fedora:37 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/i386 fedora:37 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/amd64 fedora:38 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/arm64 fedora:38 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/armhf fedora:38 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/i386 fedora:38 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/amd64 fedora:39 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/amd64 fedora:40 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/amd64 fedora:41 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/amd64 fedora:42 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/amd64 rockylinux:8 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/arm64 rockylinux:8 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/armhf rockylinux:8 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/i386 rockylinux:8 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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/amd64 rockylinux: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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/arm64 rockylinux: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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/armhf rockylinux: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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/i386 rockylinux: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/ /
|
||||
@@ -0,0 +1,13 @@
|
||||
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 https://github.com/trapexit/mergerfs /tmp/mergerfs -b "${BRANCH}"
|
||||
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
|
||||
|
||||
FROM scratch
|
||||
COPY --from=build /build/ /
|
||||
@@ -0,0 +1,13 @@
|
||||
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 https://github.com/trapexit/mergerfs /tmp/mergerfs -b "${BRANCH}"
|
||||
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
|
||||
|
||||
FROM scratch
|
||||
COPY --from=build /build/ /
|
||||
@@ -0,0 +1,13 @@
|
||||
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 https://github.com/trapexit/mergerfs /tmp/mergerfs -b "${BRANCH}"
|
||||
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
|
||||
|
||||
FROM scratch
|
||||
COPY --from=build /build/ /
|
||||
@@ -0,0 +1,13 @@
|
||||
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 https://github.com/trapexit/mergerfs /tmp/mergerfs -b "${BRANCH}"
|
||||
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
|
||||
|
||||
FROM scratch
|
||||
COPY --from=build /build/ /
|
||||
@@ -0,0 +1,10 @@
|
||||
ARG BUILD_TIMESTAMP=0
|
||||
FROM --platform=linux/amd64 ubuntu:latest as build
|
||||
RUN apt-get update && apt-get install -y makeself
|
||||
RUN mkdir -p /tmp/mergerfs/
|
||||
RUN --mount=type=bind,src=pkgs,dst=/pkgs ls -lhd /pkgs
|
||||
RUN --mount=type=bind,src=pkgs,dst=/pkgs cp -v /pkg/*static*.gz /tmp/mergerfs/
|
||||
RUN makeself /tmp/mergerfs/ /build/mergerfs-installer.run "mergerfs" echo "foo"
|
||||
|
||||
FROM scratch
|
||||
COPY --from=build /build/ /
|
||||
@@ -0,0 +1,13 @@
|
||||
FROM debian:buster as tarball
|
||||
COPY install-build-pkgs /tmp/
|
||||
RUN /tmp/install-build-pkgs
|
||||
ARG BUILD_TIMESTAMP=0
|
||||
ARG BRANCH=master
|
||||
RUN git clone https://github.com/trapexit/mergerfs /tmp/mergerfs -b "${BRANCH}"
|
||||
RUN cd /tmp/mergerfs && make version tarball
|
||||
RUN mkdir /build
|
||||
RUN cp -v /tmp/mergerfs/*.tar.gz /build/
|
||||
|
||||
|
||||
FROM scratch
|
||||
COPY --from=tarball /build/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/amd64 ubuntu:20.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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/arm64 ubuntu:20.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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/armhf ubuntu:20.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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/i386 ubuntu:20.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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/amd64 ubuntu:22.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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/arm64 ubuntu:22.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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/armhf ubuntu:22.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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/i386 ubuntu:22.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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/amd64 ubuntu:24.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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/arm64 ubuntu:24.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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/armhf ubuntu:24.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/ /
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM --platform=linux/i386 ubuntu:24.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/ /
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (c) 2016, Antonio SJ Musumeci <trapexit@spawn.link>
|
||||
|
||||
|
||||
@@ -7,34 +7,37 @@ if [ -e /usr/bin/apt-get ]; then
|
||||
install \
|
||||
ca-certificates \
|
||||
build-essential \
|
||||
dpkg \
|
||||
git \
|
||||
g++ \
|
||||
debhelper \
|
||||
automake \
|
||||
fakeroot \
|
||||
libtool \
|
||||
lsb-release
|
||||
apt-get -qy --no-install-suggests --no-install-recommends install python
|
||||
apt-get -qy --no-install-suggests --no-install-recommends install python3
|
||||
lsb-release \
|
||||
fakeroot
|
||||
apt-get -qy --force-yes --no-install-suggests --no-install-recommends install python
|
||||
apt-get -qy --force-yes --no-install-suggests --no-install-recommends install python3
|
||||
elif [ -e /usr/bin/dnf ]; then
|
||||
dnf -y update
|
||||
dnf -y install \
|
||||
git rpm-build gcc-c++ make which python3 automake \
|
||||
libtool gettext-devel
|
||||
git rpm-build gcc-c++ make which python3
|
||||
elif [ -e /usr/bin/yum ]; then
|
||||
yum -y update
|
||||
yum -y install \
|
||||
git rpm-build gcc-c++ make which \
|
||||
python python-argparse \
|
||||
automake libtool gettext-devel
|
||||
python python-argparse
|
||||
yum -y install centos-release-scl
|
||||
yum -y install devtoolset-9-gcc\*
|
||||
elif [ -e /usr/bin/zypper ]; then
|
||||
zypper update -y
|
||||
zypper install -y \
|
||||
git rpm-build gcc-c++ make which \
|
||||
python
|
||||
elif [ -e /sbin/apk ]; then
|
||||
apk add \
|
||||
abuild git gcc g++ make autoconf \
|
||||
automake libtool gettext-dev linux-headers
|
||||
abuild git gcc g++ make \
|
||||
linux-headers
|
||||
elif [ -e /usr/sbin/pkg ]; then
|
||||
pkg install \
|
||||
git gmake gcc autoconf automake libtool \
|
||||
gettext-tools
|
||||
git gmake gcc
|
||||
fi
|
||||
|
||||
if [ ! -e /usr/bin/python ]; then
|
||||
|
||||
+4
-5
@@ -9,10 +9,10 @@ UTILS :=
|
||||
INSTALLUTILS :=
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG),1)
|
||||
OPT_FLAGS := -O0 -g -fsanitize=undefined
|
||||
ifeq ($(NDEBUG),1)
|
||||
OPT_FLAGS := -O2 -DNDEBUG
|
||||
else
|
||||
OPT_FLAGS := -O2
|
||||
OPT_FLAGS := -O0 -DDEBUG -g -fsanitize=undefined
|
||||
endif
|
||||
|
||||
ifeq ($(LTO),1)
|
||||
@@ -41,7 +41,6 @@ SRC_C = \
|
||||
lib/buffer.c \
|
||||
lib/crc32b.c \
|
||||
lib/debug.c \
|
||||
lib/fuse.c \
|
||||
lib/fuse_dirents.c \
|
||||
lib/fuse_lowlevel.c \
|
||||
lib/node.c \
|
||||
@@ -52,6 +51,7 @@ SRC_C = \
|
||||
lib/helper.c \
|
||||
lib/mount.c
|
||||
SRC_CPP = \
|
||||
lib/fuse.cpp \
|
||||
lib/cpu.cpp \
|
||||
lib/fuse_config.cpp \
|
||||
lib/fuse_loop.cpp \
|
||||
@@ -87,7 +87,6 @@ FUSE_FLAGS = \
|
||||
-Ibuild \
|
||||
-D_REENTRANT \
|
||||
-D_FILE_OFFSET_BITS=64 \
|
||||
-DPACKAGE_VERSION=\"$(VERSION)\" \
|
||||
-DFUSERMOUNT_DIR=\"$(FUSERMOUNT_DIR)\"
|
||||
LDFLAGS := \
|
||||
${LDFLAGS} \
|
||||
|
||||
+75
-47
@@ -1617,6 +1617,14 @@ fuse_lib_lookup(fuse_req_t req,
|
||||
reply_entry(req,&e,err);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
fuse_lib_lseek(fuse_req_t req_,
|
||||
struct fuse_in_header *hdr_)
|
||||
{
|
||||
fuse_reply_err(req_,ENOSYS);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
fuse_lib_forget(fuse_req_t req,
|
||||
@@ -2179,6 +2187,24 @@ fuse_lib_rename(fuse_req_t req,
|
||||
fuse_reply_err(req,err);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
fuse_lib_rename2(fuse_req_t req_,
|
||||
struct fuse_in_header *hdr_)
|
||||
{
|
||||
fuse_reply_err(req_,ENOSYS);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
fuse_lib_retrieve_reply(fuse_req_t req_,
|
||||
void *cookie_,
|
||||
uint64_t ino_,
|
||||
off_t offset_)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
fuse_lib_link(fuse_req_t req,
|
||||
@@ -3674,53 +3700,55 @@ fuse_prune_remembered_nodes(struct fuse *f_)
|
||||
|
||||
static struct fuse_lowlevel_ops fuse_path_ops =
|
||||
{
|
||||
.access = fuse_lib_access,
|
||||
.bmap = fuse_lib_bmap,
|
||||
.copy_file_range = fuse_lib_copy_file_range,
|
||||
.create = fuse_lib_create,
|
||||
.destroy = fuse_lib_destroy,
|
||||
.fallocate = fuse_lib_fallocate,
|
||||
.flock = fuse_lib_flock,
|
||||
.flush = fuse_lib_flush,
|
||||
.forget = fuse_lib_forget,
|
||||
.forget_multi = fuse_lib_forget_multi,
|
||||
.fsync = fuse_lib_fsync,
|
||||
.fsyncdir = fuse_lib_fsyncdir,
|
||||
.getattr = fuse_lib_getattr,
|
||||
.getlk = fuse_lib_getlk,
|
||||
.getxattr = fuse_lib_getxattr,
|
||||
.init = fuse_lib_init,
|
||||
.ioctl = fuse_lib_ioctl,
|
||||
.link = fuse_lib_link,
|
||||
.listxattr = fuse_lib_listxattr,
|
||||
.lookup = fuse_lib_lookup,
|
||||
.mkdir = fuse_lib_mkdir,
|
||||
.mknod = fuse_lib_mknod,
|
||||
.open = fuse_lib_open,
|
||||
.opendir = fuse_lib_opendir,
|
||||
.poll = fuse_lib_poll,
|
||||
.read = fuse_lib_read,
|
||||
.readdir = fuse_lib_readdir,
|
||||
.readdir_plus = fuse_lib_readdir_plus,
|
||||
.readlink = fuse_lib_readlink,
|
||||
.release = fuse_lib_release,
|
||||
.releasedir = fuse_lib_releasedir,
|
||||
.removemapping = fuse_lib_removemapping,
|
||||
.removexattr = fuse_lib_removexattr,
|
||||
.rename = fuse_lib_rename,
|
||||
.retrieve_reply = NULL,
|
||||
.rmdir = fuse_lib_rmdir,
|
||||
.setattr = fuse_lib_setattr,
|
||||
.setlk = fuse_lib_setlk,
|
||||
.setupmapping = fuse_lib_setupmapping,
|
||||
.setxattr = fuse_lib_setxattr,
|
||||
.statfs = fuse_lib_statfs,
|
||||
.statx = fuse_lib_statx,
|
||||
.symlink = fuse_lib_symlink,
|
||||
.syncfs = fuse_lib_syncfs,
|
||||
.tmpfile = fuse_lib_tmpfile,
|
||||
.unlink = fuse_lib_unlink,
|
||||
.write = fuse_lib_write,
|
||||
.access = fuse_lib_access,
|
||||
.bmap = fuse_lib_bmap,
|
||||
.copy_file_range = fuse_lib_copy_file_range,
|
||||
.create = fuse_lib_create,
|
||||
.destroy = fuse_lib_destroy,
|
||||
.fallocate = fuse_lib_fallocate,
|
||||
.flock = fuse_lib_flock,
|
||||
.flush = fuse_lib_flush,
|
||||
.forget = fuse_lib_forget,
|
||||
.forget_multi = fuse_lib_forget_multi,
|
||||
.fsync = fuse_lib_fsync,
|
||||
.fsyncdir = fuse_lib_fsyncdir,
|
||||
.getattr = fuse_lib_getattr,
|
||||
.getlk = fuse_lib_getlk,
|
||||
.getxattr = fuse_lib_getxattr,
|
||||
.init = fuse_lib_init,
|
||||
.ioctl = fuse_lib_ioctl,
|
||||
.link = fuse_lib_link,
|
||||
.listxattr = fuse_lib_listxattr,
|
||||
.lookup = fuse_lib_lookup,
|
||||
.lseek = fuse_lib_lseek,
|
||||
.mkdir = fuse_lib_mkdir,
|
||||
.mknod = fuse_lib_mknod,
|
||||
.open = fuse_lib_open,
|
||||
.opendir = fuse_lib_opendir,
|
||||
.poll = fuse_lib_poll,
|
||||
.read = fuse_lib_read,
|
||||
.readdir = fuse_lib_readdir,
|
||||
.readdir_plus = fuse_lib_readdir_plus,
|
||||
.readlink = fuse_lib_readlink,
|
||||
.release = fuse_lib_release,
|
||||
.releasedir = fuse_lib_releasedir,
|
||||
.removemapping = fuse_lib_removemapping,
|
||||
.removexattr = fuse_lib_removexattr,
|
||||
.rename = fuse_lib_rename,
|
||||
.rename2 = fuse_lib_rename2,
|
||||
.retrieve_reply = fuse_lib_retrieve_reply,
|
||||
.rmdir = fuse_lib_rmdir,
|
||||
.setattr = fuse_lib_setattr,
|
||||
.setlk = fuse_lib_setlk,
|
||||
.setupmapping = fuse_lib_setupmapping,
|
||||
.setxattr = fuse_lib_setxattr,
|
||||
.statfs = fuse_lib_statfs,
|
||||
.statx = fuse_lib_statx,
|
||||
.symlink = fuse_lib_symlink,
|
||||
.syncfs = fuse_lib_syncfs,
|
||||
.tmpfile = fuse_lib_tmpfile,
|
||||
.unlink = fuse_lib_unlink,
|
||||
.write = fuse_lib_write,
|
||||
};
|
||||
|
||||
int
|
||||
|
||||
@@ -77,11 +77,6 @@ static void helper_help(void)
|
||||
);
|
||||
}
|
||||
|
||||
static void helper_version(void)
|
||||
{
|
||||
fprintf(stderr, "FUSE library version: %s\n", PACKAGE_VERSION);
|
||||
}
|
||||
|
||||
static int fuse_helper_opt_proc(void *data, const char *arg, int key,
|
||||
struct fuse_args *outargs)
|
||||
{
|
||||
@@ -97,7 +92,6 @@ static int fuse_helper_opt_proc(void *data, const char *arg, int key,
|
||||
return fuse_opt_add_arg(outargs, "-h");
|
||||
|
||||
case KEY_VERSION:
|
||||
helper_version();
|
||||
return 1;
|
||||
|
||||
case FUSE_OPT_KEY_NONOPT:
|
||||
|
||||
@@ -1165,8 +1165,7 @@ static void usage(void)
|
||||
|
||||
static void show_version(void)
|
||||
{
|
||||
printf("fusermount version: %s\n", PACKAGE_VERSION);
|
||||
exit(0);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
||||
+87
-3295
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -30,11 +30,11 @@ public:
|
||||
typedef E ENUM;
|
||||
|
||||
public:
|
||||
Enum<ENUM>()
|
||||
Enum()
|
||||
{
|
||||
}
|
||||
|
||||
Enum<ENUM>(const ENUM data_)
|
||||
Enum(const ENUM data_)
|
||||
: _data(data_)
|
||||
{
|
||||
}
|
||||
|
||||
+2
-2
@@ -15,9 +15,9 @@
|
||||
*/
|
||||
|
||||
#ifdef __linux__
|
||||
#warning "using fs_attr_linux.icpp"
|
||||
#pragma message "using fs_attr_linux.icpp"
|
||||
#include "fs_attr_linux.icpp"
|
||||
#else
|
||||
#warning "using fs_attr_unsupported.icpp"
|
||||
#pragma message "using fs_attr_unsupported.icpp"
|
||||
#include "fs_attr_unsupported.icpp"
|
||||
#endif
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
*/
|
||||
|
||||
#ifdef __linux__
|
||||
#warning "using fs_copy_file_range_linux.icpp"
|
||||
#pragma message "using fs_copy_file_range_linux.icpp"
|
||||
#include "fs_copy_file_range_linux.icpp"
|
||||
#else
|
||||
#warning "using fs_copy_file_range_unsupported.icpp"
|
||||
#pragma message "using fs_copy_file_range_unsupported.icpp"
|
||||
#include "fs_copy_file_range_unsupported.icpp"
|
||||
#endif
|
||||
|
||||
+2
-2
@@ -17,10 +17,10 @@
|
||||
#include <fcntl.h>
|
||||
|
||||
#if _XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L
|
||||
#warning "using fs_fadvise_posix.icpp"
|
||||
#pragma message "using fs_fadvise_posix.icpp"
|
||||
#include "fs_fadvise_posix.icpp"
|
||||
#else
|
||||
#warning "using fs_fadvise_unsupported.icpp"
|
||||
#pragma message "using fs_fadvise_unsupported.icpp"
|
||||
#include "fs_fadvise_unsupported.icpp"
|
||||
#endif
|
||||
|
||||
|
||||
+2
-2
@@ -17,9 +17,9 @@
|
||||
*/
|
||||
|
||||
#ifdef __linux__
|
||||
#warning "using fs_ficlone_linux.icpp"
|
||||
#pragma message "using fs_ficlone_linux.icpp"
|
||||
#include "fs_ficlone_linux.icpp"
|
||||
#else
|
||||
#warning "using fs_ficlone_unsupported.icpp"
|
||||
#pragma message "using fs_ficlone_unsupported.icpp"
|
||||
#include "fs_ficlone_unsupported.icpp"
|
||||
#endif
|
||||
|
||||
+3
-3
@@ -23,13 +23,13 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#warning "using fs_futimens_linux.hpp"
|
||||
#pragma message "using fs_futimens_linux.hpp"
|
||||
#include "fs_futimens_linux.hpp"
|
||||
#elif __FreeBSD__ >= 11
|
||||
#warning "using fs_futimens_freebsd_11.hpp"
|
||||
#pragma message "using fs_futimens_freebsd_11.hpp"
|
||||
#include "fs_futimens_freebsd_11.hpp"
|
||||
#else
|
||||
#warning "using fs_futimens_generic.hpp"
|
||||
#pragma message "using fs_futimens_generic.hpp"
|
||||
#include "fs_futimens_generic.hpp"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
*/
|
||||
|
||||
#if __APPLE__
|
||||
#warning "using fs_futimesat_osx.icpp"
|
||||
#pragma message "using fs_futimesat_osx.icpp"
|
||||
#include "fs_futimesat_osx.icpp"
|
||||
#else
|
||||
#warning "using fs_futimesat_generic.icpp"
|
||||
#pragma message "using fs_futimesat_generic.icpp"
|
||||
#include "fs_futimesat_generic.icpp"
|
||||
#endif
|
||||
|
||||
+2
-2
@@ -15,9 +15,9 @@
|
||||
*/
|
||||
|
||||
#ifdef __linux__
|
||||
#warning "using fs_sendfile_linux.icpp"
|
||||
#pragma message "using fs_sendfile_linux.icpp"
|
||||
#include "fs_sendfile_linux.icpp"
|
||||
#else
|
||||
#warning "using fs_sendfile_unsupported.icpp"
|
||||
#pragma message "using fs_sendfile_unsupported.icpp"
|
||||
#include "fs_sendfile_unsupported.icpp"
|
||||
#endif
|
||||
|
||||
+5
-1
@@ -11,6 +11,10 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef STATX_TYPE
|
||||
#define MERGERFS_STATX_SUPPORTED
|
||||
#endif
|
||||
|
||||
namespace fs
|
||||
{
|
||||
static
|
||||
@@ -22,7 +26,7 @@ namespace fs
|
||||
const unsigned int mask_,
|
||||
struct fuse_statx *st_)
|
||||
{
|
||||
#ifdef STATX_TYPE
|
||||
#ifdef MERGERFS_STATX_SUPPORTED
|
||||
int rv;
|
||||
|
||||
rv = ::statx(dirfd_,
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __linux__
|
||||
#warning "using fs_utimensat_linux.hpp"
|
||||
#pragma message "using fs_utimensat_linux.hpp"
|
||||
#include "fs_utimensat_linux.hpp"
|
||||
#elif __FreeBSD__
|
||||
#warning "using fs_utimensat_freebsd.hpp"
|
||||
#pragma message "using fs_utimensat_freebsd.hpp"
|
||||
#include "fs_utimensat_freebsd.hpp"
|
||||
#else
|
||||
#warning "using fs_utimensat_generic.hpp"
|
||||
#pragma message "using fs_utimensat_generic.hpp"
|
||||
#include "fs_utimensat_generic.hpp"
|
||||
#endif
|
||||
|
||||
+7
-184
@@ -1,186 +1,9 @@
|
||||
#include "fuse_statx.hpp"
|
||||
|
||||
#include "config.hpp"
|
||||
#include "errno.hpp"
|
||||
#include "fileinfo.hpp"
|
||||
#include "fs_inode.hpp"
|
||||
#include "fs_path.hpp"
|
||||
#include "fs_statx.hpp"
|
||||
#include "symlinkify.hpp"
|
||||
#include "ugid.hpp"
|
||||
|
||||
#include "fmt/core.h"
|
||||
|
||||
#include "fuse.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
static
|
||||
void
|
||||
_set_stat_if_leads_to_dir(const std::string &path_,
|
||||
struct fuse_statx *st_)
|
||||
{
|
||||
int rv;
|
||||
struct fuse_statx st;
|
||||
|
||||
rv = fs::statx(AT_FDCWD,path_,AT_SYMLINK_FOLLOW,STATX_TYPE,st_);
|
||||
if(rv < 0)
|
||||
return;
|
||||
|
||||
if(S_ISDIR(st.mode))
|
||||
*st_ = st;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
_set_stat_if_leads_to_reg(const std::string &path_,
|
||||
struct fuse_statx *st_)
|
||||
{
|
||||
int rv;
|
||||
struct fuse_statx st;
|
||||
|
||||
rv = fs::statx(AT_FDCWD,path_,AT_SYMLINK_FOLLOW,STATX_TYPE,st_);
|
||||
if(rv < 0)
|
||||
return;
|
||||
|
||||
if(S_ISREG(st.mode))
|
||||
*st_ = st;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
_statx_controlfile(struct fuse_statx *st_)
|
||||
{
|
||||
static const uid_t uid = ::getuid();
|
||||
static const gid_t gid = ::getgid();
|
||||
static const time_t now = ::time(NULL);
|
||||
|
||||
st_->ino = 0;
|
||||
st_->mode = (S_IFREG|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH);
|
||||
st_->nlink = 1;
|
||||
st_->uid = uid;
|
||||
st_->gid = gid;
|
||||
st_->size = 0;
|
||||
st_->blocks = 0;
|
||||
st_->atime.tv_sec = now;
|
||||
st_->mtime.tv_sec = now;
|
||||
st_->ctime.tv_sec = now;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
_statx(const Policy::Search &searchFunc_,
|
||||
const Branches &branches_,
|
||||
const char *fusepath_,
|
||||
const uint32_t flags_,
|
||||
const uint32_t mask_,
|
||||
struct fuse_statx *st_,
|
||||
const bool symlinkify_,
|
||||
const time_t symlinkify_timeout_,
|
||||
FollowSymlinks followsymlinks_)
|
||||
{
|
||||
int rv;
|
||||
std::string fullpath;
|
||||
StrVec basepaths;
|
||||
|
||||
rv = searchFunc_(branches_,fusepath_,&basepaths);
|
||||
if(rv == -1)
|
||||
return -errno;
|
||||
|
||||
fullpath = fs::path::make(basepaths[0],fusepath_);
|
||||
|
||||
switch(followsymlinks_)
|
||||
{
|
||||
case FollowSymlinks::ENUM::NEVER:
|
||||
rv = fs::statx(AT_FDCWD,fullpath,flags_|AT_SYMLINK_NOFOLLOW,mask_,st_);
|
||||
break;
|
||||
case FollowSymlinks::ENUM::DIRECTORY:
|
||||
rv = fs::statx(AT_FDCWD,fullpath,flags_|AT_SYMLINK_NOFOLLOW,mask_,st_);
|
||||
if((rv >= 0) && S_ISLNK(st_->mode))
|
||||
::_set_stat_if_leads_to_dir(fullpath,st_);
|
||||
break;
|
||||
case FollowSymlinks::ENUM::REGULAR:
|
||||
rv = fs::statx(AT_FDCWD,fullpath,flags_|AT_SYMLINK_NOFOLLOW,mask_,st_);
|
||||
if((rv >= 0) && S_ISLNK(st_->mode))
|
||||
::_set_stat_if_leads_to_reg(fullpath,st_);
|
||||
break;
|
||||
case FollowSymlinks::ENUM::ALL:
|
||||
rv = fs::statx(AT_FDCWD,fullpath,flags_|AT_SYMLINK_FOLLOW,mask_,st_);
|
||||
if(rv < 0)
|
||||
rv = fs::statx(AT_FDCWD,fullpath,flags_|AT_SYMLINK_NOFOLLOW,mask_,st_);
|
||||
break;
|
||||
}
|
||||
|
||||
if(rv < 0)
|
||||
return rv;
|
||||
|
||||
if(symlinkify_ && symlinkify::can_be_symlink(*st_,symlinkify_timeout_))
|
||||
symlinkify::convert(fullpath,st_);
|
||||
|
||||
fs::inode::calc(basepaths[0],fusepath_,st_);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
_statx(const char *fusepath_,
|
||||
const uint32_t flags_,
|
||||
const uint32_t mask_,
|
||||
struct fuse_statx *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
{
|
||||
int rv;
|
||||
Config::Read cfg;
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
|
||||
rv = ::_statx(cfg->func.getattr.policy,
|
||||
cfg->branches,
|
||||
fusepath_,
|
||||
flags_,
|
||||
mask_,
|
||||
st_,
|
||||
cfg->symlinkify,
|
||||
cfg->symlinkify_timeout,
|
||||
cfg->follow_symlinks);
|
||||
|
||||
timeout_->entry = ((rv >= 0) ?
|
||||
cfg->cache_entry :
|
||||
cfg->cache_negative_entry);
|
||||
timeout_->attr = cfg->cache_attr;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
FUSE::statx(const char *fusepath_,
|
||||
const uint32_t flags_,
|
||||
const uint32_t mask_,
|
||||
struct fuse_statx *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
{
|
||||
if(fusepath_ == CONTROLFILE)
|
||||
return ::_statx_controlfile(st_);
|
||||
|
||||
return ::_statx(fusepath_,flags_|AT_STATX_DONT_SYNC,mask_,st_,timeout_);
|
||||
}
|
||||
|
||||
int
|
||||
FUSE::statx_fh(const uint64_t fh_,
|
||||
const uint32_t flags_,
|
||||
const uint32_t mask_,
|
||||
struct fuse_statx *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
{
|
||||
FileInfo *fi = reinterpret_cast<FileInfo*>(fh_);
|
||||
|
||||
return ::_statx(fi->fusepath.c_str(),flags_,mask_,st_,timeout_);
|
||||
}
|
||||
#ifdef MERGERFS_STATX_SUPPORTED
|
||||
#pragma message "statx supported"
|
||||
# include "fuse_statx_supported.icpp"
|
||||
#else
|
||||
#pragma message "statx NOT supported"
|
||||
# include "fuse_statx_unsupported.icpp"
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
#include "fuse_statx.hpp"
|
||||
|
||||
#include "config.hpp"
|
||||
#include "errno.hpp"
|
||||
#include "fileinfo.hpp"
|
||||
#include "fs_inode.hpp"
|
||||
#include "fs_path.hpp"
|
||||
#include "fs_statx.hpp"
|
||||
#include "symlinkify.hpp"
|
||||
#include "ugid.hpp"
|
||||
|
||||
#include "fmt/core.h"
|
||||
|
||||
#include "fuse.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
static
|
||||
void
|
||||
_set_stat_if_leads_to_dir(const std::string &path_,
|
||||
struct fuse_statx *st_)
|
||||
{
|
||||
int rv;
|
||||
struct fuse_statx st;
|
||||
|
||||
rv = fs::statx(AT_FDCWD,path_,AT_SYMLINK_FOLLOW,STATX_TYPE,st_);
|
||||
if(rv < 0)
|
||||
return;
|
||||
|
||||
if(S_ISDIR(st.mode))
|
||||
*st_ = st;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
_set_stat_if_leads_to_reg(const std::string &path_,
|
||||
struct fuse_statx *st_)
|
||||
{
|
||||
int rv;
|
||||
struct fuse_statx st;
|
||||
|
||||
rv = fs::statx(AT_FDCWD,path_,AT_SYMLINK_FOLLOW,STATX_TYPE,st_);
|
||||
if(rv < 0)
|
||||
return;
|
||||
|
||||
if(S_ISREG(st.mode))
|
||||
*st_ = st;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
_statx_controlfile(struct fuse_statx *st_)
|
||||
{
|
||||
static const uid_t uid = ::getuid();
|
||||
static const gid_t gid = ::getgid();
|
||||
static const time_t now = ::time(NULL);
|
||||
|
||||
st_->ino = 0;
|
||||
st_->mode = (S_IFREG|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH);
|
||||
st_->nlink = 1;
|
||||
st_->uid = uid;
|
||||
st_->gid = gid;
|
||||
st_->size = 0;
|
||||
st_->blocks = 0;
|
||||
st_->atime.tv_sec = now;
|
||||
st_->mtime.tv_sec = now;
|
||||
st_->ctime.tv_sec = now;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
_statx(const Policy::Search &searchFunc_,
|
||||
const Branches &branches_,
|
||||
const char *fusepath_,
|
||||
const uint32_t flags_,
|
||||
const uint32_t mask_,
|
||||
struct fuse_statx *st_,
|
||||
const bool symlinkify_,
|
||||
const time_t symlinkify_timeout_,
|
||||
FollowSymlinks followsymlinks_)
|
||||
{
|
||||
int rv;
|
||||
std::string fullpath;
|
||||
StrVec basepaths;
|
||||
|
||||
rv = searchFunc_(branches_,fusepath_,&basepaths);
|
||||
if(rv == -1)
|
||||
return -errno;
|
||||
|
||||
fullpath = fs::path::make(basepaths[0],fusepath_);
|
||||
|
||||
switch(followsymlinks_)
|
||||
{
|
||||
case FollowSymlinks::ENUM::NEVER:
|
||||
rv = fs::statx(AT_FDCWD,fullpath,flags_|AT_SYMLINK_NOFOLLOW,mask_,st_);
|
||||
break;
|
||||
case FollowSymlinks::ENUM::DIRECTORY:
|
||||
rv = fs::statx(AT_FDCWD,fullpath,flags_|AT_SYMLINK_NOFOLLOW,mask_,st_);
|
||||
if((rv >= 0) && S_ISLNK(st_->mode))
|
||||
::_set_stat_if_leads_to_dir(fullpath,st_);
|
||||
break;
|
||||
case FollowSymlinks::ENUM::REGULAR:
|
||||
rv = fs::statx(AT_FDCWD,fullpath,flags_|AT_SYMLINK_NOFOLLOW,mask_,st_);
|
||||
if((rv >= 0) && S_ISLNK(st_->mode))
|
||||
::_set_stat_if_leads_to_reg(fullpath,st_);
|
||||
break;
|
||||
case FollowSymlinks::ENUM::ALL:
|
||||
rv = fs::statx(AT_FDCWD,fullpath,flags_|AT_SYMLINK_FOLLOW,mask_,st_);
|
||||
if(rv < 0)
|
||||
rv = fs::statx(AT_FDCWD,fullpath,flags_|AT_SYMLINK_NOFOLLOW,mask_,st_);
|
||||
break;
|
||||
}
|
||||
|
||||
if(rv < 0)
|
||||
return rv;
|
||||
|
||||
if(symlinkify_ && symlinkify::can_be_symlink(*st_,symlinkify_timeout_))
|
||||
symlinkify::convert(fullpath,st_);
|
||||
|
||||
fs::inode::calc(basepaths[0],fusepath_,st_);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
_statx(const char *fusepath_,
|
||||
const uint32_t flags_,
|
||||
const uint32_t mask_,
|
||||
struct fuse_statx *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
{
|
||||
int rv;
|
||||
Config::Read cfg;
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
|
||||
rv = ::_statx(cfg->func.getattr.policy,
|
||||
cfg->branches,
|
||||
fusepath_,
|
||||
flags_,
|
||||
mask_,
|
||||
st_,
|
||||
cfg->symlinkify,
|
||||
cfg->symlinkify_timeout,
|
||||
cfg->follow_symlinks);
|
||||
|
||||
timeout_->entry = ((rv >= 0) ?
|
||||
cfg->cache_entry :
|
||||
cfg->cache_negative_entry);
|
||||
timeout_->attr = cfg->cache_attr;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
FUSE::statx(const char *fusepath_,
|
||||
const uint32_t flags_,
|
||||
const uint32_t mask_,
|
||||
struct fuse_statx *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
{
|
||||
if(fusepath_ == CONTROLFILE)
|
||||
return ::_statx_controlfile(st_);
|
||||
|
||||
return ::_statx(fusepath_,flags_|AT_STATX_DONT_SYNC,mask_,st_,timeout_);
|
||||
}
|
||||
|
||||
int
|
||||
FUSE::statx_fh(const uint64_t fh_,
|
||||
const uint32_t flags_,
|
||||
const uint32_t mask_,
|
||||
struct fuse_statx *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
{
|
||||
FileInfo *fi = reinterpret_cast<FileInfo*>(fh_);
|
||||
|
||||
return ::_statx(fi->fusepath.c_str(),flags_,mask_,st_,timeout_);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#include "fuse_statx.hpp"
|
||||
|
||||
int
|
||||
FUSE::statx(const char *fusepath_,
|
||||
const uint32_t flags_,
|
||||
const uint32_t mask_,
|
||||
struct fuse_statx *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
int
|
||||
FUSE::statx_fh(const uint64_t fh_,
|
||||
const uint32_t flags_,
|
||||
const uint32_t mask_,
|
||||
struct fuse_statx *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
+4
-4
@@ -269,8 +269,8 @@ namespace l
|
||||
if(uid == 0)
|
||||
return;
|
||||
|
||||
char const *s = "mergerfs is not running as root and may not work correctly\n";
|
||||
fprintf(stderr,"warning: %s",s);
|
||||
const char s[] = "mergerfs is not running as root and may not work correctly\n";
|
||||
fmt::print(stderr,"warning: {}",s);
|
||||
SysLog::warning(s);
|
||||
}
|
||||
|
||||
@@ -287,8 +287,6 @@ namespace l
|
||||
SysLog::open();
|
||||
SysLog::info("mergerfs v{} started",MERGERFS_VERSION);
|
||||
|
||||
l::warn_if_not_root();
|
||||
|
||||
memset(&ops,0,sizeof(fuse_operations));
|
||||
|
||||
args.argc = argc_;
|
||||
@@ -311,6 +309,8 @@ namespace l
|
||||
return 1;
|
||||
}
|
||||
|
||||
l::warn_if_not_root();
|
||||
|
||||
l::setup_resources(cfg->scheduling_priority);
|
||||
l::setup_signal_handlers();
|
||||
l::get_fuse_operations(ops,cfg->nullrw);
|
||||
|
||||
+8
-10
@@ -16,6 +16,8 @@
|
||||
|
||||
#include "ef.hpp"
|
||||
|
||||
#include "fmt/core.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -114,21 +116,17 @@ namespace num
|
||||
std::string
|
||||
humanize(const uint64_t bytes_)
|
||||
{
|
||||
char buf[64];
|
||||
|
||||
if(bytes_ < KB)
|
||||
sprintf(buf,"%" PRIu64 "",bytes_);
|
||||
return fmt::format("{}",bytes_);
|
||||
ef(((bytes_ / TB) * TB) == bytes_)
|
||||
sprintf(buf,"%" PRIu64 "T",bytes_ / TB);
|
||||
return fmt::format("{}T",bytes_ / TB);
|
||||
ef(((bytes_ / GB) * GB) == bytes_)
|
||||
sprintf(buf,"%" PRIu64 "G",bytes_ / GB);
|
||||
return fmt::format("{}G",bytes_ / GB);
|
||||
ef(((bytes_ / MB) * MB) == bytes_)
|
||||
sprintf(buf,"%" PRIu64 "M",bytes_ / MB);
|
||||
return fmt::format("{}M",bytes_ / MB);
|
||||
ef(((bytes_ / KB) * KB) == bytes_)
|
||||
sprintf(buf,"%" PRIu64 "K",bytes_ / KB);
|
||||
else
|
||||
sprintf(buf,"%" PRIu64 "",bytes_);
|
||||
return fmt::format("{}K",bytes_ / KB);
|
||||
|
||||
return std::string(buf);
|
||||
return fmt::format("{}",bytes_);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-13
@@ -18,8 +18,8 @@
|
||||
#include "policies.hpp"
|
||||
#include "policy.hpp"
|
||||
#include "policy_eprand.hpp"
|
||||
#include "rnd.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
int
|
||||
Policy::EPRand::Action::operator()(const Branches::CPtr &branches_,
|
||||
@@ -30,10 +30,7 @@ Policy::EPRand::Action::operator()(const Branches::CPtr &branches_,
|
||||
|
||||
rv = Policies::Action::epall(branches_,fusepath_,paths_);
|
||||
if(rv == 0)
|
||||
{
|
||||
std::random_shuffle(paths_->begin(),paths_->end());
|
||||
paths_->resize(1);
|
||||
}
|
||||
RND::shrink_to_rand_elem(*paths_);
|
||||
|
||||
return rv;
|
||||
}
|
||||
@@ -47,10 +44,7 @@ Policy::EPRand::Create::operator()(const Branches::CPtr &branches_,
|
||||
|
||||
rv = Policies::Create::epall(branches_,fusepath_,paths_);
|
||||
if(rv == 0)
|
||||
{
|
||||
std::random_shuffle(paths_->begin(),paths_->end());
|
||||
paths_->resize(1);
|
||||
}
|
||||
RND::shrink_to_rand_elem(*paths_);
|
||||
|
||||
return rv;
|
||||
}
|
||||
@@ -64,10 +58,7 @@ Policy::EPRand::Search::operator()(const Branches::CPtr &branches_,
|
||||
|
||||
rv = Policies::Search::epall(branches_,fusepath_,paths_);
|
||||
if(rv == 0)
|
||||
{
|
||||
std::random_shuffle(paths_->begin(),paths_->end());
|
||||
paths_->resize(1);
|
||||
}
|
||||
RND::shrink_to_rand_elem(*paths_);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
+4
-14
@@ -18,8 +18,7 @@
|
||||
#include "policy.hpp"
|
||||
#include "policy_rand.hpp"
|
||||
#include "policies.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include "rnd.hpp"
|
||||
|
||||
int
|
||||
Policy::Rand::Action::operator()(const Branches::CPtr &branches_,
|
||||
@@ -30,10 +29,7 @@ Policy::Rand::Action::operator()(const Branches::CPtr &branches_,
|
||||
|
||||
rv = Policies::Action::all(branches_,fusepath_,paths_);
|
||||
if(rv == 0)
|
||||
{
|
||||
std::random_shuffle(paths_->begin(),paths_->end());
|
||||
paths_->resize(1);
|
||||
}
|
||||
RND::shrink_to_rand_elem(*paths_);
|
||||
|
||||
return rv;
|
||||
}
|
||||
@@ -47,10 +43,7 @@ Policy::Rand::Create::operator()(const Branches::CPtr &branches_,
|
||||
|
||||
rv = Policies::Create::all(branches_,fusepath_,paths_);
|
||||
if(rv == 0)
|
||||
{
|
||||
std::random_shuffle(paths_->begin(),paths_->end());
|
||||
paths_->resize(1);
|
||||
}
|
||||
RND::shrink_to_rand_elem(*paths_);
|
||||
|
||||
return rv;
|
||||
}
|
||||
@@ -64,10 +57,7 @@ Policy::Rand::Search::operator()(const Branches::CPtr &branches_,
|
||||
|
||||
rv = Policies::Search::all(branches_,fusepath_,paths_);
|
||||
if(rv == 0)
|
||||
{
|
||||
std::random_shuffle(paths_->begin(),paths_->end());
|
||||
paths_->resize(1);
|
||||
}
|
||||
RND::shrink_to_rand_elem(*paths_);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
+12
-6
@@ -10,10 +10,14 @@
|
||||
#include "fs_openat.hpp"
|
||||
#include "fs_read.hpp"
|
||||
|
||||
#include "fmt/core.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
static int g_PROCFS_DIR_FD = -1;
|
||||
const char PROCFS_PATH[] = "/proc";
|
||||
constexpr const char PROCFS_PATH[] = "/proc";
|
||||
|
||||
int
|
||||
procfs::init()
|
||||
@@ -33,15 +37,17 @@ procfs::get_name(const int tid_)
|
||||
{
|
||||
int fd;
|
||||
int rv;
|
||||
char commpath[256];
|
||||
std::array<char,256> commpath;
|
||||
fmt::format_to_n_result<char*> frv;
|
||||
|
||||
snprintf(commpath,sizeof(commpath),"%d/comm",tid_);
|
||||
frv = fmt::format_to_n(commpath.data(),commpath.size()-1,"{}/comm",tid_);
|
||||
frv.out[0] = '\0';
|
||||
|
||||
fd = fs::openat(g_PROCFS_DIR_FD,commpath,O_RDONLY);
|
||||
fd = fs::openat(g_PROCFS_DIR_FD,commpath.data(),O_RDONLY);
|
||||
if(fd < 0)
|
||||
return {};
|
||||
|
||||
rv = fs::read(fd,commpath,sizeof(commpath));
|
||||
rv = fs::read(fd,commpath.data(),commpath.size());
|
||||
if(rv == -1)
|
||||
return {};
|
||||
|
||||
@@ -50,5 +56,5 @@ procfs::get_name(const int tid_)
|
||||
|
||||
fs::close(fd);
|
||||
|
||||
return commpath;
|
||||
return commpath.data();
|
||||
}
|
||||
|
||||
+18
-1
@@ -19,7 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <random>
|
||||
|
||||
class RND
|
||||
{
|
||||
@@ -31,4 +31,21 @@ public:
|
||||
static uint64_t rand64(const uint64_t max_);
|
||||
static uint64_t rand64(const uint64_t min_,
|
||||
const uint64_t max_);
|
||||
|
||||
template<typename T>
|
||||
static
|
||||
void
|
||||
shrink_to_rand_elem(std::vector<T> &v_)
|
||||
{
|
||||
static std::mt19937 gen(std::random_device{}());
|
||||
|
||||
if(v_.size() <= 1)
|
||||
return;
|
||||
|
||||
std::uniform_int_distribution<> dist(0,(v_.size() - 1));
|
||||
|
||||
std::swap(v_[0],v_[dist(gen)]);
|
||||
|
||||
v_.resize(1);
|
||||
}
|
||||
};
|
||||
|
||||
+4
-10
@@ -18,6 +18,8 @@
|
||||
|
||||
#include "to_string.hpp"
|
||||
|
||||
#include "fmt/core.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
@@ -35,21 +37,13 @@ namespace str
|
||||
std::string
|
||||
to(const int int_)
|
||||
{
|
||||
char buf[24];
|
||||
|
||||
sprintf(buf,"%d",int_);
|
||||
|
||||
return buf;
|
||||
return fmt::format("{}",int_);
|
||||
}
|
||||
|
||||
std::string
|
||||
to(const uint64_t uint64_)
|
||||
{
|
||||
char buf[64];
|
||||
|
||||
sprintf(buf,"%llu",(unsigned long long)uint64_);
|
||||
|
||||
return buf;
|
||||
return fmt::format("{}",uint64_);
|
||||
}
|
||||
|
||||
std::string
|
||||
|
||||
@@ -41,11 +41,11 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
ToFromWrapper<T>()
|
||||
ToFromWrapper()
|
||||
{
|
||||
}
|
||||
|
||||
ToFromWrapper<T>(const T data_)
|
||||
ToFromWrapper(const T data_)
|
||||
: _data(data_)
|
||||
{
|
||||
}
|
||||
@@ -112,11 +112,11 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
ROToFromWrapper<T>()
|
||||
ROToFromWrapper()
|
||||
{
|
||||
}
|
||||
|
||||
ROToFromWrapper<T>(const T data_)
|
||||
ROToFromWrapper(const T data_)
|
||||
: _data(data_)
|
||||
{
|
||||
}
|
||||
|
||||
+2
-2
@@ -28,9 +28,9 @@ namespace ugid
|
||||
}
|
||||
|
||||
#if defined __linux__ and UGID_USE_RWLOCK == 0
|
||||
#warning "using ugid_linux.hpp"
|
||||
#pragma message "using ugid_linux.hpp"
|
||||
#include "ugid_linux.hpp"
|
||||
#else
|
||||
#warning "using ugid_rwlock.hpp"
|
||||
#pragma message "using ugid_rwlock.hpp"
|
||||
#include "ugid_rwlock.hpp"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user