Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
redoxfs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
redox-os
redoxfs
Commits
00321594
Commit
00321594
authored
7 years ago
by
Jeremy Soller
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #20 from ids1024/fuse
Symlinks in fuse
parents
97652cc6
f582c60f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mount/fuse.rs
+33
-0
33 additions, 0 deletions
mount/fuse.rs
with
33 additions
and
0 deletions
mount/fuse.rs
+
33
−
0
View file @
00321594
...
...
@@ -3,6 +3,7 @@ extern crate time;
use
redoxfs
;
use
std
::
path
::
Path
;
use
std
::
os
::
unix
::
ffi
::
OsStrExt
;
use
self
::
fuse
::{
FileType
,
FileAttr
,
Filesystem
,
Request
,
ReplyData
,
ReplyEntry
,
ReplyAttr
,
ReplyCreate
,
ReplyDirectory
,
ReplyEmpty
,
ReplyStatfs
,
ReplyWrite
};
use
self
::
time
::
Timespec
;
...
...
@@ -28,6 +29,8 @@ fn node_attr(node: &(u64, redoxfs::Node)) -> FileAttr {
crtime
:
CREATE_TIME
,
kind
:
if
node
.1
.is_dir
()
{
FileType
::
Directory
}
else
if
node
.1
.is_symlink
()
{
FileType
::
Symlink
}
else
{
FileType
::
RegularFile
},
...
...
@@ -252,4 +255,34 @@ impl Filesystem for Fuse {
}
}
}
fn
symlink
(
&
mut
self
,
_req
:
&
Request
,
parent_block
:
u64
,
name
:
&
Path
,
link
:
&
Path
,
reply
:
ReplyEntry
)
{
match
self
.fs
.create_node
(
redoxfs
::
Node
::
MODE_SYMLINK
|
0o777
,
name
.to_str
()
.unwrap
(),
parent_block
)
{
Ok
(
node
)
=>
{
match
self
.fs
.write_node
(
node
.0
,
0
,
link
.as_os_str
()
.as_bytes
())
{
Ok
(
_count
)
=>
{
reply
.entry
(
&
TTL
,
&
node_attr
(
&
node
),
0
);
},
Err
(
err
)
=>
{
reply
.error
(
err
.errno
as
i32
);
}
}
},
Err
(
error
)
=>
{
reply
.error
(
error
.errno
as
i32
);
}
}
}
fn
readlink
(
&
mut
self
,
_req
:
&
Request
,
ino
:
u64
,
reply
:
ReplyData
)
{
let
mut
data
=
vec!
[
0
;
4096
];
match
self
.fs
.read_node
(
ino
,
0
,
&
mut
data
)
{
Ok
(
count
)
=>
{
reply
.data
(
&
data
[
..
count
]);
},
Err
(
err
)
=>
{
reply
.error
(
err
.errno
as
i32
);
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment