Refactored attribute patching.

geesefs-0-30-9
Aaron Jacobs 2015-02-27 14:24:31 +11:00
parent 820917579f
commit 99dca8b42c
1 changed files with 10 additions and 8 deletions

View File

@ -116,6 +116,14 @@ func findChildInode(
return
}
func (fs *HelloFS) patchAttributes(
attr *fuse.InodeAttributes) {
now := fs.Clock.Now()
attr.Atime = now
attr.Mtime = now
attr.Crtime = now
}
func (fs *HelloFS) LookUpInode(
ctx context.Context,
req *fuse.LookUpInodeRequest) (
@ -140,10 +148,7 @@ func (fs *HelloFS) LookUpInode(
resp.Attributes = gInodeInfo[childInode].attributes
// Patch attributes.
now := fs.Clock.Now()
resp.Attributes.Atime = now
resp.Attributes.Mtime = now
resp.Attributes.Crtime = now
fs.patchAttributes(&resp.Attributes)
return
}
@ -165,10 +170,7 @@ func (fs *HelloFS) GetInodeAttributes(
resp.Attributes = info.attributes
// Patch attributes.
now := fs.Clock.Now()
resp.Attributes.Atime = now
resp.Attributes.Mtime = now
resp.Attributes.Crtime = now
fs.patchAttributes(&resp.Attributes)
return
}