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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
$NetBSD: patch-ae,v 1.10 2011/11/28 08:42:39 manu Exp $
On NetBSD use libperfuse(3), rename umount2(2) as unmount(2), and skip
inexistant /etc/mtab management.
Include <signal.h> for sigprocmask(2)
Use /sbin/mount on NetBSD, not /bin/mount
--- contrib/fuse-lib/mount.c.orig 2011-11-14 14:45:58.000000000 +0100
+++ contrib/fuse-lib/mount.c 2011-11-27 08:53:09.000000000 +0100
@@ -19,16 +19,30 @@
#include <limits.h>
#include <fcntl.h>
#include <errno.h>
#include <dirent.h>
+#include <signal.h>
+#ifndef __NetBSD__
#include <mntent.h>
+#endif /* __NetBSD__ */
#include <sys/stat.h>
#include <sys/poll.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <sys/mount.h>
+#ifdef __NetBSD__
+#include <perfuse.h>
+#define umount2(dir, flags) unmount(dir, ((flags) != 0) ? MNT_FORCE : 0)
+#endif
+
+#ifdef linux
+#define _PATH_MOUNT "/bin/mount"
+#else /* NetBSD, MacOS X */
+#define _PATH_MOUNT "/sbin/mount"
+#endif
+
#ifdef FUSE_UTIL
#define MALLOC(size) malloc (size)
#define FREE(ptr) free (ptr)
#define GFFUSE_LOGERR(...) fprintf (stderr, ## __VA_ARGS__)
@@ -57,8 +71,9 @@
* - s/free/FREE/, s/malloc/MALLOC/
* - there are some other minor things
*/
+#ifndef __NetBSD__
static int
mtab_needs_update (const char *mnt)
{
int res;
@@ -90,8 +105,11 @@
}
return 1;
}
+#else /* __NetBSD__ */
+#define mtab_needs_update(x) 1
+#endif /* __NetBSD__ */
#ifndef FUSE_UTIL
static
#endif
@@ -158,12 +176,12 @@
progname, tmp, strerror (errno));
exit (1);
}
rmdir (tmp);
- execl ("/bin/mount", "/bin/mount", "-i", "-f", "-t", type,
+ execl (_PATH_MOUNT, _PATH_MOUNT, "-i", "-f", "-t", type,
"-o", opts, fsname, mnt, NULL);
- GFFUSE_LOGERR ("%s: failed to execute /bin/mount: %s",
- progname, strerror (errno));
+ GFFUSE_LOGERR ("%s: failed to execute %s: %s",
+ progname, _PATH_MOUNT, strerror (errno));
exit (1);
}
res = waitpid (res, &status, 0);
if (res == -1)
@@ -562,8 +580,9 @@
goto out;
else
mounted = 1;
+#ifndef __NetBSD__
if (geteuid () == 0) {
char *newmnt = fuse_mnt_resolve_path ("fuse", mountpoint);
if (!newmnt) {
@@ -580,8 +599,9 @@
goto out;
}
}
+#endif /* __NetBSD__ */
out:
if (ret == -1) {
if (mounted)
|