From ea7227db439cc0e02a7ed69feae75fac6dfcc637 Mon Sep 17 00:00:00 2001 From: Joachim Schiele Date: Thu, 20 Jun 2013 19:18:18 +0200 Subject: - added a doxygen main page - modified all examples to be included in doxygen - modified the API documentation to have more details - added the 490px_FUSE_structure.svg.png (c) wikipedia --- example/cusexmp.c | 15 ++++++++++++++- example/fioc.c | 15 ++++++++++++++- example/fioc.h | 9 +++++++++ example/fioclient.c | 17 +++++++++++++++-- example/fsel.c | 15 ++++++++++++++- example/fselclient.c | 15 ++++++++++++++- example/fusexmp.c | 16 ++++++++++++++-- example/fusexmp_fh.c | 15 +++++++++++++-- example/hello.c | 31 +++++++++++++++++++++++++++++-- example/hello_ll.c | 41 +++++++++++++++++++++++++++++++++++++---- example/null.c | 15 +++++++++++++-- 11 files changed, 186 insertions(+), 18 deletions(-) mode change 100644 => 100755 example/cusexmp.c mode change 100644 => 100755 example/fioc.c mode change 100644 => 100755 example/fioc.h mode change 100644 => 100755 example/fioclient.c mode change 100644 => 100755 example/fsel.c mode change 100644 => 100755 example/fselclient.c mode change 100644 => 100755 example/fusexmp.c mode change 100644 => 100755 example/fusexmp_fh.c mode change 100644 => 100755 example/hello.c mode change 100644 => 100755 example/hello_ll.c mode change 100644 => 100755 example/null.c (limited to 'example') diff --git a/example/cusexmp.c b/example/cusexmp.c old mode 100644 new mode 100755 index b69f97c..a02818c --- a/example/cusexmp.c +++ b/example/cusexmp.c @@ -6,9 +6,22 @@ This program can be distributed under the terms of the GNU GPL. See the file COPYING. - gcc -Wall cusexmp.c `pkg-config fuse --cflags --libs` -o cusexmp */ +/** @file + * @tableofcontents + * + * cusexmp.c - CUSE example: Character device in Userspace + * + * \section section_compile compiling this example + * + * gcc -Wall cusexmp.c `pkg-config fuse --cflags --libs` -o cusexmp + * + * \section section_source the complete source + * \include cusexmp.c + */ + + #define FUSE_USE_VERSION 30 #include diff --git a/example/fioc.c b/example/fioc.c old mode 100644 new mode 100755 index 849bd5d..cfb18ae --- a/example/fioc.c +++ b/example/fioc.c @@ -6,9 +6,22 @@ This program can be distributed under the terms of the GNU GPL. See the file COPYING. - gcc -Wall fioc.c `pkg-config fuse --cflags --libs` -o fioc */ +/** @file + * @tableofcontents + * + * fioc.c - FUSE fioc: FUSE ioctl example + * + * \section section_compile compiling this example + * + * gcc -Wall fioc.c `pkg-config fuse --cflags --libs` -o fioc + * + * \section section_source the complete source + * \include fioc.c + */ + + #define FUSE_USE_VERSION 30 #include diff --git a/example/fioc.h b/example/fioc.h old mode 100644 new mode 100755 index ec1a39d..c9bf358 --- a/example/fioc.h +++ b/example/fioc.h @@ -7,6 +7,15 @@ See the file COPYING. */ +/** @file + * @tableofcontents + * + * fioc.h - FUSE-ioctl: ioctl support for FUSE + * + * \include fioc.h + */ + + #include #include #include diff --git a/example/fioclient.c b/example/fioclient.c old mode 100644 new mode 100755 index 5f05525..9718622 --- a/example/fioclient.c +++ b/example/fioclient.c @@ -5,10 +5,23 @@ This program can be distributed under the terms of the GNU GPL. See the file COPYING. - - gcc -Wall fioclient.c -o fioclient */ +/** @file + * @tableofcontents + * + * fioclient.c - FUSE fioclient: FUSE ioctl example client + * + * \section section_compile compiling this example + * + * gcc -Wall fioclient.c -o fioclient + * + * \section section_source the complete source + * fioclient.c + * \include fioclient.c + */ + + #include #include #include diff --git a/example/fsel.c b/example/fsel.c old mode 100644 new mode 100755 index bddc1aa..3c52033 --- a/example/fsel.c +++ b/example/fsel.c @@ -6,9 +6,22 @@ This program can be distributed under the terms of the GNU GPL. See the file COPYING. - gcc -Wall fsel.c `pkg-config fuse --cflags --libs` -o fsel */ +/** @file + * @tableofcontents + * + * fsel.c - FUSE fsel: FUSE select example + * + * \section section_compile compiling this example + * + * gcc -Wall fsel.c `pkg-config fuse --cflags --libs` -o fsel + * + * \section section_source the complete source + * \include fsel.c + */ + + #define FUSE_USE_VERSION 30 #include diff --git a/example/fselclient.c b/example/fselclient.c old mode 100644 new mode 100755 index 7c4b837..2e2e571 --- a/example/fselclient.c +++ b/example/fselclient.c @@ -6,9 +6,22 @@ This program can be distributed under the terms of the GNU GPL. See the file COPYING. - gcc -Wall fselclient.c -o fselclient */ +/** @file + * @tableofcontents + * + * fselclient.c - FUSE fselclient: FUSE select example client + * + * \section section_compile compiling this example + * + * gcc -Wall fselclient.c -o fselclient + * + * \section section_source the complete source + * \include fselclient.c + */ + + #include #include #include diff --git a/example/fusexmp.c b/example/fusexmp.c old mode 100644 new mode 100755 index 42a8134..73e9898 --- a/example/fusexmp.c +++ b/example/fusexmp.c @@ -5,10 +5,22 @@ This program can be distributed under the terms of the GNU GPL. See the file COPYING. - - gcc -Wall fusexmp.c `pkg-config fuse --cflags --libs` -o fusexmp */ +/** @file + * @tableofcontents + * + * fusexmp.c - FUSE: Filesystem in Userspace + * + * \section section_compile compiling this example + * + * gcc -Wall fusexmp.c `pkg-config fuse --cflags --libs` -o fusexmp + * + * \section section_source the complete source + * \include fusexmp.c + */ + + #define FUSE_USE_VERSION 30 #ifdef HAVE_CONFIG_H diff --git a/example/fusexmp_fh.c b/example/fusexmp_fh.c old mode 100644 new mode 100755 index eea6b9b..e538b49 --- a/example/fusexmp_fh.c +++ b/example/fusexmp_fh.c @@ -5,10 +5,21 @@ This program can be distributed under the terms of the GNU GPL. See the file COPYING. - - gcc -Wall fusexmp_fh.c `pkg-config fuse --cflags --libs` -lulockmgr -o fusexmp_fh */ +/** @file + * @tableofcontents + * + * fusexmp_fh.c - FUSE: Filesystem in Userspace + * + * \section section_compile compiling this example + * + * gcc -Wall fusexmp_fh.c `pkg-config fuse --cflags --libs` -lulockmgr -o fusexmp_fh + * + * \section section_source the complete source + * \include fusexmp_fh.c + */ + #define FUSE_USE_VERSION 30 #ifdef HAVE_CONFIG_H diff --git a/example/hello.c b/example/hello.c old mode 100644 new mode 100755 index b31fbe5..c8b4a48 --- a/example/hello.c +++ b/example/hello.c @@ -4,10 +4,35 @@ This program can be distributed under the terms of the GNU GPL. See the file COPYING. - - gcc -Wall hello.c `pkg-config fuse --cflags --libs` -o hello */ +/** @file + * + * hello.c - minimal FUSE example featuring fuse_main usage + * +* \section section_compile compiling this example + * + * gcc -Wall hello.c `pkg-config fuse --cflags --libs` -o hello + * + * \section section_usage usage + \verbatim + % mkdir mnt + % ./hello mnt # program will vanish into the background + % ls -la mnt + total 4 + drwxr-xr-x 2 root root 0 Jan 1 1970 ./ + drwxrwx--- 1 root vboxsf 4096 Jun 16 23:12 ../ + -r--r--r-- 1 root root 13 Jan 1 1970 hello + % cat mnt/hello + Hello World! + % fusermount -u mnt + \endverbatim + * + * \section section_source the complete source + * \include hello.c + */ + + #define FUSE_USE_VERSION 30 #include @@ -83,6 +108,7 @@ static int hello_read(const char *path, char *buf, size_t size, off_t offset, return size; } +// fuse_operations hello_oper is redirecting function-calls to _our_ functions implemented above static struct fuse_operations hello_oper = { .getattr = hello_getattr, .readdir = hello_readdir, @@ -90,6 +116,7 @@ static struct fuse_operations hello_oper = { .read = hello_read, }; +// in the main function we call the blocking fuse_main(..) function with &hello_oper int main(int argc, char *argv[]) { return fuse_main(argc, argv, &hello_oper, NULL); diff --git a/example/hello_ll.c b/example/hello_ll.c old mode 100644 new mode 100755 index baf41bc..687c6f1 --- a/example/hello_ll.c +++ b/example/hello_ll.c @@ -4,10 +4,39 @@ This program can be distributed under the terms of the GNU GPL. See the file COPYING. - - gcc -Wall hello_ll.c `pkg-config fuse --cflags --libs` -o hello_ll */ +/** @file + * + * hello_ll.c - fuse low level functionality + * + * unlike hello.c this example will stay in the foreground. it also replaced + * the convenience function fuse_main(..) with a more low level approach. + * + * \section section_compile compiling this example + * + * gcc -Wall hello_ll.c `pkg-config fuse --cflags --libs` -o hello_ll + * + * \section section_usage usage + \verbatim + % mkdir mnt + % ./hello_ll mnt # program will wait in foreground until you press CTRL+C + in a different shell do: + % ls -la mnt + total 4 + drwxr-xr-x 2 root root 0 Jan 1 1970 ./ + drwxrwx--- 1 root vboxsf 4096 Jun 16 23:12 ../ + -r--r--r-- 1 root root 13 Jan 1 1970 hello + % cat mnt/hello + Hello World! + finally either press ctrl+c or do: + % fusermount -u mnt + \endverbatim + * + * \section section_source the complete source + * \include hello_ll.c + */ + #define FUSE_USE_VERSION 30 #include @@ -151,6 +180,7 @@ static struct fuse_lowlevel_ops hello_ll_oper = { .read = hello_ll_read, }; +//! [doxygen_fuse_lowlevel_usage] int main(int argc, char *argv[]) { struct fuse_args args = FUSE_ARGS_INIT(argc, argv); @@ -161,13 +191,15 @@ int main(int argc, char *argv[]) if (fuse_parse_cmdline(&args, &mountpoint, NULL, NULL) != -1 && (ch = fuse_mount(mountpoint, &args)) != NULL) { struct fuse_session *se; - se = fuse_lowlevel_new(&args, &hello_ll_oper, sizeof(hello_ll_oper), NULL); if (se != NULL) { if (fuse_set_signal_handlers(se) != -1) { fuse_session_add_chan(se, ch); - err = fuse_session_loop(se); + + // fuse_session_loop(..) blocks until ctrl+c or fusermount -u + err = fuse_session_loop(se); + fuse_remove_signal_handlers(se); fuse_session_remove_chan(ch); } @@ -179,3 +211,4 @@ int main(int argc, char *argv[]) return err ? 1 : 0; } +//! [doxygen_fuse_lowlevel_usage] diff --git a/example/null.c b/example/null.c old mode 100644 new mode 100755 index 4e2bb8f..6952333 --- a/example/null.c +++ b/example/null.c @@ -4,10 +4,21 @@ This program can be distributed under the terms of the GNU GPL. See the file COPYING. - - gcc -Wall null.c `pkg-config fuse --cflags --libs` -o null */ +/** @file + * + * null.c - FUSE: Filesystem in Userspace + * + * \section section_compile compiling this example + * + * gcc -Wall null.c `pkg-config fuse --cflags --libs` -o null + * + * \section section_source the complete source + * \include null.c + */ + + #define FUSE_USE_VERSION 30 #include -- cgit v1.2.3