Commit 17f8f123 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

nodefs: more comments

parent 4f60fdad
...@@ -12,6 +12,10 @@ Decisions ...@@ -12,6 +12,10 @@ Decisions
because most filesystems will need to construct tree-like because most filesystems will need to construct tree-like
structures. structures.
* Nodes contain references to their parents. As a result, we can
derive the path for each Inode, and there is no need for a
separate PathFS.
* Nodes can be "persistent", meaning their lifetime is not under * Nodes can be "persistent", meaning their lifetime is not under
control of the kernel. This is useful for constructing FS trees control of the kernel. This is useful for constructing FS trees
in advance, rather than driven by LOOKUP. in advance, rather than driven by LOOKUP.
...@@ -52,9 +56,6 @@ To decide ...@@ -52,9 +56,6 @@ To decide
* Should we provide automatic fileID numbering? * Should we provide automatic fileID numbering?
* One giant interface with many methods, or many one-method
interfaces? Or some interface (file, dir, symlink, etc).
* function signatures, or types? The latter is easier to remember? * function signatures, or types? The latter is easier to remember?
Easier to extend? The latter less efficient (indirections/copies) Easier to extend? The latter less efficient (indirections/copies)
...@@ -84,5 +85,3 @@ or ...@@ -84,5 +85,3 @@ or
* Merge Fsync/FsyncDir? * Merge Fsync/FsyncDir?
* Merge Release/ReleaseDir? (others?)
...@@ -83,15 +83,6 @@ type DirStream interface { ...@@ -83,15 +83,6 @@ type DirStream interface {
Close() Close()
} }
/*
NOSUBMIT: how to structure?
- one interface per method?
- one interface for files (getattr, read/write), one for dirs (lookup, opendir), one shared?
- one giant interface?
- use raw types as args rather than mimicking Golang signatures?
*/
// Operations is the interface that implements the filesystem. Each // Operations is the interface that implements the filesystem. Each
// Operations instance must embed DefaultNode. // Operations instance must embed DefaultNode.
type Operations interface { type Operations interface {
...@@ -112,7 +103,7 @@ type Operations interface { ...@@ -112,7 +103,7 @@ type Operations interface {
// Access should return if the caller can access the file with // Access should return if the caller can access the file with
// the given mode. In this case, the context has data about // the given mode. In this case, the context has data about
// the real UID. For example a root-SUID binary called by user // the real UID. For example a root-SUID binary called by user
// `susan` gets the UID and GID for `susan` here. // susan gets the UID and GID for susan here.
Access(ctx context.Context, mask uint32) fuse.Status Access(ctx context.Context, mask uint32) fuse.Status
// Extended attributes // Extended attributes
...@@ -122,8 +113,8 @@ type Operations interface { ...@@ -122,8 +113,8 @@ type Operations interface {
// small, it should return ERANGE and the size of the attribute. // small, it should return ERANGE and the size of the attribute.
GetXAttr(ctx context.Context, attr string, dest []byte) (uint32, fuse.Status) GetXAttr(ctx context.Context, attr string, dest []byte) (uint32, fuse.Status)
// SetXAttr should store data for the given attribute. // SetXAttr should store data for the given attribute. See
// XXX flags. // setxattr(2) for information about flags.
SetXAttr(ctx context.Context, attr string, data []byte, flags uint32) fuse.Status SetXAttr(ctx context.Context, attr string, data []byte, flags uint32) fuse.Status
// RemoveXAttr should delete the given attribute. // RemoveXAttr should delete the given attribute.
...@@ -134,8 +125,10 @@ type Operations interface { ...@@ -134,8 +125,10 @@ type Operations interface {
// ERANGE and the correct size. // ERANGE and the correct size.
ListXAttr(ctx context.Context, dest []byte) (uint32, fuse.Status) ListXAttr(ctx context.Context, dest []byte) (uint32, fuse.Status)
// GetAttr reads attributes for an Inode
GetAttr(ctx context.Context, out *fuse.AttrOut) fuse.Status GetAttr(ctx context.Context, out *fuse.AttrOut) fuse.Status
// SetAttr sets attributes for an Inode
SetAttr(ctx context.Context, in *fuse.SetAttrIn, out *fuse.AttrOut) fuse.Status SetAttr(ctx context.Context, in *fuse.SetAttrIn, out *fuse.AttrOut) fuse.Status
} }
......
...@@ -14,7 +14,7 @@ import ( ...@@ -14,7 +14,7 @@ import (
"github.com/hanwen/go-fuse/fuse" "github.com/hanwen/go-fuse/fuse"
) )
// DefaultOperations provides common base Node functionality. // DefaultOperations provides stubs that return ENOSYS for all functions
// //
// It must be embedded in any Node implementation. // It must be embedded in any Node implementation.
type DefaultOperations struct { type DefaultOperations struct {
......
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