Commit cbfa4d27 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse/nodefs: more documentation.

parent c38f937e
...@@ -19,15 +19,9 @@ import ( ...@@ -19,15 +19,9 @@ import (
// Tests should set to true. // Tests should set to true.
var paranoia = false var paranoia = false
// FilesystemConnector is a raw FUSE filesystem that manages // FilesystemConnector that translates the raw FUSE protocol
// in-process mounts and inodes. Its job is twofold: // (serialized structs of uint32/uint64) to operations on Go objects
// // representing files and directories.
// It translates between the raw kernel interface (padded structs of
// int32 and int64) and the more abstract Go-ish NodeFileSystem
// interface.
//
// It manages mounting and unmounting of NodeFileSystems into the
// directory hierarchy.
type FileSystemConnector struct { type FileSystemConnector struct {
// Used as the generation inodes. This must be 64-bit aligned, // Used as the generation inodes. This must be 64-bit aligned,
// for sync/atomic on i386 to work properly. // for sync/atomic on i386 to work properly.
...@@ -47,6 +41,8 @@ type FileSystemConnector struct { ...@@ -47,6 +41,8 @@ type FileSystemConnector struct {
rootNode *Inode rootNode *Inode
} }
// NewOptions generates FUSE options that correspond to libfuse's
// defaults.
func NewOptions() *Options { func NewOptions() *Options {
return &Options{ return &Options{
NegativeTimeout: 0, NegativeTimeout: 0,
...@@ -78,6 +74,7 @@ func NewFileSystemConnector(nodeFs FileSystem, opts *Options) (c *FileSystemConn ...@@ -78,6 +74,7 @@ func NewFileSystemConnector(nodeFs FileSystem, opts *Options) (c *FileSystemConn
return c return c
} }
// SetDebug toggles printing of debug information.
func (c *FileSystemConnector) SetDebug(debug bool) { func (c *FileSystemConnector) SetDebug(debug bool) {
c.debug = debug c.debug = debug
} }
...@@ -224,6 +221,9 @@ func (c *FileSystemConnector) Node(parent *Inode, fullPath string) (*Inode, []st ...@@ -224,6 +221,9 @@ func (c *FileSystemConnector) Node(parent *Inode, fullPath string) (*Inode, []st
} }
func (c *FileSystemConnector) LookupNode(parent *Inode, path string) *Inode { func (c *FileSystemConnector) LookupNode(parent *Inode, path string) *Inode {
// TODO - this is broken. The internalLookups will cause
// Nlookup increments that the kernel does not know about.
if path == "" { if path == "" {
return parent return parent
} }
...@@ -241,8 +241,6 @@ func (c *FileSystemConnector) LookupNode(parent *Inode, path string) *Inode { ...@@ -241,8 +241,6 @@ func (c *FileSystemConnector) LookupNode(parent *Inode, path string) *Inode {
return parent return parent
} }
////////////////////////////////////////////////////////////////
func (c *FileSystemConnector) MountRoot(nodeFs FileSystem, opts *Options) { func (c *FileSystemConnector) MountRoot(nodeFs FileSystem, opts *Options) {
c.rootNode.mountFs(nodeFs, opts) c.rootNode.mountFs(nodeFs, opts)
c.rootNode.mount.connector = c c.rootNode.mount.connector = c
......
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