Commit 66f65406 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Add default implementations.

parent bf20a9f2
......@@ -8,6 +8,7 @@ MANUAL_GOFILES=api.go \
copy.go \
default.go \
defaultfile.go \
defaultnode.go \
defaultraw.go \
direntry.go\
files.go \
......
package fuse
import (
"os"
)
type DefaultNodeFileSystem struct {
root DefaultFsNode
}
func (me *DefaultNodeFileSystem) Unmount() {
}
func (me *DefaultNodeFileSystem) Mount(conn *FileSystemConnector) {
}
func (me *DefaultNodeFileSystem) StatFs() *StatfsOut {
return nil
}
func (me *DefaultNodeFileSystem) Root() FsNode {
return &me.root
}
////////////////////////////////////////////////////////////////
// FsNode default
type DefaultFsNode struct {
inode *Inode
}
func (me *DefaultFsNode) SetInode(node *Inode) {
if me.inode != nil {
panic("already have Inode")
}
me.inode = node
}
func (me *DefaultFsNode) Inode() *Inode {
return me.inode
}
func (me *DefaultFsNode) RmChild(name string, child FsNode) {
}
func (me *DefaultFsNode) AddChild(name string, child FsNode) {
}
func (me *DefaultFsNode) Lookup(name string) (fi *os.FileInfo, node FsNode, code Status) {
return nil, nil, ENOSYS
}
func (me *DefaultFsNode) Access(mode uint32, context *Context) (code Status) {
return ENOSYS
}
func (me *DefaultFsNode) Readlink(c *Context) ([]byte, Status) {
return nil, ENOSYS
}
func (me *DefaultFsNode) Mknod(name string, mode uint32, dev uint32, context *Context) (fi *os.FileInfo, newNode FsNode, code Status) {
return nil, nil, ENOSYS
}
func (me *DefaultFsNode) Mkdir(name string, mode uint32, context *Context) (fi *os.FileInfo, newNode FsNode, code Status) {
return nil, nil, ENOSYS
}
func (me *DefaultFsNode) Unlink(name string, context *Context) (code Status) {
return ENOSYS
}
func (me *DefaultFsNode) Rmdir(name string, context *Context) (code Status) {
return ENOSYS
}
func (me *DefaultFsNode) Symlink(name string, content string, context *Context) (fi *os.FileInfo, newNode FsNode, code Status) {
return nil, nil, ENOSYS
}
func (me *DefaultFsNode) Rename(oldName string, newParent FsNode, newName string, context *Context) (code Status) {
return ENOSYS
}
func (me *DefaultFsNode) Link(name string, existing FsNode, context *Context) (fi *os.FileInfo, newNode FsNode, code Status) {
return nil, nil, ENOSYS
}
func (me *DefaultFsNode) Create(name string, flags uint32, mode uint32, context *Context) (file File, fi *os.FileInfo, newNode FsNode, code Status) {
return nil, nil, nil, ENOSYS
}
func (me *DefaultFsNode) Open(flags uint32, context *Context) (file File, code Status) {
return nil, ENOSYS
}
func (me *DefaultFsNode) Flush(file File, openFlags uint32, context *Context) (code Status) {
return ENOSYS
}
func (me *DefaultFsNode) OpenDir(context *Context) (chan DirEntry, Status) {
return nil, ENOSYS
}
func (me *DefaultFsNode) GetXAttr(attribute string, context *Context) (data []byte, code Status) {
return nil, ENOSYS
}
func (me *DefaultFsNode) RemoveXAttr(attr string, context *Context) Status {
return ENOSYS
}
func (me *DefaultFsNode) SetXAttr(attr string, data []byte, flags int, context *Context) Status {
return ENOSYS
}
func (me *DefaultFsNode) ListXAttr(context *Context) (attrs []string, code Status) {
return nil, ENOSYS
}
func (me *DefaultFsNode) GetAttr(file File, context *Context) (fi *os.FileInfo, code Status) {
return nil, ENOSYS
}
func (me *DefaultFsNode) Chmod(file File, perms uint32, context *Context) (code Status) {
return ENOSYS
}
func (me *DefaultFsNode) Chown(file File, uid uint32, gid uint32, context *Context) (code Status) {
return ENOSYS
}
func (me *DefaultFsNode) Truncate(file File, size uint64, context *Context) (code Status) {
return ENOSYS
}
func (me *DefaultFsNode) Utimens(file File, atime uint64, mtime uint64, context *Context) (code Status) {
return ENOSYS
}
......@@ -48,13 +48,14 @@ func (me *PathNodeFs) Root() FsNode {
// there is a one-to-one mapping of paths and inodes, ie. FSes that
// disallow hardlinks.
type pathInode struct {
inode *Inode
ifs *PathNodeFs
fs FileSystem
Name string
// This is nil at the root of the mount.
Parent *pathInode
DefaultFsNode
}
// GetPath returns the path relative to the mount governing this
......@@ -92,17 +93,6 @@ func (me *pathInode) RmChild(name string, child FsNode) {
ch.Parent = nil
}
func (me *pathInode) SetInode(node *Inode) {
if me.inode != nil {
panic("already have Inode")
}
me.inode = node
}
func (me *pathInode) Inode() *Inode {
return me.inode
}
////////////////////////////////////////////////////////////////
func (me *pathInode) Readlink(c *Context) ([]byte, Status) {
......
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