Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
cdbb8ac5
Commit
cdbb8ac5
authored
Oct 22, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e25dd198
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
5 deletions
+13
-5
wcfs/internal/wcfs_misc.cpp
wcfs/internal/wcfs_misc.cpp
+6
-5
wcfs/internal/wcfs_misc.h
wcfs/internal/wcfs_misc.h
+5
-0
wcfs/internal/wcfs_virtmem.cpp
wcfs/internal/wcfs_virtmem.cpp
+2
-0
No files found.
wcfs/internal/wcfs_misc.cpp
View file @
cdbb8ac5
...
...
@@ -23,16 +23,16 @@
namespace
os
{
tuple
<
File
,
error
>
open
(
const
string
&
path
,
int
flags
,
mode_t
mode
)
{
File
f
=
{.
fd
=
-
1
,
path
=
path
};
File
f
=
{.
_fd
=
-
1
,
.
path
=
path
};
int
err
=
std
::
open
(
path
.
c_str
(),
flags
,
mode
);
if
(
err
!=
0
)
return
f
,
f
.
_errno
(
"open"
);
return
make_tuple
(
f
,
f
.
_errno
(
"open"
)
);
}
error
File
::
close
()
{
File
*
f
=
this
;
int
err
=
close
(
f
->
fd
);
int
err
=
close
(
f
->
_
fd
);
if
(
err
!=
0
)
return
f
->
_errno
(
"close"
);
}
...
...
@@ -40,7 +40,7 @@ error File::close() {
error
File
::
stat
(
struct
stat
*
st
)
{
File
*
f
=
this
;
int
err
=
fstat
(
f
->
fd
,
st
);
int
err
=
fstat
(
f
->
_
fd
,
st
);
if
(
err
!=
0
)
return
f
->
_errno
(
"stat"
);
return
nil
;
...
...
@@ -48,7 +48,8 @@ error File::stat(struct stat *st) {
// _errno returns error corresponding to op and errno.
error
File
::
_err
(
const
char
*
op
)
{
error
File
::
_errno
(
const
char
*
op
)
{
File
*
f
=
this
;
return
errorf
(
"%s %s: %s"
,
op
,
f
->
path
,
strerror_r
(
errno
));
}
...
...
wcfs/internal/wcfs_misc.h
View file @
cdbb8ac5
...
...
@@ -27,6 +27,7 @@ using std::string;
#include <tuple>
using
std
::
tuple
;
using
std
::
make_tuple
;
using
std
::
tie
;
// nil is synonim for nullptr and NULL.
...
...
@@ -60,11 +61,15 @@ class File {
string
_path
;
public:
friend
open
...
// XXX empty ctor -> fd=-1, path=?
int
fd
();
string
name
();
error
close
();
error
stat
(
struct
stat
*
st
);
private:
error
_errno
(
const
char
*
op
);
};
// open opens file @path.
...
...
wcfs/internal/wcfs_virtmem.cpp
View file @
cdbb8ac5
...
...
@@ -271,6 +271,7 @@ error _Mapping::_remmapblk(int64_t blk, Tid at) {
return
err
;
ASSERT
(
st
.
st_blksize
==
f
->
blksize
);
// FIXME assert
#if 0
// block is beyond file size - mmap with zeros (assumes head/f size ↑=)
if ((blk+1)*f->blksize > st.st_size) {
mm.map_zero_into_ro(blkmem); // XXX err
...
...
@@ -279,6 +280,7 @@ error _Mapping::_remmapblk(int64_t blk, Tid at) {
else {
mm.map_into_ro(blkmem, fsfile.fd, blk*f->blksize); // XXX err
}
#endif
return
nil
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment