aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.rst11
-rw-r--r--example/.gitignore5
-rw-r--r--example/Makefile.am4
-rw-r--r--example/notify_inval_entry.c (renamed from example/timefs3.c)8
-rw-r--r--example/notify_inval_inode.c (renamed from example/timefs1.c)48
-rw-r--r--example/notify_store_retrieve.c (renamed from example/timefs2.c)16
-rwxr-xr-xtest/test_examples.py10
7 files changed, 52 insertions, 50 deletions
diff --git a/ChangeLog.rst b/ChangeLog.rst
index e029cd6..da1b1a8 100644
--- a/ChangeLog.rst
+++ b/ChangeLog.rst
@@ -5,13 +5,12 @@ Unreleased Changes
for unknown reasons -- maybe because it tries to treat the
mountpoint as a file rather than a directory?
-* There is a new ``timefs3`` example that demonstrates the use of
- `fuse_lowlevel_notify_inval_entry`.
+* There are several new examples that demonstrate the use of
+ the ``fuse_lowlevel_notify_*`` functions:
-* There are new ``timefs1`` and ``timefs2`` examples that demonstrate
- the use of the `fuse_lowlevel_notify_store`,
- `fuse_lowlevel_notify_retrieve`, and
- `fuse_lowlevel_notify_inval_inode` functions.
+ - ``example/notify_store_retrieve.c``
+ - ``example/notify_inval_inode.c``
+ - ``example/notify_inval_entry.c``
* The ``-o big_writes`` mount option has been removed. It is now
always active. File systems that want to limit the size of write
diff --git a/example/.gitignore b/example/.gitignore
index fb1794a..f7cd045 100644
--- a/example/.gitignore
+++ b/example/.gitignore
@@ -8,5 +8,6 @@
/poll_client
/cusexmp
/passthrough_ll
-/timefs1
-/timefs2
+/notify_inval_inode
+/notify_store_retrieve
+/notify_inval_entry
diff --git a/example/Makefile.am b/example/Makefile.am
index 9d780a7..6d93edc 100644
--- a/example/Makefile.am
+++ b/example/Makefile.am
@@ -4,8 +4,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -D_REENTRANT
noinst_HEADERS = ioctl.h
noinst_PROGRAMS = passthrough passthrough_fh hello hello_ll \
ioctl ioctl_client poll poll_client \
- cusexmp passthrough_ll timefs1 timefs2 \
- timefs3
+ cusexmp passthrough_ll notify_inval_inode \
+ notify_store_retrieve notify_inval_entry
LDADD = ../lib/libfuse3.la
passthrough_fh_LDADD = ../lib/libfuse3.la @passthrough_fh_libs@
diff --git a/example/timefs3.c b/example/notify_inval_entry.c
index 613407c..fc8bc1e 100644
--- a/example/timefs3.c
+++ b/example/notify_inval_entry.c
@@ -18,7 +18,7 @@
* To see the effect, first start the file system with the
* ``--no-notify``
*
- * $ timefs --update-interval=1 --timeout 30 --no-notify mnt/
+ * $ notify_inval_entry --update-interval=1 --timeout 30 --no-notify mnt/
*
* Observe that `ls` always prints the correct directory contents
* (since `readdir` output is not cached)::
@@ -52,7 +52,7 @@
* In contrast, if you enable notifications you will be unable to stat
* the file as soon as the file system updates its name:
*
- * $ timefs --update-interval=1 --timeout 30 --no-notify mnt/
+ * $ notify_inval_entry --update-interval=1 --timeout 30 --no-notify mnt/
* $ file=$(ls mnt/); stat mnt/$file
* File: ‘mnt/Time_is_20h_42m_11s’
* Size: 0 Blocks: 0 IO Block: 4096 regular empty file
@@ -67,10 +67,10 @@
*
* \section section_compile compiling this example
*
- * gcc -Wall timefs3.c `pkg-config fuse3 --cflags --libs` -o timefs3
+ * gcc -Wall notify_inval_entry.c `pkg-config fuse3 --cflags --libs` -o notify_inval_entry
*
* \section section_source the complete source
- * \include timefs3.c
+ * \include notify_inval_entry.c
*/
diff --git a/example/timefs1.c b/example/notify_inval_inode.c
index 50363fd..5dfc225 100644
--- a/example/timefs1.c
+++ b/example/notify_inval_inode.c
@@ -12,35 +12,35 @@
* This example implements a file system with a single file whose
* contents change dynamically: it always contains the current time.
*
- * While timefs2.c uses fuse_lowlevel_notify_store() to actively push
- * the updated data into the kernel cache, this example uses
- * fuse_lowlevel_notify_inval_inode() to notify the kernel that the
- * cache has to be invalidated - but the kernel still has to explicitly
- * request the updated data on the next read.
+ * While notify_store_retrieve.c uses fuse_lowlevel_notify_store() to
+ * actively push the updated data into the kernel cache, this example
+ * uses fuse_lowlevel_notify_inval_inode() to notify the kernel that
+ * the cache has to be invalidated - but the kernel still has to
+ * explicitly request the updated data on the next read.
*
- * To see the effect, first start the file system with the
+ * To see the effect, first start the file system with the
* ``--no-notify`` option:
*
- * $ timefs --update-interval=1 --no-notify mnt/
+ * $ notify_inval_inode --update-interval=1 --no-notify mnt/
*
- * Observe that the output never changes, even though the file system
- * updates it once per second. This is because the contents are cached
- * in the kernel:
+ * Observe that the output never changes, even though the file system
+ * updates it once per second. This is because the contents are cached
+ * in the kernel:
*
- * $ for i in 1 2 3 4 5; do
- * > cat mnt/current_time
- * > sleep 1
- * > done
- * The current time is 15:58:18
- * The current time is 15:58:18
- * The current time is 15:58:18
- * The current time is 15:58:18
- * The current time is 15:58:18
+ * $ for i in 1 2 3 4 5; do
+ * > cat mnt/current_time
+ * > sleep 1
+ * > done
+ * The current time is 15:58:18
+ * The current time is 15:58:18
+ * The current time is 15:58:18
+ * The current time is 15:58:18
+ * The current time is 15:58:18
*
- * If you instead enable the notification functions, the changes become
- * visible:
+ * If you instead enable the notification functions, the changes become
+ * visible:
*
- * $ timefs --update-interval=1 mnt/
+ * $ notify_inval_inode --update-interval=1 mnt/
* $ for i in 1 2 3 4 5; do
* > cat mnt/current_time
* > sleep 1
@@ -53,10 +53,10 @@
*
* \section section_compile compiling this example
*
- * gcc -Wall timefs1.c `pkg-config fuse3 --cflags --libs` -o timefs1
+ * gcc -Wall notify_inval_inode.c `pkg-config fuse3 --cflags --libs` -o notify_inval_inode
*
* \section section_source the complete source
- * \include timefs1.c
+ * \include notify_inval_inode.c
*/
diff --git a/example/timefs2.c b/example/notify_store_retrieve.c
index ae3fe99..a21d117 100644
--- a/example/timefs2.c
+++ b/example/notify_store_retrieve.c
@@ -12,15 +12,15 @@
* This example implements a file system with a single file whose
* contents change dynamically: it always contains the current time.
*
- * While timefs1.c uses fuse_lowlevel_notify_inval_inode() to let the
- * kernel know that it has to invalidate the cache, this example
- * actively pushes the updated data into the kernel cache using
- * fuse_lowlevel_notify_store().
+ * While notify_inval_inode.c uses fuse_lowlevel_notify_inval_inode()
+ * to let the kernel know that it has to invalidate the cache, this
+ * example actively pushes the updated data into the kernel cache
+ * using fuse_lowlevel_notify_store().
*
* To see the effect, first start the file system with the
* ``--no-notify`` option:
*
- * $ timefs --update-interval=1 --no-notify mnt/
+ * $ notify_store_retrieve --update-interval=1 --no-notify mnt/
*
* Observe that the output never changes, even though the file system
* updates it once per second. This is because the contents are cached
@@ -39,7 +39,7 @@
* If you instead enable the notification functions, the changes become
* visible:
*
- * $ timefs --update-interval=1 mnt/
+ * $ notify_store_retrieve --update-interval=1 mnt/
* $ for i in 1 2 3 4 5; do
* > cat mnt/current_time
* > sleep 1
@@ -52,10 +52,10 @@
*
* \section section_compile compiling this example
*
- * gcc -Wall timefs2.c `pkg-config fuse3 --cflags --libs` -o timefs2
+ * gcc -Wall notify_store_retrieve.c `pkg-config fuse3 --cflags --libs` -o notify_store_retrieve
*
* \section section_source the complete source
- * \include timefs2.c
+ * \include notify_store_retrieve.c
*/
diff --git a/test/test_examples.py b/test/test_examples.py
index 0d754d2..9d83ae9 100755
--- a/test/test_examples.py
+++ b/test/test_examples.py
@@ -142,10 +142,12 @@ def test_poll(tmpdir):
else:
umount(mount_process, mnt_dir)
-@pytest.mark.parametrize("name", ('timefs1', 'timefs2'))
+@pytest.mark.parametrize("name",
+ ('notify_inval_inode',
+ 'notify_store_retrieve'))
@pytest.mark.parametrize("options", LL_OPTIONS)
@pytest.mark.parametrize("notify", (True, False))
-def test_timefs12(tmpdir, name, options, notify):
+def test_notify1(tmpdir, name, options, notify):
mnt_dir = str(tmpdir)
cmdline = base_cmdline + \
[ pjoin(basename, 'example', name),
@@ -172,10 +174,10 @@ def test_timefs12(tmpdir, name, options, notify):
umount(mount_process, mnt_dir)
@pytest.mark.parametrize("notify", (True, False))
-def test_timefs3(tmpdir, notify):
+def test_notify_inval_entry(tmpdir, notify):
mnt_dir = str(tmpdir)
cmdline = base_cmdline + \
- [ pjoin(basename, 'example', 'timefs3'),
+ [ pjoin(basename, 'example', 'notify_inval_entry'),
'-f', '--update-interval=2',
'--timeout=4', mnt_dir ]
if not notify: