aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Nikolaus Rath <Nikolaus@rath.org>2017-08-03 17:13:23 +0200
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2017-08-03 17:21:06 +0200
commitcbf19044da93e550b559639271c56f5c17c2172f (patch)
tree4159d1aeade3340e4b59129dab04700b2d2917c2 /lib
parent67a904806e526bb02a37645861c046562b8c4711 (diff)
Simply #ifdefs
mount_bsd.c is only used when compiling for *BSD, and FreeBSD is the only BSD that supports FUSE. So there really is no need to check if this file is compiled under FreeBSD.
Diffstat (limited to 'lib')
-rw-r--r--lib/mount_bsd.c53
1 files changed, 0 insertions, 53 deletions
diff --git a/lib/mount_bsd.c b/lib/mount_bsd.c
index 7f78fdd..31b41de 100644
--- a/lib/mount_bsd.c
+++ b/lib/mount_bsd.c
@@ -13,10 +13,8 @@
#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>
@@ -125,62 +123,11 @@ 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];
- const char *argv[4];
- const char umount_cmd[] = "/sbin/umount";
- pid_t pid;
-
- snprintf(device_path, SPECNAMELEN + 12, _PATH_DEV "%s", dev);
-
- argv[0] = umount_cmd;
- argv[1] = "-f";
- argv[2] = device_path;
- argv[3] = NULL;
-
- pid = fork();
-
- if (pid == -1)
- return;
-
- if (pid == 0) {
- close(fd);
- execvp(umount_cmd, (char **)argv);
- exit(1);
- }
-
- 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)
- goto out;
-
- devname_r(sbuf.st_rdev, S_IFCHR, dev, 128);
-
- if (strncmp(dev, "fuse", 4))
- goto out;
-
- strtol(dev + 4, &ep, 10);
- if (*ep != '\0')
- goto out;
-
- do_unmount(dev, fd);
-
-out:
-#endif
close(fd);
}