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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Michal Rostecki
redoxfs
Commits
e869b3b1
Commit
e869b3b1
authored
5 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Plain Diff
Merge branch 'update_path' into 'master'
Update path after frename See merge request
!46
parents
602a63ac
924adef1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mount/redox/resource.rs
+9
-0
9 additions, 0 deletions
src/mount/redox/resource.rs
src/mount/redox/scheme.rs
+3
-2
3 additions, 2 deletions
src/mount/redox/scheme.rs
with
12 additions
and
2 deletions
src/mount/redox/resource.rs
+
9
−
0
View file @
e869b3b1
...
@@ -13,6 +13,7 @@ use filesystem::FileSystem;
...
@@ -13,6 +13,7 @@ use filesystem::FileSystem;
pub
trait
Resource
<
D
:
Disk
>
{
pub
trait
Resource
<
D
:
Disk
>
{
fn
block
(
&
self
)
->
u64
;
fn
block
(
&
self
)
->
u64
;
fn
dup
(
&
self
)
->
Result
<
Box
<
Resource
<
D
>>>
;
fn
dup
(
&
self
)
->
Result
<
Box
<
Resource
<
D
>>>
;
fn
set_path
(
&
mut
self
,
path
:
&
str
);
fn
read
(
&
mut
self
,
buf
:
&
mut
[
u8
],
fs
:
&
mut
FileSystem
<
D
>
)
->
Result
<
usize
>
;
fn
read
(
&
mut
self
,
buf
:
&
mut
[
u8
],
fs
:
&
mut
FileSystem
<
D
>
)
->
Result
<
usize
>
;
fn
write
(
&
mut
self
,
buf
:
&
[
u8
],
fs
:
&
mut
FileSystem
<
D
>
)
->
Result
<
usize
>
;
fn
write
(
&
mut
self
,
buf
:
&
[
u8
],
fs
:
&
mut
FileSystem
<
D
>
)
->
Result
<
usize
>
;
fn
seek
(
&
mut
self
,
offset
:
usize
,
whence
:
usize
,
fs
:
&
mut
FileSystem
<
D
>
)
->
Result
<
usize
>
;
fn
seek
(
&
mut
self
,
offset
:
usize
,
whence
:
usize
,
fs
:
&
mut
FileSystem
<
D
>
)
->
Result
<
usize
>
;
...
@@ -63,6 +64,10 @@ impl<D: Disk> Resource<D> for DirResource {
...
@@ -63,6 +64,10 @@ impl<D: Disk> Resource<D> for DirResource {
}))
}))
}
}
fn
set_path
(
&
mut
self
,
path
:
&
str
)
{
self
.path
=
path
.to_string
();
}
fn
read
(
&
mut
self
,
buf
:
&
mut
[
u8
],
_fs
:
&
mut
FileSystem
<
D
>
)
->
Result
<
usize
>
{
fn
read
(
&
mut
self
,
buf
:
&
mut
[
u8
],
_fs
:
&
mut
FileSystem
<
D
>
)
->
Result
<
usize
>
{
let
data
=
self
.data
.as_ref
()
.ok_or
(
Error
::
new
(
EISDIR
))
?
;
let
data
=
self
.data
.as_ref
()
.ok_or
(
Error
::
new
(
EISDIR
))
?
;
let
mut
i
=
0
;
let
mut
i
=
0
;
...
@@ -284,6 +289,10 @@ impl<D: Disk> Resource<D> for FileResource {
...
@@ -284,6 +289,10 @@ impl<D: Disk> Resource<D> for FileResource {
}))
}))
}
}
fn
set_path
(
&
mut
self
,
path
:
&
str
)
{
self
.path
=
path
.to_string
();
}
fn
read
(
&
mut
self
,
buf
:
&
mut
[
u8
],
fs
:
&
mut
FileSystem
<
D
>
)
->
Result
<
usize
>
{
fn
read
(
&
mut
self
,
buf
:
&
mut
[
u8
],
fs
:
&
mut
FileSystem
<
D
>
)
->
Result
<
usize
>
{
if
self
.flags
&
O_ACCMODE
==
O_RDWR
||
self
.flags
&
O_ACCMODE
==
O_RDONLY
{
if
self
.flags
&
O_ACCMODE
==
O_RDWR
||
self
.flags
&
O_ACCMODE
==
O_RDONLY
{
let
count
=
fs
.read_node
(
self
.block
,
self
.seek
,
buf
)
?
;
let
count
=
fs
.read_node
(
self
.block
,
self
.seek
,
buf
)
?
;
...
...
This diff is collapsed.
Click to expand it.
src/mount/redox/scheme.rs
+
3
−
2
View file @
e869b3b1
...
@@ -522,8 +522,8 @@ impl<D: Disk> Scheme for FileScheme<D> {
...
@@ -522,8 +522,8 @@ impl<D: Disk> Scheme for FileScheme<D> {
// println!("Frename {}, {} from {}, {}", id, path, uid, gid);
// println!("Frename {}, {} from {}, {}", id, path, uid, gid);
let
files
=
self
.files
.borrow_mut
();
let
mut
files
=
self
.files
.borrow_mut
();
if
let
Some
(
file
)
=
files
.get
(
&
id
)
{
if
let
Some
(
file
)
=
files
.get
_mut
(
&
id
)
{
//TODO: Check for EINVAL
//TODO: Check for EINVAL
// The new pathname contained a path prefix of the old, or, more generally,
// The new pathname contained a path prefix of the old, or, more generally,
// an attempt was made to make a directory a subdirectory of itself.
// an attempt was made to make a directory a subdirectory of itself.
...
@@ -607,6 +607,7 @@ impl<D: Disk> Scheme for FileScheme<D> {
...
@@ -607,6 +607,7 @@ impl<D: Disk> Scheme for FileScheme<D> {
fs
.insert_blocks
(
orig
.0
,
BLOCK_SIZE
,
parent
.0
)
?
;
fs
.insert_blocks
(
orig
.0
,
BLOCK_SIZE
,
parent
.0
)
?
;
}
}
file
.set_path
(
path
);
Ok
(
0
)
Ok
(
0
)
}
else
{
}
else
{
Err
(
Error
::
new
(
EPERM
))
Err
(
Error
::
new
(
EPERM
))
...
...
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