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
Will Angenent
redoxfs
Commits
43533e8d
Verified
Commit
43533e8d
authored
5 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Plain Diff
Merge branch 'jD91mZM2/redoxfs-master' into HEAD
parents
bf4d0161
79cef7c0
No related branches found
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
+10
-7
10 additions, 7 deletions
src/mount/redox/resource.rs
src/mount/redox/scheme.rs
+3
-15
3 additions, 15 deletions
src/mount/redox/scheme.rs
with
13 additions
and
22 deletions
src/mount/redox/resource.rs
+
10
−
7
View file @
43533e8d
...
@@ -5,7 +5,7 @@ use std::time::{SystemTime, UNIX_EPOCH};
...
@@ -5,7 +5,7 @@ use std::time::{SystemTime, UNIX_EPOCH};
use
syscall
::
data
::{
Map
,
Stat
,
TimeSpec
};
use
syscall
::
data
::{
Map
,
Stat
,
TimeSpec
};
use
syscall
::
error
::{
Error
,
Result
,
EBADF
,
EINVAL
,
EISDIR
,
ENOMEM
,
EPERM
};
use
syscall
::
error
::{
Error
,
Result
,
EBADF
,
EINVAL
,
EISDIR
,
ENOMEM
,
EPERM
};
use
syscall
::
flag
::{
O_ACCMODE
,
O_RDONLY
,
O_WRONLY
,
O_RDWR
,
F_GETFL
,
F_SETFL
,
MODE_PERM
,
PROT_READ
,
PROT_WRITE
,
SEEK_SET
,
SEEK_CUR
,
SEEK_END
};
use
syscall
::
flag
::{
O_ACCMODE
,
O_APPEND
,
O_RDONLY
,
O_WRONLY
,
O_RDWR
,
F_GETFL
,
F_SETFL
,
MODE_PERM
,
PROT_READ
,
PROT_WRITE
,
SEEK_SET
,
SEEK_CUR
,
SEEK_END
};
use
disk
::
Disk
;
use
disk
::
Disk
;
use
filesystem
::
FileSystem
;
use
filesystem
::
FileSystem
;
...
@@ -256,13 +256,13 @@ pub struct FileResource {
...
@@ -256,13 +256,13 @@ pub struct FileResource {
}
}
impl
FileResource
{
impl
FileResource
{
pub
fn
new
(
path
:
String
,
block
:
u64
,
flags
:
usize
,
seek
:
u64
,
uid
:
u32
)
->
FileResource
{
pub
fn
new
(
path
:
String
,
block
:
u64
,
flags
:
usize
,
uid
:
u32
)
->
FileResource
{
FileResource
{
FileResource
{
path
:
path
,
path
,
block
:
block
,
block
,
flags
:
flags
,
flags
,
seek
:
seek
,
seek
:
0
,
uid
:
uid
,
uid
,
fmaps
:
BTreeMap
::
new
(),
fmaps
:
BTreeMap
::
new
(),
}
}
}
}
...
@@ -296,6 +296,9 @@ impl<D: Disk> Resource<D> for FileResource {
...
@@ -296,6 +296,9 @@ impl<D: Disk> Resource<D> for FileResource {
fn
write
(
&
mut
self
,
buf
:
&
[
u8
],
fs
:
&
mut
FileSystem
<
D
>
)
->
Result
<
usize
>
{
fn
write
(
&
mut
self
,
buf
:
&
[
u8
],
fs
:
&
mut
FileSystem
<
D
>
)
->
Result
<
usize
>
{
if
self
.flags
&
O_ACCMODE
==
O_RDWR
||
self
.flags
&
O_ACCMODE
==
O_WRONLY
{
if
self
.flags
&
O_ACCMODE
==
O_RDWR
||
self
.flags
&
O_ACCMODE
==
O_WRONLY
{
if
self
.flags
&
O_APPEND
==
O_APPEND
{
self
.seek
=
fs
.node_len
(
self
.block
)
?
;
}
let
mtime
=
SystemTime
::
now
()
.duration_since
(
UNIX_EPOCH
)
.unwrap
();
let
mtime
=
SystemTime
::
now
()
.duration_since
(
UNIX_EPOCH
)
.unwrap
();
let
count
=
fs
.write_node
(
self
.block
,
self
.seek
,
buf
,
mtime
.as_secs
(),
mtime
.subsec_nanos
())
?
;
let
count
=
fs
.write_node
(
self
.block
,
self
.seek
,
buf
,
mtime
.as_secs
(),
mtime
.subsec_nanos
())
?
;
self
.seek
+=
count
as
u64
;
self
.seek
+=
count
as
u64
;
...
...
This diff is collapsed.
Click to expand it.
src/mount/redox/scheme.rs
+
3
−
15
View file @
43533e8d
...
@@ -6,7 +6,7 @@ use std::time::{SystemTime, UNIX_EPOCH};
...
@@ -6,7 +6,7 @@ use std::time::{SystemTime, UNIX_EPOCH};
use
syscall
::
data
::{
Map
,
Stat
,
StatVfs
,
TimeSpec
};
use
syscall
::
data
::{
Map
,
Stat
,
StatVfs
,
TimeSpec
};
use
syscall
::
error
::{
Error
,
Result
,
EACCES
,
EEXIST
,
EISDIR
,
ENOTDIR
,
ENOTEMPTY
,
EPERM
,
ENOENT
,
EBADF
,
ELOOP
,
EINVAL
};
use
syscall
::
error
::{
Error
,
Result
,
EACCES
,
EEXIST
,
EISDIR
,
ENOTDIR
,
ENOTEMPTY
,
EPERM
,
ENOENT
,
EBADF
,
ELOOP
,
EINVAL
};
use
syscall
::
flag
::{
O_APPEND
,
O_CREAT
,
O_DIRECTORY
,
O_STAT
,
O_EXCL
,
O_TRUNC
,
O_ACCMODE
,
O_RDONLY
,
O_WRONLY
,
O_RDWR
,
MODE_PERM
,
O_SYMLINK
,
O_NOFOLLOW
};
use
syscall
::
flag
::{
O_CREAT
,
O_DIRECTORY
,
O_STAT
,
O_EXCL
,
O_TRUNC
,
O_ACCMODE
,
O_RDONLY
,
O_WRONLY
,
O_RDWR
,
MODE_PERM
,
O_SYMLINK
,
O_NOFOLLOW
};
use
syscall
::
scheme
::
Scheme
;
use
syscall
::
scheme
::
Scheme
;
use
BLOCK_SIZE
;
use
BLOCK_SIZE
;
...
@@ -250,13 +250,7 @@ impl<D: Disk> Scheme for FileScheme<D> {
...
@@ -250,13 +250,7 @@ impl<D: Disk> Scheme for FileScheme<D> {
fs
.node_set_len
(
node
.0
,
0
)
?
;
fs
.node_set_len
(
node
.0
,
0
)
?
;
}
}
let
seek
=
if
flags
&
O_APPEND
==
O_APPEND
{
Box
::
new
(
FileResource
::
new
(
path
.to_string
(),
node
.0
,
flags
,
uid
))
fs
.node_len
(
node
.0
)
?
}
else
{
0
};
Box
::
new
(
FileResource
::
new
(
path
.to_string
(),
node
.0
,
flags
,
seek
,
uid
))
},
},
None
=>
if
flags
&
O_CREAT
==
O_CREAT
{
None
=>
if
flags
&
O_CREAT
==
O_CREAT
{
let
mut
last_part
=
String
::
new
();
let
mut
last_part
=
String
::
new
();
...
@@ -290,13 +284,7 @@ impl<D: Disk> Scheme for FileScheme<D> {
...
@@ -290,13 +284,7 @@ impl<D: Disk> Scheme for FileScheme<D> {
if
dir
{
if
dir
{
Box
::
new
(
DirResource
::
new
(
path
.to_string
(),
node
.0
,
None
,
uid
))
Box
::
new
(
DirResource
::
new
(
path
.to_string
(),
node
.0
,
None
,
uid
))
}
else
{
}
else
{
let
seek
=
if
flags
&
O_APPEND
==
O_APPEND
{
Box
::
new
(
FileResource
::
new
(
path
.to_string
(),
node
.0
,
flags
,
uid
))
fs
.node_len
(
node
.0
)
?
}
else
{
0
};
Box
::
new
(
FileResource
::
new
(
path
.to_string
(),
node
.0
,
flags
,
seek
,
uid
))
}
}
}
else
{
}
else
{
return
Err
(
Error
::
new
(
EPERM
));
return
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