Added FUSE support #55
@ -103,7 +103,7 @@ func (n *ITNode) Readdir(ctx context.Context) (fs.DirStream, syscall.Errno) {
|
||||
// root folder
|
||||
r := make([]fuse.DirEntry, 2)
|
||||
r[0] = fuse.DirEntry{
|
||||
Name: "device",
|
||||
Name: "info",
|
||||
Ino: 0,
|
||||
Mode: fuse.S_IFDIR,
|
||||
}
|
||||
@ -115,7 +115,7 @@ func (n *ITNode) Readdir(ctx context.Context) (fs.DirStream, syscall.Errno) {
|
||||
return fs.NewListDirStream(r), 0
|
||||
|
||||
case 1:
|
||||
// device folder
|
||||
// info folder
|
||||
r := make([]fuse.DirEntry, 6)
|
||||
for ind, value := range properties {
|
||||
r[ind] = fuse.DirEntry{
|
||||
@ -128,7 +128,7 @@ func (n *ITNode) Readdir(ctx context.Context) (fs.DirStream, syscall.Errno) {
|
||||
return fs.NewListDirStream(r), 0
|
||||
|
||||
case 2:
|
||||
// on device
|
||||
// on info
|
||||
files, err := myfs.ReadDir(n.path)
|
||||
if err != nil {
|
||||
log.Error("FUSE ReadDir failed").Str("path", n.path).Err(err).Send()
|
||||
@ -185,7 +185,7 @@ func (n *ITNode) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*
|
||||
switch n.kind {
|
||||
case 0:
|
||||
// root folder
|
||||
if name == "device" {
|
||||
if name == "info" {
|
||||
stable := fs.StableAttr{
|
||||
Mode: fuse.S_IFDIR,
|
||||
Ino: uint64(0),
|
||||
@ -203,7 +203,7 @@ func (n *ITNode) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*
|
||||
return child, 0
|
||||
}
|
||||
case 1:
|
||||
// device folder
|
||||
// info folder
|
||||
for _, value := range properties {
|
||||
if value.name == name {
|
||||
stable := fs.StableAttr{
|
||||
|
Loading…
Reference in New Issue
Block a user