Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
16971e47
Commit
16971e47
authored
Oct 09, 2014
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ns: Introduce ns walking helper
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
e1072b93
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
namespaces.h
include/namespaces.h
+1
-0
namespaces.c
namespaces.c
+40
-0
No files found.
include/namespaces.h
View file @
16971e47
...
...
@@ -46,6 +46,7 @@ extern unsigned long root_ns_mask;
extern
const
struct
fdtype_ops
nsfile_dump_ops
;
extern
struct
collect_image_info
nsfile_cinfo
;
extern
int
walk_namespaces
(
struct
ns_desc
*
nd
,
int
(
*
cb
)(
struct
ns_id
*
,
void
*
),
void
*
oarg
);
extern
int
collect_namespaces
(
bool
for_dump
);
extern
int
collect_mnt_namespaces
(
void
);
extern
int
dump_mnt_namespaces
(
void
);
...
...
namespaces.c
View file @
16971e47
...
...
@@ -177,6 +177,46 @@ struct ns_id *lookup_ns_by_id(unsigned int id, struct ns_desc *nd)
return
NULL
;
}
/*
* For all namespaces we support, there are two supported
* tasks-to-namespaces layout.
*
* If root task lives in the same namespace as criu does
* all other tasks should live in it too and we do NOT dump
* this namespace. On restore tasks inherit the respective
* namespace from criu.
*
* If root task lives in its own namespace, then all other
* tasks may live in it. Sometimes (CLONE_SUBNS) there can
* be more than one namespace of that type. For this case
* we dump all namespace's info and recreate them on restore.
*/
int
walk_namespaces
(
struct
ns_desc
*
nd
,
int
(
*
cb
)(
struct
ns_id
*
,
void
*
),
void
*
oarg
)
{
int
ret
=
0
;
struct
ns_id
*
ns
;
for
(
ns
=
ns_ids
;
ns
!=
NULL
;
ns
=
ns
->
next
)
{
if
(
ns
->
nd
!=
nd
)
continue
;
if
(
ns
->
pid
==
getpid
())
{
if
(
root_ns_mask
&
nd
->
cflag
)
continue
;
ret
=
cb
(
ns
,
oarg
);
break
;
}
ret
=
cb
(
ns
,
oarg
);
if
(
ret
)
break
;
}
return
ret
;
}
static
unsigned
int
generate_ns_id
(
int
pid
,
unsigned
int
kid
,
struct
ns_desc
*
nd
,
struct
ns_id
**
ns_ret
)
{
...
...
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