aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Baptiste Daroussin <bapt@FreeBSD.org>2017-08-03 14:24:22 +0200
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2017-08-03 16:40:36 +0200
commit91ab3b53a30719e34ab05036c8421236ff92d09c (patch)
tree285fd757392e2ffec296d132b8e7a99b20b1e869 /lib
parent66943705473cfd9583d8b6e83df80174db3c206c (diff)
FreeBSD: use unmount(2) and add missing FreeBSD mount option
Diffstat (limited to 'lib')
-rw-r--r--lib/mount_bsd.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/mount_bsd.c b/lib/mount_bsd.c
index 5e1ea1d..7f78fdd 100644
--- a/lib/mount_bsd.c
+++ b/lib/mount_bsd.c
@@ -13,6 +13,11 @@
#include "fuse_misc.h"
#include "fuse_opt.h"
+#ifdef __FreeBSD__
+#include <sys/param.h>
+#include <sys/mount.h>
+#endif
+
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/sysctl.h>
@@ -72,6 +77,7 @@ static const struct fuse_opt fuse_mount_opts[] = {
FUSE_DUAL_OPT_KEY("ro", KEY_KERN),
FUSE_DUAL_OPT_KEY("rw", KEY_KERN),
FUSE_DUAL_OPT_KEY("auto", KEY_KERN),
+ FUSE_DUAL_OPT_KEY("automounted", KEY_KERN),
/* options supported under both Linux and FBSD */
FUSE_DUAL_OPT_KEY("allow_other", KEY_KERN),
FUSE_DUAL_OPT_KEY("default_permissions",KEY_KERN),
@@ -119,6 +125,7 @@ static int fuse_mount_opt_proc(void *data, const char *arg, int key,
return 1;
}
+#ifndef __FreeBSD__
static void do_unmount(char *dev, int fd)
{
char device_path[SPECNAMELEN + 12];
@@ -146,12 +153,16 @@ static void do_unmount(char *dev, int fd)
waitpid(pid, NULL, 0);
}
+#endif
void fuse_kern_unmount(const char *mountpoint, int fd)
{
char *ep, dev[128];
struct stat sbuf;
+#ifdef __FreeBSD__
+ unmount(mountpoint, MNT_FORCE);
+#else
(void)mountpoint;
if (fstat(fd, &sbuf) == -1)
@@ -169,6 +180,7 @@ void fuse_kern_unmount(const char *mountpoint, int fd)
do_unmount(dev, fd);
out:
+#endif
close(fd);
}