Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports
Path: blob/main/filesystems/fusefs-libs/files/patch-lib_mount__bsd.c
18878 views
1
--- lib/mount_bsd.c.orig 2015-05-22 09:24:02 UTC
2
+++ lib/mount_bsd.c
3
@@ -10,6 +10,8 @@
4
#include "fuse_misc.h"
5
#include "fuse_opt.h"
6
7
+#include <sys/param.h>
8
+#include <sys/mount.h>
9
#include <sys/stat.h>
10
#include <sys/wait.h>
11
#include <sys/sysctl.h>
12
@@ -78,6 +80,7 @@ static const struct fuse_opt fuse_mount_
13
FUSE_DUAL_OPT_KEY("ro", KEY_KERN),
14
FUSE_DUAL_OPT_KEY("rw", KEY_KERN),
15
FUSE_DUAL_OPT_KEY("auto", KEY_KERN),
16
+ FUSE_DUAL_OPT_KEY("automounted", KEY_KERN),
17
/* options supported under both Linux and FBSD */
18
FUSE_DUAL_OPT_KEY("allow_other", KEY_KERN),
19
FUSE_DUAL_OPT_KEY("default_permissions",KEY_KERN),
20
@@ -192,56 +195,12 @@ void fuse_unmount_compat22(const char *m
21
free(umount_cmd);
22
}
23
24
-static void do_unmount(char *dev, int fd)
25
-{
26
- char device_path[SPECNAMELEN + 12];
27
- const char *argv[4];
28
- const char umount_cmd[] = "/sbin/umount";
29
- pid_t pid;
30
-
31
- snprintf(device_path, SPECNAMELEN + 12, _PATH_DEV "%s", dev);
32
-
33
- argv[0] = umount_cmd;
34
- argv[1] = "-f";
35
- argv[2] = device_path;
36
- argv[3] = NULL;
37
-
38
- pid = fork();
39
-
40
- if (pid == -1)
41
- return;
42
-
43
- if (pid == 0) {
44
- close(fd);
45
- execvp(umount_cmd, (char **)argv);
46
- exit(1);
47
- }
48
-
49
- waitpid(pid, NULL, 0);
50
-}
51
-
52
void fuse_kern_unmount(const char *mountpoint, int fd)
53
{
54
char *ep, dev[128];
55
struct stat sbuf;
56
57
- (void)mountpoint;
58
-
59
- if (fstat(fd, &sbuf) == -1)
60
- goto out;
61
-
62
- devname_r(sbuf.st_rdev, S_IFCHR, dev, 128);
63
-
64
- if (strncmp(dev, "fuse", 4))
65
- goto out;
66
-
67
- strtol(dev + 4, &ep, 10);
68
- if (*ep != '\0')
69
- goto out;
70
-
71
- do_unmount(dev, fd);
72
-
73
-out:
74
+ unmount(mountpoint, MNT_FORCE);
75
close(fd);
76
}
77
78
79