Commit 90b39a3b authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Fake link counts so zipfs tests pass.

parent 58c4a412
...@@ -258,7 +258,7 @@ func (me *fsInode) GetAttr(file File, context *Context) (fi *os.FileInfo, code S ...@@ -258,7 +258,7 @@ func (me *fsInode) GetAttr(file File, context *Context) (fi *os.FileInfo, code S
fi, code = me.fs.GetAttr(me.GetPath(), context) fi, code = me.fs.GetAttr(me.GetPath(), context)
} }
if fi != nil && !fi.IsDirectory() { if fi != nil && !fi.IsDirectory() && fi.Nlink == 0 {
fi.Nlink = 1 fi.Nlink = 1
} }
return fi, code return fi, code
......
...@@ -40,21 +40,20 @@ type fileSystemMount struct { ...@@ -40,21 +40,20 @@ type fileSystemMount struct {
openFiles HandleMap openFiles HandleMap
} }
func (me *fileSystemMount) setOwner(attr *Attr) { func (me *fileSystemMount) setOwner(attr *Attr) {
if me.options.Owner != nil { if me.options.Owner != nil {
attr.Owner = *me.options.Owner attr.Owner = *me.options.Owner
} }
} }
func (me *fileSystemMount) fileInfoToEntry(fi *os.FileInfo) (out *EntryOut) { func (me *fileSystemMount) fileInfoToEntry(fi *os.FileInfo) (out *EntryOut) {
out = &EntryOut{} out = &EntryOut{}
SplitNs(me.options.EntryTimeout, &out.EntryValid, &out.EntryValidNsec) SplitNs(me.options.EntryTimeout, &out.EntryValid, &out.EntryValidNsec)
SplitNs(me.options.AttrTimeout, &out.AttrValid, &out.AttrValidNsec) SplitNs(me.options.AttrTimeout, &out.AttrValid, &out.AttrValidNsec)
CopyFileInfo(fi, &out.Attr) CopyFileInfo(fi, &out.Attr)
me.setOwner(&out.Attr) me.setOwner(&out.Attr)
if !fi.IsDirectory() { if !fi.IsDirectory() && fi.Nlink == 0 {
fi.Nlink = 1 out.Nlink = 1
} }
return out return out
} }
......
...@@ -71,7 +71,6 @@ func TestZipFs(t *testing.T) { ...@@ -71,7 +71,6 @@ func TestZipFs(t *testing.T) {
} }
func TestLinkCount(t *testing.T) { func TestLinkCount(t *testing.T) {
t.Log("TestLinkCount")
mp, clean := setupZipfs() mp, clean := setupZipfs()
defer clean() defer clean()
......
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