Skip to content

Commit

Permalink
adjust name
Browse files Browse the repository at this point in the history
  • Loading branch information
SandyXSD committed Nov 6, 2024
1 parent 54bd1dd commit e69ff83
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fuse/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ type ReadResult interface {
Done()
}

type ReadResultFd interface {
type ReadResultWithFd interface {
ReadResult
ReadFd() uintptr
}
Expand Down
2 changes: 1 addition & 1 deletion fuse/opcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 4 additions & 0 deletions fuse/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion fuse/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e69ff83

Please sign in to comment.