aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend_reverse
diff options
context:
space:
mode:
Diffstat (limited to 'internal/fusefrontend_reverse')
-rw-r--r--internal/fusefrontend_reverse/file.go11
-rw-r--r--internal/fusefrontend_reverse/file_api_check.go23
2 files changed, 21 insertions, 13 deletions
diff --git a/internal/fusefrontend_reverse/file.go b/internal/fusefrontend_reverse/file.go
index 55f5f80..294872f 100644
--- a/internal/fusefrontend_reverse/file.go
+++ b/internal/fusefrontend_reverse/file.go
@@ -68,3 +68,14 @@ func (f *File) Read(ctx context.Context, buf []byte, ioff int64) (resultData fus
func (f *File) Release(context.Context) syscall.Errno {
return fs.ToErrno(f.fd.Close())
}
+
+// Lseek - FUSE call.
+func (f *File) Lseek(ctx context.Context, off uint64, whence uint32) (uint64, syscall.Errno) {
+ plainOff := f.contentEnc.CipherSizeToPlainSize(off)
+ newPlainOff, err := syscall.Seek(int(f.fd.Fd()), int64(plainOff), int(whence))
+ if err != nil {
+ return 0, fs.ToErrno(err)
+ }
+ newOff := f.contentEnc.PlainSizeToCipherSize(uint64(newPlainOff))
+ return newOff, 0
+}
diff --git a/internal/fusefrontend_reverse/file_api_check.go b/internal/fusefrontend_reverse/file_api_check.go
index 201f1ea..b7e59d4 100644
--- a/internal/fusefrontend_reverse/file_api_check.go
+++ b/internal/fusefrontend_reverse/file_api_check.go
@@ -7,22 +7,19 @@ import (
// Check that we have implemented the fs.File* interfaces
var _ = (fs.FileReader)((*File)(nil))
var _ = (fs.FileReleaser)((*File)(nil))
-
-/* TODO
-var _ = (fs.FileLseeker)((*File2)(nil))
-*/
+var _ = (fs.FileLseeker)((*File)(nil))
/* Not needed
-var _ = (fs.FileGetattrer)((*File2)(nil))
-var _ = (fs.FileGetlker)((*File2)(nil))
-var _ = (fs.FileSetlker)((*File2)(nil))
-var _ = (fs.FileSetlkwer)((*File2)(nil))
+var _ = (fs.FileGetattrer)((*File)(nil))
+var _ = (fs.FileGetlker)((*File)(nil))
+var _ = (fs.FileSetlker)((*File)(nil))
+var _ = (fs.FileSetlkwer)((*File)(nil))
*/
/* Will not implement these - reverse mode is read-only!
-var _ = (fs.FileSetattrer)((*File2)(nil))
-var _ = (fs.FileWriter)((*File2)(nil))
-var _ = (fs.FileFsyncer)((*File2)(nil))
-var _ = (fs.FileFlusher)((*File2)(nil))
-var _ = (fs.FileAllocater)((*File2)(nil))
+var _ = (fs.FileSetattrer)((*File)(nil))
+var _ = (fs.FileWriter)((*File)(nil))
+var _ = (fs.FileFsyncer)((*File)(nil))
+var _ = (fs.FileFlusher)((*File)(nil))
+var _ = (fs.FileAllocater)((*File)(nil))
*/