Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Redox Scheme
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
redox-os
Redox Scheme
Commits
4c0f33e3
Verified
Commit
4c0f33e3
authored
6 months ago
by
Jacob Lorentzon
Browse files
Options
Downloads
Patches
Plain Diff
Remove seek.rs
parent
4e0c6d85
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lib.rs
+0
-2
0 additions, 2 deletions
src/lib.rs
src/seek.rs
+0
-43
0 additions, 43 deletions
src/seek.rs
with
0 additions
and
45 deletions
src/lib.rs
+
0
−
2
View file @
4c0f33e3
...
@@ -18,7 +18,6 @@ pub use self::scheme::Scheme;
...
@@ -18,7 +18,6 @@ pub use self::scheme::Scheme;
pub
use
self
::
scheme_block
::
SchemeBlock
;
pub
use
self
::
scheme_block
::
SchemeBlock
;
pub
use
self
::
scheme_block_mut
::
SchemeBlockMut
;
pub
use
self
::
scheme_block_mut
::
SchemeBlockMut
;
pub
use
self
::
scheme_mut
::
SchemeMut
;
pub
use
self
::
scheme_mut
::
SchemeMut
;
pub
use
self
::
seek
::
*
;
unsafe
fn
str_from_raw_parts
(
ptr
:
*
const
u8
,
len
:
usize
)
->
Option
<&
'static
str
>
{
unsafe
fn
str_from_raw_parts
(
ptr
:
*
const
u8
,
len
:
usize
)
->
Option
<&
'static
str
>
{
let
slice
=
slice
::
from_raw_parts
(
ptr
,
len
);
let
slice
=
slice
::
from_raw_parts
(
ptr
,
len
);
...
@@ -29,7 +28,6 @@ mod scheme;
...
@@ -29,7 +28,6 @@ mod scheme;
mod
scheme_block
;
mod
scheme_block
;
mod
scheme_block_mut
;
mod
scheme_block_mut
;
mod
scheme_mut
;
mod
scheme_mut
;
mod
seek
;
pub
struct
CallerCtx
{
pub
struct
CallerCtx
{
pub
pid
:
usize
,
pub
pid
:
usize
,
...
...
This diff is collapsed.
Click to expand it.
src/seek.rs
deleted
100644 → 0
+
0
−
43
View file @
4e0c6d85
use
core
::
cmp
;
use
core
::
convert
::
TryFrom
;
use
syscall
::
error
::
*
;
use
syscall
::
flag
::
*
;
/// Helper for seek calls
/// In most cases it's easier to use a usize to track the offset and buffer size internally,
/// but the seek interface uses isize. This wrapper ensures EOVERFLOW errors are returned
/// as appropriate if the value in the usize can't fit in the isize.
pub
fn
calc_seek_offset_usize
(
cur_offset
:
usize
,
pos
:
isize
,
whence
:
usize
,
buf_len
:
usize
,
)
->
Result
<
isize
>
{
let
cur_offset
=
isize
::
try_from
(
cur_offset
)
.or_else
(|
_
|
Err
(
Error
::
new
(
EOVERFLOW
)))
?
;
let
buf_len
=
isize
::
try_from
(
buf_len
)
.or_else
(|
_
|
Err
(
Error
::
new
(
EOVERFLOW
)))
?
;
calc_seek_offset_isize
(
cur_offset
,
pos
,
whence
,
buf_len
)
}
/// Helper for seek calls
/// Result is guaranteed to be positive.
/// EOVERFLOW returned if the arguments would cause an overflow.
/// EINVAL returned if the new offset is out of bounds.
pub
fn
calc_seek_offset_isize
(
cur_offset
:
isize
,
pos
:
isize
,
whence
:
usize
,
buf_len
:
isize
,
)
->
Result
<
isize
>
{
let
new_offset
=
match
whence
{
SEEK_CUR
=>
pos
.checked_add
(
cur_offset
),
SEEK_END
=>
pos
.checked_add
(
buf_len
),
SEEK_SET
=>
Some
(
pos
),
_
=>
None
,
};
match
new_offset
{
Some
(
new_offset
)
if
new_offset
<
0
=>
Err
(
Error
::
new
(
EINVAL
)),
Some
(
new_offset
)
=>
Ok
(
cmp
::
min
(
new_offset
,
buf_len
)),
None
=>
Err
(
Error
::
new
(
EOVERFLOW
)),
}
}
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