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
Kirill Smelkov
go-fuse
Commits
b5f69ec8
Commit
b5f69ec8
authored
Jul 18, 2016
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return the right mode for GetAttr on the root directory.
Change-Id: I8eeddc02b1793fb546aa35f50c99b9e912d19123
parent
98e77584
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
fuse/nodefs/fileless_test.go
fuse/nodefs/fileless_test.go
+12
-8
No files found.
fuse/nodefs/fileless_test.go
View file @
b5f69ec8
...
@@ -9,14 +9,16 @@ import (
...
@@ -9,14 +9,16 @@ import (
type
nodeReadNode
struct
{
type
nodeReadNode
struct
{
Node
Node
dir
bool
noOpen
bool
noOpen
bool
data
[]
byte
data
[]
byte
}
}
func
newNodeReadNode
(
noOpen
bool
,
d
[]
byte
)
*
nodeReadNode
{
func
newNodeReadNode
(
noOpen
,
dir
bool
,
d
[]
byte
)
*
nodeReadNode
{
return
&
nodeReadNode
{
return
&
nodeReadNode
{
Node
:
NewDefaultNode
(),
Node
:
NewDefaultNode
(),
noOpen
:
noOpen
,
noOpen
:
noOpen
,
dir
:
dir
,
data
:
d
,
data
:
d
,
}
}
}
}
...
@@ -37,16 +39,18 @@ func (n *nodeReadNode) Read(file File, dest []byte, off int64, context *fuse.Con
...
@@ -37,16 +39,18 @@ func (n *nodeReadNode) Read(file File, dest []byte, off int64, context *fuse.Con
}
}
func
(
n
*
nodeReadNode
)
GetAttr
(
out
*
fuse
.
Attr
,
file
File
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
func
(
n
*
nodeReadNode
)
GetAttr
(
out
*
fuse
.
Attr
,
file
File
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
out
.
Mode
=
fuse
.
S_IFREG
|
0644
if
n
.
dir
{
out
.
Mode
=
fuse
.
S_IFDIR
|
0755
}
else
{
out
.
Mode
=
fuse
.
S_IFREG
|
0644
}
out
.
Size
=
uint64
(
len
(
n
.
data
))
out
.
Size
=
uint64
(
len
(
n
.
data
))
return
fuse
.
OK
return
fuse
.
OK
}
}
func
(
n
*
nodeReadNode
)
Lookup
(
out
*
fuse
.
Attr
,
name
string
,
context
*
fuse
.
Context
)
(
*
Inode
,
fuse
.
Status
)
{
func
(
n
*
nodeReadNode
)
Lookup
(
out
*
fuse
.
Attr
,
name
string
,
context
*
fuse
.
Context
)
(
*
Inode
,
fuse
.
Status
)
{
out
.
Mode
=
fuse
.
S_IFREG
|
0644
ch
:=
n
.
Inode
()
.
NewChild
(
name
,
false
,
newNodeReadNode
(
n
.
noOpen
,
false
,
[]
byte
(
name
)))
out
.
Size
=
uint64
(
len
(
name
))
return
ch
,
ch
.
Node
()
.
GetAttr
(
out
,
nil
,
context
)
ch
:=
n
.
Inode
()
.
NewChild
(
name
,
false
,
newNodeReadNode
(
n
.
noOpen
,
[]
byte
(
name
)))
return
ch
,
fuse
.
OK
}
}
func
TestNoOpen
(
t
*
testing
.
T
)
{
func
TestNoOpen
(
t
*
testing
.
T
)
{
...
@@ -55,7 +59,7 @@ func TestNoOpen(t *testing.T) {
...
@@ -55,7 +59,7 @@ func TestNoOpen(t *testing.T) {
t
.
Fatalf
(
"TempDir: %v"
,
err
)
t
.
Fatalf
(
"TempDir: %v"
,
err
)
}
}
root
:=
newNodeReadNode
(
true
,
nil
)
root
:=
newNodeReadNode
(
true
,
true
,
nil
)
root
.
noOpen
=
true
root
.
noOpen
=
true
s
,
_
,
err
:=
MountRoot
(
dir
,
root
,
&
Options
{
Debug
:
VerboseTest
()})
s
,
_
,
err
:=
MountRoot
(
dir
,
root
,
&
Options
{
Debug
:
VerboseTest
()})
...
@@ -96,7 +100,7 @@ func TestNodeRead(t *testing.T) {
...
@@ -96,7 +100,7 @@ func TestNodeRead(t *testing.T) {
t
.
Fatalf
(
"TempDir: %v"
,
err
)
t
.
Fatalf
(
"TempDir: %v"
,
err
)
}
}
root
:=
newNodeReadNode
(
false
,
nil
)
root
:=
newNodeReadNode
(
false
,
true
,
nil
)
opts
:=
NewOptions
()
opts
:=
NewOptions
()
opts
.
Debug
=
true
opts
.
Debug
=
true
s
,
_
,
err
:=
MountRoot
(
dir
,
root
,
opts
)
s
,
_
,
err
:=
MountRoot
(
dir
,
root
,
opts
)
...
...
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