From 72e4ed930d5f6d1006914555581d3832583c22f8 Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Fri, 27 Feb 2015 13:44:51 +1100 Subject: [PATCH] Added a mode to inode attributes. --- file_system.go | 3 ++- samples/hello_fs.go | 8 ++++++-- server.go | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/file_system.go b/file_system.go index d416e9a..46aaccf 100644 --- a/file_system.go +++ b/file_system.go @@ -4,6 +4,7 @@ package fuse import ( + "os" "time" bazilfuse "bazil.org/fuse" @@ -89,8 +90,8 @@ const RootInodeID InodeID = InodeID(bazilfuse.RootID) // Attributes for a file or directory inode. Corresponds to struct inode (cf. // http://goo.gl/tvYyQt). type InodeAttributes struct { - // The size of the file in bytes. Size uint64 + Mode os.FileMode } // A generation number for an inode. Irrelevant for file systems that won't be diff --git a/samples/hello_fs.go b/samples/hello_fs.go index d2fe156..d633bd5 100644 --- a/samples/hello_fs.go +++ b/samples/hello_fs.go @@ -4,6 +4,8 @@ package samples import ( + "os" + "github.com/jacobsa/fuse" "github.com/jacobsa/fuse/fuseutil" "github.com/jacobsa/gcsfuse/timeutil" @@ -45,8 +47,10 @@ type inodeInfo struct { var gInodeInfo = map[fuse.InodeID]inodeInfo{ // root rootInode: inodeInfo{ - attributes: fuse.InodeAttributes{}, - dir: true, + attributes: fuse.InodeAttributes{ + Mode: 0700 | os.ModeDir, + }, + dir: true, children: []fuseutil.Dirent{ fuseutil.Dirent{ Offset: 1, diff --git a/server.go b/server.go index cf2a1da..90a582c 100644 --- a/server.go +++ b/server.go @@ -181,5 +181,6 @@ func convertAttributes(inode InodeID, attr InodeAttributes) bazilfuse.Attr { return bazilfuse.Attr{ Inode: uint64(inode), Size: attr.Size, + Mode: attr.Mode, } }