Commit 39ac4936 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse: add Timeout methods to EntryOut and AttrOut

parent 64a8ae60
...@@ -546,6 +546,15 @@ type EntryOut struct { ...@@ -546,6 +546,15 @@ type EntryOut struct {
Attr Attr
} }
// EntryTimeout returns entry timeout currently
func (o *EntryOut) EntryTimeout() time.Duration {
return time.Duration(uint64(o.EntryValidNsec) + o.EntryValid*1e9)
}
func (o *EntryOut) AttrTimeout() time.Duration {
return time.Duration(uint64(o.AttrValidNsec) + o.AttrValid*1e9)
}
func (o *EntryOut) SetEntryTimeout(dt time.Duration) { func (o *EntryOut) SetEntryTimeout(dt time.Duration) {
ns := int64(dt) ns := int64(dt)
o.EntryValidNsec = uint32(ns % 1e9) o.EntryValidNsec = uint32(ns % 1e9)
...@@ -565,6 +574,10 @@ type AttrOut struct { ...@@ -565,6 +574,10 @@ type AttrOut struct {
Attr Attr
} }
func (o *AttrOut) Timeout() time.Duration {
return time.Duration(uint64(o.AttrValidNsec) + o.AttrValid*1e9)
}
func (o *AttrOut) SetTimeout(dt time.Duration) { func (o *AttrOut) SetTimeout(dt time.Duration) {
ns := int64(dt) ns := int64(dt)
o.AttrValidNsec = uint32(ns % 1e9) o.AttrValidNsec = uint32(ns % 1e9)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment