From: Nikolaus Rath Date: Thu, 3 Aug 2017 15:13:23 +0000 (+0200) Subject: Simply #ifdefs X-Git-Tag: fuse-3.1.1~10 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=cbf19044da93e550b559639271c56f5c17c2172f;p=qemu-gpiodev%2Flibfuse.git 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. --- 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 #include -#endif #include #include @@ -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); }