Make fuse3 support optional and document.

The experimental fuse3 support is not complete yet, and fuse3 is new and
still difficult to install on some platforms.

Make it optional at compile time, and default to off.

Signed-off-by: Justin Husted <sigstop@gmail.com>
This commit is contained in:
Justin Husted 2019-11-11 12:00:08 -08:00
parent 1f7098c222
commit a00998c4cd
6 changed files with 50 additions and 1 deletions

30
INSTALL
View File

@ -1,3 +1,4 @@
-- Getting started --
Dependencies: Dependencies:
@ -20,3 +21,32 @@ On debian, you can install these with
uuid-dev zlib1g-dev valgrind uuid-dev zlib1g-dev valgrind
Then, just make && make install 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

View File

@ -38,7 +38,11 @@ ifdef D
CFLAGS+=-DCONFIG_BCACHEFS_DEBUG=y CFLAGS+=-DCONFIG_BCACHEFS_DEBUG=y
endif 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)) PKGCONFIG_CFLAGS:=$(shell $(PKG_CONFIG) --cflags $(PKGCONFIG_LIBS))
ifeq (,$(PKGCONFIG_CFLAGS)) ifeq (,$(PKGCONFIG_CFLAGS))

View File

@ -203,8 +203,10 @@ int main(int argc, char *argv[])
if (!strcmp(cmd, "setattr")) if (!strcmp(cmd, "setattr"))
return cmd_setattr(argc, argv); return cmd_setattr(argc, argv);
#ifdef BCACHEFS_FUSE
if (!strcmp(cmd, "fusemount")) if (!strcmp(cmd, "fusemount"))
return cmd_fusemount(argc, argv); return cmd_fusemount(argc, argv);
#endif
if (!strcmp(cmd, "--help")) { if (!strcmp(cmd, "--help")) {
usage(); usage();

View File

@ -1,3 +1,5 @@
#ifdef BCACHEFS_FUSE
#include <errno.h> #include <errno.h>
#include <float.h> #include <float.h>
#include <getopt.h> #include <getopt.h>
@ -1262,3 +1264,5 @@ out:
return ret ? 1 : 0; return ret ? 1 : 0;
} }
#endif /* BCACHEFS_FUSE */

View File

@ -2,9 +2,13 @@
# #
# Tests of the fuse mount functionality. # Tests of the fuse mount functionality.
import pytest
import os import os
import util import util
pytestmark = pytest.mark.skipif(
not util.have_fuse(), reason="bcachefs not built with fuse support.")
def test_mount(bfuse): def test_mount(bfuse):
bfuse.mount() bfuse.mount()
bfuse.unmount() bfuse.unmount()

View File

@ -4,6 +4,7 @@ import os
import pytest import pytest
import re import re
import subprocess import subprocess
import sys
import tempfile import tempfile
import threading import threading
import time import time
@ -208,3 +209,7 @@ class BFuse(threading.Thread):
assert self.returncode == 0 assert self.returncode == 0
assert len(self.stdout) > 0 assert len(self.stdout) > 0
assert len(self.stderr) == 0 assert len(self.stderr) == 0
def have_fuse():
res = run(BCH_PATH, 'fusemount', valgrind=False)
return "Please supply a mountpoint." in res.stdout