Compare commits

..

No commits in common. "6ac4ab9f4d418582b09096a7effd7521422a2b0c" and "0defa1ce912024afc45f4509ab4c3ee341203c4f" have entirely different histories.

View File

@ -29,7 +29,7 @@ type DirEntry struct {
type ITNode struct { type ITNode struct {
fs.Inode fs.Inode
kind nodeKind kind int
Ino uint64 Ino uint64
lst []DirEntry lst []DirEntry
@ -37,15 +37,6 @@ type ITNode struct {
path string path string
} }
type nodeKind uint8
const (
nodeKindRoot = iota
nodeKindInfo
nodeKindFS
nodeKindReadOnly
)
var ( var (
myfs *blefs.FS = nil myfs *blefs.FS = nil
inodemap map[string]uint64 = nil inodemap map[string]uint64 = nil
@ -60,7 +51,7 @@ func BuildRootNode(dev *infinitime.Device) (*ITNode, error) {
return nil, err return nil, err
} }
return &ITNode{kind: nodeKindRoot}, nil return &ITNode{kind: 0}, nil
} }
var properties = make([]ITProperty, 6) var properties = make([]ITProperty, 6)
@ -207,7 +198,7 @@ func (n *ITNode) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*
Mode: fuse.S_IFDIR, Mode: fuse.S_IFDIR,
Ino: uint64(0), Ino: uint64(0),
} }
operations := &ITNode{kind: nodeKindInfo, Ino: 0} operations := &ITNode{kind: 1, Ino: 0}
child := n.NewInode(ctx, operations, stable) child := n.NewInode(ctx, operations, stable)
return child, 0 return child, 0
} else if name == "fs" { } else if name == "fs" {
@ -215,7 +206,7 @@ func (n *ITNode) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*
Mode: fuse.S_IFDIR, Mode: fuse.S_IFDIR,
Ino: uint64(1), Ino: uint64(1),
} }
operations := &ITNode{kind: nodeKindFS, Ino: 1, path: ""} operations := &ITNode{kind: 2, Ino: 1, path: ""}
child := n.NewInode(ctx, operations, stable) child := n.NewInode(ctx, operations, stable)
return child, 0 return child, 0
} }
@ -227,7 +218,7 @@ func (n *ITNode) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*
Mode: fuse.S_IFREG, Mode: fuse.S_IFREG,
Ino: uint64(value.Ino), Ino: uint64(value.Ino),
} }
operations := &ITNode{kind: nodeKindReadOnly, Ino: value.Ino} operations := &ITNode{kind: 3, Ino: value.Ino}
child := n.NewInode(ctx, operations, stable) child := n.NewInode(ctx, operations, stable)
return child, 0 return child, 0
} }
@ -250,7 +241,7 @@ func (n *ITNode) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*
Mode: fuse.S_IFDIR, Mode: fuse.S_IFDIR,
Ino: inodemap[file.path], Ino: inodemap[file.path],
} }
operations := &ITNode{kind: nodeKindFS, path: file.path} operations := &ITNode{kind: 2, path: file.path}
child := n.NewInode(ctx, operations, stable) child := n.NewInode(ctx, operations, stable)
return child, 0 return child, 0
} else { } else {
@ -259,12 +250,13 @@ func (n *ITNode) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*
Ino: inodemap[file.path], Ino: inodemap[file.path],
} }
operations := &ITNode{ operations := &ITNode{
kind: nodeKindFS, path: file.path, kind: 2, path: file.path,
self: file, self: file,
} }
child := n.NewInode(ctx, operations, stable) child := n.NewInode(ctx, operations, stable)
return child, 0 return child, 0
} }
break
} }
log.Warn("FUSE Lookup failed").Str("path", n.path+"/"+name).Send() log.Warn("FUSE Lookup failed").Str("path", n.path+"/"+name).Send()
} }
@ -491,7 +483,7 @@ func (f *ITNode) Create(ctx context.Context, name string, flags uint32, mode uin
Ino: ino, Ino: ino,
} }
operations := &ITNode{ operations := &ITNode{
kind: nodeKindFS, Ino: ino, kind: 2, Ino: ino,
path: path, path: path,
} }
node = f.NewInode(ctx, operations, stable) node = f.NewInode(ctx, operations, stable)
@ -532,7 +524,7 @@ func (f *ITNode) Mkdir(ctx context.Context, name string, mode uint32, out *fuse.
Ino: ino, Ino: ino,
} }
operations := &ITNode{ operations := &ITNode{
kind: nodeKindFS, Ino: ino, kind: 2, Ino: ino,
path: path, path: path,
} }
node := f.NewInode(ctx, operations, stable) node := f.NewInode(ctx, operations, stable)