Renamed some examples to make their function more obvious

Also, added more comments for the same purpose.
This commit is contained in:
Nikolaus Rath
2016-10-09 19:22:57 -07:00
parent 225c12aebf
commit 463189cd12
8 changed files with 47 additions and 86 deletions
+2 -2
View File
@@ -69,8 +69,8 @@ AC_SEARCH_LIBS(clock_gettime, [rt])
libfuse_libs=$LIBS
LIBS=
AC_CHECK_LIB(ulockmgr, ulockmgr_op)
fusexmp_fh_libs=$LIBS
AC_SUBST(fusexmp_fh_libs)
passthrough_fh_libs=$LIBS
AC_SUBST(passthrough_fh_libs)
LIBS=
AC_ARG_WITH([libiconv-prefix],
+3 -3
View File
@@ -1,5 +1,5 @@
/fusexmp
/fusexmp_fh
/passthrough
/passthrough_fh
/hello
/hello_ll
/fioc
@@ -7,6 +7,6 @@
/fsel
/fselclient
/cusexmp
/fuse_lo-plus
/passthrough_ll
/timefs1
/timefs2
+3 -3
View File
@@ -2,12 +2,12 @@
AM_CPPFLAGS = -I$(top_srcdir)/include -D_REENTRANT
noinst_HEADERS = fioc.h
noinst_PROGRAMS = fusexmp fusexmp_fh hello hello_ll fioc fioclient \
fsel fselclient cusexmp fuse_lo-plus timefs1 timefs2 \
noinst_PROGRAMS = passthrough passthrough_fh hello hello_ll fioc fioclient \
fsel fselclient cusexmp passthrough_ll timefs1 timefs2 \
timefs3
LDADD = ../lib/libfuse3.la
fusexmp_fh_LDADD = ../lib/libfuse3.la @fusexmp_fh_libs@
passthrough_fh_LDADD = ../lib/libfuse3.la @passthrough_fh_libs@
fioclient_CPPFLAGS =
fioclient_LDFLAGS =
+6 -3
View File
@@ -10,14 +10,17 @@
/** @file
* @tableofcontents
*
* fusexmp.c - FUSE: Filesystem in Userspace
* This file system mirrors the existing file system hierarchy of the
* system, starting at the root file system. This is implemented by
* just "passing through" all requests to the corresponding user-space
* libc functions. It's performance is terrible.
*
* \section section_compile compiling this example
*
* gcc -Wall fusexmp.c `pkg-config fuse3 --cflags --libs` -o fusexmp
* gcc -Wall passthrough.c `pkg-config fuse3 --cflags --libs` -o passthrough
*
* \section section_source the complete source
* \include fusexmp.c
* \include passthrough.c
*/
@@ -10,14 +10,18 @@
/** @file
* @tableofcontents
*
* fusexmp_fh.c - FUSE: Filesystem in Userspace
* This file system mirrors the existing file system hierarchy of the
* system, starting at the root file system. This is implemented by
* just "passing through" all requests to the corresponding user-space
* libc functions. This implementation is a little more sophisticated
* than the one in passthrough.c, so performance is not quite as bad.
*
* \section section_compile compiling this example
*
* gcc -Wall fusexmp_fh.c `pkg-config fuse3 --cflags --libs` -lulockmgr -o fusexmp_fh
* gcc -Wall passthrough_fh.c `pkg-config fuse3 --cflags --libs` -lulockmgr -o passthrough_fh
*
* \section section_source the complete source
* \include fusexmp_fh.c
* \include passthrough_fh.c
*/
#define FUSE_USE_VERSION 30
@@ -6,8 +6,22 @@
See the file COPYING.
*/
/*
* gcc -Wall fuse_lo-plus.c `pkg-config fuse3 --cflags --libs` -o fuse_lo-plus
/** @file
* @tableofcontents
*
* This file system mirrors the existing file system hierarchy of the
* system, starting at the root file system. This is implemented by
* just "passing through" all requests to the corresponding user-space
* libc functions. In contrast to passthrough.c and passthrough_fh.c,
* this implementation ises the low-level API. Its performance should
* be the least bad among the three.
*
* \section section_compile compiling this example
*
* gcc -Wall passthrough_ll.c `pkg-config fuse3 --cflags --libs` -o passthrough_ll
*
* \section section_source the complete source
* \include passthrough_ll.c
*/
#define _GNU_SOURCE
+10 -37
View File
@@ -60,53 +60,26 @@ def test_hello(tmpdir, name, options):
else:
umount(mount_process, mnt_dir)
@pytest.mark.parametrize("name", ('passthrough', 'passthrough_fh',
'passthrough_ll'))
@pytest.mark.parametrize("options", LL_OPTIONS)
def test_fuse_lo_plus(tmpdir, options):
mnt_dir = str(tmpdir.mkdir('mnt'))
src_dir = str(tmpdir.mkdir('src'))
cmdline = base_cmdline + \
[ pjoin(basename, 'example', 'fuse_lo-plus'),
'-f', '-s', mnt_dir ] + options
mount_process = subprocess.Popen(cmdline)
try:
wait_for_mount(mount_process, mnt_dir)
work_dir = pjoin(mnt_dir, src_dir)
tst_write(work_dir)
tst_mkdir(work_dir)
tst_symlink(work_dir)
tst_mknod(work_dir)
if os.getuid() == 0:
tst_chown(work_dir)
# Underlying fs may not have full nanosecond resolution
tst_utimens(work_dir, ns_tol=1000)
tst_link(work_dir)
tst_readdir(work_dir)
tst_statvfs(work_dir)
tst_truncate_path(work_dir)
tst_truncate_fd(work_dir)
tst_unlink(work_dir)
tst_passthrough(src_dir, work_dir)
except:
cleanup(mnt_dir)
raise
else:
umount(mount_process, mnt_dir)
@pytest.mark.parametrize("name", ('fusexmp', 'fusexmp_fh'))
@pytest.mark.parametrize("options", LL_OPTIONS)
def test_fusexmp_fh(tmpdir, name, options):
def test_passthrough(tmpdir, name, options):
mnt_dir = str(tmpdir.mkdir('mnt'))
src_dir = str(tmpdir.mkdir('src'))
cmdline = base_cmdline + \
[ pjoin(basename, 'example', name),
'-f', '-o', 'use_ino,readdir_ino,kernel_cache',
mnt_dir ] + options
'-f', mnt_dir ] + options
if not name.endswith('_ll'):
cmdline += [ '-o', 'use_ino,readdir_ino,kernel_cache' ]
mount_process = subprocess.Popen(cmdline)
try:
wait_for_mount(mount_process, mnt_dir)
work_dir = pjoin(mnt_dir, src_dir)
subprocess.check_call([ os.path.join(basename, 'test', 'test'),
work_dir, ':' + src_dir ])
tst_write(work_dir)
tst_mkdir(work_dir)
tst_symlink(work_dir)
-33
View File
@@ -1,33 +0,0 @@
#!/usr/bin/env python3
import pytest
import sys
if __name__ == '__main__':
sys.exit(pytest.main([__file__] + sys.argv[1:]))
import subprocess
import os
from util import wait_for_mount, umount, cleanup, base_cmdline
basename = os.path.join(os.path.dirname(__file__), '..')
def test_fuse(tmpdir):
mnt_dir = str(tmpdir.mkdir('mnt'))
src_dir = str(tmpdir.mkdir('src'))
cmdline = base_cmdline + \
[ os.path.join(basename, 'example', 'fusexmp_fh'),
'-f', '-o' , 'use_ino,readdir_ino,kernel_cache',
mnt_dir ]
mount_process = subprocess.Popen(cmdline)
try:
wait_for_mount(mount_process, mnt_dir)
cmdline = [ os.path.join(basename, 'test', 'test'),
os.path.join(mnt_dir, src_dir),
':' + src_dir ]
subprocess.check_call(cmdline)
except:
cleanup(mnt_dir)
raise
else:
umount(mount_process, mnt_dir)