aboutsummaryrefslogtreecommitdiff
path: root/example/fusexmp_fh.c
diff options
context:
space:
mode:
Diffstat (limited to 'example/fusexmp_fh.c')
-rwxr-xr-x[-rw-r--r--]example/fusexmp_fh.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/example/fusexmp_fh.c b/example/fusexmp_fh.c
index 1ba9dbc..ba6789b 100644..100755
--- a/example/fusexmp_fh.c
+++ b/example/fusexmp_fh.c
@@ -5,11 +5,22 @@
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
*/
-#define FUSE_USE_VERSION 26
+/** @file
+ * @tableofcontents
+ *
+ * fusexmp_fh.c - FUSE: Filesystem in Userspace
+ *
+ * \section section_compile compiling this example
+ *
+ * gcc -Wall fusexmp_fh.c `pkg-config fuse3 --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
#include <config.h>
@@ -18,7 +29,11 @@
#define _GNU_SOURCE
#include <fuse.h>
+
+#ifdef HAVE_LIBULOCKMGR
#include <ulockmgr.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -489,6 +504,7 @@ static int xmp_removexattr(const char *path, const char *name)
}
#endif /* HAVE_SETXATTR */
+#ifdef HAVE_LIBULOCKMGR
static int xmp_lock(const char *path, struct fuse_file_info *fi, int cmd,
struct flock *lock)
{
@@ -497,6 +513,7 @@ static int xmp_lock(const char *path, struct fuse_file_info *fi, int cmd,
return ulockmgr_op(fi->fh, cmd, lock, &fi->lock_owner,
sizeof(fi->lock_owner));
}
+#endif
static int xmp_flock(const char *path, struct fuse_file_info *fi, int op)
{
@@ -551,13 +568,10 @@ static struct fuse_operations xmp_oper = {
.listxattr = xmp_listxattr,
.removexattr = xmp_removexattr,
#endif
+#ifdef HAVE_LIBULOCKMGR
.lock = xmp_lock,
- .flock = xmp_flock,
-
- .flag_nullpath_ok = 1,
-#if HAVE_UTIMENSAT
- .flag_utime_omit_ok = 1,
#endif
+ .flock = xmp_flock,
};
int main(int argc, char *argv[])