From 7922d064fa5d5f9d348cb3eb7407e5f52ed1adad Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Mon, 2 Mar 2015 15:23:17 +1100 Subject: [PATCH] Implemented memFS.GetInodeAttributes. --- samples/memfs/fs.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/samples/memfs/fs.go b/samples/memfs/fs.go index 055fdf1..d5d3c6c 100644 --- a/samples/memfs/fs.go +++ b/samples/memfs/fs.go @@ -171,6 +171,25 @@ func (fs *memFS) LookUpInode( return } +func (fs *memFS) GetInodeAttributes( + ctx context.Context, + req *fuse.GetInodeAttributesRequest) ( + resp *fuse.GetInodeAttributesResponse, err error) { + resp = &fuse.GetInodeAttributesResponse{} + + // Look up the inode. + inode := fs.getInodeOrDie(req.Inode) + + // Fill in the response. + resp.Attributes = inode.Attributes() + + // We don't spontaneously mutate, so the kernel can cache as long as it wants + // (since it also handles invalidation). + resp.AttributesExpiration = fs.clock.Now().Add(365 * 24 * time.Hour) + + return +} + func (fs *memFS) OpenDir( ctx context.Context, req *fuse.OpenDirRequest) (resp *fuse.OpenDirResponse, err error) {