mirror of https://github.com/trapexit/mergerfs.git
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
90 changed files with 1208 additions and 3658 deletions
-
48Makefile
-
49buildtools/build-mergerfs
-
101buildtools/build-release
-
9buildtools/containerfiles/debian.10.amd64
-
9buildtools/containerfiles/debian.10.arm64
-
9buildtools/containerfiles/debian.10.armhf
-
9buildtools/containerfiles/debian.10.i386
-
9buildtools/containerfiles/debian.11.amd64
-
9buildtools/containerfiles/debian.11.arm64
-
9buildtools/containerfiles/debian.11.armhf
-
9buildtools/containerfiles/debian.11.i386
-
9buildtools/containerfiles/debian.12.amd64
-
9buildtools/containerfiles/debian.12.arm64
-
9buildtools/containerfiles/debian.12.armhf
-
9buildtools/containerfiles/debian.12.i386
-
9buildtools/containerfiles/debian.9.amd64
-
9buildtools/containerfiles/debian.9.arm64
-
9buildtools/containerfiles/debian.9.armhf
-
9buildtools/containerfiles/debian.9.i386
-
9buildtools/containerfiles/fedora.37.amd64
-
9buildtools/containerfiles/fedora.37.arm64
-
9buildtools/containerfiles/fedora.37.armhf
-
9buildtools/containerfiles/fedora.37.i386
-
9buildtools/containerfiles/fedora.38.amd64
-
9buildtools/containerfiles/fedora.38.arm64
-
9buildtools/containerfiles/fedora.38.armhf
-
9buildtools/containerfiles/fedora.38.i386
-
9buildtools/containerfiles/fedora.39.amd64
-
9buildtools/containerfiles/fedora.40.amd64
-
9buildtools/containerfiles/fedora.41.amd64
-
9buildtools/containerfiles/fedora.42.amd64
-
9buildtools/containerfiles/rockylinux.8.amd64
-
9buildtools/containerfiles/rockylinux.8.arm64
-
9buildtools/containerfiles/rockylinux.8.armhf
-
9buildtools/containerfiles/rockylinux.8.i386
-
9buildtools/containerfiles/rockylinux.9.amd64
-
9buildtools/containerfiles/rockylinux.9.arm64
-
9buildtools/containerfiles/rockylinux.9.armhf
-
9buildtools/containerfiles/rockylinux.9.i386
-
13buildtools/containerfiles/static.amd64
-
13buildtools/containerfiles/static.arm64
-
13buildtools/containerfiles/static.armhf
-
13buildtools/containerfiles/static.i386
-
10buildtools/containerfiles/static.installer
-
13buildtools/containerfiles/tarball
-
9buildtools/containerfiles/ubuntu.18.04.amd64
-
9buildtools/containerfiles/ubuntu.18.04.arm64
-
9buildtools/containerfiles/ubuntu.18.04.armhf
-
9buildtools/containerfiles/ubuntu.18.04.i386
-
9buildtools/containerfiles/ubuntu.20.04.amd64
-
9buildtools/containerfiles/ubuntu.20.04.arm64
-
9buildtools/containerfiles/ubuntu.20.04.armhf
-
9buildtools/containerfiles/ubuntu.20.04.i386
-
9buildtools/containerfiles/ubuntu.22.04.amd64
-
9buildtools/containerfiles/ubuntu.22.04.arm64
-
9buildtools/containerfiles/ubuntu.22.04.armhf
-
9buildtools/containerfiles/ubuntu.22.04.i386
-
9buildtools/containerfiles/ubuntu.24.04.amd64
-
9buildtools/containerfiles/ubuntu.24.04.arm64
-
9buildtools/containerfiles/ubuntu.24.04.armhf
-
9buildtools/containerfiles/ubuntu.24.04.i386
-
2buildtools/git2debcl
-
31buildtools/install-build-pkgs
-
9libfuse/Makefile
-
122libfuse/lib/fuse.cpp
-
6libfuse/lib/helper.c
-
3libfuse/util/fusermount.c
-
3384man/mergerfs.1
-
4src/enum.hpp
-
4src/fs_attr.cpp
-
4src/fs_copy_file_range.cpp
-
4src/fs_fadvise.cpp
-
4src/fs_ficlone.cpp
-
6src/fs_futimens.hpp
-
4src/fs_futimesat.cpp
-
4src/fs_sendfile.cpp
-
6src/fs_statx.hpp
-
6src/fs_utimensat.hpp
-
191src/fuse_statx.cpp
-
186src/fuse_statx_supported.icpp
-
21src/fuse_statx_unsupported.icpp
-
8src/mergerfs.cpp
-
18src/num.cpp
-
17src/policy_eprand.cpp
-
18src/policy_rand.cpp
-
18src/procfs_get_name.cpp
-
19src/rnd.hpp
-
14src/to_string.cpp
-
8src/tofrom_wrapper.hpp
-
4src/ugid.hpp
@ -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 |
@ -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/ / |
3384
man/mergerfs.1
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -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 "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; |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue