diff --git a/file_system.go b/file_system.go index 0cdeea9..a1fbc5f 100644 --- a/file_system.go +++ b/file_system.go @@ -96,11 +96,17 @@ 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 { - Size uint64 - Mode os.FileMode + Size uint64 + Mode os.FileMode + + // Time information Atime time.Time Mtime time.Time Crtime time.Time + + // Owner information + Uid uint32 + Gid uint32 } // 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 03067c5..01c023c 100644 --- a/samples/hello_fs.go +++ b/samples/hello_fs.go @@ -22,6 +22,10 @@ import ( type HelloFS struct { fuseutil.NotImplementedFileSystem Clock timeutil.Clock + + // Set by Init. + Uid uint32 + Gid uint32 } var _ fuse.FileSystem = &HelloFS{} @@ -48,8 +52,6 @@ var gInodeInfo = map[fuse.InodeID]inodeInfo{ // root rootInode: inodeInfo{ attributes: fuse.InodeAttributes{ - // TODO(jacobsa): Why do we get premission denied errors when this is - // 0500? Mode: 0500 | os.ModeDir, }, dir: true, @@ -119,6 +121,8 @@ func findChildInode( func (fs *HelloFS) patchAttributes( attr *fuse.InodeAttributes) { now := fs.Clock.Now() + attr.Uid = fs.Uid + attr.Gid = fs.Gid attr.Atime = now attr.Mtime = now attr.Crtime = now @@ -129,6 +133,8 @@ func (fs *HelloFS) Init( req *fuse.InitRequest) ( resp *fuse.InitResponse, err error) { resp = &fuse.InitResponse{} + fs.Uid = req.Uid + fs.Gid = req.Gid return } diff --git a/server.go b/server.go index 6ba8932..481395e 100644 --- a/server.go +++ b/server.go @@ -224,5 +224,7 @@ func convertAttributes(inode InodeID, attr InodeAttributes) bazilfuse.Attr { Atime: attr.Atime, Mtime: attr.Mtime, Crtime: attr.Crtime, + Uid: attr.Uid, + Gid: attr.Gid, } }