summaryrefslogtreecommitdiff
path: root/sysutils/fusefs-libs/files/patch-example_fusexmp_fh.c
blob: 19408c3ced874170a949659660824b1f46ccaa45 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
--- example/fusexmp_fh.c.orig	Tue Sep 13 21:26:12 2005
+++ example/fusexmp_fh.c	Sun Oct  9 22:05:09 2005
@@ -17,7 +17,12 @@
 #include <fcntl.h>
 #include <dirent.h>
 #include <errno.h>
+#ifdef __FreeBSD__
+#include <sys/param.h>
+#include <sys/mount.h>
+#else
 #include <sys/statfs.h>
+#endif
 #ifdef HAVE_SETXATTR
 #include <sys/xattr.h>
 #endif
@@ -68,7 +73,11 @@
         memset(&st, 0, sizeof(st));
         st.st_ino = de->d_ino;
         st.st_mode = de->d_type << 12;
+#ifdef __FreeBSD__
+        if (filler(buf, de->d_name, &st, telldir(dp)))
+#else
         if (filler(buf, de->d_name, &st, de->d_off))
+#endif
             break;
     }
 
@@ -87,7 +96,20 @@
 {
     int res;
 
+#ifndef __FreeBSD__
     res = mknod(path, mode, rdev);
+#else
+    if (rdev)
+        res = mknod(path, mode, rdev);
+    else if (mode & S_IFIFO)
+        res = mkfifo(path, mode);
+    else {
+        res = open(path, O_CREAT | O_TRUNC | O_WRONLY, mode);
+        if (res >= 0)
+            res = close(res);
+    }
+#endif
+
     if(res == -1)
         return -errno;
 
@@ -268,9 +290,13 @@
     int res;
     (void) path;
 
+#ifdef __FreeBSD__
+    (void) isdatasync;
+#else
     if (isdatasync)
         res = fdatasync(fi->fh);
     else
+#endif
         res = fsync(fi->fh);
     if(res == -1)
         return -errno;