mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
fix listing with correct inode
This commit is contained in:
parent
6ac066d1dc
commit
65a19e3abc
|
@ -5,10 +5,8 @@ import (
|
||||||
"github.com/chrislusf/seaweedfs/weed/filer"
|
"github.com/chrislusf/seaweedfs/weed/filer"
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||||
"github.com/chrislusf/seaweedfs/weed/mount/meta_cache"
|
"github.com/chrislusf/seaweedfs/weed/mount/meta_cache"
|
||||||
"github.com/chrislusf/seaweedfs/weed/util"
|
|
||||||
"github.com/hanwen/go-fuse/v2/fuse"
|
"github.com/hanwen/go-fuse/v2/fuse"
|
||||||
"math"
|
"math"
|
||||||
"os"
|
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -147,32 +145,29 @@ func (wfs *WFS) doReadDirectory(input *fuse.ReadIn, out *fuse.DirEntryList, isPl
|
||||||
dirPath := wfs.inodeToPath.GetPath(input.NodeId)
|
dirPath := wfs.inodeToPath.GetPath(input.NodeId)
|
||||||
|
|
||||||
var dirEntry fuse.DirEntry
|
var dirEntry fuse.DirEntry
|
||||||
if input.Offset == 0 && !isPlusMode {
|
if input.Offset == 0 {
|
||||||
dirEntry.Ino = input.NodeId
|
if !isPlusMode {
|
||||||
dirEntry.Name = "."
|
out.AddDirEntry(fuse.DirEntry{Mode: fuse.S_IFDIR, Name: "."})
|
||||||
dirEntry.Mode = toSystemMode(os.ModeDir)
|
out.AddDirEntry(fuse.DirEntry{Mode: fuse.S_IFDIR, Name: ".."})
|
||||||
out.AddDirEntry(dirEntry)
|
} else {
|
||||||
|
out.AddDirLookupEntry(fuse.DirEntry{Mode: fuse.S_IFDIR, Name: "."})
|
||||||
parentDir, _ := dirPath.DirAndName()
|
out.AddDirLookupEntry(fuse.DirEntry{Mode: fuse.S_IFDIR, Name: ".."})
|
||||||
parentInode := wfs.inodeToPath.GetInode(util.FullPath(parentDir))
|
}
|
||||||
dirEntry.Ino = parentInode
|
|
||||||
dirEntry.Name = ".."
|
|
||||||
dirEntry.Mode = toSystemMode(os.ModeDir)
|
|
||||||
out.AddDirEntry(dirEntry)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processEachEntryFn := func(entry *filer.Entry, isLast bool) bool {
|
processEachEntryFn := func(entry *filer.Entry, isLast bool) bool {
|
||||||
dirEntry.Name = entry.Name()
|
dirEntry.Name = entry.Name()
|
||||||
inode := wfs.inodeToPath.GetInode(dirPath.Child(dirEntry.Name))
|
|
||||||
dirEntry.Ino = inode
|
|
||||||
dirEntry.Mode = toSystemMode(entry.Mode)
|
dirEntry.Mode = toSystemMode(entry.Mode)
|
||||||
if !isPlusMode {
|
if !isPlusMode {
|
||||||
|
inode := wfs.inodeToPath.Lookup(dirPath.Child(dirEntry.Name), entry.IsDirectory(), false)
|
||||||
|
dirEntry.Ino = inode
|
||||||
if !out.AddDirEntry(dirEntry) {
|
if !out.AddDirEntry(dirEntry) {
|
||||||
isEarlyTerminated = true
|
isEarlyTerminated = true
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
inode := wfs.inodeToPath.Lookup(dirPath.Child(dirEntry.Name), entry.IsDirectory(), true)
|
||||||
|
dirEntry.Ino = inode
|
||||||
entryOut := out.AddDirLookupEntry(dirEntry)
|
entryOut := out.AddDirLookupEntry(dirEntry)
|
||||||
if entryOut == nil {
|
if entryOut == nil {
|
||||||
isEarlyTerminated = true
|
isEarlyTerminated = true
|
||||||
|
|
Loading…
Reference in a new issue