mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
parent
3d5cb7eb86
commit
4085b79d38
|
@ -6,7 +6,6 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/seaweedfs/fuse"
|
"github.com/seaweedfs/fuse"
|
||||||
|
@ -309,7 +308,7 @@ func (dir *Dir) ReadDirAll(ctx context.Context) (ret []fuse.Dirent, err error) {
|
||||||
dirent := fuse.Dirent{Inode: inode, Name: entry.Name, Type: fuse.DT_Dir}
|
dirent := fuse.Dirent{Inode: inode, Name: entry.Name, Type: fuse.DT_Dir}
|
||||||
ret = append(ret, dirent)
|
ret = append(ret, dirent)
|
||||||
} else {
|
} else {
|
||||||
dirent := fuse.Dirent{Inode: inode, Name: entry.Name, Type: findFileType(uint16(entry.Attributes.FileMode))}
|
dirent := fuse.Dirent{Inode: inode, Name: entry.Name, Type: fuse.DT_File}
|
||||||
ret = append(ret, dirent)
|
ret = append(ret, dirent)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -331,26 +330,6 @@ func (dir *Dir) ReadDirAll(ctx context.Context) (ret []fuse.Dirent, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func findFileType(mode uint16) fuse.DirentType {
|
|
||||||
switch mode & (syscall.S_IFMT & 0xffff) {
|
|
||||||
case syscall.S_IFSOCK:
|
|
||||||
return fuse.DT_Socket
|
|
||||||
case syscall.S_IFLNK:
|
|
||||||
return fuse.DT_Link
|
|
||||||
case syscall.S_IFREG:
|
|
||||||
return fuse.DT_File
|
|
||||||
case syscall.S_IFBLK:
|
|
||||||
return fuse.DT_Block
|
|
||||||
case syscall.S_IFDIR:
|
|
||||||
return fuse.DT_Dir
|
|
||||||
case syscall.S_IFCHR:
|
|
||||||
return fuse.DT_Char
|
|
||||||
case syscall.S_IFIFO:
|
|
||||||
return fuse.DT_FIFO
|
|
||||||
}
|
|
||||||
return fuse.DT_File
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dir *Dir) Remove(ctx context.Context, req *fuse.RemoveRequest) error {
|
func (dir *Dir) Remove(ctx context.Context, req *fuse.RemoveRequest) error {
|
||||||
|
|
||||||
if !req.Dir {
|
if !req.Dir {
|
||||||
|
|
Loading…
Reference in a new issue