Refactored attribute patching.
parent
820917579f
commit
99dca8b42c
|
@ -116,6 +116,14 @@ func findChildInode(
|
||||||
return
|
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(
|
func (fs *HelloFS) LookUpInode(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req *fuse.LookUpInodeRequest) (
|
req *fuse.LookUpInodeRequest) (
|
||||||
|
@ -140,10 +148,7 @@ func (fs *HelloFS) LookUpInode(
|
||||||
resp.Attributes = gInodeInfo[childInode].attributes
|
resp.Attributes = gInodeInfo[childInode].attributes
|
||||||
|
|
||||||
// Patch attributes.
|
// Patch attributes.
|
||||||
now := fs.Clock.Now()
|
fs.patchAttributes(&resp.Attributes)
|
||||||
resp.Attributes.Atime = now
|
|
||||||
resp.Attributes.Mtime = now
|
|
||||||
resp.Attributes.Crtime = now
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -165,10 +170,7 @@ func (fs *HelloFS) GetInodeAttributes(
|
||||||
resp.Attributes = info.attributes
|
resp.Attributes = info.attributes
|
||||||
|
|
||||||
// Patch attributes.
|
// Patch attributes.
|
||||||
now := fs.Clock.Now()
|
fs.patchAttributes(&resp.Attributes)
|
||||||
resp.Attributes.Atime = now
|
|
||||||
resp.Attributes.Mtime = now
|
|
||||||
resp.Attributes.Crtime = now
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue