aboutsummaryrefslogtreecommitdiff
path: root/example/hello.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.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.c')
-rwxr-xr-x[-rw-r--r--]example/hello.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/example/hello.c b/example/hello.c
index b31fbe5..c8b4a48 100644..100755
--- 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 <fuse.h>
@@ -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);