Skip to content

Commit 6a9e2fb

Browse files
committed
nsfs: move root inode number to uapi
Userspace relies on the root inode numbers to identify the initial namespaces. That's already a hard dependency. So we cannot change that anymore. Move the initial inode numbers to a public header. Link: systemd/systemd@d293fad Link: https://lore.kernel.org/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent 19272b3 commit 6a9e2fb

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

include/linux/proc_ns.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#define _LINUX_PROC_NS_H
77

88
#include <linux/ns_common.h>
9+
#include <uapi/linux/nsfs.h>
910

1011
struct pid_namespace;
1112
struct nsset;
@@ -40,12 +41,12 @@ extern const struct proc_ns_operations timens_for_children_operations;
4041
*/
4142
enum {
4243
PROC_ROOT_INO = 1,
43-
PROC_IPC_INIT_INO = 0xEFFFFFFFU,
44-
PROC_UTS_INIT_INO = 0xEFFFFFFEU,
45-
PROC_USER_INIT_INO = 0xEFFFFFFDU,
46-
PROC_PID_INIT_INO = 0xEFFFFFFCU,
47-
PROC_CGROUP_INIT_INO = 0xEFFFFFFBU,
48-
PROC_TIME_INIT_INO = 0xEFFFFFFAU,
44+
PROC_IPC_INIT_INO = IPC_NS_INIT_INO,
45+
PROC_UTS_INIT_INO = UTS_NS_INIT_INO,
46+
PROC_USER_INIT_INO = USER_NS_INIT_INO,
47+
PROC_PID_INIT_INO = PID_NS_INIT_INO,
48+
PROC_CGROUP_INIT_INO = CGROUP_NS_INIT_INO,
49+
PROC_TIME_INIT_INO = TIME_NS_INIT_INO,
4950
};
5051

5152
#ifdef CONFIG_PROC_FS

include/uapi/linux/nsfs.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,13 @@ struct mnt_ns_info {
4242
/* Get previous namespace. */
4343
#define NS_MNT_GET_PREV _IOR(NSIO, 12, struct mnt_ns_info)
4444

45+
enum init_ns_ino {
46+
IPC_NS_INIT_INO = 0xEFFFFFFFU,
47+
UTS_NS_INIT_INO = 0xEFFFFFFEU,
48+
USER_NS_INIT_INO = 0xEFFFFFFDU,
49+
PID_NS_INIT_INO = 0xEFFFFFFCU,
50+
CGROUP_NS_INIT_INO = 0xEFFFFFFBU,
51+
TIME_NS_INIT_INO = 0xEFFFFFFAU,
52+
};
53+
4554
#endif /* __LINUX_NSFS_H */

0 commit comments

Comments
 (0)