Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
remi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sds
remi
Commits
d33334a3
Commit
d33334a3
authored
Sep 13, 2018
by
Matthieu Dorier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added mode support
parent
ed886341
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
src/remi-client.cpp
src/remi-client.cpp
+4
-1
src/remi-server.cpp
src/remi-server.cpp
+3
-2
No files found.
src/remi-client.cpp
View file @
d33334a3
...
...
@@ -128,6 +128,7 @@ extern "C" int remi_fileset_migrate(
// expose the data
std
::
vector
<
std
::
pair
<
void
*
,
std
::
size_t
>>
theData
;
std
::
vector
<
std
::
size_t
>
theSizes
;
std
::
vector
<
mode_t
>
theModes
;
// prepare lambda for cleaning up mapped files
auto
cleanup
=
[
&
theData
]()
{
...
...
@@ -160,6 +161,8 @@ extern "C" int remi_fileset_migrate(
}
auto
size
=
st
.
st_size
;
theSizes
.
push_back
(
size
);
auto
mode
=
st
.
st_mode
;
theModes
.
push_back
(
mode
);
if
(
size
==
0
)
{
close
(
fd
);
continue
;
...
...
@@ -191,7 +194,7 @@ extern "C" int remi_fileset_migrate(
fileset
->
m_root
=
theRemoteRoot
;
// send the RPC
std
::
pair
<
int32_t
,
int32_t
>
result
=
ph
->
m_client
->
m_migrate_rpc
.
on
(
*
ph
)(
*
fileset
,
theSizes
,
localBulk
);
std
::
pair
<
int32_t
,
int32_t
>
result
=
ph
->
m_client
->
m_migrate_rpc
.
on
(
*
ph
)(
*
fileset
,
theSizes
,
theModes
,
localBulk
);
int
ret
=
result
.
first
;
*
status
=
result
.
second
;
...
...
src/remi-server.cpp
View file @
d33334a3
...
...
@@ -40,6 +40,7 @@ struct remi_provider : public tl::provider<remi_provider> {
const
tl
::
request
&
req
,
remi_fileset
&
fileset
,
const
std
::
vector
<
std
::
size_t
>&
filesizes
,
const
std
::
vector
<
mode_t
>&
theModes
,
tl
::
bulk
&
remote_bulk
)
{
// pair of <returnvalue, status>
...
...
@@ -93,7 +94,7 @@ struct remi_provider : public tl::provider<remi_provider> {
auto
theDir
=
theFilename
.
substr
(
0
,
p
);
mkdirs
(
theDir
.
c_str
());
totalSize
+=
filesizes
[
i
];
int
fd
=
open
(
theFilename
.
c_str
(),
O_RDWR
|
O_CREAT
|
O_TRUNC
,
0600
);
int
fd
=
open
(
theFilename
.
c_str
(),
O_RDWR
|
O_CREAT
|
O_TRUNC
,
theModes
[
i
]
);
if
(
fd
==
-
1
)
{
cleanup
();
result
.
first
=
REMI_ERR_IO
;
...
...
@@ -112,8 +113,8 @@ struct remi_provider : public tl::provider<remi_provider> {
return
;
}
void
*
segment
=
mmap
(
0
,
filesizes
[
i
],
PROT_WRITE
|
PROT_READ
,
MAP_SHARED
,
fd
,
0
);
close
(
fd
);
if
(
segment
==
NULL
)
{
close
(
fd
);
cleanup
();
result
.
first
=
REMI_ERR_IO
;
req
.
respond
(
result
);
...
...
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