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
db297a0f
Commit
db297a0f
authored
May 11, 2012
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mnt: Preparations for mountpoints dumping
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
3d64f9d1
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
0 deletions
+33
-0
crtools.c
crtools.c
+4
-0
crtools.h
include/crtools.h
+1
-0
image.h
include/image.h
+1
-0
mount.h
include/mount.h
+5
-0
syscall-types.h
include/syscall-types.h
+4
-0
mount.c
mount.c
+11
-0
namespaces.c
namespaces.c
+7
-0
No files found.
crtools.c
View file @
db297a0f
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include "eventfd.h"
#include "eventfd.h"
#include "eventpoll.h"
#include "eventpoll.h"
#include "inotify.h"
#include "inotify.h"
#include "mount.h"
struct
cr_options
opts
;
struct
cr_options
opts
;
...
@@ -75,6 +76,7 @@ struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX] = {
...
@@ -75,6 +76,7 @@ struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX] = {
FD_ENTRY
(
REMAP_FPATH
,
"remap-fpath"
,
show_remap_files
),
FD_ENTRY
(
REMAP_FPATH
,
"remap-fpath"
,
show_remap_files
),
FD_ENTRY
(
GHOST_FILE
,
"ghost-file-%x"
,
show_ghost_file
),
FD_ENTRY
(
GHOST_FILE
,
"ghost-file-%x"
,
show_ghost_file
),
FD_ENTRY
(
TCP_STREAM
,
"tcp-stream-%x"
,
show_tcp_stream
),
FD_ENTRY
(
TCP_STREAM
,
"tcp-stream-%x"
,
show_tcp_stream
),
FD_ENTRY
(
MOUNTPOINTS
,
"mountpoints-%d"
,
show_mountpoints
),
};
};
static
struct
cr_fdset
*
alloc_cr_fdset
(
int
nr
)
static
struct
cr_fdset
*
alloc_cr_fdset
(
int
nr
)
...
@@ -183,6 +185,8 @@ static int parse_ns_string(const char *ptr)
...
@@ -183,6 +185,8 @@ static int parse_ns_string(const char *ptr)
opts
.
namespaces_flags
|=
CLONE_NEWUTS
;
opts
.
namespaces_flags
|=
CLONE_NEWUTS
;
else
if
(
!
strncmp
(
ptr
,
"ipc"
,
3
))
else
if
(
!
strncmp
(
ptr
,
"ipc"
,
3
))
opts
.
namespaces_flags
|=
CLONE_NEWIPC
;
opts
.
namespaces_flags
|=
CLONE_NEWIPC
;
else
if
(
!
strncmp
(
ptr
,
"mnt"
,
3
))
opts
.
namespaces_flags
|=
CLONE_NEWNS
;
else
else
goto
bad_ns
;
goto
bad_ns
;
ptr
+=
4
;
ptr
+=
4
;
...
...
include/crtools.h
View file @
db297a0f
...
@@ -40,6 +40,7 @@ enum {
...
@@ -40,6 +40,7 @@ enum {
CR_FD_IPCNS_SHM
,
CR_FD_IPCNS_SHM
,
CR_FD_IPCNS_MSG
,
CR_FD_IPCNS_MSG
,
CR_FD_IPCNS_SEM
,
CR_FD_IPCNS_SEM
,
CR_FD_MOUNTPOINTS
,
_CR_FD_NS_TO
,
_CR_FD_NS_TO
,
CR_FD_PSTREE
,
CR_FD_PSTREE
,
...
...
include/image.h
View file @
db297a0f
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#define EVENTPOLL_TFD_MAGIC 0x44433746
/* Novorossiysk */
#define EVENTPOLL_TFD_MAGIC 0x44433746
/* Novorossiysk */
#define INOTIFY_MAGIC 0x48424431
/* Volgograd */
#define INOTIFY_MAGIC 0x48424431
/* Volgograd */
#define INOTIFY_WD_MAGIC 0x54562009
/* Svetlogorsk (Rauschen) */
#define INOTIFY_WD_MAGIC 0x54562009
/* Svetlogorsk (Rauschen) */
#define MOUNTPOINTS_MAGIC 0x55563928
/* Petushki */
enum
fd_types
{
enum
fd_types
{
FDINFO_UND
,
FDINFO_UND
,
...
...
include/mount.h
View file @
db297a0f
...
@@ -6,4 +6,9 @@ struct proc_mountinfo;
...
@@ -6,4 +6,9 @@ struct proc_mountinfo;
extern
int
open_mount
(
unsigned
int
s_dev
);
extern
int
open_mount
(
unsigned
int
s_dev
);
extern
int
collect_mount_info
(
void
);
extern
int
collect_mount_info
(
void
);
struct
cr_fdset
;
extern
int
dump_mnt_ns
(
int
pid
,
struct
cr_fdset
*
);
struct
cr_options
;
extern
void
show_mountpoints
(
int
fd
,
struct
cr_options
*
);
#endif
/* MOUNT_H__ */
#endif
/* MOUNT_H__ */
include/syscall-types.h
View file @
db297a0f
...
@@ -40,6 +40,10 @@ struct file_handle;
...
@@ -40,6 +40,10 @@ struct file_handle;
#define F_GETFD 1
#define F_GETFD 1
#endif
#endif
#ifndef CLONE_NEWNS
#define CLONE_NEWNS 0x00020000
#endif
#ifndef CLONE_NEWPID
#ifndef CLONE_NEWPID
#define CLONE_NEWPID 0x20000000
#define CLONE_NEWPID 0x20000000
#endif
#endif
...
...
mount.c
View file @
db297a0f
...
@@ -53,3 +53,14 @@ int collect_mount_info(void)
...
@@ -53,3 +53,14 @@ int collect_mount_info(void)
return
0
;
return
0
;
}
}
int
dump_mnt_ns
(
int
ns_pid
,
struct
cr_fdset
*
fdset
)
{
return
-
1
;
}
void
show_mountpoints
(
int
fd
,
struct
cr_options
*
o
)
{
pr_img_head
(
CR_FD_MOUNTPOINTS
);
pr_img_tail
(
CR_FD_MOUNTPOINTS
);
}
namespaces.c
View file @
db297a0f
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include "syscall.h"
#include "syscall.h"
#include "uts_ns.h"
#include "uts_ns.h"
#include "ipc_ns.h"
#include "ipc_ns.h"
#include "mount.h"
int
switch_ns
(
int
pid
,
int
type
,
char
*
ns
)
int
switch_ns
(
int
pid
,
int
type
,
char
*
ns
)
{
{
...
@@ -49,6 +50,12 @@ static int do_dump_namespaces(int ns_pid, unsigned int ns_flags)
...
@@ -49,6 +50,12 @@ static int do_dump_namespaces(int ns_pid, unsigned int ns_flags)
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
err
;
goto
err
;
}
}
if
(
ns_flags
&
CLONE_NEWNS
)
{
pr_info
(
"Dump MNT namespace (mountpoints)
\n
"
);
ret
=
dump_mnt_ns
(
ns_pid
,
fdset
);
if
(
ret
<
0
)
goto
err
;
}
err:
err:
close_cr_fdset
(
&
fdset
);
close_cr_fdset
(
&
fdset
);
return
ret
;
return
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