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
5af9e2b1
Commit
5af9e2b1
authored
Sep 21, 2016
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mount: Helper for auto-ext entry creation
Signed-off-by:
Pavel Emelyanov
<
xemul@virtuozzo.com
>
parent
8ccdb649
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
17 deletions
+29
-17
mount.c
criu/mount.c
+29
-17
No files found.
criu/mount.c
View file @
5af9e2b1
...
...
@@ -35,6 +35,11 @@
#include "images/mnt.pb-c.h"
#include "images/binfmt-misc.pb-c.h"
/*
* Put a : in here since those are invalid on
* the cli, so we know it's autogenerated in
* debugging.
*/
#define AUTODETECTED_MOUNT "CRIU:AUTOGENERATED"
#define MS_PROPAGATE (MS_SHARED | MS_PRIVATE | MS_UNBINDABLE | MS_SLAVE)
...
...
@@ -79,6 +84,19 @@ static struct ext_mount *ext_mount_lookup(char *key)
return
NULL
;
}
static
struct
ext_mount
*
ext_mount_make_auto
(
char
*
key
,
char
*
val
)
{
struct
ext_mount
*
em
;
em
=
xmalloc
(
sizeof
(
*
em
));
if
(
em
)
{
em
->
key
=
key
;
em
->
val
=
val
;
}
return
em
;
}
/*
* Single linked list of mount points get from proc/images
*/
...
...
@@ -817,7 +835,6 @@ static int resolve_external_mounts(struct mount_info *info)
for
(
m
=
info
;
m
;
m
=
m
->
next
)
{
int
ret
;
char
*
p
,
*
cut_root
;
struct
ext_mount
*
em
;
struct
mount_info
*
match
;
if
(
m
->
parent
==
NULL
||
m
->
is_ns_root
)
...
...
@@ -861,17 +878,16 @@ static int resolve_external_mounts(struct mount_info *info)
if
(
!
p
)
return
-
1
;
em
=
xmalloc
(
sizeof
(
struct
ext_mount
)
);
if
(
!
em
)
{
m
->
external
=
ext_mount_make_auto
(
p
,
AUTODETECTED_MOUNT
);
if
(
!
m
->
external
)
{
free
(
p
);
return
-
1
;
}
em
->
val
=
AUTODETECTED_MOUNT
;
em
->
key
=
p
;
m
->
external
=
em
;
/*
* Put the guessed name in source. It will be picked up
* as auto-root in get_mp_root() on restore.
*/
xfree
(
m
->
source
);
m
->
source
=
p
;
...
...
@@ -3086,18 +3102,14 @@ static int get_mp_root(MntEntry *me, struct mount_info *mi)
* Make up an external mount entry for this
* mount point, since we couldn't find a user
* supplied one.
*
* The 'val' was put into mi->source during
* dump by resolve_external_mounts().
*/
em
=
xmalloc
(
sizeof
(
struct
ext_mount
));
em
=
ext_mount_make_auto
(
AUTODETECTED_MOUNT
,
mi
->
source
);
if
(
!
em
)
return
-
1
;
/*
* Put a : in here since those are invalid on
* the cli, so we know it's autogenerated in
* debugging.
*/
em
->
key
=
AUTODETECTED_MOUNT
;
em
->
val
=
mi
->
source
;
}
mi
->
external
=
em
;
...
...
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