Commit 82289ebd authored by Aaron Jacobs's avatar Aaron Jacobs

Fixed sample build errors.

parent e7a97bf9
......@@ -19,6 +19,8 @@ import (
"os"
"time"
"golang.org/x/net/context"
"github.com/jacobsa/fuse"
"github.com/jacobsa/fuse/fuseops"
"github.com/jacobsa/fuse/fuseutil"
......@@ -240,6 +242,7 @@ func (fs *cachingFS) SetMtime(mtime time.Time) {
// LOCKS_EXCLUDED(fs.mu)
func (fs *cachingFS) LookUpInode(
ctx context.Context,
op *fuseops.LookUpInodeOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
......@@ -294,6 +297,7 @@ func (fs *cachingFS) LookUpInode(
// LOCKS_EXCLUDED(fs.mu)
func (fs *cachingFS) GetInodeAttributes(
ctx context.Context,
op *fuseops.GetInodeAttributesOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
......@@ -323,11 +327,13 @@ func (fs *cachingFS) GetInodeAttributes(
}
func (fs *cachingFS) OpenDir(
ctx context.Context,
op *fuseops.OpenDirOp) (err error) {
return
}
func (fs *cachingFS) OpenFile(
ctx context.Context,
op *fuseops.OpenFileOp) (err error) {
return
}
......@@ -19,6 +19,8 @@ import (
"os"
"sync"
"golang.org/x/net/context"
"github.com/jacobsa/fuse"
"github.com/jacobsa/fuse/fuseops"
"github.com/jacobsa/fuse/fuseutil"
......@@ -93,6 +95,7 @@ func (fs *flushFS) barAttributes() fuseops.InodeAttributes {
////////////////////////////////////////////////////////////////////////
func (fs *flushFS) LookUpInode(
ctx context.Context,
op *fuseops.LookUpInodeOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
......@@ -126,6 +129,7 @@ func (fs *flushFS) LookUpInode(
}
func (fs *flushFS) GetInodeAttributes(
ctx context.Context,
op *fuseops.GetInodeAttributesOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
......@@ -150,6 +154,7 @@ func (fs *flushFS) GetInodeAttributes(
}
func (fs *flushFS) OpenFile(
ctx context.Context,
op *fuseops.OpenFileOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
......@@ -164,6 +169,7 @@ func (fs *flushFS) OpenFile(
}
func (fs *flushFS) ReadFile(
ctx context.Context,
op *fuseops.ReadFileOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
......@@ -181,6 +187,7 @@ func (fs *flushFS) ReadFile(
}
func (fs *flushFS) WriteFile(
ctx context.Context,
op *fuseops.WriteFileOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
......@@ -204,6 +211,7 @@ func (fs *flushFS) WriteFile(
}
func (fs *flushFS) SyncFile(
ctx context.Context,
op *fuseops.SyncFileOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
......@@ -213,6 +221,7 @@ func (fs *flushFS) SyncFile(
}
func (fs *flushFS) FlushFile(
ctx context.Context,
op *fuseops.FlushFileOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
......@@ -222,6 +231,7 @@ func (fs *flushFS) FlushFile(
}
func (fs *flushFS) OpenDir(
ctx context.Context,
op *fuseops.OpenDirOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
......@@ -240,6 +250,7 @@ func (fs *flushFS) OpenDir(
}
func (fs *flushFS) ReadDir(
ctx context.Context,
op *fuseops.ReadDirOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
......
......@@ -18,6 +18,8 @@ import (
"fmt"
"os"
"golang.org/x/net/context"
"github.com/jacobsa/fuse"
"github.com/jacobsa/fuse/fuseops"
"github.com/jacobsa/fuse/fuseutil"
......@@ -223,6 +225,7 @@ func (fs *fsImpl) findInodeByID(id fuseops.InodeID) (in *inode) {
////////////////////////////////////////////////////////////////////////
func (fs *fsImpl) LookUpInode(
ctx context.Context,
op *fuseops.LookUpInodeOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
......@@ -258,6 +261,7 @@ func (fs *fsImpl) LookUpInode(
}
func (fs *fsImpl) GetInodeAttributes(
ctx context.Context,
op *fuseops.GetInodeAttributesOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
......@@ -272,6 +276,7 @@ func (fs *fsImpl) GetInodeAttributes(
}
func (fs *fsImpl) ForgetInode(
ctx context.Context,
op *fuseops.ForgetInodeOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
......@@ -284,6 +289,7 @@ func (fs *fsImpl) ForgetInode(
}
func (fs *fsImpl) MkDir(
ctx context.Context,
op *fuseops.MkDirOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
......@@ -315,6 +321,7 @@ func (fs *fsImpl) MkDir(
}
func (fs *fsImpl) CreateFile(
ctx context.Context,
op *fuseops.CreateFileOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
......@@ -346,6 +353,7 @@ func (fs *fsImpl) CreateFile(
}
func (fs *fsImpl) OpenFile(
ctx context.Context,
op *fuseops.OpenFileOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
......@@ -357,6 +365,7 @@ func (fs *fsImpl) OpenFile(
}
func (fs *fsImpl) OpenDir(
ctx context.Context,
op *fuseops.OpenDirOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
......
......@@ -19,6 +19,8 @@ import (
"os"
"strings"
"golang.org/x/net/context"
"github.com/jacobsa/fuse"
"github.com/jacobsa/fuse/fuseops"
"github.com/jacobsa/fuse/fuseutil"
......@@ -147,7 +149,9 @@ func (fs *helloFS) patchAttributes(
attr.Crtime = now
}
func (fs *helloFS) LookUpInode(op *fuseops.LookUpInodeOp) (err error) {
func (fs *helloFS) LookUpInode(
ctx context.Context,
op *fuseops.LookUpInodeOp) (err error) {
// Find the info for the parent.
parentInfo, ok := gInodeInfo[op.Parent]
if !ok {
......@@ -172,6 +176,7 @@ func (fs *helloFS) LookUpInode(op *fuseops.LookUpInodeOp) (err error) {
}
func (fs *helloFS) GetInodeAttributes(
ctx context.Context,
op *fuseops.GetInodeAttributesOp) (err error) {
// Find the info for this inode.
info, ok := gInodeInfo[op.Inode]
......@@ -190,12 +195,14 @@ func (fs *helloFS) GetInodeAttributes(
}
func (fs *helloFS) OpenDir(
ctx context.Context,
op *fuseops.OpenDirOp) (err error) {
// Allow opening any directory.
return
}
func (fs *helloFS) ReadDir(
ctx context.Context,
op *fuseops.ReadDirOp) (err error) {
// Find the info for this inode.
info, ok := gInodeInfo[op.Inode]
......@@ -232,12 +239,14 @@ func (fs *helloFS) ReadDir(
}
func (fs *helloFS) OpenFile(
ctx context.Context,
op *fuseops.OpenFileOp) (err error) {
// Allow opening any file.
return
}
func (fs *helloFS) ReadFile(
ctx context.Context,
op *fuseops.ReadFileOp) (err error) {
// Let io.ReaderAt deal with the semantics.
reader := strings.NewReader("Hello, world!")
......
......@@ -19,6 +19,8 @@ import (
"os"
"sync"
"golang.org/x/net/context"
"github.com/jacobsa/fuse"
"github.com/jacobsa/fuse/fuseops"
"github.com/jacobsa/fuse/fuseutil"
......@@ -78,6 +80,7 @@ func (fs *InterruptFS) WaitForReadInFlight() {
////////////////////////////////////////////////////////////////////////
func (fs *InterruptFS) LookUpInode(
ctx context.Context,
op *fuseops.LookUpInodeOp) (err error) {
// We support only one parent.
if op.Parent != fuseops.RootInodeID {
......@@ -99,6 +102,7 @@ func (fs *InterruptFS) LookUpInode(
}
func (fs *InterruptFS) GetInodeAttributes(
ctx context.Context,
op *fuseops.GetInodeAttributesOp) (err error) {
switch op.Inode {
case fuseops.RootInodeID:
......@@ -116,11 +120,13 @@ func (fs *InterruptFS) GetInodeAttributes(
}
func (fs *InterruptFS) OpenFile(
ctx context.Context,
op *fuseops.OpenFileOp) (err error) {
return
}
func (fs *InterruptFS) ReadFile(
ctx context.Context,
op *fuseops.ReadFileOp) (err error) {
// Signal that a read has been received.
fs.mu.Lock()
......@@ -129,7 +135,7 @@ func (fs *InterruptFS) ReadFile(
fs.mu.Unlock()
// Wait for cancellation.
done := op.Context().Done()
done := ctx.Done()
if done == nil {
panic("Expected non-nil channel.")
}
......@@ -137,7 +143,7 @@ func (fs *InterruptFS) ReadFile(
<-done
// Return the context's error.
err = op.Context().Err()
err = ctx.Err()
return
}
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