aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9pfuse
diff options
context:
space:
mode:
authorJames Porter <james@jamesporter.me>2016-11-30 23:00:38 -0500
committerRuss Cox <rsc@swtch.com>2017-02-10 13:37:44 +0000
commit9f34853f7c6b459fb473d75cb78372406f69d7b2 (patch)
treecb70f4d0ac69467911139b787e3b1d3dead43ad8 /src/cmd/9pfuse
parentc819ee640c1e0369b7ae513985b8bb44e154c0a1 (diff)
downloadplan9port-9f34853f7c6b459fb473d75cb78372406f69d7b2.tar.gz
plan9port-9f34853f7c6b459fb473d75cb78372406f69d7b2.tar.bz2
plan9port-9f34853f7c6b459fb473d75cb78372406f69d7b2.zip
9pfuse: support osxfuse>=3.3.0
Change-Id: Ibca68261016b0f588e169e9f319748b5ba7d15ac Reviewed-on: https://plan9port-review.googlesource.com/2700 Reviewed-by: michaelian ennis <michaelian.ennis@gmail.com> Reviewed-by: Russ Cox <rsc@swtch.com>
Diffstat (limited to 'src/cmd/9pfuse')
-rw-r--r--src/cmd/9pfuse/fuse.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/src/cmd/9pfuse/fuse.c b/src/cmd/9pfuse/fuse.c
index 4d4b8954..3f91ce78 100644
--- a/src/cmd/9pfuse/fuse.c
+++ b/src/cmd/9pfuse/fuse.c
@@ -799,10 +799,14 @@ mountfuse(char *mtpt)
char buf[20];
struct vfsconf vfs;
char *f, *v;
-
- if(getvfsbyname(v="osxfusefs", &vfs) < 0 && getvfsbyname(v="fusefs", &vfs) < 0){
+
+ if(getvfsbyname(v="osxfusefs", &vfs) < 0 &&
+ getvfsbyname(v="osxfuse", &vfs) < 0 &&
+ getvfsbyname(v="fusefs", &vfs) < 0){
if(access((v="osxfusefs", f="/Library/Filesystems/osxfusefs.fs"
"/Support/load_osxfusefs"), 0) < 0 &&
+ access((v="osxfuse", f="/Library/Filesystems/osxfuse.fs"
+ "/Contents/Resources/load_osxfuse"), 0) < 0 &&
access((v="fusefs", f="/System/Library/Extensions/fusefs.kext"
"/Contents/Resources/load_fusefs"), 0) < 0 &&
access(f="/Library/Extensions/fusefs.kext"
@@ -827,10 +831,20 @@ mountfuse(char *mtpt)
return -1;
}
}
-
+
/* Look for available FUSE device. */
+ /*
+ * We need to truncate `fs` from the end of the vfs name if
+ * it's present
+ */
+ int len;
+ if (strcmp(v, "osxfuse") == 0) {
+ len = strlen(v);
+ } else {
+ len = strlen(v)-2;
+ }
for(i=0;; i++){
- snprint(buf, sizeof buf, "/dev/%.*s%d", strlen(v)-2, v, i);
+ snprint(buf, sizeof buf, "/dev/%.*s%d", len, v, i);
if(access(buf, 0) < 0){
werrstr("no available fuse devices");
return -1;
@@ -844,12 +858,19 @@ mountfuse(char *mtpt)
return -1;
if(pid == 0){
snprint(buf, sizeof buf, "%d", fd);
+ /* OSXFUSE >=3.3 changed the name of the environment variable, set both */
putenv("MOUNT_FUSEFS_CALL_BY_LIB", "");
+ putenv("MOUNT_OSXFUSE_CALL_BY_LIB", "");
/*
- * Different versions of MacFUSE put the
- * mount_fusefs binary in different places.
- * Try all.
+ * Different versions of OSXFUSE and MacFUSE put the
+ * mount_fusefs binary in different places. Try all.
*/
+ /* OSXFUSE >=3.3 greater location */
+ putenv("MOUNT_OSXFUSE_DAEMON_PATH",
+ "/Library/Filesystems/osxfuse.fs/Contents/Resources/mount_osxfuse");
+ execl("/Library/Filesystems/osxfuse.fs/Contents/Resources/mount_osxfuse",
+ "mount_osxfuse", buf, mtpt, nil);
+
/* Lion OSXFUSE location */
putenv("MOUNT_FUSEFS_DAEMON_PATH",
"/Library/Filesystems/osxfusefs.fs/Support/mount_osxfusefs");