diff --git a/go.mod b/go.mod index 7f4e090e7..ec6403e86 100644 --- a/go.mod +++ b/go.mod @@ -26,6 +26,7 @@ require ( github.com/gabriel-vasile/mimetype v1.4.2 github.com/gdamore/tcell/v2 v2.6.0 github.com/go-chi/chi/v5 v5.0.10 + github.com/go-git/go-billy/v5 v5.4.1 github.com/google/uuid v1.3.1 github.com/hanwen/go-fuse/v2 v2.3.0 github.com/henrybear327/Proton-API-Bridge v0.0.0-20230908065933-5bfa15b567db diff --git a/go.sum b/go.sum index 8d836dfd2..2cc19dab3 100644 --- a/go.sum +++ b/go.sum @@ -187,6 +187,8 @@ github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod github.com/glycerine/goconvey v0.0.0-20180728074245-46e3a41ad493/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4= +github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= diff --git a/vfs/read_write.go b/vfs/read_write.go index ead0f6b23..4130e68b0 100644 --- a/vfs/read_write.go +++ b/vfs/read_write.go @@ -30,6 +30,16 @@ type RWFileHandle struct { writeCalled bool // if any Write() methods have been called } +// Lock performs Unix locking, not supported +func (fh *RWFileHandle) Lock() error { + return os.ErrInvalid +} + +// Unlock performs Unix unlocking, not supported +func (fh *RWFileHandle) Unlock() error { + return os.ErrInvalid +} + func newRWFileHandle(d *Dir, f *File, flags int) (fh *RWFileHandle, err error) { defer log.Trace(f.Path(), "")("err=%v", &err) // get an item to represent this from the cache diff --git a/vfs/vfs.go b/vfs/vfs.go index 82f926b50..5202d8cf6 100644 --- a/vfs/vfs.go +++ b/vfs/vfs.go @@ -32,6 +32,7 @@ import ( "sync/atomic" "time" + "github.com/go-git/go-billy/v5" "github.com/rclone/rclone/fs" "github.com/rclone/rclone/fs/cache" "github.com/rclone/rclone/fs/log" @@ -119,6 +120,8 @@ type Handle interface { Release() error Node() Node // Size() int64 + Lock() error + Unlock() error } // baseHandle implements all the missing methods @@ -144,16 +147,19 @@ func (h baseHandle) WriteString(s string) (n int, err error) { retu func (h baseHandle) Flush() (err error) { return ENOSYS } func (h baseHandle) Release() (err error) { return ENOSYS } func (h baseHandle) Node() Node { return nil } +func (h baseHandle) Unlock() error { return os.ErrInvalid } +func (h baseHandle) Lock() error { return os.ErrInvalid } //func (h baseHandle) Size() int64 { return 0 } // Check interfaces var ( - _ OsFiler = (*os.File)(nil) - _ Handle = (*baseHandle)(nil) - _ Handle = (*ReadFileHandle)(nil) - _ Handle = (*WriteFileHandle)(nil) - _ Handle = (*DirHandle)(nil) + _ OsFiler = (*os.File)(nil) + _ Handle = (*baseHandle)(nil) + _ Handle = (*ReadFileHandle)(nil) + _ Handle = (*WriteFileHandle)(nil) + _ Handle = (*DirHandle)(nil) + _ billy.File = (Handle)(nil) ) // VFS represents the top level filing system diff --git a/vfs/vfstest/os.go b/vfs/vfstest/os.go index d12f55ddb..6e7a1b640 100644 --- a/vfs/vfstest/os.go +++ b/vfs/vfstest/os.go @@ -48,6 +48,14 @@ func (f realOsFile) Node() vfs.Node { return nil } +func (f realOsFile) Lock() error { + return os.ErrInvalid +} + +func (f realOsFile) Unlock() error { + return os.ErrInvalid +} + // Chtimes func (r realOs) Chtimes(name string, atime time.Time, mtime time.Time) error { return os.Chtimes(name, atime, mtime)