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

Fixed sample build errors.

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