From 13335f6e9b4a3614f71055b77dc1007036eb5646 Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Fri, 6 Mar 2015 06:00:55 +1100 Subject: [PATCH] Support changing mode. --- samples/memfs/fs.go | 2 +- samples/memfs/inode.go | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/samples/memfs/fs.go b/samples/memfs/fs.go index 730636f..49a1f69 100644 --- a/samples/memfs/fs.go +++ b/samples/memfs/fs.go @@ -281,7 +281,7 @@ func (fs *memFS) SetInodeAttributes( defer inode.mu.Unlock() // Handle the request. - inode.SetAttributes(req.Size) + inode.SetAttributes(req.Size, req.Mode) // Fill in the response. resp.Attributes = inode.attributes diff --git a/samples/memfs/inode.go b/samples/memfs/inode.go index a878fcc..0ea3d5b 100644 --- a/samples/memfs/inode.go +++ b/samples/memfs/inode.go @@ -373,7 +373,7 @@ func (inode *inode) WriteAt(p []byte, off int64) (n int, err error) { // Update attributes from non-nil parameters. // // EXCLUSIVE_LOCKS_REQUIRED(inode.mu) -func (inode *inode) SetAttributes(size *uint64) { +func (inode *inode) SetAttributes(size *uint64, mode *os.FileMode) { // Update the modification time. inode.attributes.Mtime = inode.clock.Now() @@ -392,4 +392,9 @@ func (inode *inode) SetAttributes(size *uint64) { // Update attributes. inode.attributes.Size = *size } + + // Change mode? + if mode != nil { + inode.attributes.Mode = *mode + } }