mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +00:00
ns: Extend ns_desc to carry the length of the ns name
This will be needed for fast parsing of procfs ns references. [ xemul: Add user_ns_desc here ] Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
4531f0ac7d
commit
30936058a0
@@ -9,9 +9,18 @@ struct cr_options;
|
||||
struct ns_desc {
|
||||
unsigned int cflag;
|
||||
char *str;
|
||||
size_t len;
|
||||
};
|
||||
|
||||
#define NS_DESC_ENTRY(_cflag, _str) \
|
||||
{ \
|
||||
.cflag = _cflag, \
|
||||
.str = _str, \
|
||||
.len = sizeof(_str) - 1, \
|
||||
}
|
||||
|
||||
extern struct ns_desc pid_ns_desc;
|
||||
extern struct ns_desc user_ns_desc;
|
||||
extern unsigned long current_ns_mask;
|
||||
|
||||
int dump_namespaces(struct pid *pid, unsigned int ns_flags);
|
||||
|
5
ipc_ns.c
5
ipc_ns.c
@@ -938,7 +938,4 @@ int prepare_ipc_ns(int pid)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct ns_desc ipc_ns_desc = {
|
||||
.cflag = CLONE_NEWIPC,
|
||||
.str = "ipc",
|
||||
};
|
||||
struct ns_desc ipc_ns_desc = NS_DESC_ENTRY(CLONE_NEWIPC, "ipc");
|
||||
|
5
mount.c
5
mount.c
@@ -812,7 +812,4 @@ int mntns_collect_root(pid_t pid)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct ns_desc mnt_ns_desc = {
|
||||
.cflag = CLONE_NEWNS,
|
||||
.str = "mnt",
|
||||
};
|
||||
struct ns_desc mnt_ns_desc = NS_DESC_ENTRY(CLONE_NEWNS, "mnt");
|
||||
|
@@ -313,7 +313,5 @@ int try_show_namespaces(int ns_pid, struct cr_options *o)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct ns_desc pid_ns_desc = {
|
||||
.cflag = CLONE_NEWPID,
|
||||
.str = "pid",
|
||||
};
|
||||
struct ns_desc pid_ns_desc = NS_DESC_ENTRY(CLONE_NEWPID, "pid");
|
||||
struct ns_desc user_ns_desc = NS_DESC_ENTRY(CLONE_NEWUSER, "user");
|
||||
|
5
net.c
5
net.c
@@ -404,7 +404,4 @@ void network_unlock(void)
|
||||
run_scripts("network-unlock");
|
||||
}
|
||||
|
||||
struct ns_desc net_ns_desc = {
|
||||
.cflag = CLONE_NEWNET,
|
||||
.str = "net",
|
||||
};
|
||||
struct ns_desc net_ns_desc = NS_DESC_ENTRY(CLONE_NEWNET, "net");
|
||||
|
Reference in New Issue
Block a user