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