Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

simplify

chrislua10c28ba8290
diff --git a/weed/mount/weedfs_attr.go b/weed/mount/weedfs_attr.go
index 41cd29b751..7e53ad5064 100644
--- a/weed/mount/weedfs_attr.go
+++ b/weed/mount/weedfs_attr.go
@@ -20,11 +20,9 @@ func (wfs *WFS) GetAttr(cancel <-chan struct{}, input *fuse.GetAttrIn, out *fuse
if status != fuse.OK {
return status
}
- if entry.IsDirectory {
+ wfs.setOutAttr(out, input.NodeId, entry)
- }
-
- return fuse.ENOSYS
+ return fuse.OK
}
func (wfs *WFS) SetAttr(cancel <-chan struct{}, input *fuse.SetAttrIn, out *fuse.AttrOut) (code fuse.Status) {
@@ -56,7 +54,7 @@ func (wfs *WFS) setRootAttr(out *fuse.AttrOut) {
out.Mtime = now
out.Ctime = now
out.Atime = now
- out.Mode = uint32(syscall.S_IFDIR | wfs.option.MountMode)
+ out.Mode = osToSystemMode(os.ModeDir) | uint32(wfs.option.MountMode)
out.Nlink = 1
}
@@ -65,7 +63,7 @@ func (wfs *WFS) setOutAttr(out *fuse.AttrOut, inode uint64, entry *filer_pb.Entr
out.Ino = inode
out.Uid = entry.Attributes.Uid
out.Gid = entry.Attributes.Gid
- out.Mode = entry.Attributes.FileMode
+ out.Mode = modeToSystemMode(entry.Attributes.FileMode)
out.Mtime = uint64(entry.Attributes.Mtime)
out.Ctime = uint64(entry.Attributes.Mtime)
out.Atime = uint64(entry.Attributes.Mtime)
@@ -78,8 +76,12 @@ func (wfs *WFS) setOutAttr(out *fuse.AttrOut, inode uint64, entry *filer_pb.Entr
out.Nlink = 1
}
+func modeToSystemMode(mode uint32) uint32 {
+ return osToSystemMode(os.FileMode(mode)) | mode
+}
+
func osToSystemMode(mode os.FileMode) uint32 {
- switch mode & 0x7F {
+ switch mode & os.ModeType {
case os.ModeDir:
return syscall.S_IFDIR
case os.ModeSymlink: