From e69ff8341b8f35d3ed2bd81dd0b8651d926f8cb4 Mon Sep 17 00:00:00 2001 From: Sandy Xu Date: Wed, 6 Nov 2024 17:29:47 +0800 Subject: [PATCH] adjust name --- fuse/api.go | 2 +- fuse/opcode.go | 2 +- fuse/read.go | 4 ++++ fuse/request.go | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/fuse/api.go b/fuse/api.go index 085d9df53..215d59fd0 100644 --- a/fuse/api.go +++ b/fuse/api.go @@ -112,7 +112,7 @@ type ReadResult interface { Done() } -type ReadResultFd interface { +type ReadResultWithFd interface { ReadResult ReadFd() uintptr } diff --git a/fuse/opcode.go b/fuse/opcode.go index 44f408451..f16b66695 100644 --- a/fuse/opcode.go +++ b/fuse/opcode.go @@ -396,7 +396,7 @@ func doRead(server *Server, req *request) { } req.readResult, req.status = server.fileSystem.Read(req.cancel, in, buf) - if fd, ok := req.readResult.(ReadResultFd); ok { + if fd, ok := req.readResult.(ReadResultWithFd); ok { req.fdData = fd req.flatData = nil } else if req.readResult != nil && req.status.Ok() { diff --git a/fuse/read.go b/fuse/read.go index 22075040b..ee0508155 100644 --- a/fuse/read.go +++ b/fuse/read.go @@ -30,6 +30,10 @@ func ReadResultData(b []byte) ReadResult { return &readResultData{b} } +func ReadResultFd(fd uintptr, off int64, sz int) ReadResult { + return &readResultFd{fd, off, sz} +} + // ReadResultFd is the read return for zero-copy file data. type readResultFd struct { // Splice from the following file. diff --git a/fuse/request.go b/fuse/request.go index 22d0a3e25..8eab1aee9 100644 --- a/fuse/request.go +++ b/fuse/request.go @@ -36,7 +36,7 @@ type request struct { // Output data. status Status flatData []byte - fdData ReadResultFd + fdData ReadResultWithFd slices [][]byte // In case of read, keep read result here so we can call