From 632b1e612010e42a6a4279d1567a1a33ea29741d Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Fri, 6 Mar 2015 05:45:17 +1100 Subject: [PATCH] Added FileSystem.SetInodeAttributes. --- file_system.go | 27 ++++++++++++++++++++++++++- samples/memfs/memfs_test.go | 8 ++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/file_system.go b/file_system.go index 0588966..d67fcee 100644 --- a/file_system.go +++ b/file_system.go @@ -57,6 +57,14 @@ type FileSystem interface { ctx context.Context, req *GetInodeAttributesRequest) (*GetInodeAttributesResponse, error) + // Change attributes for an inode. + // + // The kernel calls this for obvious cases like chmod(2), and for less + // obvious cases like ftrunctate(2). + SetInodeAttributes( + ctx context.Context, + req *SetInodeAttributesRequest) (*SetInodeAttributesResponse, error) + // Forget an inode ID previously issued (e.g. by LookUpInode or MkDir). The // kernel calls this when removing an inode from its internal caches. ForgetInode( @@ -413,7 +421,24 @@ type GetInodeAttributesRequest struct { type GetInodeAttributesResponse struct { // Attributes for the inode, and the time at which they should expire. See - // notes on LookUpInodeResponse.AttributesExpiration for more. + // notes on ChildInodeEntry.AttributesExpiration for more. + Attributes InodeAttributes + AttributesExpiration time.Time +} + +type SetInodeAttributesRequest struct { + Header RequestHeader + + // The inode of interest. + Inode InodeID + + // The attributes to modify, or nil for attributes that don't need a change. + Size *uint64 +} + +type SetInodeAttributesResponse struct { + // The new attributes for the inode, and the time at which they should + // expire. See notes on ChildInodeEntry.AttributesExpiration for more. Attributes InodeAttributes AttributesExpiration time.Time } diff --git a/samples/memfs/memfs_test.go b/samples/memfs/memfs_test.go index 0fa821a..10678ad 100644 --- a/samples/memfs/memfs_test.go +++ b/samples/memfs/memfs_test.go @@ -856,3 +856,11 @@ func (t *MemFSTest) ReadsPastEndOfFile() { ExpectEq(0, n) ExpectEq("", string(buf[:n])) } + +func (t *MemFSTest) Chmod() { + AssertTrue(false, "TODO") +} + +func (t *MemFSTest) Chtimes() { + AssertTrue(false, "TODO") +}