From 38e2aaff58cd1ad287ba9cb4b1cf6b3028065421 Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Fri, 20 Mar 2015 11:40:14 +1100 Subject: [PATCH] flushFS.GetInodeAttributes --- samples/flushfs/flush_fs.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/samples/flushfs/flush_fs.go b/samples/flushfs/flush_fs.go index 924566b..6ca14c9 100644 --- a/samples/flushfs/flush_fs.go +++ b/samples/flushfs/flush_fs.go @@ -48,6 +48,14 @@ type flushFS struct { // Helpers //////////////////////////////////////////////////////////////////////// +// LOCKS_REQUIRED(fs.mu) +func (fs *flushFS) rootAttributes() fuse.InodeAttributes { + return fuse.InodeAttributes{ + Nlink: 1, + Mode: 0777 | os.ModeDir, + } +} + // LOCKS_REQUIRED(fs.mu) func (fs *flushFS) fooAttributes() fuse.InodeAttributes { return fuse.InodeAttributes{ @@ -90,3 +98,27 @@ func (fs *flushFS) LookUpInode( return } + +func (fs *flushFS) GetInodeAttributes( + ctx context.Context, + req *fuse.GetInodeAttributesRequest) ( + resp *fuse.GetInodeAttributesResponse, err error) { + resp = &fuse.GetInodeAttributesResponse{} + + fs.mu.Lock() + defer fs.mu.Unlock() + + switch req.Inode { + case fuse.RootInodeID: + resp.Attributes = fs.rootAttributes() + return + + case fooID: + resp.Attributes = fs.fooAttributes() + return + + default: + err = fuse.ENOENT + return + } +}