From 91ab3b53a30719e34ab05036c8421236ff92d09c Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Thu, 3 Aug 2017 14:24:22 +0200 Subject: FreeBSD: use unmount(2) and add missing FreeBSD mount option --- lib/mount_bsd.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib') 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 +#include +#endif + #include #include #include @@ -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); } -- cgit v1.2.3