aboutsummaryrefslogtreecommitdiff
path: root/example/hello_ll.c
diff options
context:
space:
mode:
authorGravatar Joachim Schiele <js@lastlog.de>2013-06-20 19:18:18 +0200
committerGravatar Joachim Schiele <js@lastlog.de>2013-06-20 19:18:18 +0200
commitea7227db439cc0e02a7ed69feae75fac6dfcc637 (patch)
tree7203bac45bf5594ed77fea2fbf037e92daacf539 /example/hello_ll.c
parent18c59ab4893cf3c64762556aa0af2cac638655df (diff)
- 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
Diffstat (limited to 'example/hello_ll.c')
-rwxr-xr-x[-rw-r--r--]example/hello_ll.c41
1 files changed, 37 insertions, 4 deletions
diff --git a/example/hello_ll.c b/example/hello_ll.c
index baf41bc..687c6f1 100644..100755
--- 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 <fuse_lowlevel.h>
@@ -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]