From e96100b5ac95a350504623c75f2f14136ff4b4be Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Wed, 25 Mar 2015 09:55:11 +1100 Subject: [PATCH] Fixed hellofs. --- samples/hellofs/hello_fs.go | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/samples/hellofs/hello_fs.go b/samples/hellofs/hello_fs.go index f0722d5..2957ce0 100644 --- a/samples/hellofs/hello_fs.go +++ b/samples/hellofs/hello_fs.go @@ -147,11 +147,17 @@ func (fs *helloFS) patchAttributes( attr.Crtime = now } -func (fs *helloFS) Init(op *fuseops.InitOp) (err error) { +func (fs *helloFS) Init(op *fuseops.InitOp) { + var err error + defer func() { op.Respond(err) }() + return } -func (fs *helloFS) LookUpInode(op *fuseops.LookUpInodeOp) (err error) { +func (fs *helloFS) LookUpInode(op *fuseops.LookUpInodeOp) { + var err error + defer func() { op.Respond(err) }() + // Find the info for the parent. parentInfo, ok := gInodeInfo[op.Parent] if !ok { @@ -176,7 +182,10 @@ func (fs *helloFS) LookUpInode(op *fuseops.LookUpInodeOp) (err error) { } func (fs *helloFS) GetInodeAttributes( - op *fuseops.GetInodeAttributesOp) (err error) { + op *fuseops.GetInodeAttributesOp) { + var err error + defer func() { op.Respond(err) }() + // Find the info for this inode. info, ok := gInodeInfo[op.Inode] if !ok { @@ -194,13 +203,19 @@ func (fs *helloFS) GetInodeAttributes( } func (fs *helloFS) OpenDir( - op *fuseops.OpenDirOp) (err error) { + op *fuseops.OpenDirOp) { + var err error + defer func() { op.Respond(err) }() + // Allow opening any directory. return } func (fs *helloFS) ReadDir( - op *fuseops.ReadDirOp) (err error) { + op *fuseops.ReadDirOp) { + var err error + defer func() { op.Respond(err) }() + // Find the info for this inode. info, ok := gInodeInfo[op.Inode] if !ok { @@ -236,13 +251,19 @@ func (fs *helloFS) ReadDir( } func (fs *helloFS) OpenFile( - op *fuseops.OpenFileOp) (err error) { + op *fuseops.OpenFileOp) { + var err error + defer func() { op.Respond(err) }() + // Allow opening any file. return } func (fs *helloFS) ReadFile( - op *fuseops.ReadFileOp) (err error) { + op *fuseops.ReadFileOp) { + var err error + defer func() { op.Respond(err) }() + // Let io.ReaderAt deal with the semantics. reader := strings.NewReader("Hello, world!")