diff --git a/INSTALL b/INSTALL index 46833a39..e344c53c 100644 --- a/INSTALL +++ b/INSTALL @@ -1,3 +1,4 @@ +-- Getting started -- Dependencies: @@ -20,3 +21,32 @@ On debian, you can install these with uuid-dev zlib1g-dev valgrind Then, just make && make install + + +-- Experimental features -- + +Experimental fuse support is currently disabled by default. Fuse support is at +an early stage and may corrupt your filesystem, so it should only be used for +testing. To enable, you'll also need to add: + +* libfuse3 + +On debian: + apt install -y libfuse3-dev + +Then, make using the BCACHEFS_FUSE environment variable: + +BCACHEFS_FUSE=1 make && + + +-- Tests -- + +Some tests are available to validate the "bcachefs" binary. The tests depend +on python3 pytest. + +On debian: + apt install -u python3-pytest + +Then, you can run the tests via: + + make check diff --git a/Makefile b/Makefile index eb2798ff..adea7611 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,11 @@ ifdef D CFLAGS+=-DCONFIG_BCACHEFS_DEBUG=y endif -PKGCONFIG_LIBS="blkid uuid liburcu libsodium zlib liblz4 libzstd fuse3" +PKGCONFIG_LIBS="blkid uuid liburcu libsodium zlib liblz4 libzstd" +ifdef BCACHEFS_FUSE + PKGCONFIG_LIBS+="fuse3" + CFLAGS+=-DBCACHEFS_FUSE +endif PKGCONFIG_CFLAGS:=$(shell $(PKG_CONFIG) --cflags $(PKGCONFIG_LIBS)) ifeq (,$(PKGCONFIG_CFLAGS)) diff --git a/bcachefs.c b/bcachefs.c index 8840d516..03ebfd20 100644 --- a/bcachefs.c +++ b/bcachefs.c @@ -203,8 +203,10 @@ int main(int argc, char *argv[]) if (!strcmp(cmd, "setattr")) return cmd_setattr(argc, argv); +#ifdef BCACHEFS_FUSE if (!strcmp(cmd, "fusemount")) return cmd_fusemount(argc, argv); +#endif if (!strcmp(cmd, "--help")) { usage(); diff --git a/cmd_fusemount.c b/cmd_fusemount.c index 96a2339d..4e4c24cc 100644 --- a/cmd_fusemount.c +++ b/cmd_fusemount.c @@ -1,3 +1,5 @@ +#ifdef BCACHEFS_FUSE + #include #include #include @@ -1262,3 +1264,5 @@ out: return ret ? 1 : 0; } + +#endif /* BCACHEFS_FUSE */ diff --git a/tests/test_fuse.py b/tests/test_fuse.py index 877fd64c..da0a7a42 100644 --- a/tests/test_fuse.py +++ b/tests/test_fuse.py @@ -2,9 +2,13 @@ # # Tests of the fuse mount functionality. +import pytest import os import util +pytestmark = pytest.mark.skipif( + not util.have_fuse(), reason="bcachefs not built with fuse support.") + def test_mount(bfuse): bfuse.mount() bfuse.unmount() diff --git a/tests/util.py b/tests/util.py index 18d60020..b6e05e3a 100644 --- a/tests/util.py +++ b/tests/util.py @@ -4,6 +4,7 @@ import os import pytest import re import subprocess +import sys import tempfile import threading import time @@ -208,3 +209,7 @@ class BFuse(threading.Thread): assert self.returncode == 0 assert len(self.stdout) > 0 assert len(self.stderr) == 0 + +def have_fuse(): + res = run(BCH_PATH, 'fusemount', valgrind=False) + return "Please supply a mountpoint." in res.stdout