Commit 9c331316 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse: add cancel channel to Release call

This is unlikely to be useful, but makes the API more uniform.
parent cbed0736
...@@ -246,7 +246,7 @@ type RawFileSystem interface { ...@@ -246,7 +246,7 @@ type RawFileSystem interface {
SetLk(cancel <-chan struct{}, input *LkIn) (code Status) SetLk(cancel <-chan struct{}, input *LkIn) (code Status)
SetLkw(cancel <-chan struct{}, input *LkIn) (code Status) SetLkw(cancel <-chan struct{}, input *LkIn) (code Status)
Release(input *ReleaseIn) Release(cancel <-chan struct{}, input *ReleaseIn)
Write(cancel <-chan struct{}, input *WriteIn, data []byte) (written uint32, code Status) Write(cancel <-chan struct{}, input *WriteIn, data []byte) (written uint32, code Status)
CopyFileRange(cancel <-chan struct{}, input *CopyFileRangeIn) (written uint32, code Status) CopyFileRange(cancel <-chan struct{}, input *CopyFileRangeIn) (written uint32, code Status)
......
...@@ -125,7 +125,7 @@ func (fs *defaultRawFileSystem) SetLkw(cancel <-chan struct{}, in *LkIn) (code S ...@@ -125,7 +125,7 @@ func (fs *defaultRawFileSystem) SetLkw(cancel <-chan struct{}, in *LkIn) (code S
return ENOSYS return ENOSYS
} }
func (fs *defaultRawFileSystem) Release(input *ReleaseIn) { func (fs *defaultRawFileSystem) Release(cancel <-chan struct{}, input *ReleaseIn) {
} }
func (fs *defaultRawFileSystem) Write(cancel <-chan struct{}, input *WriteIn, data []byte) (written uint32, code Status) { func (fs *defaultRawFileSystem) Write(cancel <-chan struct{}, input *WriteIn, data []byte) (written uint32, code Status) {
......
...@@ -362,7 +362,7 @@ func (c *rawBridge) Create(cancel <-chan struct{}, input *fuse.CreateIn, name st ...@@ -362,7 +362,7 @@ func (c *rawBridge) Create(cancel <-chan struct{}, input *fuse.CreateIn, name st
return code return code
} }
func (c *rawBridge) Release(input *fuse.ReleaseIn) { func (c *rawBridge) Release(cancel <-chan struct{}, input *fuse.ReleaseIn) {
if input.Fh != 0 { if input.Fh != 0 {
node := c.toInode(input.NodeId) node := c.toInode(input.NodeId)
opened := node.mount.unregisterFileHandle(input.Fh, node) opened := node.mount.unregisterFileHandle(input.Fh, node)
......
...@@ -360,7 +360,7 @@ func doFlush(server *Server, req *request) { ...@@ -360,7 +360,7 @@ func doFlush(server *Server, req *request) {
} }
func doRelease(server *Server, req *request) { func doRelease(server *Server, req *request) {
server.fileSystem.Release((*ReleaseIn)(req.inData)) server.fileSystem.Release(req.cancel, (*ReleaseIn)(req.inData))
} }
func doFsync(server *Server, req *request) { func doFsync(server *Server, req *request) {
......
...@@ -550,15 +550,14 @@ func (b *rawBridge) SetLkw(cancel <-chan struct{}, input *fuse.LkIn) fuse.Status ...@@ -550,15 +550,14 @@ func (b *rawBridge) SetLkw(cancel <-chan struct{}, input *fuse.LkIn) fuse.Status
return fuse.ENOTSUP return fuse.ENOTSUP
} }
func (b *rawBridge) Release(input *fuse.ReleaseIn) { func (b *rawBridge) Release(cancel <-chan struct{}, input *fuse.ReleaseIn) {
// XXX should have cancel channel too.
n, f := b.releaseFileEntry(input.NodeId, input.Fh) n, f := b.releaseFileEntry(input.NodeId, input.Fh)
if f == nil { if f == nil {
return return
} }
f.wg.Wait() f.wg.Wait()
n.fileOps().Release(&fuse.Context{Caller: input.Caller, Cancel: nil}, f.file) n.fileOps().Release(&fuse.Context{Caller: input.Caller, Cancel: cancel}, f.file)
b.mu.Lock() b.mu.Lock()
defer b.mu.Unlock() defer b.mu.Unlock()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment