diff options
| author | chrislu <chris.lu@gmail.com> | 2022-02-12 05:27:16 -0800 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-02-12 05:27:16 -0800 |
| commit | 5a0a709016f6530a3eca225499f5f814c1a38948 (patch) | |
| tree | d99b4f30f3f7710d69642a40d408a88a1c4b5ae6 /weed/mount/weedfs_dir_read.go | |
| parent | 866981d8ac4e8c99c371c4ca2fafcbe36e00a506 (diff) | |
| download | seaweedfs-5a0a709016f6530a3eca225499f5f814c1a38948.tar.xz seaweedfs-5a0a709016f6530a3eca225499f5f814c1a38948.zip | |
it runs, but directory listing output is not showing up
Diffstat (limited to 'weed/mount/weedfs_dir_read.go')
| -rw-r--r-- | weed/mount/weedfs_dir_read.go | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/weed/mount/weedfs_dir_read.go b/weed/mount/weedfs_dir_read.go index 43eb17bf2..a696953a1 100644 --- a/weed/mount/weedfs_dir_read.go +++ b/weed/mount/weedfs_dir_read.go @@ -5,8 +5,10 @@ import ( "github.com/chrislusf/seaweedfs/weed/filer" "github.com/chrislusf/seaweedfs/weed/filesys/meta_cache" "github.com/chrislusf/seaweedfs/weed/glog" + "github.com/chrislusf/seaweedfs/weed/util" "github.com/hanwen/go-fuse/v2/fuse" "math" + "os" ) // Directory handling @@ -31,26 +33,45 @@ func (wfs *WFS) ReadDirPlus(cancel <-chan struct{}, input *fuse.ReadIn, out *fus func (wfs *WFS) doReadDirectory(input *fuse.ReadIn, out *fuse.DirEntryList, isPlusMode bool) fuse.Status { dirPath := wfs.inodeToPath.GetPath(input.NodeId) + println("input size", input.Size, "offset", input.Offset, "pid", input.Caller.Pid) + var dirEntry fuse.DirEntry + if input.Offset == 0 { + dirEntry.Ino = input.NodeId + dirEntry.Name = "." + dirEntry.Mode = toSystemMode(os.ModeDir) + out.AddDirEntry(dirEntry) + + parentDir, _ := dirPath.DirAndName() + parentInode := wfs.inodeToPath.GetInode(util.FullPath(parentDir)) + dirEntry.Ino = parentInode + dirEntry.Name = ".." + dirEntry.Mode = toSystemMode(os.ModeDir) + out.AddDirEntry(dirEntry) + + } + + var counter uint64 processEachEntryFn := func(entry *filer.Entry, isLast bool) bool { + counter++ + if counter <= input.Offset { + return true + } dirEntry.Name = entry.Name() inode := wfs.inodeToPath.GetInode(dirPath.Child(dirEntry.Name)) + println("entry", dirEntry.Name, "inode", inode) dirEntry.Ino = inode dirEntry.Mode = toSystemMode(entry.Mode) if !isPlusMode { if !out.AddDirEntry(dirEntry) { return false } - } else { entryOut := out.AddDirLookupEntry(dirEntry) if entryOut == nil { return false } - entryOut.Generation = 1 - entryOut.EntryValid = 1 - entryOut.AttrValid = 1 - wfs.setAttrByFilerEntry(&entryOut.Attr, inode, entry) + wfs.outputEntry(entryOut, inode, entry) } return true } @@ -67,5 +88,6 @@ func (wfs *WFS) doReadDirectory(input *fuse.ReadIn, out *fuse.DirEntryList, isPl glog.Errorf("list meta cache: %v", listErr) return fuse.EIO } + return fuse.OK } |
