From ce18045adbb8abbdf0534a619afbd1d7bfa72035 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Fri, 1 Nov 2024 13:39:38 +0100 Subject: [PATCH] fuse: fold systemWrite and write together Change-Id: Iddf69afb97c1437b874d9cb0220bada5072b7f63 --- fuse/server.go | 10 +++------- fuse/server_linux.go | 2 +- fuse/server_unix.go | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/fuse/server.go b/fuse/server.go index 1d0eb769..4e46c6c2 100644 --- a/fuse/server.go +++ b/fuse/server.go @@ -612,15 +612,11 @@ func (ms *Server) handleRequest(req *requestAlloc) Status { req.outPayload = ms.buffers.AllocBuffer(uint32(outPayloadSize)) } ms.innerHandleRequest(h, &req.request) - code = ms.write(&req.request) - return code -} - -func (ms *Server) write(req *request) Status { if req.suppressReply { return OK } - errno := ms.systemWrite(req) + + errno := ms.write(&req.request) if errno != 0 { // Ignore ENOENT for INTERRUPT responses which // indicates that the referred request is no longer @@ -703,7 +699,7 @@ func (ms *Server) notifyWrite(req *request) Status { // Protect against concurrent close. ms.writeMu.Lock() - result := ms.systemWrite(req) + result := ms.write(req) ms.writeMu.Unlock() if ms.opts.Debug { diff --git a/fuse/server_linux.go b/fuse/server_linux.go index fb73d48e..6e3f61ad 100644 --- a/fuse/server_linux.go +++ b/fuse/server_linux.go @@ -10,7 +10,7 @@ import ( const useSingleReader = false -func (ms *Server) systemWrite(req *request) Status { +func (ms *Server) write(req *request) Status { if req.outPayloadSize() == 0 { err := handleEINTR(func() error { _, err := syscall.Write(ms.mountFd, req.outputBuf) diff --git a/fuse/server_unix.go b/fuse/server_unix.go index b88e3877..0e960c6a 100644 --- a/fuse/server_unix.go +++ b/fuse/server_unix.go @@ -11,7 +11,7 @@ import ( // do not error-out, meaning that unmount will hang. const useSingleReader = true -func (ms *Server) systemWrite(req *request) Status { +func (ms *Server) write(req *request) Status { if req.outPayloadSize() == 0 { err := handleEINTR(func() error { _, err := unix.Write(ms.mountFd, req.outputBuf)