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
343e78c2
Commit
343e78c2
authored
Apr 06, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
newunionfs: symlink/readlink
parent
fb70a9f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
newunionfs/unionfs.go
newunionfs/unionfs.go
+39
-0
No files found.
newunionfs/unionfs.go
View file @
343e78c2
...
@@ -258,6 +258,45 @@ func (n *unionFSNode) Rmdir(ctx context.Context, name string) syscall.Errno {
...
@@ -258,6 +258,45 @@ func (n *unionFSNode) Rmdir(ctx context.Context, name string) syscall.Errno {
return
n
.
root
()
.
delPath
(
filepath
.
Join
(
n
.
Path
(
nil
),
name
))
return
n
.
root
()
.
delPath
(
filepath
.
Join
(
n
.
Path
(
nil
),
name
))
}
}
var
_
=
(
nodefs
.
Symlinker
)((
*
unionFSNode
)(
nil
))
func
(
n
*
unionFSNode
)
Symlink
(
ctx
context
.
Context
,
target
,
name
string
,
out
*
fuse
.
EntryOut
)
(
*
nodefs
.
Inode
,
syscall
.
Errno
)
{
n
.
promote
()
path
:=
filepath
.
Join
(
n
.
root
()
.
roots
[
0
],
n
.
Path
(
nil
),
name
)
err
:=
syscall
.
Symlink
(
target
,
path
)
if
err
!=
nil
{
return
nil
,
err
.
(
syscall
.
Errno
)
}
var
st
syscall
.
Stat_t
if
err
:=
syscall
.
Lstat
(
path
,
&
st
);
err
!=
nil
{
return
nil
,
err
.
(
syscall
.
Errno
)
}
out
.
FromStat
(
&
st
)
ch
:=
n
.
NewInode
(
ctx
,
&
unionFSNode
{},
nodefs
.
NodeAttr
{
Mode
:
syscall
.
S_IFLNK
,
Ino
:
st
.
Ino
,
})
return
ch
,
0
}
var
_
=
(
nodefs
.
Readlinker
)((
*
unionFSNode
)(
nil
))
func
(
n
*
unionFSNode
)
Readlink
(
ctx
context
.
Context
)
([]
byte
,
syscall
.
Errno
)
{
nm
,
idx
:=
n
.
getBranch
(
nil
)
var
buf
[
1024
]
byte
count
,
err
:=
syscall
.
Readlink
(
filepath
.
Join
(
n
.
root
()
.
roots
[
idx
],
nm
),
buf
[
:
])
if
err
!=
nil
{
return
nil
,
err
.
(
syscall
.
Errno
)
}
return
buf
[
:
count
],
0
}
// getBranch returns the root where we can find the given file. It
// getBranch returns the root where we can find the given file. It
// will check the deletion markers in roots[0].
// will check the deletion markers in roots[0].
func
(
n
*
unionFSNode
)
getBranch
(
st
*
syscall
.
Stat_t
)
(
string
,
int
)
{
func
(
n
*
unionFSNode
)
getBranch
(
st
*
syscall
.
Stat_t
)
(
string
,
int
)
{
...
...
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