Added time info.

geesefs-0-30-9
Aaron Jacobs 2015-02-27 14:05:52 +11:00
parent 5514405606
commit 1750a271f5
3 changed files with 23 additions and 5 deletions

View File

@ -90,8 +90,11 @@ const RootInodeID InodeID = InodeID(bazilfuse.RootID)
// Attributes for a file or directory inode. Corresponds to struct inode (cf.
// http://goo.gl/tvYyQt).
type InodeAttributes struct {
Size uint64
Mode os.FileMode
Size uint64
Mode os.FileMode
Atime time.Time
Mtime time.Time
Crtime time.Time
}
// A generation number for an inode. Irrelevant for file systems that won't be

View File

@ -139,6 +139,12 @@ func (fs *HelloFS) LookUpInode(
resp.Child = childInode
resp.Attributes = gInodeInfo[childInode].attributes
// Patch attributes.
now := fs.Clock.Now()
resp.Attributes.Atime = now
resp.Attributes.Mtime = now
resp.Attributes.Crtime = now
return
}
@ -158,6 +164,12 @@ func (fs *HelloFS) GetInodeAttributes(
// Copy over its attributes.
resp.Attributes = info.attributes
// Patch attributes.
now := fs.Clock.Now()
resp.Attributes.Atime = now
resp.Attributes.Mtime = now
resp.Attributes.Crtime = now
return
}

View File

@ -206,8 +206,11 @@ func (s *server) handleFuseRequest(fuseReq bazilfuse.Request) {
func convertAttributes(inode InodeID, attr InodeAttributes) bazilfuse.Attr {
return bazilfuse.Attr{
Inode: uint64(inode),
Size: attr.Size,
Mode: attr.Mode,
Inode: uint64(inode),
Size: attr.Size,
Mode: attr.Mode,
Atime: attr.Atime,
Mtime: attr.Mtime,
Crtime: attr.Crtime,
}
}