Commit 18e0e322 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

nodefs: more method documentation

parent 2f9c4b1d
...@@ -85,3 +85,4 @@ or ...@@ -85,3 +85,4 @@ or
* Merge Fsync/FsyncDir? * Merge Fsync/FsyncDir?
* OnMount in Operations or in Options? Or argument to NewNodeFS ?
...@@ -67,8 +67,8 @@ func InodeOf(node Operations) *Inode { ...@@ -67,8 +67,8 @@ func InodeOf(node Operations) *Inode {
return node.inode() return node.inode()
} }
// Operations is the interface that implements the filesystem. Each // Operations is the interface that implements the filesystem inode.
// Operations instance must embed DefaultNode. // Each Operations instance must embed DefaultNode.
type Operations interface { type Operations interface {
// setInode and inode are used by nodefs internally to link Inode to a Node. // setInode and inode are used by nodefs internally to link Inode to a Node.
// //
...@@ -293,7 +293,6 @@ type FileHandle interface { ...@@ -293,7 +293,6 @@ type FileHandle interface {
// Options sets options for the entire filesystem // Options sets options for the entire filesystem
type Options struct { type Options struct {
// Debug toggles debug output // Debug toggles debug output
Debug bool Debug bool
......
This diff is collapsed.
...@@ -17,6 +17,7 @@ type loopbackDirStream struct { ...@@ -17,6 +17,7 @@ type loopbackDirStream struct {
fd int fd int
} }
// NewLoopbackDirStream open a directory for reading as a DirStream
func NewLoopbackDirStream(name string) (DirStream, fuse.Status) { func NewLoopbackDirStream(name string) (DirStream, fuse.Status) {
fd, err := syscall.Open(name, syscall.O_DIRECTORY, 0755) fd, err := syscall.Open(name, syscall.O_DIRECTORY, 0755)
if err != nil { if err != nil {
......
...@@ -14,11 +14,12 @@ import ( ...@@ -14,11 +14,12 @@ import (
"github.com/hanwen/go-fuse/fuse" "github.com/hanwen/go-fuse/fuse"
) )
func newLoopbackFile(fd int) *loopbackFile { // NewLoopbackFile creates a FileHandle out of a file descriptor. All
// operations are implemented.
func NewLoopbackFile(fd int) FileHandle {
return &loopbackFile{fd: fd} return &loopbackFile{fd: fd}
} }
// loopbackFile delegates all operations back to an underlying file.
type loopbackFile struct { type loopbackFile struct {
fd int fd int
......
...@@ -95,7 +95,6 @@ func (n *loopbackNode) Mknod(ctx context.Context, name string, mode, rdev uint32 ...@@ -95,7 +95,6 @@ func (n *loopbackNode) Mknod(ctx context.Context, name string, mode, rdev uint32
} }
func (n *loopbackNode) Mkdir(ctx context.Context, name string, mode uint32, out *fuse.EntryOut) (*Inode, fuse.Status) { func (n *loopbackNode) Mkdir(ctx context.Context, name string, mode uint32, out *fuse.EntryOut) (*Inode, fuse.Status) {
// NOSUBMIT what about umask
p := filepath.Join(n.path(), name) p := filepath.Join(n.path(), name)
err := os.Mkdir(p, os.FileMode(mode)) err := os.Mkdir(p, os.FileMode(mode))
if err != nil { if err != nil {
...@@ -172,7 +171,7 @@ func (n *loopbackNode) Create(ctx context.Context, name string, flags uint32, mo ...@@ -172,7 +171,7 @@ func (n *loopbackNode) Create(ctx context.Context, name string, flags uint32, mo
node := n.rootNode.newLoopbackNode() node := n.rootNode.newLoopbackNode()
ch := n.inode().NewInode(node, uint32(st.Mode), idFromStat(&st)) ch := n.inode().NewInode(node, uint32(st.Mode), idFromStat(&st))
lf := newLoopbackFile(fd) lf := NewLoopbackFile(fd)
return ch, lf, 0, fuse.OK return ch, lf, 0, fuse.OK
} }
...@@ -236,7 +235,7 @@ func (n *loopbackNode) Open(ctx context.Context, flags uint32) (fh FileHandle, f ...@@ -236,7 +235,7 @@ func (n *loopbackNode) Open(ctx context.Context, flags uint32) (fh FileHandle, f
if err != nil { if err != nil {
return nil, 0, fuse.ToStatus(err) return nil, 0, fuse.ToStatus(err)
} }
lf := newLoopbackFile(f) lf := NewLoopbackFile(f)
return lf, 0, fuse.OK return lf, 0, fuse.OK
} }
......
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