From afe364822a73b32b903775104895baab73a59f2a Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Fri, 27 Feb 2015 13:32:04 +1100 Subject: [PATCH] Added a getattr method. --- file_system.go | 18 ++++++++++++++++++ fuseutil/not_implemented_file_system.go | 7 +++++++ 2 files changed, 25 insertions(+) diff --git a/file_system.go b/file_system.go index a6a042a..5943dd2 100644 --- a/file_system.go +++ b/file_system.go @@ -26,6 +26,12 @@ type FileSystem interface { ctx context.Context, req *LookUpInodeRequest) (*LookUpInodeResponse, error) + // Refresh the attributes for an inode whose ID was previously returned by + // LookUpInode. + GetInodeAttributes( + ctx context.Context, + req *GetInodeAttributesRequest) (*GetInodeAttributesResponse, error) + // Forget an inode ID previously issued (e.g. by LookUpInode). The kernel // calls this when removing an inode from its internal caches. ForgetInode( @@ -201,6 +207,18 @@ type LookUpInodeResponse struct { EntryExpiration time.Time } +type GetInodeAttributesRequest struct { + // The inode of interest. + Inode InodeID +} + +type GetInodeAttributesResponse struct { + // Attributes for the inode, and the time at which they should expire. See + // notes on LookUpInodeResponse.AttributesExpiration for more. + Attributes InodeAttributes + AttributesExpiration time.Time +} + type ForgetInodeRequest struct { // The inode to be forgotten. The kernel guarantees that the node ID will not // be used in further calls to the file system (unless it is reissued by the diff --git a/fuseutil/not_implemented_file_system.go b/fuseutil/not_implemented_file_system.go index e341065..1fb12f4 100644 --- a/fuseutil/not_implemented_file_system.go +++ b/fuseutil/not_implemented_file_system.go @@ -21,6 +21,13 @@ func (fs *NotImplementedFileSystem) LookUpInode( return nil, fuse.ENOSYS } +func (fs *NotImplementedFileSystem) GetInodeAttributes( + ctx context.Context, + req *fuse.GetInodeAttributesRequest) ( + *fuse.GetInodeAttributesResponse, error) { + return nil, fuse.ENOSYS +} + func (fs *NotImplementedFileSystem) ForgetInode( ctx context.Context, req *fuse.ForgetInodeRequest) (*fuse.ForgetInodeResponse, error) {