Support changing mode.

geesefs-0-30-9
Aaron Jacobs 2015-03-06 06:00:55 +11:00
parent f10dc3e5ee
commit 13335f6e9b
2 changed files with 7 additions and 2 deletions

View File

@ -281,7 +281,7 @@ func (fs *memFS) SetInodeAttributes(
defer inode.mu.Unlock() defer inode.mu.Unlock()
// Handle the request. // Handle the request.
inode.SetAttributes(req.Size) inode.SetAttributes(req.Size, req.Mode)
// Fill in the response. // Fill in the response.
resp.Attributes = inode.attributes resp.Attributes = inode.attributes

View File

@ -373,7 +373,7 @@ func (inode *inode) WriteAt(p []byte, off int64) (n int, err error) {
// Update attributes from non-nil parameters. // Update attributes from non-nil parameters.
// //
// EXCLUSIVE_LOCKS_REQUIRED(inode.mu) // EXCLUSIVE_LOCKS_REQUIRED(inode.mu)
func (inode *inode) SetAttributes(size *uint64) { func (inode *inode) SetAttributes(size *uint64, mode *os.FileMode) {
// Update the modification time. // Update the modification time.
inode.attributes.Mtime = inode.clock.Now() inode.attributes.Mtime = inode.clock.Now()
@ -392,4 +392,9 @@ func (inode *inode) SetAttributes(size *uint64) {
// Update attributes. // Update attributes.
inode.attributes.Size = *size inode.attributes.Size = *size
} }
// Change mode?
if mode != nil {
inode.attributes.Mode = *mode
}
} }