Commit 0f2f00b8 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

rename NodeAttr to StableAttr

parent 4e10c985
...@@ -51,7 +51,7 @@ func (r *StatFS) addFile(name string, a fuse.Attr) { ...@@ -51,7 +51,7 @@ func (r *StatFS) addFile(name string, a fuse.Attr) {
if ch == nil { if ch == nil {
// Create a directory // Create a directory
ch = p.NewPersistentInode(context.Background(), &nodefs.Inode{}, ch = p.NewPersistentInode(context.Background(), &nodefs.Inode{},
nodefs.NodeAttr{Mode: syscall.S_IFDIR}) nodefs.StableAttr{Mode: syscall.S_IFDIR})
// Add it // Add it
p.AddChild(component, ch, true) p.AddChild(component, ch, true)
} }
...@@ -63,7 +63,7 @@ func (r *StatFS) addFile(name string, a fuse.Attr) { ...@@ -63,7 +63,7 @@ func (r *StatFS) addFile(name string, a fuse.Attr) {
child := p.NewPersistentInode(context.Background(), &nodefs.MemRegularFile{ child := p.NewPersistentInode(context.Background(), &nodefs.MemRegularFile{
Data: make([]byte, a.Size), Data: make([]byte, a.Size),
Attr: a, Attr: a,
}, nodefs.NodeAttr{}) }, nodefs.StableAttr{})
// And add it // And add it
p.AddChild(base, child, true) p.AddChild(base, child, true)
......
...@@ -27,7 +27,7 @@ func (r *HelloRoot) OnAdd(ctx context.Context) { ...@@ -27,7 +27,7 @@ func (r *HelloRoot) OnAdd(ctx context.Context) {
Attr: fuse.Attr{ Attr: fuse.Attr{
Mode: 0644, Mode: 0644,
}, },
}, nodefs.NodeAttr{Ino: 2}) }, nodefs.StableAttr{Ino: 2})
r.AddChild("file.txt", ch, false) r.AddChild("file.txt", ch, false)
} }
......
...@@ -188,7 +188,7 @@ func (n *unionFSNode) Create(ctx context.Context, name string, flags uint32, mod ...@@ -188,7 +188,7 @@ func (n *unionFSNode) Create(ctx context.Context, name string, flags uint32, mod
return nil, nil, 0, err.(syscall.Errno) return nil, nil, 0, err.(syscall.Errno)
} }
ch := n.NewInode(ctx, &unionFSNode{}, nodefs.NodeAttr{Mode: st.Mode, Ino: st.Ino}) ch := n.NewInode(ctx, &unionFSNode{}, nodefs.StableAttr{Mode: st.Mode, Ino: st.Ino})
out.FromStat(&st) out.FromStat(&st)
return ch, nodefs.NewLoopbackFile(fd), 0, 0 return ch, nodefs.NewLoopbackFile(fd), 0, 0
...@@ -238,7 +238,7 @@ func (n *unionFSNode) Lookup(ctx context.Context, name string, out *fuse.EntryOu ...@@ -238,7 +238,7 @@ func (n *unionFSNode) Lookup(ctx context.Context, name string, out *fuse.EntryOu
idx := n.root().getBranch(p, &st) idx := n.root().getBranch(p, &st)
if idx >= 0 { if idx >= 0 {
// XXX use idx in Ino? // XXX use idx in Ino?
ch := n.NewInode(ctx, &unionFSNode{}, nodefs.NodeAttr{Mode: st.Mode, Ino: st.Ino}) ch := n.NewInode(ctx, &unionFSNode{}, nodefs.StableAttr{Mode: st.Mode, Ino: st.Ino})
out.FromStat(&st) out.FromStat(&st)
out.Mode |= 0111 out.Mode |= 0111
return ch, 0 return ch, 0
...@@ -276,7 +276,7 @@ func (n *unionFSNode) Symlink(ctx context.Context, target, name string, out *fus ...@@ -276,7 +276,7 @@ func (n *unionFSNode) Symlink(ctx context.Context, target, name string, out *fus
out.FromStat(&st) out.FromStat(&st)
ch := n.NewInode(ctx, &unionFSNode{}, nodefs.NodeAttr{ ch := n.NewInode(ctx, &unionFSNode{}, nodefs.StableAttr{
Mode: syscall.S_IFLNK, Mode: syscall.S_IFLNK,
Ino: st.Ino, Ino: st.Ino,
}) })
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
// //
// func (n *myNode) Lookup(ctx context.Context, name string, ... ) (*Inode, syscall.Errno) { // func (n *myNode) Lookup(ctx context.Context, name string, ... ) (*Inode, syscall.Errno) {
// child := myNode{} // child := myNode{}
// return n.NewInode(ctx, &myNode{}, NodeAttr{Mode: syscall.S_IFDIR}), 0 // return n.NewInode(ctx, &myNode{}, StableAttr{Mode: syscall.S_IFDIR}), 0
// } // }
// //
// On mounting, the root InodeEmbedder is associated with root of the // On mounting, the root InodeEmbedder is associated with root of the
......
...@@ -51,7 +51,7 @@ type rawBridge struct { ...@@ -51,7 +51,7 @@ type rawBridge struct {
} }
// newInode creates creates new inode pointing to ops. // newInode creates creates new inode pointing to ops.
func (b *rawBridge) newInodeUnlocked(ops InodeEmbedder, id NodeAttr, persistent bool) *Inode { func (b *rawBridge) newInodeUnlocked(ops InodeEmbedder, id StableAttr, persistent bool) *Inode {
b.mu.Lock() b.mu.Lock()
defer b.mu.Unlock() defer b.mu.Unlock()
...@@ -84,7 +84,7 @@ func (b *rawBridge) newInodeUnlocked(ops InodeEmbedder, id NodeAttr, persistent ...@@ -84,7 +84,7 @@ func (b *rawBridge) newInodeUnlocked(ops InodeEmbedder, id NodeAttr, persistent
// file // file
// //
// dir1.Lookup("file") and dir2.Lookup("file") are executed // dir1.Lookup("file") and dir2.Lookup("file") are executed
// simultaneously. The matching NodeAttrs ensure that we return the // simultaneously. The matching StableAttrs ensure that we return the
// same node. // same node.
old := b.nodes[id.Ino] old := b.nodes[id.Ino]
if old != nil { if old != nil {
...@@ -101,7 +101,7 @@ func (b *rawBridge) newInodeUnlocked(ops InodeEmbedder, id NodeAttr, persistent ...@@ -101,7 +101,7 @@ func (b *rawBridge) newInodeUnlocked(ops InodeEmbedder, id NodeAttr, persistent
return ops.embed() return ops.embed()
} }
func (b *rawBridge) newInode(ctx context.Context, ops InodeEmbedder, id NodeAttr, persistent bool) *Inode { func (b *rawBridge) newInode(ctx context.Context, ops InodeEmbedder, id StableAttr, persistent bool) *Inode {
ch := b.newInodeUnlocked(ops, id, persistent) ch := b.newInodeUnlocked(ops, id, persistent)
if ch != ops.embed() { if ch != ops.embed() {
return ch return ch
...@@ -183,7 +183,7 @@ func NewNodeFS(root InodeEmbedder, opts *Options) fuse.RawFileSystem { ...@@ -183,7 +183,7 @@ func NewNodeFS(root InodeEmbedder, opts *Options) fuse.RawFileSystem {
} }
initInode(root.embed(), root, initInode(root.embed(), root,
NodeAttr{ StableAttr{
Ino: 1, Ino: 1,
Mode: fuse.S_IFDIR, Mode: fuse.S_IFDIR,
}, },
...@@ -792,7 +792,7 @@ func (b *rawBridge) getStream(ctx context.Context, inode *Inode) (DirStream, sys ...@@ -792,7 +792,7 @@ func (b *rawBridge) getStream(ctx context.Context, inode *Inode) (DirStream, sys
for k, ch := range inode.Children() { for k, ch := range inode.Children() {
r = append(r, fuse.DirEntry{Mode: ch.Mode(), r = append(r, fuse.DirEntry{Mode: ch.Mode(),
Name: k, Name: k,
Ino: ch.NodeAttr().Ino}) Ino: ch.StableAttr().Ino})
} }
return NewListDirStream(r), 0 return NewListDirStream(r), 0
} }
......
...@@ -78,13 +78,13 @@ func (r *keepCacheRoot) OnAdd(ctx context.Context) { ...@@ -78,13 +78,13 @@ func (r *keepCacheRoot) OnAdd(ctx context.Context) {
keepCache: true, keepCache: true,
} }
r.keep.setContent(0) r.keep.setContent(0)
i.AddChild("keep", i.NewInode(ctx, r.keep, NodeAttr{}), true) i.AddChild("keep", i.NewInode(ctx, r.keep, StableAttr{}), true)
r.nokeep = &keepCacheFile{ r.nokeep = &keepCacheFile{
keepCache: false, keepCache: false,
} }
r.nokeep.setContent(0) r.nokeep.setContent(0)
i.AddChild("nokeep", i.NewInode(ctx, r.nokeep, NodeAttr{}), true) i.AddChild("nokeep", i.NewInode(ctx, r.nokeep, StableAttr{}), true)
} }
// Test FOPEN_KEEP_CACHE. This is a little subtle: the automatic cache // Test FOPEN_KEEP_CACHE. This is a little subtle: the automatic cache
......
...@@ -20,7 +20,7 @@ type dioRoot struct { ...@@ -20,7 +20,7 @@ type dioRoot struct {
} }
func (r *dioRoot) OnAdd(ctx context.Context) { func (r *dioRoot) OnAdd(ctx context.Context) {
r.Inode.AddChild("file", r.Inode.NewInode(ctx, &dioFile{}, NodeAttr{}), false) r.Inode.AddChild("file", r.Inode.NewInode(ctx, &dioFile{}, StableAttr{}), false)
} }
// A file handle that pretends that every hole/data starts at // A file handle that pretends that every hole/data starts at
......
...@@ -22,8 +22,8 @@ type parentData struct { ...@@ -22,8 +22,8 @@ type parentData struct {
parent *Inode parent *Inode
} }
// NodeAttr holds immutable attributes of a object in the filesystem. // StableAttr holds immutable attributes of a object in the filesystem.
type NodeAttr struct { type StableAttr struct {
// Each Inode has a type, which does not change over the // Each Inode has a type, which does not change over the
// lifetime of the inode, for example fuse.S_IFDIR. The default (0) // lifetime of the inode, for example fuse.S_IFDIR. The default (0)
// is interpreted as S_IFREG (regular file). // is interpreted as S_IFREG (regular file).
...@@ -43,8 +43,8 @@ type NodeAttr struct { ...@@ -43,8 +43,8 @@ type NodeAttr struct {
Gen uint64 Gen uint64
} }
// Reserved returns if the NodeAttr is using reserved Inode numbers. // Reserved returns if the StableAttr is using reserved Inode numbers.
func (i *NodeAttr) Reserved() bool { func (i *StableAttr) Reserved() bool {
return i.Ino == 1 || i.Ino == ^uint64(0) return i.Ino == 1 || i.Ino == ^uint64(0)
} }
...@@ -57,7 +57,7 @@ func (i *NodeAttr) Reserved() bool { ...@@ -57,7 +57,7 @@ func (i *NodeAttr) Reserved() bool {
// copied. Inodes should be obtained by calling Inode.NewInode() or // copied. Inodes should be obtained by calling Inode.NewInode() or
// Inode.NewPersistentInode(). // Inode.NewPersistentInode().
type Inode struct { type Inode struct {
nodeAttr NodeAttr nodeAttr StableAttr
ops InodeEmbedder ops InodeEmbedder
bridge *rawBridge bridge *rawBridge
...@@ -108,7 +108,7 @@ func (n *Inode) EmbeddedInode() *Inode { ...@@ -108,7 +108,7 @@ func (n *Inode) EmbeddedInode() *Inode {
return n return n
} }
func initInode(n *Inode, ops InodeEmbedder, attr NodeAttr, bridge *rawBridge, persistent bool) { func initInode(n *Inode, ops InodeEmbedder, attr StableAttr, bridge *rawBridge, persistent bool) {
n.ops = ops n.ops = ops
n.nodeAttr = attr n.nodeAttr = attr
n.bridge = bridge n.bridge = bridge
...@@ -126,8 +126,8 @@ func (n *Inode) setEntryOut(out *fuse.EntryOut) { ...@@ -126,8 +126,8 @@ func (n *Inode) setEntryOut(out *fuse.EntryOut) {
out.Mode = (out.Attr.Mode & 07777) | n.nodeAttr.Mode out.Mode = (out.Attr.Mode & 07777) | n.nodeAttr.Mode
} }
// NodeAttr returns the (Ino, Gen) tuple for this node. // StableAttr returns the (Ino, Gen) tuple for this node.
func (n *Inode) NodeAttr() NodeAttr { func (n *Inode) StableAttr() NodeAttr {
return n.nodeAttr return n.nodeAttr
} }
...@@ -311,7 +311,7 @@ func (iparent *Inode) setEntry(name string, ichild *Inode) { ...@@ -311,7 +311,7 @@ func (iparent *Inode) setEntry(name string, ichild *Inode) {
// NewPersistentInode returns an Inode whose lifetime is not in // NewPersistentInode returns an Inode whose lifetime is not in
// control of the kernel. // control of the kernel.
func (n *Inode) NewPersistentInode(ctx context.Context, node InodeEmbedder, id NodeAttr) *Inode { func (n *Inode) NewPersistentInode(ctx context.Context, node InodeEmbedder, id StableAttr) *Inode {
return n.newInode(ctx, node, id, true) return n.newInode(ctx, node, id, true)
} }
...@@ -327,11 +327,11 @@ func (n *Inode) ForgetPersistent() { ...@@ -327,11 +327,11 @@ func (n *Inode) ForgetPersistent() {
// id.Ino argument is used to implement hard-links. If it is given, // id.Ino argument is used to implement hard-links. If it is given,
// and another node with the same ID is known, that will node will be // and another node with the same ID is known, that will node will be
// returned, and the passed-in `node` is ignored. // returned, and the passed-in `node` is ignored.
func (n *Inode) NewInode(ctx context.Context, node InodeEmbedder, id NodeAttr) *Inode { func (n *Inode) NewInode(ctx context.Context, node InodeEmbedder, id StableAttr) *Inode {
return n.newInode(ctx, node, id, false) return n.newInode(ctx, node, id, false)
} }
func (n *Inode) newInode(ctx context.Context, ops InodeEmbedder, id NodeAttr, persistent bool) *Inode { func (n *Inode) newInode(ctx context.Context, ops InodeEmbedder, id StableAttr, persistent bool) *Inode {
return n.bridge.newInode(ctx, ops, id, persistent) return n.bridge.newInode(ctx, ops, id, persistent)
} }
......
...@@ -25,7 +25,7 @@ func (r *interruptRoot) Lookup(ctx context.Context, name string, out *fuse.Entry ...@@ -25,7 +25,7 @@ func (r *interruptRoot) Lookup(ctx context.Context, name string, out *fuse.Entry
if name != "file" { if name != "file" {
return nil, syscall.ENOENT return nil, syscall.ENOENT
} }
ch := r.Inode.NewInode(ctx, &r.child, NodeAttr{ ch := r.Inode.NewInode(ctx, &r.child, StableAttr{
Ino: 2, Ino: 2,
Gen: 1}) Gen: 1})
......
...@@ -162,7 +162,7 @@ func (n *loopbackNode) Rename(ctx context.Context, name string, newParent InodeE ...@@ -162,7 +162,7 @@ func (n *loopbackNode) Rename(ctx context.Context, name string, newParent InodeE
return ToErrno(err) return ToErrno(err)
} }
func (r *loopbackRoot) idFromStat(st *syscall.Stat_t) NodeAttr { func (r *loopbackRoot) idFromStat(st *syscall.Stat_t) StableAttr {
// We compose an inode number by the underlying inode, and // We compose an inode number by the underlying inode, and
// mixing in the device number. In traditional filesystems, // mixing in the device number. In traditional filesystems,
// the inode numbers are small. The device numbers are also // the inode numbers are small. The device numbers are also
...@@ -172,7 +172,7 @@ func (r *loopbackRoot) idFromStat(st *syscall.Stat_t) NodeAttr { ...@@ -172,7 +172,7 @@ func (r *loopbackRoot) idFromStat(st *syscall.Stat_t) NodeAttr {
// the underlying filesystem // the underlying filesystem
swapped := (uint64(st.Dev) << 32) | (uint64(st.Dev) >> 32) swapped := (uint64(st.Dev) << 32) | (uint64(st.Dev) >> 32)
swappedRootDev := (r.rootDev << 32) | (r.rootDev >> 32) swappedRootDev := (r.rootDev << 32) | (r.rootDev >> 32)
return NodeAttr{ return StableAttr{
Mode: uint32(st.Mode), Mode: uint32(st.Mode),
Gen: 1, Gen: 1,
// This should work well for traditional backing FSes, // This should work well for traditional backing FSes,
......
...@@ -52,7 +52,7 @@ func (n *loopbackNode) renameExchange(name string, newparent *loopbackNode, newN ...@@ -52,7 +52,7 @@ func (n *loopbackNode) renameExchange(name string, newparent *loopbackNode, newN
// Double check that nodes didn't change from under us. // Double check that nodes didn't change from under us.
inode := &n.Inode inode := &n.Inode
if inode.Root() != inode && inode.NodeAttr().Ino != n.root().idFromStat(&st).Ino { if inode.Root() != inode && inode.StableAttr().Ino != n.root().idFromStat(&st).Ino {
return syscall.EBUSY return syscall.EBUSY
} }
if err := syscall.Fstat(fd2, &st); err != nil { if err := syscall.Fstat(fd2, &st); err != nil {
...@@ -60,7 +60,7 @@ func (n *loopbackNode) renameExchange(name string, newparent *loopbackNode, newN ...@@ -60,7 +60,7 @@ func (n *loopbackNode) renameExchange(name string, newparent *loopbackNode, newN
} }
newinode := &newparent.Inode newinode := &newparent.Inode
if newinode.Root() != newinode && newinode.NodeAttr().Ino != n.root().idFromStat(&st).Ino { if newinode.Root() != newinode && newinode.StableAttr().Ino != n.root().idFromStat(&st).Ino {
return syscall.EBUSY return syscall.EBUSY
} }
......
...@@ -53,7 +53,7 @@ func TestDataFile(t *testing.T) { ...@@ -53,7 +53,7 @@ func TestDataFile(t *testing.T) {
Mode: 0464, Mode: 0464,
}, },
}, },
NodeAttr{}) StableAttr{})
n.AddChild("file", ch, false) n.AddChild("file", ch, false)
}, },
}) })
...@@ -106,7 +106,7 @@ func TestDataFileLargeRead(t *testing.T) { ...@@ -106,7 +106,7 @@ func TestDataFileLargeRead(t *testing.T) {
Mode: 0464, Mode: 0464,
}, },
}, },
NodeAttr{}) StableAttr{})
n.AddChild("file", ch, false) n.AddChild("file", ch, false)
}, },
}) })
...@@ -130,7 +130,7 @@ func (s *SymlinkerRoot) Symlink(ctx context.Context, target, name string, out *f ...@@ -130,7 +130,7 @@ func (s *SymlinkerRoot) Symlink(ctx context.Context, target, name string, out *f
Data: []byte(target), Data: []byte(target),
} }
ch := s.NewPersistentInode(ctx, l, NodeAttr{Mode: syscall.S_IFLNK}) ch := s.NewPersistentInode(ctx, l, StableAttr{Mode: syscall.S_IFLNK})
return ch, 0 return ch, 0
} }
......
...@@ -31,8 +31,8 @@ func TestDefaultPermissions(t *testing.T) { ...@@ -31,8 +31,8 @@ func TestDefaultPermissions(t *testing.T) {
mntDir, _, clean := testMount(t, root, &Options{ mntDir, _, clean := testMount(t, root, &Options{
DefaultPermissions: true, DefaultPermissions: true,
OnAdd: func(ctx context.Context) { OnAdd: func(ctx context.Context) {
dir := root.NewPersistentInode(ctx, &Inode{}, NodeAttr{Mode: syscall.S_IFDIR}) dir := root.NewPersistentInode(ctx, &Inode{}, StableAttr{Mode: syscall.S_IFDIR})
file := root.NewPersistentInode(ctx, &Inode{}, NodeAttr{Mode: syscall.S_IFREG}) file := root.NewPersistentInode(ctx, &Inode{}, StableAttr{Mode: syscall.S_IFREG})
root.AddChild("dir", dir, false) root.AddChild("dir", dir, false)
root.AddChild("file", file, false) root.AddChild("file", file, false)
......
...@@ -107,7 +107,7 @@ func TestZipFSOnAdd(t *testing.T) { ...@@ -107,7 +107,7 @@ func TestZipFSOnAdd(t *testing.T) {
mnt, _, clean := testMount(t, root, &Options{ mnt, _, clean := testMount(t, root, &Options{
OnAdd: func(ctx context.Context) { OnAdd: func(ctx context.Context) {
root.AddChild("sub", root.AddChild("sub",
root.NewPersistentInode(ctx, zr, NodeAttr{Mode: syscall.S_IFDIR}), false) root.NewPersistentInode(ctx, zr, StableAttr{Mode: syscall.S_IFDIR}), false)
}, },
}) })
defer clean() defer clean()
...@@ -197,13 +197,13 @@ func (zr *zipRoot) OnAdd(ctx context.Context) { ...@@ -197,13 +197,13 @@ func (zr *zipRoot) OnAdd(ctx context.Context) {
ch := p.GetChild(component) ch := p.GetChild(component)
if ch == nil { if ch == nil {
ch = p.NewPersistentInode(ctx, &Inode{}, ch = p.NewPersistentInode(ctx, &Inode{},
NodeAttr{Mode: fuse.S_IFDIR}) StableAttr{Mode: fuse.S_IFDIR})
p.AddChild(component, ch, true) p.AddChild(component, ch, true)
} }
p = ch p = ch
} }
ch := p.NewPersistentInode(ctx, &zipFile{file: f}, NodeAttr{}) ch := p.NewPersistentInode(ctx, &zipFile{file: f}, StableAttr{})
p.AddChild(base, ch, true) p.AddChild(base, ch, true)
} }
} }
...@@ -235,7 +235,7 @@ func ExampleInode_NewPersistentInode() { ...@@ -235,7 +235,7 @@ func ExampleInode_NewPersistentInode() {
if ch == nil { if ch == nil {
// Create a directory // Create a directory
ch = p.NewPersistentInode(ctx, &Inode{}, ch = p.NewPersistentInode(ctx, &Inode{},
NodeAttr{Mode: syscall.S_IFDIR}) StableAttr{Mode: syscall.S_IFDIR})
// Add it // Add it
p.AddChild(component, ch, true) p.AddChild(component, ch, true)
} }
...@@ -246,7 +246,7 @@ func ExampleInode_NewPersistentInode() { ...@@ -246,7 +246,7 @@ func ExampleInode_NewPersistentInode() {
// Create the file // Create the file
child := p.NewPersistentInode(ctx, &MemRegularFile{ child := p.NewPersistentInode(ctx, &MemRegularFile{
Data: []byte(content), Data: []byte(content),
}, NodeAttr{}) }, StableAttr{})
// And add it // And add it
p.AddChild(base, child, true) p.AddChild(base, child, true)
......
...@@ -29,7 +29,7 @@ type MultiZipFs struct { ...@@ -29,7 +29,7 @@ type MultiZipFs struct {
} }
func (fs *MultiZipFs) OnAdd(ctx context.Context) { func (fs *MultiZipFs) OnAdd(ctx context.Context) {
n := fs.NewPersistentInode(ctx, &configRoot{}, nodefs.NodeAttr{Mode: syscall.S_IFDIR}) n := fs.NewPersistentInode(ctx, &configRoot{}, nodefs.StableAttr{Mode: syscall.S_IFDIR})
fs.AddChild("config", n, false) fs.AddChild("config", n, false)
} }
...@@ -72,12 +72,12 @@ func (r *configRoot) Symlink(ctx context.Context, target string, base string, ou ...@@ -72,12 +72,12 @@ func (r *configRoot) Symlink(ctx context.Context, target string, base string, ou
} }
_, parent := r.Parent() _, parent := r.Parent()
ch := r.NewPersistentInode(ctx, root, nodefs.NodeAttr{Mode: syscall.S_IFDIR}) ch := r.NewPersistentInode(ctx, root, nodefs.StableAttr{Mode: syscall.S_IFDIR})
parent.AddChild(base, ch, false) parent.AddChild(base, ch, false)
link := r.NewPersistentInode(ctx, &nodefs.MemSymlink{ link := r.NewPersistentInode(ctx, &nodefs.MemSymlink{
Data: []byte(target), Data: []byte(target),
}, nodefs.NodeAttr{Mode: syscall.S_IFLNK}) }, nodefs.StableAttr{Mode: syscall.S_IFLNK})
r.AddChild(base, link, false) r.AddChild(base, link, false)
return link, 0 return link, 0
} }
...@@ -78,7 +78,7 @@ func (r *tarRoot) OnAdd(ctx context.Context) { ...@@ -78,7 +78,7 @@ func (r *tarRoot) OnAdd(ctx context.Context) {
if ch == nil { if ch == nil {
ch = p.NewPersistentInode(ctx, ch = p.NewPersistentInode(ctx,
&nodefs.Inode{}, &nodefs.Inode{},
nodefs.NodeAttr{Mode: syscall.S_IFDIR}) nodefs.StableAttr{Mode: syscall.S_IFDIR})
p.AddChild(comp, ch, false) p.AddChild(comp, ch, false)
} }
p = ch p = ch
...@@ -92,7 +92,7 @@ func (r *tarRoot) OnAdd(ctx context.Context) { ...@@ -92,7 +92,7 @@ func (r *tarRoot) OnAdd(ctx context.Context) {
Data: []byte(hdr.Linkname), Data: []byte(hdr.Linkname),
} }
l.Attr = attr l.Attr = attr
p.AddChild(base, r.NewPersistentInode(ctx, l, nodefs.NodeAttr{Mode: syscall.S_IFLNK}), false) p.AddChild(base, r.NewPersistentInode(ctx, l, nodefs.StableAttr{Mode: syscall.S_IFLNK}), false)
case tar.TypeLink: case tar.TypeLink:
log.Println("don't know how to handle Typelink") log.Println("don't know how to handle Typelink")
...@@ -100,25 +100,25 @@ func (r *tarRoot) OnAdd(ctx context.Context) { ...@@ -100,25 +100,25 @@ func (r *tarRoot) OnAdd(ctx context.Context) {
case tar.TypeChar: case tar.TypeChar:
rf := &nodefs.MemRegularFile{} rf := &nodefs.MemRegularFile{}
rf.Attr = attr rf.Attr = attr
p.AddChild(base, r.NewPersistentInode(ctx, rf, nodefs.NodeAttr{Mode: syscall.S_IFCHR}), false) p.AddChild(base, r.NewPersistentInode(ctx, rf, nodefs.StableAttr{Mode: syscall.S_IFCHR}), false)
case tar.TypeBlock: case tar.TypeBlock:
rf := &nodefs.MemRegularFile{} rf := &nodefs.MemRegularFile{}
rf.Attr = attr rf.Attr = attr
p.AddChild(base, r.NewPersistentInode(ctx, rf, nodefs.NodeAttr{Mode: syscall.S_IFBLK}), false) p.AddChild(base, r.NewPersistentInode(ctx, rf, nodefs.StableAttr{Mode: syscall.S_IFBLK}), false)
case tar.TypeDir: case tar.TypeDir:
rf := &nodefs.MemRegularFile{} rf := &nodefs.MemRegularFile{}
rf.Attr = attr rf.Attr = attr
p.AddChild(base, r.NewPersistentInode(ctx, rf, nodefs.NodeAttr{Mode: syscall.S_IFDIR}), false) p.AddChild(base, r.NewPersistentInode(ctx, rf, nodefs.StableAttr{Mode: syscall.S_IFDIR}), false)
case tar.TypeFifo: case tar.TypeFifo:
rf := &nodefs.MemRegularFile{} rf := &nodefs.MemRegularFile{}
rf.Attr = attr rf.Attr = attr
p.AddChild(base, r.NewPersistentInode(ctx, rf, nodefs.NodeAttr{Mode: syscall.S_IFIFO}), false) p.AddChild(base, r.NewPersistentInode(ctx, rf, nodefs.StableAttr{Mode: syscall.S_IFIFO}), false)
case tar.TypeReg, tar.TypeRegA: case tar.TypeReg, tar.TypeRegA:
df := &nodefs.MemRegularFile{ df := &nodefs.MemRegularFile{
Data: buf.Bytes(), Data: buf.Bytes(),
} }
df.Attr = attr df.Attr = attr
p.AddChild(base, r.NewPersistentInode(ctx, df, nodefs.NodeAttr{}), false) p.AddChild(base, r.NewPersistentInode(ctx, df, nodefs.StableAttr{}), false)
default: default:
log.Printf("entry %q: unsupported type '%c'", hdr.Name, hdr.Typeflag) log.Printf("entry %q: unsupported type '%c'", hdr.Name, hdr.Typeflag)
} }
......
...@@ -66,13 +66,13 @@ func (zr *zipRoot) OnAdd(ctx context.Context) { ...@@ -66,13 +66,13 @@ func (zr *zipRoot) OnAdd(ctx context.Context) {
ch := p.GetChild(component) ch := p.GetChild(component)
if ch == nil { if ch == nil {
ch = p.NewPersistentInode(ctx, &nodefs.Inode{}, ch = p.NewPersistentInode(ctx, &nodefs.Inode{},
nodefs.NodeAttr{Mode: fuse.S_IFDIR}) nodefs.StableAttr{Mode: fuse.S_IFDIR})
p.AddChild(component, ch, true) p.AddChild(component, ch, true)
} }
p = ch p = ch
} }
ch := p.NewPersistentInode(ctx, &zipFile{file: f}, nodefs.NodeAttr{}) ch := p.NewPersistentInode(ctx, &zipFile{file: f}, nodefs.StableAttr{})
p.AddChild(base, ch, true) p.AddChild(base, ch, true)
} }
} }
......
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