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>
This commit is contained in:
parent
c819ee640c
commit
9f34853f7c
1 changed files with 28 additions and 7 deletions
|
|
@ -800,9 +800,13 @@ mountfuse(char *mtpt)
|
|||
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"
|
||||
|
|
@ -829,8 +833,18 @@ mountfuse(char *mtpt)
|
|||
}
|
||||
|
||||
/* 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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue