aboutsummaryrefslogtreecommitdiff
path: root/lib/mount.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2010-08-27 17:16:54 +0200
committerMiklos Szeredi <mszeredi@suse.cz>2010-08-27 17:16:54 +0200
commit64222fbcbd3ed227e4f9c68e1acccd7e68218982 (patch)
tree7fd0ce19a909ee39f741e50732f1f97cffe21f22 /lib/mount.c
parent7cc73a47ddbc25666f0fba1872099eb3245ba25e (diff)
downloadlibfuse-64222fbcbd3ed227e4f9c68e1acccd7e68218982.tar.gz
Add NetBSD support
The bulk of it is just about adding ifdef __NetBSD__ where there is already an ifdef __FreeBSD__ Add a arch=netbsd to deal with NetBSD specifics. I suggests that arch=bsd could be renamed to arch=freebsd NetBSD specific linking with -lperfuse NetBSD patches to lib/mount.c. It turned to be less itrusive to patch mount;c than mount_bsd.c. I suggest mount_bsd.c could be renamed to mount_freebsd.c Patch from Emmanuel Dreyfus
Diffstat (limited to 'lib/mount.c')
-rw-r--r--lib/mount.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/mount.c b/lib/mount.c
index c3b16a4..b525da5 100644
--- a/lib/mount.c
+++ b/lib/mount.c
@@ -17,6 +17,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <stddef.h>
+#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/poll.h>
@@ -25,6 +26,19 @@
#include <sys/wait.h>
#include <sys/mount.h>
+#ifdef __NetBSD__
+#include <perfuse.h>
+
+#define MS_RDONLY MNT_RDONLY
+#define MS_NOSUID MNT_NOSUID
+#define MS_NODEV MNT_NODEV
+#define MS_NOEXEC MNT_NOEXEC
+#define MS_SYNCHRONOUS MNT_SYNCHRONOUS
+#define MS_NOATIME MNT_NOATIME
+
+#define umount2(mnt, flags) unmount(mnt, (flags == 2) ? MNT_FORCE : 0)
+#endif
+
#define FUSERMOUNT_PROG "fusermount"
#define FUSE_COMMFD_ENV "_FUSE_COMMFD"
@@ -155,7 +169,9 @@ static struct mount_flags mount_flags[] = {
{"sync", MS_SYNCHRONOUS, 1},
{"atime", MS_NOATIME, 0},
{"noatime", MS_NOATIME, 1},
+#ifndef __NetBSD__
{"dirsync", MS_DIRSYNC, 1},
+#endif
{NULL, 0, 0}
};
@@ -484,6 +500,7 @@ static int fuse_mount_sys(const char *mnt, struct mount_opts *mo,
goto out_close;
}
+#ifndef __NetBSD__
if (geteuid() == 0) {
char *newmnt = fuse_mnt_resolve_path("fuse", mnt);
res = -1;
@@ -496,6 +513,7 @@ static int fuse_mount_sys(const char *mnt, struct mount_opts *mo,
if (res == -1)
goto out_umount;
}
+#endif /* __NetBSD__ */
free(type);
free(source);