Commit 4ed8a459 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Hide DefaultRawFileSystem type to reduce API clutter.

parent 92e2381b
......@@ -223,7 +223,7 @@ type MountOptions struct {
// interactions with open files, renames, and threading right etc. are
// somewhat tricky and not very interesting.
//
// Include DefaultRawFileSystem to inherit a null implementation.
// A null implementation is provided by NewDefaultRawFileSystem.
type RawFileSystem interface {
String() string
......@@ -280,9 +280,6 @@ type RawFileSystem interface {
Init(params *RawFsInit)
}
// DefaultRawFileSystem returns ENOSYS for every operation.
type DefaultRawFileSystem struct{}
// Talk back to FUSE.
//
// InodeNotify invalidates the information associated with the inode
......
......@@ -6,135 +6,142 @@ import (
"os"
)
var _ = RawFileSystem((*DefaultRawFileSystem)(nil))
// NewDefaultRawFileSystem returns ENOSYS (not implemented) for all
// operations.
func NewDefaultRawFileSystem() RawFileSystem {
return &defaultRawFileSystem{}
}
type defaultRawFileSystem struct{}
func (fs *DefaultRawFileSystem) Init(init *RawFsInit) {
func (fs *defaultRawFileSystem) Init(init *RawFsInit) {
}
func (fs *DefaultRawFileSystem) String() string {
func (fs *defaultRawFileSystem) String() string {
return os.Args[0]
}
func (fs *DefaultRawFileSystem) SetDebug(dbg bool) {
func (fs *defaultRawFileSystem) SetDebug(dbg bool) {
}
func (fs *DefaultRawFileSystem) StatFs(out *StatfsOut, context *Context) Status {
func (fs *defaultRawFileSystem) StatFs(out *StatfsOut, context *Context) Status {
return ENOSYS
}
func (fs *DefaultRawFileSystem) Lookup(out *raw.EntryOut, context *Context, name string) (code Status) {
func (fs *defaultRawFileSystem) Lookup(out *raw.EntryOut, context *Context, name string) (code Status) {
return ENOSYS
}
func (fs *DefaultRawFileSystem) Forget(nodeID, nlookup uint64) {
func (fs *defaultRawFileSystem) Forget(nodeID, nlookup uint64) {
}
func (fs *DefaultRawFileSystem) GetAttr(out *raw.AttrOut, context *Context, input *raw.GetAttrIn) (code Status) {
func (fs *defaultRawFileSystem) GetAttr(out *raw.AttrOut, context *Context, input *raw.GetAttrIn) (code Status) {
return ENOSYS
}
func (fs *DefaultRawFileSystem) Open(out *raw.OpenOut, context *Context, input *raw.OpenIn) (status Status) {
func (fs *defaultRawFileSystem) Open(out *raw.OpenOut, context *Context, input *raw.OpenIn) (status Status) {
return OK
}
func (fs *DefaultRawFileSystem) SetAttr(out *raw.AttrOut, context *Context, input *raw.SetAttrIn) (code Status) {
func (fs *defaultRawFileSystem) SetAttr(out *raw.AttrOut, context *Context, input *raw.SetAttrIn) (code Status) {
return ENOSYS
}
func (fs *DefaultRawFileSystem) Readlink(context *Context) (out []byte, code Status) {
func (fs *defaultRawFileSystem) Readlink(context *Context) (out []byte, code Status) {
return nil, ENOSYS
}
func (fs *DefaultRawFileSystem) Mknod(out *raw.EntryOut, context *Context, input *raw.MknodIn, name string) (code Status) {
func (fs *defaultRawFileSystem) Mknod(out *raw.EntryOut, context *Context, input *raw.MknodIn, name string) (code Status) {
return ENOSYS
}
func (fs *DefaultRawFileSystem) Mkdir(out *raw.EntryOut, context *Context, input *raw.MkdirIn, name string) (code Status) {
func (fs *defaultRawFileSystem) Mkdir(out *raw.EntryOut, context *Context, input *raw.MkdirIn, name string) (code Status) {
return ENOSYS
}
func (fs *DefaultRawFileSystem) Unlink(context *Context, name string) (code Status) {
func (fs *defaultRawFileSystem) Unlink(context *Context, name string) (code Status) {
return ENOSYS
}
func (fs *DefaultRawFileSystem) Rmdir(context *Context, name string) (code Status) {
func (fs *defaultRawFileSystem) Rmdir(context *Context, name string) (code Status) {
return ENOSYS
}
func (fs *DefaultRawFileSystem) Symlink(out *raw.EntryOut, context *Context, pointedTo string, linkName string) (code Status) {
func (fs *defaultRawFileSystem) Symlink(out *raw.EntryOut, context *Context, pointedTo string, linkName string) (code Status) {
return ENOSYS
}
func (fs *DefaultRawFileSystem) Rename(context *Context, input *raw.RenameIn, oldName string, newName string) (code Status) {
func (fs *defaultRawFileSystem) Rename(context *Context, input *raw.RenameIn, oldName string, newName string) (code Status) {
return ENOSYS
}
func (fs *DefaultRawFileSystem) Link(out *raw.EntryOut, context *Context, input *raw.LinkIn, name string) (code Status) {
func (fs *defaultRawFileSystem) Link(out *raw.EntryOut, context *Context, input *raw.LinkIn, name string) (code Status) {
return ENOSYS
}
func (fs *DefaultRawFileSystem) GetXAttrSize(context *Context, attr string) (size int, code Status) {
func (fs *defaultRawFileSystem) GetXAttrSize(context *Context, attr string) (size int, code Status) {
return 0, ENOSYS
}
func (fs *DefaultRawFileSystem) GetXAttrData(context *Context, attr string) (data []byte, code Status) {
func (fs *defaultRawFileSystem) GetXAttrData(context *Context, attr string) (data []byte, code Status) {
return nil, ENOSYS
}
func (fs *DefaultRawFileSystem) SetXAttr(context *Context, input *raw.SetXAttrIn, attr string, data []byte) Status {
func (fs *defaultRawFileSystem) SetXAttr(context *Context, input *raw.SetXAttrIn, attr string, data []byte) Status {
return ENOSYS
}
func (fs *DefaultRawFileSystem) ListXAttr(context *Context) (data []byte, code Status) {
func (fs *defaultRawFileSystem) ListXAttr(context *Context) (data []byte, code Status) {
return nil, ENOSYS
}
func (fs *DefaultRawFileSystem) RemoveXAttr(context *Context, attr string) Status {
func (fs *defaultRawFileSystem) RemoveXAttr(context *Context, attr string) Status {
return ENOSYS
}
func (fs *DefaultRawFileSystem) Access(context *Context, input *raw.AccessIn) (code Status) {
func (fs *defaultRawFileSystem) Access(context *Context, input *raw.AccessIn) (code Status) {
return ENOSYS
}
func (fs *DefaultRawFileSystem) Create(out *raw.CreateOut, context *Context, input *raw.CreateIn, name string) (code Status) {
func (fs *defaultRawFileSystem) Create(out *raw.CreateOut, context *Context, input *raw.CreateIn, name string) (code Status) {
return ENOSYS
}
func (fs *DefaultRawFileSystem) OpenDir(out *raw.OpenOut, context *Context, input *raw.OpenIn) (status Status) {
func (fs *defaultRawFileSystem) OpenDir(out *raw.OpenOut, context *Context, input *raw.OpenIn) (status Status) {
return ENOSYS
}
func (fs *DefaultRawFileSystem) Read(context *Context, input *raw.ReadIn, buf []byte) (ReadResult, Status) {
func (fs *defaultRawFileSystem) Read(context *Context, input *raw.ReadIn, buf []byte) (ReadResult, Status) {
return &ReadResultData{}, ENOSYS
}
func (fs *DefaultRawFileSystem) Release(context *Context, input *raw.ReleaseIn) {
func (fs *defaultRawFileSystem) Release(context *Context, input *raw.ReleaseIn) {
}
func (fs *DefaultRawFileSystem) Write(context *Context, input *raw.WriteIn, data []byte) (written uint32, code Status) {
func (fs *defaultRawFileSystem) Write(context *Context, input *raw.WriteIn, data []byte) (written uint32, code Status) {
return 0, ENOSYS
}
func (fs *DefaultRawFileSystem) Flush(context *Context, input *raw.FlushIn) Status {
func (fs *defaultRawFileSystem) Flush(context *Context, input *raw.FlushIn) Status {
return OK
}
func (fs *DefaultRawFileSystem) Fsync(context *Context, input *raw.FsyncIn) (code Status) {
func (fs *defaultRawFileSystem) Fsync(context *Context, input *raw.FsyncIn) (code Status) {
return ENOSYS
}
func (fs *DefaultRawFileSystem) ReadDir(l *DirEntryList, context *Context, input *raw.ReadIn) Status {
func (fs *defaultRawFileSystem) ReadDir(l *DirEntryList, context *Context, input *raw.ReadIn) Status {
return ENOSYS
}
func (fs *DefaultRawFileSystem) ReleaseDir(context *Context, input *raw.ReleaseIn) {
func (fs *defaultRawFileSystem) ReleaseDir(context *Context, input *raw.ReleaseIn) {
}
func (fs *DefaultRawFileSystem) FsyncDir(context *Context, input *raw.FsyncIn) (code Status) {
func (fs *defaultRawFileSystem) FsyncDir(context *Context, input *raw.FsyncIn) (code Status) {
return ENOSYS
}
func (fs *DefaultRawFileSystem) Fallocate(context *Context, in *raw.FallocateIn) (code Status) {
func (fs *defaultRawFileSystem) Fallocate(context *Context, in *raw.FallocateIn) (code Status) {
return ENOSYS
}
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