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
ac4ae29a
Commit
ac4ae29a
authored
Mar 01, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nodefs: set file type automatically in Lookup/GetAttr/etc.
parent
a3ed4324
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
nodefs/bridge.go
nodefs/bridge.go
+8
-6
No files found.
nodefs/bridge.go
View file @
ac4ae29a
...
@@ -65,16 +65,16 @@ func (b *rawBridge) newInode(node Operations, mode uint32, id FileID, persistent
...
@@ -65,16 +65,16 @@ func (b *rawBridge) newInode(node Operations, mode uint32, id FileID, persistent
if
old
!=
nil
{
if
old
!=
nil
{
return
old
return
old
}
}
mode
=
mode
&^
07777
inode
:=
&
Inode
{
inode
:=
&
Inode
{
mode
:
mode
^
07777
,
mode
:
mode
,
node
:
node
,
node
:
node
,
nodeID
:
id
,
nodeID
:
id
,
bridge
:
b
,
bridge
:
b
,
persistent
:
persistent
,
persistent
:
persistent
,
parents
:
make
(
map
[
parentData
]
struct
{}),
parents
:
make
(
map
[
parentData
]
struct
{}),
}
}
if
mode
&
fuse
.
S_IFDIR
!=
0
{
if
mode
==
fuse
.
S_IFDIR
{
inode
.
children
=
make
(
map
[
string
]
*
Inode
)
inode
.
children
=
make
(
map
[
string
]
*
Inode
)
}
}
...
@@ -142,6 +142,8 @@ func (b *rawBridge) Lookup(header *fuse.InHeader, name string, out *fuse.EntryOu
...
@@ -142,6 +142,8 @@ func (b *rawBridge) Lookup(header *fuse.InHeader, name string, out *fuse.EntryOu
b
.
addNewChild
(
parent
,
name
,
child
,
nil
,
out
)
b
.
addNewChild
(
parent
,
name
,
child
,
nil
,
out
)
b
.
setEntryOutTimeout
(
out
)
b
.
setEntryOutTimeout
(
out
)
out
.
Mode
=
child
.
mode
|
(
out
.
Mode
&
07777
)
return
fuse
.
OK
return
fuse
.
OK
}
}
...
@@ -251,9 +253,7 @@ func (b *rawBridge) Create(input *fuse.CreateIn, name string, out *fuse.CreateOu
...
@@ -251,9 +253,7 @@ func (b *rawBridge) Create(input *fuse.CreateIn, name string, out *fuse.CreateOu
out
.
NodeId
=
child
.
nodeID
.
Ino
out
.
NodeId
=
child
.
nodeID
.
Ino
b
.
setEntryOutTimeout
(
&
out
.
EntryOut
)
b
.
setEntryOutTimeout
(
&
out
.
EntryOut
)
if
out
.
Attr
.
Mode
&^
07777
!=
fuse
.
S_IFREG
{
out
.
Mode
=
(
out
.
Attr
.
Mode
&
07777
)
|
child
.
mode
log
.
Panicf
(
"Create: mode must be S_IFREG (%o), got %o"
,
fuse
.
S_IFREG
,
out
.
Attr
.
Mode
)
}
return
fuse
.
OK
return
fuse
.
OK
}
}
...
@@ -275,6 +275,7 @@ func (b *rawBridge) GetAttr(input *fuse.GetAttrIn, out *fuse.AttrOut) fuse.Statu
...
@@ -275,6 +275,7 @@ func (b *rawBridge) GetAttr(input *fuse.GetAttrIn, out *fuse.AttrOut) fuse.Statu
code
:=
n
.
node
.
GetAttr
(
context
.
TODO
(),
f
,
out
)
code
:=
n
.
node
.
GetAttr
(
context
.
TODO
(),
f
,
out
)
b
.
setAttrTimeout
(
out
)
b
.
setAttrTimeout
(
out
)
out
.
Ino
=
input
.
NodeId
out
.
Ino
=
input
.
NodeId
out
.
Mode
=
(
out
.
Attr
.
Mode
&
07777
)
|
n
.
mode
return
code
return
code
}
}
...
@@ -349,6 +350,7 @@ func (b *rawBridge) SetAttr(input *fuse.SetAttrIn, out *fuse.AttrOut) (code fuse
...
@@ -349,6 +350,7 @@ func (b *rawBridge) SetAttr(input *fuse.SetAttrIn, out *fuse.AttrOut) (code fuse
code
=
n
.
node
.
GetAttr
(
ctx
,
f
,
out
)
code
=
n
.
node
.
GetAttr
(
ctx
,
f
,
out
)
b
.
setAttrTimeout
(
out
)
b
.
setAttrTimeout
(
out
)
out
.
Ino
=
n
.
nodeID
.
Ino
out
.
Ino
=
n
.
nodeID
.
Ino
out
.
Mode
=
n
.
mode
|
(
out
.
Mode
&^
07777
)
return
code
return
code
}
}
...
...
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