aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend_reverse/file.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-08-16 19:58:47 +0200
committerJakob Unterwurzacher2020-08-16 19:58:47 +0200
commitd212b246c5e24e6151bef45ad5a8185fdd12a28f (patch)
treed1d2eecd9fb289b674c426d0ba2bddc6c21b60ff /internal/fusefrontend_reverse/file.go
parent58a2726977a1b1f92063a1e51c0769af71833e72 (diff)
v2api/reverse: implement Lseek
Diffstat (limited to 'internal/fusefrontend_reverse/file.go')
-rw-r--r--internal/fusefrontend_reverse/file.go11
1 files changed, 11 insertions, 0 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
+}