Skip to content

Commit

Permalink
Updated fileSystem.SetInodeAttributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsa committed Sep 10, 2015
1 parent 174a5a7 commit 679a940
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions internal/fs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -952,38 +952,27 @@ func (fs *fileSystem) SetInodeAttributes(

in.Lock()
defer in.Unlock()
file, isFile := in.(*inode.FileInode)

// We don't support changing non-files.
file, ok := in.(*inode.FileInode)
if !ok {
err = fuse.ENOSYS
return
}

// Set the mtime, if requested.
if op.Mtime != nil {
// Set file mtimes.
if isFile && op.Mtime != nil {
err = file.SetMtime(ctx, *op.Mtime)
if err != nil {
err = fmt.Errorf("SetMtime: %v", err)
return
}
}

// Set the size, if specified.
if op.Size != nil {
// Truncate files.
if isFile && op.Size != nil {
err = file.Truncate(ctx, int64(*op.Size))
if err != nil {
err = fmt.Errorf("Truncate: %v", err)
return
}
}

// We don't support setting mode. (We silently ignore atime updates, as per
// docs/semantics.md.)
if op.Mode != nil {
err = fuse.ENOSYS
return
}
// We silently ignore updates to mode and atime.

// Fill in the response.
op.Attributes, op.AttributesExpiration, err = fs.getAttributes(ctx, in)
Expand Down

0 comments on commit 679a940

Please sign in to comment.