Commit ce1a82ae authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Split out negative entries into fuse.NegativeEntry()

parent 15a0b00c
// Random odds and ends. // Random odds and ends.
package fuse package fuse
...@@ -283,3 +283,11 @@ func CountCpus() int { ...@@ -283,3 +283,11 @@ func CountCpus() int {
return len(re.FindAllString(string(contents[:n]), 100)) return len(re.FindAllString(string(contents[:n]), 100))
} }
// Creates a return entry for a non-existent path.
func NegativeEntry(time float64) *EntryOut {
out := new(EntryOut)
out.NodeId = 0
SplitNs(time, &out.EntryValid, &out.EntryValidNsec)
return out
}
...@@ -266,10 +266,7 @@ func (self *PathFileSystemConnector) Lookup(header *InHeader, name string) (out ...@@ -266,10 +266,7 @@ func (self *PathFileSystemConnector) Lookup(header *InHeader, name string) (out
fullPath := path.Join(parent.GetPath(), name) fullPath := path.Join(parent.GetPath(), name)
attr, err := self.fileSystem.GetAttr(fullPath) attr, err := self.fileSystem.GetAttr(fullPath)
if err == ENOENT && self.options.NegativeTimeout > 0.0 { if err == ENOENT && self.options.NegativeTimeout > 0.0 {
out = new(EntryOut) return NegativeEntry(self.options.NegativeTimeout), OK
out.NodeId = 0
SplitNs(self.options.NegativeTimeout, &out.EntryValid, &out.EntryValidNsec)
return out, OK
} }
if err != OK { if err != OK {
......
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