Compare commits

..

No commits in common. "f87f5db493b56c5f4ebe482a1b7d02c7e5d572fa" and "279744a252a0867c1145e1890214a346cc296da5" have entirely different histories.

9 changed files with 7 additions and 42 deletions

View File

@ -3,15 +3,7 @@
**v1.6.0** **v1.6.0**
- Rename import path to `github.com/winfsp/cgofuse`. - Add `FileSystemHost.SetCapDeleteAccess` [Windows only]. A file system can use this capability to deny delete access on Windows. Such a file system must:
- 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: - 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 ```Go
func (fs *filesystem) Access(path string, mask uint32) int { func (fs *filesystem) Access(path string, mask uint32) int {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

2
go.mod
View File

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