Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Levin Zimmermann
go-fuse
Commits
3d080ff7
Commit
3d080ff7
authored
Jun 22, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always return Nlink = 1 for non-directory files in
FileSystemConnector. Test for this in ZipFs.
parent
768f8806
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
9 deletions
+39
-9
fuse/loopback_test.go
fuse/loopback_test.go
+1
-1
fuse/pathops.go
fuse/pathops.go
+9
-0
zipfs/zipfs_test.go
zipfs/zipfs_test.go
+29
-8
No files found.
fuse/loopback_test.go
View file @
3d080ff7
...
...
@@ -242,7 +242,7 @@ func (me *testCase) testLink() {
err
=
os
.
Link
(
me
.
mountFile
,
me
.
mountSubfile
)
CheckSuccess
(
err
)
fi
,
err
:=
os
.
Lstat
(
me
.
mount
File
)
fi
,
err
:=
os
.
Lstat
(
me
.
orig
File
)
if
fi
.
Nlink
!=
2
{
me
.
tester
.
Errorf
(
"Expect 2 links: %v"
,
fi
)
}
...
...
fuse/pathops.go
View file @
3d080ff7
...
...
@@ -69,9 +69,14 @@ func (me *FileSystemConnector) internalLookupWithNode(parent *inode, name string
}
SplitNs
(
mount
.
options
.
EntryTimeout
,
&
out
.
EntryValid
,
&
out
.
EntryValidNsec
)
SplitNs
(
mount
.
options
.
AttrTimeout
,
&
out
.
AttrValid
,
&
out
.
AttrValidNsec
)
if
!
fi
.
IsDirectory
()
{
fi
.
Nlink
=
1
}
CopyFileInfo
(
fi
,
&
out
.
Attr
)
out
.
Attr
.
Ino
=
data
.
NodeId
mount
.
setOwner
(
&
out
.
Attr
)
return
out
,
OK
,
data
}
...
...
@@ -111,6 +116,10 @@ func (me *FileSystemConnector) GetAttr(header *InHeader, input *GetAttrIn) (out
out
=
&
AttrOut
{}
CopyFileInfo
(
fi
,
&
out
.
Attr
)
out
.
Attr
.
Ino
=
header
.
NodeId
if
!
fi
.
IsDirectory
()
{
out
.
Nlink
=
1
}
mount
.
setOwner
(
&
out
.
Attr
)
SplitNs
(
mount
.
options
.
AttrTimeout
,
&
out
.
AttrValid
,
&
out
.
AttrValidNsec
)
return
out
,
OK
...
...
zipfs/zipfs_test.go
View file @
3d080ff7
package
zipfs
import
(
...
...
@@ -6,22 +7,29 @@ import (
"testing"
)
func
TestZipFs
(
t
*
testing
.
T
)
{
func
setupZipfs
()
(
mountPoint
string
,
cleanup
func
()
)
{
wd
,
err
:=
os
.
Getwd
()
CheckSuccess
(
err
)
zfs
,
err
:=
NewArchiveFileSystem
(
wd
+
"/test.zip"
)
if
err
!=
nil
{
t
.
Error
(
"NewZipArchiveFileSystem failed:"
,
err
)
}
CheckSuccess
(
err
)
mountPoint
=
fuse
.
MakeTempDir
()
mountPoint
:=
fuse
.
MakeTempDir
()
defer
os
.
RemoveAll
(
mountPoint
)
state
,
_
,
err
:=
fuse
.
MountFileSystem
(
mountPoint
,
zfs
,
nil
)
defer
state
.
Unmount
()
state
.
Debug
=
true
go
state
.
Loop
(
false
)
return
mountPoint
,
func
()
{
state
.
Unmount
()
os
.
RemoveAll
(
mountPoint
)
}
}
func
TestZipFs
(
t
*
testing
.
T
)
{
mountPoint
,
clean
:=
setupZipfs
()
defer
clean
()
d
,
err
:=
os
.
Open
(
mountPoint
)
CheckSuccess
(
err
)
...
...
@@ -58,3 +66,16 @@ func TestZipFs(t *testing.T) {
}
f
.
Close
()
}
func
TestLinkCount
(
t
*
testing
.
T
)
{
t
.
Log
(
"TestLinkCount"
)
mp
,
clean
:=
setupZipfs
()
defer
clean
()
fi
,
err
:=
os
.
Stat
(
mp
+
"/file.txt"
)
CheckSuccess
(
err
)
if
fi
.
Nlink
!=
1
{
t
.
Fatal
(
"wrong link count"
,
fi
.
Nlink
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment