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
James Matlik
redoxfs
Commits
e355f755
Commit
e355f755
authored
8 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Comment out prints
parent
94c36fa3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scheme/scheme.rs
+12
-12
12 additions, 12 deletions
scheme/scheme.rs
with
12 additions
and
12 deletions
scheme/scheme.rs
+
12
−
12
View file @
e355f755
...
@@ -28,7 +28,7 @@ impl Scheme for FileScheme {
...
@@ -28,7 +28,7 @@ impl Scheme for FileScheme {
fn
open
(
&
mut
self
,
url
:
&
str
,
flags
:
usize
,
_mode
:
usize
)
->
Result
<
usize
>
{
fn
open
(
&
mut
self
,
url
:
&
str
,
flags
:
usize
,
_mode
:
usize
)
->
Result
<
usize
>
{
let
path
=
url
.split
(
':'
)
.nth
(
1
)
.unwrap_or
(
""
)
.trim_matches
(
'/'
);
let
path
=
url
.split
(
':'
)
.nth
(
1
)
.unwrap_or
(
""
)
.trim_matches
(
'/'
);
println!
(
"Open '{}' {:X}"
,
path
,
flags
);
//
println!("Open '{}' {:X}", path, flags);
let
mut
nodes
=
Vec
::
new
();
let
mut
nodes
=
Vec
::
new
();
let
node_result
=
self
.fs
.path_nodes
(
path
,
&
mut
nodes
);
let
node_result
=
self
.fs
.path_nodes
(
path
,
&
mut
nodes
);
...
@@ -99,7 +99,7 @@ impl Scheme for FileScheme {
...
@@ -99,7 +99,7 @@ impl Scheme for FileScheme {
fn
mkdir
(
&
mut
self
,
url
:
&
str
,
_mode
:
usize
)
->
Result
<
usize
>
{
fn
mkdir
(
&
mut
self
,
url
:
&
str
,
_mode
:
usize
)
->
Result
<
usize
>
{
let
path
=
url
.split
(
':'
)
.nth
(
1
)
.unwrap_or
(
""
)
.trim_matches
(
'/'
);
let
path
=
url
.split
(
':'
)
.nth
(
1
)
.unwrap_or
(
""
)
.trim_matches
(
'/'
);
println!
(
"Mkdir '{}'"
,
path
);
//
println!("Mkdir '{}'", path);
let
mut
nodes
=
Vec
::
new
();
let
mut
nodes
=
Vec
::
new
();
match
self
.fs
.path_nodes
(
path
,
&
mut
nodes
)
{
match
self
.fs
.path_nodes
(
path
,
&
mut
nodes
)
{
...
@@ -129,7 +129,7 @@ impl Scheme for FileScheme {
...
@@ -129,7 +129,7 @@ impl Scheme for FileScheme {
fn
rmdir
(
&
mut
self
,
url
:
&
str
)
->
Result
<
usize
>
{
fn
rmdir
(
&
mut
self
,
url
:
&
str
)
->
Result
<
usize
>
{
let
path
=
url
.split
(
':'
)
.nth
(
1
)
.unwrap_or
(
""
)
.trim_matches
(
'/'
);
let
path
=
url
.split
(
':'
)
.nth
(
1
)
.unwrap_or
(
""
)
.trim_matches
(
'/'
);
println!
(
"Rmdir '{}'"
,
path
);
//
println!("Rmdir '{}'", path);
let
mut
nodes
=
Vec
::
new
();
let
mut
nodes
=
Vec
::
new
();
let
child
=
try
!
(
self
.fs
.path_nodes
(
path
,
&
mut
nodes
));
let
child
=
try
!
(
self
.fs
.path_nodes
(
path
,
&
mut
nodes
));
...
@@ -151,7 +151,7 @@ impl Scheme for FileScheme {
...
@@ -151,7 +151,7 @@ impl Scheme for FileScheme {
fn
unlink
(
&
mut
self
,
url
:
&
str
)
->
Result
<
usize
>
{
fn
unlink
(
&
mut
self
,
url
:
&
str
)
->
Result
<
usize
>
{
let
path
=
url
.split
(
':'
)
.nth
(
1
)
.unwrap_or
(
""
)
.trim_matches
(
'/'
);
let
path
=
url
.split
(
':'
)
.nth
(
1
)
.unwrap_or
(
""
)
.trim_matches
(
'/'
);
println!
(
"Unlink '{}'"
,
path
);
//
println!("Unlink '{}'", path);
let
mut
nodes
=
Vec
::
new
();
let
mut
nodes
=
Vec
::
new
();
let
child
=
try
!
(
self
.fs
.path_nodes
(
path
,
&
mut
nodes
));
let
child
=
try
!
(
self
.fs
.path_nodes
(
path
,
&
mut
nodes
));
...
@@ -173,7 +173,7 @@ impl Scheme for FileScheme {
...
@@ -173,7 +173,7 @@ impl Scheme for FileScheme {
/* Resource operations */
/* Resource operations */
#[allow(unused_variables)]
#[allow(unused_variables)]
fn
read
(
&
mut
self
,
id
:
usize
,
buf
:
&
mut
[
u8
])
->
Result
<
usize
>
{
fn
read
(
&
mut
self
,
id
:
usize
,
buf
:
&
mut
[
u8
])
->
Result
<
usize
>
{
println!
(
"Read {}, {:X} {}"
,
id
,
buf
.as_ptr
()
as
usize
,
buf
.len
());
//
println!("Read {}, {:X} {}", id, buf.as_ptr() as usize, buf.len());
if
let
Some
(
mut
file
)
=
self
.files
.get_mut
(
&
id
)
{
if
let
Some
(
mut
file
)
=
self
.files
.get_mut
(
&
id
)
{
file
.read
(
buf
)
file
.read
(
buf
)
...
@@ -183,7 +183,7 @@ impl Scheme for FileScheme {
...
@@ -183,7 +183,7 @@ impl Scheme for FileScheme {
}
}
fn
write
(
&
mut
self
,
id
:
usize
,
buf
:
&
[
u8
])
->
Result
<
usize
>
{
fn
write
(
&
mut
self
,
id
:
usize
,
buf
:
&
[
u8
])
->
Result
<
usize
>
{
println!
(
"Write {}, {:X} {}"
,
id
,
buf
.as_ptr
()
as
usize
,
buf
.len
());
//
println!("Write {}, {:X} {}", id, buf.as_ptr() as usize, buf.len());
if
let
Some
(
mut
file
)
=
self
.files
.get_mut
(
&
id
)
{
if
let
Some
(
mut
file
)
=
self
.files
.get_mut
(
&
id
)
{
file
.write
(
buf
)
file
.write
(
buf
)
}
else
{
}
else
{
...
@@ -192,7 +192,7 @@ impl Scheme for FileScheme {
...
@@ -192,7 +192,7 @@ impl Scheme for FileScheme {
}
}
fn
seek
(
&
mut
self
,
id
:
usize
,
pos
:
usize
,
whence
:
usize
)
->
Result
<
usize
>
{
fn
seek
(
&
mut
self
,
id
:
usize
,
pos
:
usize
,
whence
:
usize
)
->
Result
<
usize
>
{
println!
(
"Seek {}, {} {}"
,
id
,
pos
,
whence
);
//
println!("Seek {}, {} {}", id, pos, whence);
if
let
Some
(
mut
file
)
=
self
.files
.get_mut
(
&
id
)
{
if
let
Some
(
mut
file
)
=
self
.files
.get_mut
(
&
id
)
{
file
.seek
(
pos
,
whence
)
file
.seek
(
pos
,
whence
)
}
else
{
}
else
{
...
@@ -201,7 +201,7 @@ impl Scheme for FileScheme {
...
@@ -201,7 +201,7 @@ impl Scheme for FileScheme {
}
}
fn
fpath
(
&
self
,
id
:
usize
,
buf
:
&
mut
[
u8
])
->
Result
<
usize
>
{
fn
fpath
(
&
self
,
id
:
usize
,
buf
:
&
mut
[
u8
])
->
Result
<
usize
>
{
println!
(
"Fpath {}, {:X} {}"
,
id
,
buf
.as_ptr
()
as
usize
,
buf
.len
());
//
println!("Fpath {}, {:X} {}", id, buf.as_ptr() as usize, buf.len());
if
let
Some
(
file
)
=
self
.files
.get
(
&
id
)
{
if
let
Some
(
file
)
=
self
.files
.get
(
&
id
)
{
file
.path
(
buf
)
file
.path
(
buf
)
}
else
{
}
else
{
...
@@ -210,7 +210,7 @@ impl Scheme for FileScheme {
...
@@ -210,7 +210,7 @@ impl Scheme for FileScheme {
}
}
fn
fstat
(
&
self
,
id
:
usize
,
stat
:
&
mut
Stat
)
->
Result
<
usize
>
{
fn
fstat
(
&
self
,
id
:
usize
,
stat
:
&
mut
Stat
)
->
Result
<
usize
>
{
println!
(
"Fstat {}, {:X}"
,
id
,
stat
as
*
mut
Stat
as
usize
);
//
println!("Fstat {}, {:X}", id, stat as *mut Stat as usize);
if
let
Some
(
file
)
=
self
.files
.get
(
&
id
)
{
if
let
Some
(
file
)
=
self
.files
.get
(
&
id
)
{
file
.stat
(
stat
)
file
.stat
(
stat
)
}
else
{
}
else
{
...
@@ -219,7 +219,7 @@ impl Scheme for FileScheme {
...
@@ -219,7 +219,7 @@ impl Scheme for FileScheme {
}
}
fn
fsync
(
&
mut
self
,
id
:
usize
)
->
Result
<
usize
>
{
fn
fsync
(
&
mut
self
,
id
:
usize
)
->
Result
<
usize
>
{
println!
(
"Fsync {}"
,
id
);
//
println!("Fsync {}", id);
if
let
Some
(
mut
file
)
=
self
.files
.get_mut
(
&
id
)
{
if
let
Some
(
mut
file
)
=
self
.files
.get_mut
(
&
id
)
{
file
.sync
()
file
.sync
()
}
else
{
}
else
{
...
@@ -228,7 +228,7 @@ impl Scheme for FileScheme {
...
@@ -228,7 +228,7 @@ impl Scheme for FileScheme {
}
}
fn
ftruncate
(
&
mut
self
,
id
:
usize
,
len
:
usize
)
->
Result
<
usize
>
{
fn
ftruncate
(
&
mut
self
,
id
:
usize
,
len
:
usize
)
->
Result
<
usize
>
{
println!
(
"Ftruncate {}, {}"
,
id
,
len
);
//
println!("Ftruncate {}, {}", id, len);
if
let
Some
(
mut
file
)
=
self
.files
.get_mut
(
&
id
)
{
if
let
Some
(
mut
file
)
=
self
.files
.get_mut
(
&
id
)
{
file
.truncate
(
len
)
file
.truncate
(
len
)
}
else
{
}
else
{
...
@@ -237,7 +237,7 @@ impl Scheme for FileScheme {
...
@@ -237,7 +237,7 @@ impl Scheme for FileScheme {
}
}
fn
close
(
&
mut
self
,
id
:
usize
)
->
Result
<
usize
>
{
fn
close
(
&
mut
self
,
id
:
usize
)
->
Result
<
usize
>
{
println!
(
"Close {}"
,
id
);
//
println!("Close {}", id);
if
self
.files
.remove
(
&
id
)
.is_some
()
{
if
self
.files
.remove
(
&
id
)
.is_some
()
{
Ok
(
0
)
Ok
(
0
)
}
else
{
}
else
{
...
...
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