Compare commits

...

10 Commits

Author SHA1 Message Date
Bill Zissimopoulos f87f5db493
Merge pull request from djdv/fix/search-fusermount
fuse: search a list of paths for `fusermount` executable
2023-01-30 14:07:08 +00:00
Dominic Della Valle 669a7b4c93 fuse: search a list of paths for `fusermount` 2023-01-30 08:49:25 -05:00
Bill Zissimopoulos 84c0898ad2
Merge pull request from djdv/fuse-t
fuse: include FUSE-T header path
2022-11-18 13:01:20 +00:00
Dominic Della Valle 0f0dea9d98 fuse: include FUSE-T header path 2022-11-15 14:10:50 -05:00
Bill Zissimopoulos c23bd0f99a
Merge pull request from djdv/fuse-t
fuse: support linking with FUSE-T
2022-11-06 06:40:41 -08:00
Dominic Della Valle 9ce98a3a11 fuse: support linking with FUSE-T 2022-11-05 17:15:03 -04:00
Bill Zissimopoulos ce7e5a65ca update changelog 2022-04-21 18:36:02 +01:00
Bill Zissimopoulos 3b8d476513 go.mod: go 1.17 2022-04-21 18:24:37 +01:00
Bill Zissimopoulos a6ead49d39 fuse: host: support Windows on ARM64 2022-04-21 18:15:50 +01:00
Bill Zissimopoulos 0451fe87af use go:build tags 2022-04-21 17:32:05 +01:00
9 changed files with 42 additions and 7 deletions

View File

@ -3,7 +3,15 @@
**v1.6.0**
- Add `FileSystemHost.SetCapDeleteAccess` [Windows only]. A file system can use this capability to deny delete access on Windows. Such a file system must:
- Rename import path to `github.com/winfsp/cgofuse`.
- Convert package to module.
- Preliminary support for Windows on ARM64.
- Add `FileSystemGetpath` interface. A case-insensitive file system can use `Getpath` to report the correct case of a file path on Windows.
- Add `FileSystemHost.SetCapDeleteAccess`. A file system can use this capability to deny delete access on Windows. Such a file system must:
- Implement the `Access` file system operation and handle the new `fuse.DELETE_OK` mask to return `-fuse.EPERM` for files that should not be deleted. An example implementation might look like:
```Go
func (fs *filesystem) Access(path string, mask uint32) int {

View File

@ -1,3 +1,4 @@
//go:build windows
// +build windows
/*

View File

@ -1,3 +1,4 @@
//go:build cgo
// +build cgo
/*

View File

@ -1,3 +1,4 @@
//go:build !cgo && windows
// +build !cgo,windows
/*

View File

@ -1,3 +1,4 @@
//go:build cgo
// +build cgo
/*
@ -15,7 +16,7 @@
package fuse
/*
#cgo darwin CFLAGS: -DFUSE_USE_VERSION=28 -D_FILE_OFFSET_BITS=64 -I/usr/local/include/osxfuse/fuse
#cgo darwin CFLAGS: -DFUSE_USE_VERSION=28 -D_FILE_OFFSET_BITS=64 -I/usr/local/include/osxfuse/fuse -I/usr/local/include/fuse
#cgo freebsd CFLAGS: -DFUSE_USE_VERSION=28 -D_FILE_OFFSET_BITS=64 -I/usr/local/include/fuse
#cgo netbsd CFLAGS: -DFUSE_USE_VERSION=28 -D_FILE_OFFSET_BITS=64 -D_KERNTYPES
#cgo openbsd CFLAGS: -DFUSE_USE_VERSION=28 -D_FILE_OFFSET_BITS=64
@ -171,6 +172,8 @@ static void *cgofuse_init_fuse(void)
h = dlopen("/usr/local/lib/libfuse.2.dylib", RTLD_NOW); // MacFUSE/OSXFuse >= v4
if (0 == h)
h = dlopen("/usr/local/lib/libosxfuse.2.dylib", RTLD_NOW); // MacFUSE/OSXFuse < v4
if (0 == h)
h = dlopen("/usr/local/lib/libfuse-t.dylib", RTLD_NOW); // FUSE-T
#elif defined(__FreeBSD__)
h = dlopen("libfuse.so.2", RTLD_NOW);
#elif defined(__NetBSD__)
@ -215,7 +218,9 @@ static int (* pfn_fsp_fuse_notify)(struct fsp_fuse_env *env,
static NTSTATUS FspLoad(void **PModule)
{
#if defined(_WIN64)
#if defined(__aarch64__)
#define FSP_DLLNAME "winfsp-a64.dll"
#elif defined(__amd64__)
#define FSP_DLLNAME "winfsp-x64.dll"
#else
#define FSP_DLLNAME "winfsp-x86.dll"
@ -629,9 +634,21 @@ static int hostUnmount(struct fuse *fuse, char *mountpoint)
if (0 == umount2(mountpoint, MNT_DETACH))
return 1;
// linux: umount2 failed; try fusermount
char *argv[] =
char *paths[] =
{
"/bin/fusermount",
"/usr/bin/fusermount",
};
char *path = paths[0];
for (size_t i = 0; sizeof paths / sizeof paths[0] > i; i++)
if (0 == access(paths[i], X_OK))
{
path = paths[i];
break;
}
char *argv[] =
{
path,
"-z",
"-u",
mountpoint,

View File

@ -1,3 +1,4 @@
//go:build !cgo && windows
// +build !cgo,windows
/*
@ -16,6 +17,7 @@ package fuse
import (
"path/filepath"
"runtime"
"sync"
"syscall"
"unsafe"
@ -539,9 +541,12 @@ func c_hostOptParse(args *c_struct_fuse_args, data unsafe.Pointer, opts *c_struc
func fspload() (dll *syscall.DLL, err error) {
dllname := ""
if uint64(0xffffffff) < uint64(^uintptr(0)) {
switch runtime.GOARCH {
case "arm64":
dllname = "winfsp-a64.dll"
case "amd64":
dllname = "winfsp-x64.dll"
} else {
case "386":
dllname = "winfsp-x86.dll"
}

View File

@ -1,3 +1,4 @@
//go:build darwin || freebsd || netbsd || openbsd || linux
// +build darwin freebsd netbsd openbsd linux
/*

View File

@ -1,3 +1,4 @@
//go:build windows
// +build windows
/*

2
go.mod
View File

@ -1,3 +1,3 @@
module github.com/winfsp/cgofuse
go 1.16
go 1.17