mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
ns: Introduce ns type
We (may) have 3 types of namespace objects in criu -- criu's one, root task's one and others. All of them sometimes make sense and we differentiate them in a weird way -- by checking the ns->pid field against getpid() or by comparing with root_item's. The proposal is to mark ns_id objects explicitly with type field. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
1c34b284f3
commit
22b7256612
3 changed files with 28 additions and 6 deletions
|
|
@ -9,12 +9,20 @@ struct ns_desc {
|
|||
size_t len;
|
||||
};
|
||||
|
||||
enum ns_type {
|
||||
NS_UNKNOWN = 0,
|
||||
NS_CRIU,
|
||||
NS_ROOT,
|
||||
NS_OTHER,
|
||||
};
|
||||
|
||||
struct ns_id {
|
||||
unsigned int kid;
|
||||
unsigned int id;
|
||||
pid_t pid;
|
||||
struct ns_desc *nd;
|
||||
struct ns_id *next;
|
||||
enum ns_type type;
|
||||
|
||||
/*
|
||||
* For mount namespaces on restore -- indicates that
|
||||
|
|
@ -68,7 +76,7 @@ extern int restore_ns(int rst, struct ns_desc *nd);
|
|||
extern int dump_task_ns_ids(struct pstree_item *);
|
||||
extern int predump_task_ns_ids(struct pstree_item *);
|
||||
extern struct ns_id *rst_new_ns_id(unsigned int id, pid_t pid, struct ns_desc *nd);
|
||||
extern int rst_add_ns_id(unsigned int id, pid_t pid, struct ns_desc *nd);
|
||||
extern int rst_add_ns_id(unsigned int id, struct pstree_item *, struct ns_desc *nd);
|
||||
extern struct ns_id *lookup_ns_by_id(unsigned int id, struct ns_desc *nd);
|
||||
|
||||
extern int collect_user_namespaces(bool for_dump);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue