Commit 1ee3533f authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

nodefs: rename DefaultOperations to OperationStubs

parent 0c3074f5
...@@ -53,10 +53,4 @@ Decisions ...@@ -53,10 +53,4 @@ Decisions
To decide To decide
========= =========
* A better name for DefaultOperations.
* InodeLink
* ReadonlyOperations
* BaseOperations
* implement remaining file types (exercise Mknod) * implement remaining file types (exercise Mknod)
...@@ -65,7 +65,7 @@ import ( ...@@ -65,7 +65,7 @@ import (
) )
// Operations is the interface that implements the filesystem inode. // Operations is the interface that implements the filesystem inode.
// Each Operations instance must embed DefaultNode. All error // Each Operations instance must embed OperationStubs. All error
// reporting must use the syscall.Errno type. The value 0 (`OK`) // reporting must use the syscall.Errno type. The value 0 (`OK`)
// should be used to indicate success. // should be used to indicate success.
type Operations interface { type Operations interface {
...@@ -79,12 +79,11 @@ type Operations interface { ...@@ -79,12 +79,11 @@ type Operations interface {
// Inode returns the *Inode associated with this Operations // Inode returns the *Inode associated with this Operations
// instance. The identity of the Inode does not change over // instance. The identity of the Inode does not change over
// the lifetime of the node object. Inode() is provided by // the lifetime of the node object. Inode() is provided by
// DefaultOperations, and should not be reimplemented. // OperationStubs, and should not be reimplemented.
Inode() *Inode Inode() *Inode
// StatFs implements statistics for the filesystem that holds // StatFs implements statistics for the filesystem that holds
// this Inode. DefaultNode implements this, because OSX // this Inode.
// filesystem must have a valid StatFs implementation.
StatFs(ctx context.Context, out *fuse.StatfsOut) syscall.Errno StatFs(ctx context.Context, out *fuse.StatfsOut) syscall.Errno
// Access should return if the caller can access the file with // Access should return if the caller can access the file with
......
...@@ -19,7 +19,7 @@ import ( ...@@ -19,7 +19,7 @@ import (
) )
type keepCacheFile struct { type keepCacheFile struct {
DefaultOperations OperationStubs
keepCache bool keepCache bool
mu sync.Mutex mu sync.Mutex
...@@ -62,7 +62,7 @@ func (f *keepCacheFile) Read(ctx context.Context, fh FileHandle, dest []byte, of ...@@ -62,7 +62,7 @@ func (f *keepCacheFile) Read(ctx context.Context, fh FileHandle, dest []byte, of
} }
type keepCacheRoot struct { type keepCacheRoot struct {
DefaultOperations OperationStubs
keep, nokeep *keepCacheFile keep, nokeep *keepCacheFile
} }
......
This diff is collapsed.
...@@ -17,7 +17,7 @@ import ( ...@@ -17,7 +17,7 @@ import (
) )
type dioRoot struct { type dioRoot struct {
DefaultOperations OperationStubs
} }
func (r *dioRoot) OnAdd(ctx context.Context) { func (r *dioRoot) OnAdd(ctx context.Context) {
...@@ -27,7 +27,7 @@ func (r *dioRoot) OnAdd(ctx context.Context) { ...@@ -27,7 +27,7 @@ func (r *dioRoot) OnAdd(ctx context.Context) {
// A file handle that pretends that every hole/data starts at // A file handle that pretends that every hole/data starts at
// multiples of 1024 // multiples of 1024
type dioFH struct { type dioFH struct {
DefaultFileHandle FileHandleStubs
} }
func (f *dioFH) Lseek(ctx context.Context, off uint64, whence uint32) (uint64, syscall.Errno) { func (f *dioFH) Lseek(ctx context.Context, off uint64, whence uint32) (uint64, syscall.Errno) {
...@@ -42,7 +42,7 @@ func (fh *dioFH) Read(ctx context.Context, data []byte, off int64) (fuse.ReadRes ...@@ -42,7 +42,7 @@ func (fh *dioFH) Read(ctx context.Context, data []byte, off int64) (fuse.ReadRes
// overrides Open so it can return a dioFH file handle // overrides Open so it can return a dioFH file handle
type dioFile struct { type dioFile struct {
DefaultOperations OperationStubs
} }
func (f *dioFile) Open(ctx context.Context, flags uint32) (fh FileHandle, fuseFlags uint32, errno syscall.Errno) { func (f *dioFile) Open(ctx context.Context, flags uint32) (fh FileHandle, fuseFlags uint32, errno syscall.Errno) {
......
...@@ -17,12 +17,12 @@ import ( ...@@ -17,12 +17,12 @@ import (
) )
type interruptRoot struct { type interruptRoot struct {
DefaultOperations OperationStubs
child interruptOps child interruptOps
} }
type interruptOps struct { type interruptOps struct {
DefaultOperations OperationStubs
interrupted bool interrupted bool
} }
......
...@@ -41,7 +41,7 @@ func (n *loopbackRoot) GetAttr(ctx context.Context, out *fuse.AttrOut) syscall.E ...@@ -41,7 +41,7 @@ func (n *loopbackRoot) GetAttr(ctx context.Context, out *fuse.AttrOut) syscall.E
} }
type loopbackNode struct { type loopbackNode struct {
DefaultOperations OperationStubs
} }
func (n *loopbackNode) root() *loopbackRoot { func (n *loopbackNode) root() *loopbackRoot {
......
...@@ -106,7 +106,7 @@ func TestZipFS(t *testing.T) { ...@@ -106,7 +106,7 @@ func TestZipFS(t *testing.T) {
// zipFile is a file read from a zip archive. // zipFile is a file read from a zip archive.
type zipFile struct { type zipFile struct {
DefaultOperations OperationStubs
file *zip.File file *zip.File
mu sync.Mutex mu sync.Mutex
...@@ -157,7 +157,7 @@ func (zf *zipFile) Read(ctx context.Context, f FileHandle, dest []byte, off int6 ...@@ -157,7 +157,7 @@ func (zf *zipFile) Read(ctx context.Context, f FileHandle, dest []byte, off int6
// zipRoot is the root of the Zip filesystem. Its only functionality // zipRoot is the root of the Zip filesystem. Its only functionality
// is populating the filesystem. // is populating the filesystem.
type zipRoot struct { type zipRoot struct {
DefaultOperations OperationStubs
r *zip.Reader r *zip.Reader
} }
...@@ -177,7 +177,7 @@ func (zr *zipRoot) OnAdd(ctx context.Context) { ...@@ -177,7 +177,7 @@ func (zr *zipRoot) OnAdd(ctx context.Context) {
} }
ch := p.GetChild(component) ch := p.GetChild(component)
if ch == nil { if ch == nil {
ch = p.NewPersistentInode(ctx, &DefaultOperations{}, ch = p.NewPersistentInode(ctx, &OperationStubs{},
NodeAttr{Mode: fuse.S_IFDIR}) NodeAttr{Mode: fuse.S_IFDIR})
p.AddChild(component, ch, true) p.AddChild(component, ch, true)
} }
......
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