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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
ea3997a8
Commit
ea3997a8
authored
Oct 22, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
fc4ab83b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletion
+24
-1
wcfs/internal/wcfs_misc.cpp
wcfs/internal/wcfs_misc.cpp
+8
-0
wcfs/internal/wcfs_misc.h
wcfs/internal/wcfs_misc.h
+6
-1
wcfs/internal/wcfs_virtmem.cpp
wcfs/internal/wcfs_virtmem.cpp
+10
-0
No files found.
wcfs/internal/wcfs_misc.cpp
View file @
ea3997a8
...
...
@@ -21,6 +21,13 @@
namespace
os
{
tuple
<
File
,
error
>
open
(
const
string
&
path
)
{
File
f
=
{.
fd
=
-
1
,
path
=
path
};
int
err
=
std
::
open
(
path
.
c_str
(),
O_RDONLY
);
// XXX mode
if
(
err
!=
0
)
return
f
,
f
.
_errno
();
}
error
File
::
close
()
{
File
*
f
=
this
;
...
...
@@ -44,4 +51,5 @@ error File::_err(const char *op) {
return
errorf
(
"%s %s: %s"
,
op
,
f
->
path
,
strerror_r
(
errno
));
}
}
// os::
wcfs/internal/wcfs_misc.h
View file @
ea3997a8
...
...
@@ -25,6 +25,9 @@
#include <string>
using
std
::
string
;
#include <tuple>
using
std
::
tuple
;
// error mimics error from Go.
struct
error
{
string
err
;
...
...
@@ -51,7 +54,9 @@ struct File {
error
stat
(
struct
stat
*
st
);
};
// XXX tuple<File, error> open(const string &path)
// open opens file @path.
// XXX mode
tuple
<
File
,
error
>
open
(
const
string
&
path
);
}
// os::
...
...
wcfs/internal/wcfs_virtmem.cpp
View file @
ea3997a8
...
...
@@ -73,6 +73,7 @@ struct SrvReq;
struct
WCFS
{
Conn
*
connect
(
Tid
at
);
tuple
<
os
::
File
,
error
>
_open
(
const
string
&
path
/*, XXX mode*/
);
};
// Conn represents logical connection that provides view of data on wcfs
...
...
@@ -264,3 +265,12 @@ void _Mapping::_remmapblk(int64_t blk, Tid at) {
mm
.
map_into_ro
(
blkmem
,
fsfile
.
fd
,
blk
*
f
->
blksize
);
}
}
// ---- WCFS raw file access ----
tuple
<
os
::
File
,
error
>
WCFS
::
_open
(
const
string
&
path
/*, XXX mode*/
)
{
WCFS
*
wc
=
this
;
path_
=
wc
->
_path
(
path
);
return
os
::
open
(
path_
/*, XXX mode*/
);
}
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