From bcad1a6f22662ff0d04a6ae417adb30550252d97 Mon Sep 17 00:00:00 2001 From: Nikolaus Rath Date: Sun, 9 Oct 2016 19:50:51 -0700 Subject: [PATCH] Renamed ioctl and poll examples The new names should make it more obvious at first glance what each example demonstrates. --- example/.gitignore | 8 ++++---- example/Makefile.am | 19 ++++++++++--------- example/cusexmp.c | 2 +- example/{fioc.c => ioctl.c} | 12 ++++++------ example/{fioc.h => ioctl.h} | 5 +++-- example/{fioclient.c => ioctl_client.c} | 11 ++++++----- example/{fsel.c => poll.c} | 10 +++++----- example/{fselclient.c => poll_client.c} | 9 +++++---- test/test_examples.py | 12 ++++++------ 9 files changed, 46 insertions(+), 42 deletions(-) rename example/{fioc.c => ioctl.c} (93%) rename example/{fioc.h => ioctl.h} (85%) mode change 100755 => 100644 rename example/{fioclient.c => ioctl_client.c} (85%) rename example/{fsel.c => poll.c} (95%) rename example/{fselclient.c => poll_client.c} (91%) diff --git a/example/.gitignore b/example/.gitignore index ea56c8d..fb1794a 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -2,10 +2,10 @@ /passthrough_fh /hello /hello_ll -/fioc -/fioclient -/fsel -/fselclient +/ioctl +/ioctl_client +/poll +/poll_client /cusexmp /passthrough_ll /timefs1 diff --git a/example/Makefile.am b/example/Makefile.am index 5d82f64..9d780a7 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -1,17 +1,18 @@ ## Process this file with automake to produce Makefile.in AM_CPPFLAGS = -I$(top_srcdir)/include -D_REENTRANT -noinst_HEADERS = fioc.h -noinst_PROGRAMS = passthrough passthrough_fh hello hello_ll fioc fioclient \ - fsel fselclient cusexmp passthrough_ll timefs1 timefs2 \ +noinst_HEADERS = ioctl.h +noinst_PROGRAMS = passthrough passthrough_fh hello hello_ll \ + ioctl ioctl_client poll poll_client \ + cusexmp passthrough_ll timefs1 timefs2 \ timefs3 LDADD = ../lib/libfuse3.la passthrough_fh_LDADD = ../lib/libfuse3.la @passthrough_fh_libs@ -fioclient_CPPFLAGS = -fioclient_LDFLAGS = -fioclient_LDADD = -fselclient_CPPFLAGS = -fselclient_LDFLAGS = -fselclient_LDADD = +ioctl_client_CPPFLAGS = +ioctl_client_LDFLAGS = +ioctl_client_LDADD = +poll_client_CPPFLAGS = +poll_client_LDFLAGS = +poll_client_LDADD = diff --git a/example/cusexmp.c b/example/cusexmp.c index 8d22075..a9f3365 100644 --- a/example/cusexmp.c +++ b/example/cusexmp.c @@ -35,7 +35,7 @@ #include #include -#include "fioc.h" +#include "ioctl.h" static void *cusexmp_buf; static size_t cusexmp_size; diff --git a/example/fioc.c b/example/ioctl.c similarity index 93% rename from example/fioc.c rename to example/ioctl.c index 368f807..ee58f03 100644 --- a/example/fioc.c +++ b/example/ioctl.c @@ -5,23 +5,23 @@ This program can be distributed under the terms of the GNU GPL. See the file COPYING. - */ /** @file * @tableofcontents * - * fioc.c - FUSE fioc: FUSE ioctl example + * This example illustrates how to write a FUSE file system that can + * process (a restricted set of) ioctls. It can be tested with the + * ioctl_client.c program. * * \section section_compile compiling this example * - * gcc -Wall fioc.c `pkg-config fuse3 --cflags --libs` -o fioc + * gcc -Wall ioctl.c `pkg-config fuse3 --cflags --libs` -o ioctl * * \section section_source the complete source - * \include fioc.c + * \include ioctl.c */ - #define FUSE_USE_VERSION 30 #include @@ -34,7 +34,7 @@ #include #include -#include "fioc.h" +#include "ioctl.h" #define FIOC_NAME "fioc" diff --git a/example/fioc.h b/example/ioctl.h old mode 100755 new mode 100644 similarity index 85% rename from example/fioc.h rename to example/ioctl.h index 42799aa..ded2a15 --- a/example/fioc.h +++ b/example/ioctl.h @@ -10,9 +10,10 @@ /** @file * @tableofcontents * - * fioc.h - FUSE-ioctl: ioctl support for FUSE + * Header file to share definitions between the ioctl.c example file + * system and the ioctl_client.c test program. * - * \include fioc.h + * \include ioctl.h */ diff --git a/example/fioclient.c b/example/ioctl_client.c similarity index 85% rename from example/fioclient.c rename to example/ioctl_client.c index 704f24b..83ede65 100644 --- a/example/fioclient.c +++ b/example/ioctl_client.c @@ -3,6 +3,8 @@ Copyright (C) 2008 SUSE Linux Products GmbH Copyright (C) 2008 Tejun Heo + This program tests the ioctl.c example file systsem. + This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ @@ -10,15 +12,14 @@ /** @file * @tableofcontents * - * fioclient.c - FUSE fioclient: FUSE ioctl example client + * This program tests the ioctl.c example file systsem. * * \section section_compile compiling this example * - * gcc -Wall fioclient.c -o fioclient + * gcc -Wall ioctl_client.c -o ioctl_client * * \section section_source the complete source - * fioclient.c - * \include fioclient.c + * \include ioctl_client.c */ #include @@ -31,7 +32,7 @@ #include #include #include -#include "fioc.h" +#include "ioctl.h" const char *usage = "Usage: fioclient FIOC_FILE [size]\n" diff --git a/example/fsel.c b/example/poll.c similarity index 95% rename from example/fsel.c rename to example/poll.c index b496c9a..61c5365 100644 --- a/example/fsel.c +++ b/example/poll.c @@ -5,23 +5,23 @@ This program can be distributed under the terms of the GNU GPL. See the file COPYING. - */ /** @file * @tableofcontents * - * fsel.c - FUSE fsel: FUSE select example + * This example illustrates how to write a FUSE file system that + * supports polling for changes that don't come through the kernel. It + * can be tested with the poll_client.c program. * * \section section_compile compiling this example * - * gcc -Wall fsel.c `pkg-config fuse3 --cflags --libs` -o fsel + * gcc -Wall poll.c `pkg-config fuse3 --cflags --libs` -o poll * * \section section_source the complete source - * \include fsel.c + * \include poll.c */ - #define FUSE_USE_VERSION 30 #include diff --git a/example/fselclient.c b/example/poll_client.c similarity index 91% rename from example/fselclient.c rename to example/poll_client.c index 637cb07..5c04fea 100644 --- a/example/fselclient.c +++ b/example/poll_client.c @@ -5,20 +5,21 @@ This program can be distributed under the terms of the GNU GPL. See the file COPYING. - */ /** @file * @tableofcontents * - * fselclient.c - FUSE fselclient: FUSE select example client + * poll_client.c + * + * This program tests the poll.c example file systsem. * * \section section_compile compiling this example * - * gcc -Wall fselclient.c -o fselclient + * gcc -Wall poll_client.c -o poll_client * * \section section_source the complete source - * \include fselclient.c + * \include poll_client.c */ #include diff --git a/test/test_examples.py b/test/test_examples.py index 6deaff1..0d754d2 100755 --- a/test/test_examples.py +++ b/test/test_examples.py @@ -101,17 +101,17 @@ def test_passthrough(tmpdir, name, options): else: umount(mount_process, mnt_dir) -def test_fioc(tmpdir): +def test_ioctl(tmpdir): mnt_dir = str(tmpdir) testfile = pjoin(mnt_dir, 'fioc') cmdline = base_cmdline + \ - [pjoin(basename, 'example', 'fioc'), '-f', mnt_dir ] + [pjoin(basename, 'example', 'ioctl'), '-f', mnt_dir ] mount_process = subprocess.Popen(cmdline) try: wait_for_mount(mount_process, mnt_dir) cmdline = base_cmdline + \ - [ pjoin(basename, 'example', 'fioclient'), + [ pjoin(basename, 'example', 'ioctl_client'), testfile ] assert subprocess.check_output(cmdline) == b'0\n' with open(testfile, 'wb') as fh: @@ -126,15 +126,15 @@ def test_fioc(tmpdir): else: umount(mount_process, mnt_dir) -def test_fsel(tmpdir): +def test_poll(tmpdir): mnt_dir = str(tmpdir) - cmdline = base_cmdline + [pjoin(basename, 'example', 'fsel'), + cmdline = base_cmdline + [pjoin(basename, 'example', 'poll'), '-f', mnt_dir ] mount_process = subprocess.Popen(cmdline) try: wait_for_mount(mount_process, mnt_dir) cmdline = base_cmdline + \ - [ pjoin(basename, 'example', 'fselclient') ] + [ pjoin(basename, 'example', 'poll_client') ] subprocess.check_call(cmdline, cwd=mnt_dir) except: cleanup(mnt_dir) -- 2.30.2