Commit 023a3889 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Move NegativeEntry() to fileSystemMount.negativeEntry()

parent 0ea25f6d
...@@ -122,3 +122,12 @@ func (me *fileSystemMount) registerFileHandle(node *Inode, dir rawDir, f File, f ...@@ -122,3 +122,12 @@ func (me *fileSystemMount) registerFileHandle(node *Inode, dir rawDir, f File, f
handle := me.openFiles.Register(&b.Handled, b) handle := me.openFiles.Register(&b.Handled, b)
return handle, b return handle, b
} }
// Creates a return entry for a non-existent path.
func (me *fileSystemMount) negativeEntry() *EntryOut {
out := new(EntryOut)
out.NodeId = 0
SplitNs(me.options.NegativeTimeout, &out.EntryValid, &out.EntryValidNsec)
return out
}
...@@ -24,7 +24,7 @@ func (me *FileSystemConnector) Lookup(header *InHeader, name string) (out *Entry ...@@ -24,7 +24,7 @@ func (me *FileSystemConnector) Lookup(header *InHeader, name string) (out *Entry
func (me *FileSystemConnector) lookupMountUpdate(mount *fileSystemMount) (out *EntryOut, status Status) { func (me *FileSystemConnector) lookupMountUpdate(mount *fileSystemMount) (out *EntryOut, status Status) {
fi, err := mount.fs.Root().GetAttr(nil, nil) fi, err := mount.fs.Root().GetAttr(nil, nil)
if err == ENOENT && mount.options.NegativeTimeout > 0.0 { if err == ENOENT && mount.options.NegativeTimeout > 0.0 {
return NegativeEntry(mount.options.NegativeTimeout), OK return mount.negativeEntry(), OK
} }
if !err.Ok() { if !err.Ok() {
return nil, err return nil, err
...@@ -93,7 +93,7 @@ func (me *FileSystemConnector) postLookup(fi *os.FileInfo, fsNode FsNode, code S ...@@ -93,7 +93,7 @@ func (me *FileSystemConnector) postLookup(fi *os.FileInfo, fsNode FsNode, code S
} }
if code == ENOENT && mount.options.NegativeTimeout > 0.0 { if code == ENOENT && mount.options.NegativeTimeout > 0.0 {
return NegativeEntry(mount.options.NegativeTimeout), OK return mount.negativeEntry(), OK
} }
return nil, code return nil, code
} }
......
...@@ -118,14 +118,6 @@ func Writev(fd int, packet [][]byte) (n int, err os.Error) { ...@@ -118,14 +118,6 @@ func Writev(fd int, packet [][]byte) (n int, err os.Error) {
return n, err return n, err
} }
// 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
}
func ModeToType(mode uint32) uint32 { func ModeToType(mode uint32) uint32 {
return (mode & 0170000) >> 12 return (mode & 0170000) >> 12
} }
......
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