Commit 6dae0ec7 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

nodefs: prefix Node interface names with Node

parent 2851c510
...@@ -20,7 +20,7 @@ type StatFS struct { ...@@ -20,7 +20,7 @@ type StatFS struct {
files map[string]fuse.Attr files map[string]fuse.Attr
} }
var _ = (nodefs.OnAdder)((*StatFS)(nil)) var _ = (nodefs.NodeOnAdder)((*StatFS)(nil))
func (r *StatFS) OnAdd(ctx context.Context) { func (r *StatFS) OnAdd(ctx context.Context) {
for nm, a := range r.files { for nm, a := range r.files {
......
...@@ -36,8 +36,8 @@ func (r *HelloRoot) Getattr(ctx context.Context, fh nodefs.FileHandle, out *fuse ...@@ -36,8 +36,8 @@ func (r *HelloRoot) Getattr(ctx context.Context, fh nodefs.FileHandle, out *fuse
return 0 return 0
} }
var _ = (nodefs.Getattrer)((*HelloRoot)(nil)) var _ = (nodefs.NodeGetattrer)((*HelloRoot)(nil))
var _ = (nodefs.OnAdder)((*HelloRoot)(nil)) var _ = (nodefs.NodeOnAdder)((*HelloRoot)(nil))
func main() { func main() {
debug := flag.Bool("debug", false, "print debug data") debug := flag.Bool("debug", false, "print debug data")
......
...@@ -102,7 +102,7 @@ func (n *unionFSNode) root() *unionFSRoot { ...@@ -102,7 +102,7 @@ func (n *unionFSNode) root() *unionFSRoot {
return n.Root().Operations().(*unionFSRoot) return n.Root().Operations().(*unionFSRoot)
} }
var _ = (nodefs.Setattrer)((*unionFSNode)(nil)) var _ = (nodefs.NodeSetattrer)((*unionFSNode)(nil))
func (n *unionFSNode) Setattr(ctx context.Context, fh nodefs.FileHandle, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno { func (n *unionFSNode) Setattr(ctx context.Context, fh nodefs.FileHandle, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno {
if errno := n.promote(); errno != 0 { if errno := n.promote(); errno != 0 {
...@@ -183,7 +183,7 @@ func (n *unionFSNode) Setattr(ctx context.Context, fh nodefs.FileHandle, in *fus ...@@ -183,7 +183,7 @@ func (n *unionFSNode) Setattr(ctx context.Context, fh nodefs.FileHandle, in *fus
return 0 return 0
} }
var _ = (nodefs.Creater)((*unionFSNode)(nil)) var _ = (nodefs.NodeCreater)((*unionFSNode)(nil))
func (n *unionFSNode) Create(ctx context.Context, name string, flags uint32, mode uint32, out *fuse.EntryOut) (*nodefs.Inode, nodefs.FileHandle, uint32, syscall.Errno) { func (n *unionFSNode) Create(ctx context.Context, name string, flags uint32, mode uint32, out *fuse.EntryOut) (*nodefs.Inode, nodefs.FileHandle, uint32, syscall.Errno) {
if n.IsRoot() && name == delDir { if n.IsRoot() && name == delDir {
...@@ -223,7 +223,7 @@ func (n *unionFSNode) Create(ctx context.Context, name string, flags uint32, mod ...@@ -223,7 +223,7 @@ func (n *unionFSNode) Create(ctx context.Context, name string, flags uint32, mod
return ch, nodefs.NewLoopbackFile(fd), 0, 0 return ch, nodefs.NewLoopbackFile(fd), 0, 0
} }
var _ = (nodefs.Opener)((*unionFSNode)(nil)) var _ = (nodefs.NodeOpener)((*unionFSNode)(nil))
func (n *unionFSNode) Open(ctx context.Context, flags uint32) (nodefs.FileHandle, uint32, syscall.Errno) { func (n *unionFSNode) Open(ctx context.Context, flags uint32) (nodefs.FileHandle, uint32, syscall.Errno) {
isWR := (flags&syscall.O_RDWR != 0) || (flags&syscall.O_WRONLY != 0) isWR := (flags&syscall.O_RDWR != 0) || (flags&syscall.O_WRONLY != 0)
...@@ -245,7 +245,7 @@ func (n *unionFSNode) Open(ctx context.Context, flags uint32) (nodefs.FileHandle ...@@ -245,7 +245,7 @@ func (n *unionFSNode) Open(ctx context.Context, flags uint32) (nodefs.FileHandle
return nodefs.NewLoopbackFile(fd), 0, 0 return nodefs.NewLoopbackFile(fd), 0, 0
} }
var _ = (nodefs.Getattrer)((*unionFSNode)(nil)) var _ = (nodefs.NodeGetattrer)((*unionFSNode)(nil))
func (n *unionFSNode) Getattr(ctx context.Context, fh nodefs.FileHandle, out *fuse.AttrOut) syscall.Errno { func (n *unionFSNode) Getattr(ctx context.Context, fh nodefs.FileHandle, out *fuse.AttrOut) syscall.Errno {
var st syscall.Stat_t var st syscall.Stat_t
...@@ -258,7 +258,7 @@ func (n *unionFSNode) Getattr(ctx context.Context, fh nodefs.FileHandle, out *fu ...@@ -258,7 +258,7 @@ func (n *unionFSNode) Getattr(ctx context.Context, fh nodefs.FileHandle, out *fu
return 0 return 0
} }
var _ = (nodefs.Lookuper)((*unionFSNode)(nil)) var _ = (nodefs.NodeLookuper)((*unionFSNode)(nil))
func (n *unionFSNode) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*nodefs.Inode, syscall.Errno) { func (n *unionFSNode) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*nodefs.Inode, syscall.Errno) {
if n.IsRoot() && name == delDir { if n.IsRoot() && name == delDir {
...@@ -279,19 +279,19 @@ func (n *unionFSNode) Lookup(ctx context.Context, name string, out *fuse.EntryOu ...@@ -279,19 +279,19 @@ func (n *unionFSNode) Lookup(ctx context.Context, name string, out *fuse.EntryOu
return nil, syscall.ENOENT return nil, syscall.ENOENT
} }
var _ = (nodefs.Unlinker)((*unionFSNode)(nil)) var _ = (nodefs.NodeUnlinker)((*unionFSNode)(nil))
func (n *unionFSNode) Unlink(ctx context.Context, name string) syscall.Errno { func (n *unionFSNode) Unlink(ctx context.Context, name string) syscall.Errno {
return n.root().delPath(filepath.Join(n.Path(nil), name)) return n.root().delPath(filepath.Join(n.Path(nil), name))
} }
var _ = (nodefs.Rmdirer)((*unionFSNode)(nil)) var _ = (nodefs.NodeRmdirer)((*unionFSNode)(nil))
func (n *unionFSNode) Rmdir(ctx context.Context, name string) syscall.Errno { func (n *unionFSNode) Rmdir(ctx context.Context, name string) syscall.Errno {
return n.root().delPath(filepath.Join(n.Path(nil), name)) return n.root().delPath(filepath.Join(n.Path(nil), name))
} }
var _ = (nodefs.Symlinker)((*unionFSNode)(nil)) var _ = (nodefs.NodeSymlinker)((*unionFSNode)(nil))
func (n *unionFSNode) Symlink(ctx context.Context, target, name string, out *fuse.EntryOut) (*nodefs.Inode, syscall.Errno) { func (n *unionFSNode) Symlink(ctx context.Context, target, name string, out *fuse.EntryOut) (*nodefs.Inode, syscall.Errno) {
n.promote() n.promote()
...@@ -316,7 +316,7 @@ func (n *unionFSNode) Symlink(ctx context.Context, target, name string, out *fus ...@@ -316,7 +316,7 @@ func (n *unionFSNode) Symlink(ctx context.Context, target, name string, out *fus
return ch, 0 return ch, 0
} }
var _ = (nodefs.Readlinker)((*unionFSNode)(nil)) var _ = (nodefs.NodeReadlinker)((*unionFSNode)(nil))
func (n *unionFSNode) Readlink(ctx context.Context) ([]byte, syscall.Errno) { func (n *unionFSNode) Readlink(ctx context.Context) ([]byte, syscall.Errno) {
nm, idx := n.getBranch(nil) nm, idx := n.getBranch(nil)
...@@ -330,7 +330,7 @@ func (n *unionFSNode) Readlink(ctx context.Context) ([]byte, syscall.Errno) { ...@@ -330,7 +330,7 @@ func (n *unionFSNode) Readlink(ctx context.Context) ([]byte, syscall.Errno) {
return buf[:count], 0 return buf[:count], 0
} }
var _ = (nodefs.Readdirer)((*unionFSNode)(nil)) var _ = (nodefs.NodeReaddirer)((*unionFSNode)(nil))
func (n *unionFSNode) Readdir(ctx context.Context) (nodefs.DirStream, syscall.Errno) { func (n *unionFSNode) Readdir(ctx context.Context) (nodefs.DirStream, syscall.Errno) {
root := n.root() root := n.root()
......
This diff is collapsed.
This diff is collapsed.
...@@ -25,9 +25,9 @@ type keepCacheFile struct { ...@@ -25,9 +25,9 @@ type keepCacheFile struct {
count int count int
} }
var _ = (Reader)((*keepCacheFile)(nil)) var _ = (NodeReader)((*keepCacheFile)(nil))
var _ = (Opener)((*keepCacheFile)(nil)) var _ = (NodeOpener)((*keepCacheFile)(nil))
var _ = (Getattrer)((*keepCacheFile)(nil)) var _ = (NodeGetattrer)((*keepCacheFile)(nil))
func (f *keepCacheFile) setContent(delta int) { func (f *keepCacheFile) setContent(delta int) {
f.mu.Lock() f.mu.Lock()
...@@ -69,7 +69,7 @@ type keepCacheRoot struct { ...@@ -69,7 +69,7 @@ type keepCacheRoot struct {
keep, nokeep *keepCacheFile keep, nokeep *keepCacheFile
} }
var _ = (OnAdder)((*keepCacheRoot)(nil)) var _ = (NodeOnAdder)((*keepCacheRoot)(nil))
func (r *keepCacheRoot) OnAdd(ctx context.Context) { func (r *keepCacheRoot) OnAdd(ctx context.Context) {
i := &r.Inode i := &r.Inode
......
...@@ -46,7 +46,7 @@ type dioFile struct { ...@@ -46,7 +46,7 @@ type dioFile struct {
Inode Inode
} }
var _ = (Opener)((*dioFile)(nil)) var _ = (NodeOpener)((*dioFile)(nil))
func (f *dioFile) Open(ctx context.Context, flags uint32) (fh FileHandle, fuseFlags uint32, errno syscall.Errno) { func (f *dioFile) Open(ctx context.Context, flags uint32) (fh FileHandle, fuseFlags uint32, errno syscall.Errno) {
return &dioFH{}, fuse.FOPEN_DIRECT_IO, OK return &dioFH{}, fuse.FOPEN_DIRECT_IO, OK
......
...@@ -19,7 +19,7 @@ type interruptRoot struct { ...@@ -19,7 +19,7 @@ type interruptRoot struct {
child interruptOps child interruptOps
} }
var _ = (Lookuper)((*interruptRoot)(nil)) var _ = (NodeLookuper)((*interruptRoot)(nil))
func (r *interruptRoot) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*Inode, syscall.Errno) { func (r *interruptRoot) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*Inode, syscall.Errno) {
if name != "file" { if name != "file" {
...@@ -37,7 +37,7 @@ type interruptOps struct { ...@@ -37,7 +37,7 @@ type interruptOps struct {
interrupted bool interrupted bool
} }
var _ = (Opener)((*interruptOps)(nil)) var _ = (NodeOpener)((*interruptOps)(nil))
func (o *interruptOps) Open(ctx context.Context, flags uint32) (FileHandle, uint32, syscall.Errno) { func (o *interruptOps) Open(ctx context.Context, flags uint32) (FileHandle, uint32, syscall.Errno) {
select { select {
......
...@@ -24,26 +24,26 @@ type loopbackNode struct { ...@@ -24,26 +24,26 @@ type loopbackNode struct {
Inode Inode
} }
var _ = (Statfser)((*loopbackNode)(nil)) var _ = (NodeStatfser)((*loopbackNode)(nil))
var _ = (Statfser)((*loopbackNode)(nil)) var _ = (NodeStatfser)((*loopbackNode)(nil))
var _ = (Getattrer)((*loopbackNode)(nil)) var _ = (NodeGetattrer)((*loopbackNode)(nil))
var _ = (Getxattrer)((*loopbackNode)(nil)) var _ = (NodeGetxattrer)((*loopbackNode)(nil))
var _ = (Setxattrer)((*loopbackNode)(nil)) var _ = (NodeSetxattrer)((*loopbackNode)(nil))
var _ = (Removexattrer)((*loopbackNode)(nil)) var _ = (NodeRemovexattrer)((*loopbackNode)(nil))
var _ = (Listxattrer)((*loopbackNode)(nil)) var _ = (NodeListxattrer)((*loopbackNode)(nil))
var _ = (Readlinker)((*loopbackNode)(nil)) var _ = (NodeReadlinker)((*loopbackNode)(nil))
var _ = (Opener)((*loopbackNode)(nil)) var _ = (NodeOpener)((*loopbackNode)(nil))
var _ = (CopyFileRanger)((*loopbackNode)(nil)) var _ = (NodeCopyFileRanger)((*loopbackNode)(nil))
var _ = (Lookuper)((*loopbackNode)(nil)) var _ = (NodeLookuper)((*loopbackNode)(nil))
var _ = (Opendirer)((*loopbackNode)(nil)) var _ = (NodeOpendirer)((*loopbackNode)(nil))
var _ = (Readdirer)((*loopbackNode)(nil)) var _ = (NodeReaddirer)((*loopbackNode)(nil))
var _ = (Mkdirer)((*loopbackNode)(nil)) var _ = (NodeMkdirer)((*loopbackNode)(nil))
var _ = (Mknoder)((*loopbackNode)(nil)) var _ = (NodeMknoder)((*loopbackNode)(nil))
var _ = (Linker)((*loopbackNode)(nil)) var _ = (NodeLinker)((*loopbackNode)(nil))
var _ = (Symlinker)((*loopbackNode)(nil)) var _ = (NodeSymlinker)((*loopbackNode)(nil))
var _ = (Unlinker)((*loopbackNode)(nil)) var _ = (NodeUnlinker)((*loopbackNode)(nil))
var _ = (Rmdirer)((*loopbackNode)(nil)) var _ = (NodeRmdirer)((*loopbackNode)(nil))
var _ = (Renamer)((*loopbackNode)(nil)) var _ = (NodeRenamer)((*loopbackNode)(nil))
func (n *loopbackNode) Statfs(ctx context.Context, out *fuse.StatfsOut) syscall.Errno { func (n *loopbackNode) Statfs(ctx context.Context, out *fuse.StatfsOut) syscall.Errno {
s := syscall.Statfs_t{} s := syscall.Statfs_t{}
...@@ -181,7 +181,7 @@ func (r *loopbackRoot) idFromStat(st *syscall.Stat_t) StableAttr { ...@@ -181,7 +181,7 @@ func (r *loopbackRoot) idFromStat(st *syscall.Stat_t) StableAttr {
} }
} }
var _ = (Creater)((*loopbackNode)(nil)) var _ = (NodeCreater)((*loopbackNode)(nil))
func (n *loopbackNode) Create(ctx context.Context, name string, flags uint32, mode uint32, out *fuse.EntryOut) (inode *Inode, fh FileHandle, fuseFlags uint32, errno syscall.Errno) { func (n *loopbackNode) Create(ctx context.Context, name string, flags uint32, mode uint32, out *fuse.EntryOut) (inode *Inode, fh FileHandle, fuseFlags uint32, errno syscall.Errno) {
p := filepath.Join(n.path(), name) p := filepath.Join(n.path(), name)
...@@ -298,7 +298,7 @@ func (n *loopbackNode) Getattr(ctx context.Context, f FileHandle, out *fuse.Attr ...@@ -298,7 +298,7 @@ func (n *loopbackNode) Getattr(ctx context.Context, f FileHandle, out *fuse.Attr
return OK return OK
} }
var _ = (Setattrer)((*loopbackNode)(nil)) var _ = (NodeSetattrer)((*loopbackNode)(nil))
func (n *loopbackNode) Setattr(ctx context.Context, f FileHandle, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno { func (n *loopbackNode) Setattr(ctx context.Context, f FileHandle, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno {
p := n.path() p := n.path()
......
...@@ -20,9 +20,9 @@ type MemRegularFile struct { ...@@ -20,9 +20,9 @@ type MemRegularFile struct {
Attr fuse.Attr Attr fuse.Attr
} }
var _ = (Opener)((*MemRegularFile)(nil)) var _ = (NodeOpener)((*MemRegularFile)(nil))
var _ = (Reader)((*MemRegularFile)(nil)) var _ = (NodeReader)((*MemRegularFile)(nil))
var _ = (Flusher)((*MemRegularFile)(nil)) var _ = (NodeFlusher)((*MemRegularFile)(nil))
func (f *MemRegularFile) Open(ctx context.Context, flags uint32) (fh FileHandle, fuseFlags uint32, errno syscall.Errno) { func (f *MemRegularFile) Open(ctx context.Context, flags uint32) (fh FileHandle, fuseFlags uint32, errno syscall.Errno) {
if flags&(syscall.O_RDWR) != 0 || flags&syscall.O_WRONLY != 0 { if flags&(syscall.O_RDWR) != 0 || flags&syscall.O_WRONLY != 0 {
...@@ -32,7 +32,7 @@ func (f *MemRegularFile) Open(ctx context.Context, flags uint32) (fh FileHandle, ...@@ -32,7 +32,7 @@ func (f *MemRegularFile) Open(ctx context.Context, flags uint32) (fh FileHandle,
return nil, fuse.FOPEN_KEEP_CACHE, OK return nil, fuse.FOPEN_KEEP_CACHE, OK
} }
var _ = (Getattrer)((*MemRegularFile)(nil)) var _ = (NodeGetattrer)((*MemRegularFile)(nil))
func (f *MemRegularFile) Getattr(ctx context.Context, fh FileHandle, out *fuse.AttrOut) syscall.Errno { func (f *MemRegularFile) Getattr(ctx context.Context, fh FileHandle, out *fuse.AttrOut) syscall.Errno {
out.Attr = f.Attr out.Attr = f.Attr
...@@ -59,13 +59,13 @@ type MemSymlink struct { ...@@ -59,13 +59,13 @@ type MemSymlink struct {
Data []byte Data []byte
} }
var _ = (Readlinker)((*MemSymlink)(nil)) var _ = (NodeReadlinker)((*MemSymlink)(nil))
func (l *MemSymlink) Readlink(ctx context.Context) ([]byte, syscall.Errno) { func (l *MemSymlink) Readlink(ctx context.Context) ([]byte, syscall.Errno) {
return l.Data, OK return l.Data, OK
} }
var _ = (Getattrer)((*MemSymlink)(nil)) var _ = (NodeGetattrer)((*MemSymlink)(nil))
func (l *MemSymlink) Getattr(ctx context.Context, fh FileHandle, out *fuse.AttrOut) syscall.Errno { func (l *MemSymlink) Getattr(ctx context.Context, fh FileHandle, out *fuse.AttrOut) syscall.Errno {
out.Attr = l.Attr out.Attr = l.Attr
......
...@@ -129,8 +129,8 @@ type zipFile struct { ...@@ -129,8 +129,8 @@ type zipFile struct {
data []byte data []byte
} }
var _ = (Opener)((*zipFile)(nil)) var _ = (NodeOpener)((*zipFile)(nil))
var _ = (Getattrer)((*zipFile)(nil)) var _ = (NodeGetattrer)((*zipFile)(nil))
// Getattr sets the minimum, which is the size. A more full-featured // Getattr sets the minimum, which is the size. A more full-featured
// FS would also set timestamps and permissions. // FS would also set timestamps and permissions.
...@@ -179,7 +179,7 @@ type zipRoot struct { ...@@ -179,7 +179,7 @@ type zipRoot struct {
zr *zip.Reader zr *zip.Reader
} }
var _ = (OnAdder)((*zipRoot)(nil)) var _ = (NodeOnAdder)((*zipRoot)(nil))
func (zr *zipRoot) OnAdd(ctx context.Context) { func (zr *zipRoot) OnAdd(ctx context.Context) {
// OnAdd is called once we are attached to an Inode. We can // OnAdd is called once we are attached to an Inode. We can
......
...@@ -38,8 +38,8 @@ type configRoot struct { ...@@ -38,8 +38,8 @@ type configRoot struct {
nodefs.Inode nodefs.Inode
} }
var _ = (nodefs.Unlinker)((*configRoot)(nil)) var _ = (nodefs.NodeUnlinker)((*configRoot)(nil))
var _ = (nodefs.Symlinker)((*configRoot)(nil)) var _ = (nodefs.NodeSymlinker)((*configRoot)(nil))
func (r *configRoot) Unlink(ctx context.Context, basename string) syscall.Errno { func (r *configRoot) Unlink(ctx context.Context, basename string) syscall.Errno {
if r.GetChild(basename) == nil { if r.GetChild(basename) == nil {
......
...@@ -25,7 +25,7 @@ type zipRoot struct { ...@@ -25,7 +25,7 @@ type zipRoot struct {
zr *zip.ReadCloser zr *zip.ReadCloser
} }
var _ = (nodefs.OnAdder)((*zipRoot)(nil)) var _ = (nodefs.NodeOnAdder)((*zipRoot)(nil))
func (zr *zipRoot) OnAdd(ctx context.Context) { func (zr *zipRoot) OnAdd(ctx context.Context) {
for _, f := range zr.zr.File { for _, f := range zr.zr.File {
...@@ -72,8 +72,8 @@ type zipFile struct { ...@@ -72,8 +72,8 @@ type zipFile struct {
data []byte data []byte
} }
var _ = (nodefs.Opener)((*zipFile)(nil)) var _ = (nodefs.NodeOpener)((*zipFile)(nil))
var _ = (nodefs.Getattrer)((*zipFile)(nil)) var _ = (nodefs.NodeGetattrer)((*zipFile)(nil))
// Getattr sets the minimum, which is the size. A more full-featured // Getattr sets the minimum, which is the size. A more full-featured
// FS would also set timestamps and permissions. // FS would also set timestamps and permissions.
...@@ -120,7 +120,7 @@ func (zf *zipFile) Read(ctx context.Context, f nodefs.FileHandle, dest []byte, o ...@@ -120,7 +120,7 @@ func (zf *zipFile) Read(ctx context.Context, f nodefs.FileHandle, dest []byte, o
return fuse.ReadResultData(zf.data[off:end]), 0 return fuse.ReadResultData(zf.data[off:end]), 0
} }
var _ = (nodefs.OnAdder)((*zipRoot)(nil)) var _ = (nodefs.NodeOnAdder)((*zipRoot)(nil))
func NewArchiveFileSystem(name string) (root nodefs.InodeEmbedder, err error) { func NewArchiveFileSystem(name string) (root nodefs.InodeEmbedder, err error) {
switch { switch {
......
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