mirror of
https://github.com/libfuse/libfuse.git
synced 2024-11-23 04:04:31 +08:00
Added new example filesystem
passthrough_hp puts emphasis and performance and correctness, rather than simplicity.
This commit is contained in:
parent
625ed81b82
commit
055f272517
@ -1,5 +1,27 @@
|
||||
((python-mode . ((indent-tabs-mode . nil)))
|
||||
(autoconf-mode . ((indent-tabs-mode . t)))
|
||||
(c++-mode . ((c-file-style . "k&r")
|
||||
(indent-tabs-mode . nil)
|
||||
(c-basic-offset . 4)
|
||||
(c-file-offsets .
|
||||
((block-close . 0)
|
||||
(brace-list-close . 0)
|
||||
(brace-list-entry . 0)
|
||||
(brace-list-intro . +)
|
||||
(case-label . 0)
|
||||
(class-close . 0)
|
||||
(defun-block-intro . +)
|
||||
(defun-close . 0)
|
||||
(defun-open . 0)
|
||||
(else-clause . 0)
|
||||
(inclass . +)
|
||||
(label . 0)
|
||||
(statement . 0)
|
||||
(statement-block-intro . +)
|
||||
(statement-case-intro . +)
|
||||
(statement-cont . +)
|
||||
(substatement . +)
|
||||
(topmost-intro . 0)))))
|
||||
(c-mode . ((c-file-style . "stroustrup")
|
||||
(indent-tabs-mode . t)
|
||||
(tab-width . 8)
|
||||
|
@ -3,6 +3,7 @@ dist: xenial
|
||||
|
||||
language:
|
||||
- c
|
||||
- c++
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
@ -11,6 +12,7 @@ addons:
|
||||
- doxygen
|
||||
- valgrind
|
||||
- clang
|
||||
- libstdc++-7-dev
|
||||
- gcc
|
||||
- gcc-7
|
||||
- python3-pip
|
||||
|
@ -1,3 +1,10 @@
|
||||
Unreleased Changes
|
||||
==================
|
||||
|
||||
* Added a new example (passthrough_hp). The functionality is similar
|
||||
to passthrough_ll, but the implementation focuses on performance and
|
||||
correctness rather than simplicity.
|
||||
|
||||
libfuse 3.5.0 (2019-04-16)
|
||||
==========================
|
||||
|
||||
|
2077
example/cxxopts.hpp
Normal file
2077
example/cxxopts.hpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -31,4 +31,10 @@ foreach ex : threaded_examples
|
||||
install: false)
|
||||
endforeach
|
||||
|
||||
if not platform.endswith('bsd') and platform != 'dragonfly'
|
||||
executable('passthrough_hp', 'passthrough_hp.cc',
|
||||
dependencies: [ thread_dep, libfuse_dep ],
|
||||
install: false)
|
||||
endif
|
||||
|
||||
# TODO: Link passthrough_fh with ulockmgr if available
|
||||
|
1280
example/passthrough_hp.cc
Normal file
1280
example/passthrough_hp.cc
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
project('libfuse3', 'c', version: '3.5.0',
|
||||
project('libfuse3', ['cpp', 'c'], version: '3.5.0',
|
||||
meson_version: '>= 0.42',
|
||||
default_options: [ 'buildtype=debugoptimized' ])
|
||||
|
||||
@ -66,6 +66,10 @@ configure_file(output: 'config.h',
|
||||
add_project_arguments('-D_REENTRANT', '-DHAVE_CONFIG_H', '-Wall', '-Wextra', '-Wno-sign-compare',
|
||||
'-Wstrict-prototypes', '-Wmissing-declarations', '-Wwrite-strings',
|
||||
'-fno-strict-aliasing', language: 'c')
|
||||
add_project_arguments('-D_REENTRANT', '-DHAVE_CONFIG_H', '-D_GNU_SOURCE',
|
||||
'-Wall', '-Wextra', '-Wno-sign-compare', '-std=c++11',
|
||||
'-Wmissing-declarations', '-Wwrite-strings',
|
||||
'-fno-strict-aliasing', language: 'cpp')
|
||||
|
||||
# Some (stupid) GCC versions warn about unused return values even when they are
|
||||
# casted to void. This makes -Wunused-result pretty useless, since there is no
|
||||
|
@ -153,6 +153,60 @@ def test_passthrough(tmpdir, name, debug, capfd, writeback):
|
||||
else:
|
||||
umount(mount_process, mnt_dir)
|
||||
|
||||
@pytest.mark.parametrize("cache", (False, True))
|
||||
def test_passthrough_hp(tmpdir, cache):
|
||||
mnt_dir = str(tmpdir.mkdir('mnt'))
|
||||
src_dir = str(tmpdir.mkdir('src'))
|
||||
|
||||
cmdline = base_cmdline + \
|
||||
[ pjoin(basename, 'example', 'passthrough_hp'),
|
||||
src_dir, mnt_dir ]
|
||||
|
||||
if not cache:
|
||||
cmdline.append('--nocache')
|
||||
|
||||
mount_process = subprocess.Popen(cmdline)
|
||||
try:
|
||||
wait_for_mount(mount_process, mnt_dir)
|
||||
|
||||
tst_statvfs(mnt_dir)
|
||||
tst_readdir(src_dir, mnt_dir)
|
||||
tst_readdir_big(src_dir, mnt_dir)
|
||||
tst_open_read(src_dir, mnt_dir)
|
||||
tst_open_write(src_dir, mnt_dir)
|
||||
tst_create(mnt_dir)
|
||||
tst_passthrough(src_dir, mnt_dir)
|
||||
tst_append(src_dir, mnt_dir)
|
||||
tst_seek(src_dir, mnt_dir)
|
||||
tst_mkdir(mnt_dir)
|
||||
tst_rmdir(src_dir, mnt_dir)
|
||||
tst_unlink(src_dir, mnt_dir)
|
||||
tst_symlink(mnt_dir)
|
||||
if os.getuid() == 0:
|
||||
tst_chown(mnt_dir)
|
||||
|
||||
# Underlying fs may not have full nanosecond resolution
|
||||
tst_utimens(mnt_dir, ns_tol=1000)
|
||||
|
||||
tst_link(mnt_dir)
|
||||
tst_truncate_path(mnt_dir)
|
||||
tst_truncate_fd(mnt_dir)
|
||||
tst_open_unlink(mnt_dir)
|
||||
|
||||
# test_syscalls assumes that changes in source directory
|
||||
# will be reflected immediately in mountpoint, so we
|
||||
# can't use it.
|
||||
if not cache:
|
||||
syscall_test_cmd = [ os.path.join(basename, 'test', 'test_syscalls'),
|
||||
mnt_dir, ':' + src_dir ]
|
||||
subprocess.check_call(syscall_test_cmd)
|
||||
except:
|
||||
cleanup(mount_process, mnt_dir)
|
||||
raise
|
||||
else:
|
||||
umount(mount_process, mnt_dir)
|
||||
|
||||
|
||||
@pytest.mark.skipif(fuse_proto < (7,11),
|
||||
reason='not supported by running kernel')
|
||||
def test_ioctl(tmpdir):
|
||||
|
@ -67,6 +67,11 @@ static void test_error(const char *func, const char *msg, ...)
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
static int is_dot_or_dotdot(const char *name) {
|
||||
return name[0] == '.' &&
|
||||
(name[1] == '\0' || (name[1] == '.' && name[2] == '\0'));
|
||||
}
|
||||
|
||||
static void success(void)
|
||||
{
|
||||
fprintf(stderr, "%s OK\n", testname);
|
||||
@ -381,10 +386,6 @@ static int check_dir_contents(const char *path, const char **contents)
|
||||
found[i] = 0;
|
||||
cont[i] = contents[i];
|
||||
}
|
||||
found[i] = 0;
|
||||
cont[i++] = ".";
|
||||
found[i] = 0;
|
||||
cont[i++] = "..";
|
||||
cont[i] = NULL;
|
||||
|
||||
dp = opendir(path);
|
||||
@ -405,6 +406,8 @@ static int check_dir_contents(const char *path, const char **contents)
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (is_dot_or_dotdot(de->d_name))
|
||||
continue;
|
||||
for (i = 0; cont[i] != NULL; i++) {
|
||||
assert(i < MAX_ENTRIES);
|
||||
if (strcmp(cont[i], de->d_name) == 0) {
|
||||
|
@ -27,12 +27,15 @@ cd "${TEST_DIR}"
|
||||
# Standard build
|
||||
for CC in gcc gcc-7 clang; do
|
||||
mkdir build-${CC}; cd build-${CC}
|
||||
if [ "${CC}" == "clang" ]; then
|
||||
export CXX="clang++"
|
||||
fi
|
||||
if [ ${CC} == 'gcc-7' ]; then
|
||||
build_opts='-D b_lundef=false'
|
||||
else
|
||||
build_opts=''
|
||||
fi
|
||||
meson -D werror=true ${build_opts} "${SOURCE_DIR}"
|
||||
meson -D werror=true ${build_opts} "${SOURCE_DIR}" || (cat meson-logs/meson-log.txt; false)
|
||||
ninja
|
||||
|
||||
sudo chown root:root util/fusermount3
|
||||
@ -44,11 +47,13 @@ done
|
||||
|
||||
# Sanitized build
|
||||
CC=clang
|
||||
CXX=clang++
|
||||
for san in undefined address; do
|
||||
mkdir build-${san}; cd build-${san}
|
||||
# b_lundef=false is required to work around clang
|
||||
# bug, cf. https://groups.google.com/forum/#!topic/mesonbuild/tgEdAXIIdC4
|
||||
meson -D b_sanitize=${san} -D b_lundef=false -D werror=true "${SOURCE_DIR}"
|
||||
meson -D b_sanitize=${san} -D b_lundef=false -D werror=true "${SOURCE_DIR}" \
|
||||
|| (cat meson-logs/meson-log.txt; false)
|
||||
ninja
|
||||
|
||||
# Test as root and regular user
|
||||
|
Loading…
Reference in New Issue
Block a user