Skip to content

Commit 435d5f4

Browse files
author
Al Viro
committed
common object embedded into various struct ....ns
for now - just move corresponding ->proc_inum instances over there Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent cac7f24 commit 435d5f4

17 files changed

Lines changed: 43 additions & 29 deletions

‎fs/mount.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#include <linux/mount.h>
22
#include <linux/seq_file.h>
33
#include <linux/poll.h>
4+
#include <linux/ns_common.h>
45

56
struct mnt_namespace {
67
atomic_t count;
7-
unsigned int proc_inum;
8+
struct ns_common ns;
89
struct mount * root;
910
struct list_head list;
1011
struct user_namespace *user_ns;

‎fs/namespace.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2640,7 +2640,7 @@ long do_mount(const char *dev_name, const char __user *dir_name,
26402640

26412641
static void free_mnt_ns(struct mnt_namespace *ns)
26422642
{
2643-
proc_free_inum(ns->proc_inum);
2643+
proc_free_inum(ns->ns.inum);
26442644
put_user_ns(ns->user_ns);
26452645
kfree(ns);
26462646
}
@@ -2662,7 +2662,7 @@ static struct mnt_namespace *alloc_mnt_ns(struct user_namespace *user_ns)
26622662
new_ns = kmalloc(sizeof(struct mnt_namespace), GFP_KERNEL);
26632663
if (!new_ns)
26642664
return ERR_PTR(-ENOMEM);
2665-
ret = proc_alloc_inum(&new_ns->proc_inum);
2665+
ret = proc_alloc_inum(&new_ns->ns.inum);
26662666
if (ret) {
26672667
kfree(new_ns);
26682668
return ERR_PTR(ret);
@@ -3201,7 +3201,7 @@ static int mntns_install(struct nsproxy *nsproxy, void *ns)
32013201
static unsigned int mntns_inum(void *ns)
32023202
{
32033203
struct mnt_namespace *mnt_ns = ns;
3204-
return mnt_ns->proc_inum;
3204+
return mnt_ns->ns.inum;
32053205
}
32063206

32073207
const struct proc_ns_operations mntns_operations = {

‎include/linux/ipc_namespace.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <linux/rwsem.h>
77
#include <linux/notifier.h>
88
#include <linux/nsproxy.h>
9+
#include <linux/ns_common.h>
910

1011
/*
1112
* ipc namespace events
@@ -68,7 +69,7 @@ struct ipc_namespace {
6869
/* user_ns which owns the ipc ns */
6970
struct user_namespace *user_ns;
7071

71-
unsigned int proc_inum;
72+
struct ns_common ns;
7273
};
7374

7475
extern struct ipc_namespace init_ipc_ns;

‎include/linux/ns_common.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#ifndef _LINUX_NS_COMMON_H
2+
#define _LINUX_NS_COMMON_H
3+
4+
struct ns_common {
5+
unsigned int inum;
6+
};
7+
8+
#endif

‎include/linux/pid_namespace.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/threads.h>
99
#include <linux/nsproxy.h>
1010
#include <linux/kref.h>
11+
#include <linux/ns_common.h>
1112

1213
struct pidmap {
1314
atomic_t nr_free;
@@ -43,7 +44,7 @@ struct pid_namespace {
4344
kgid_t pid_gid;
4445
int hide_pid;
4546
int reboot; /* group exit code if this pidns was rebooted */
46-
unsigned int proc_inum;
47+
struct ns_common ns;
4748
};
4849

4950
extern struct pid_namespace init_pid_ns;

‎include/linux/user_namespace.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <linux/kref.h>
55
#include <linux/nsproxy.h>
6+
#include <linux/ns_common.h>
67
#include <linux/sched.h>
78
#include <linux/err.h>
89

@@ -26,7 +27,7 @@ struct user_namespace {
2627
int level;
2728
kuid_t owner;
2829
kgid_t group;
29-
unsigned int proc_inum;
30+
struct ns_common ns;
3031

3132
/* Register of per-UID persistent keyrings for this namespace */
3233
#ifdef CONFIG_PERSISTENT_KEYRINGS

‎include/linux/utsname.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <linux/sched.h>
66
#include <linux/kref.h>
77
#include <linux/nsproxy.h>
8+
#include <linux/ns_common.h>
89
#include <linux/err.h>
910
#include <uapi/linux/utsname.h>
1011

@@ -23,7 +24,7 @@ struct uts_namespace {
2324
struct kref kref;
2425
struct new_utsname name;
2526
struct user_namespace *user_ns;
26-
unsigned int proc_inum;
27+
struct ns_common ns;
2728
};
2829
extern struct uts_namespace init_uts_ns;
2930

‎include/net/net_namespace.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#endif
2727
#include <net/netns/nftables.h>
2828
#include <net/netns/xfrm.h>
29+
#include <linux/ns_common.h>
2930

3031
struct user_namespace;
3132
struct proc_dir_entry;
@@ -60,7 +61,7 @@ struct net {
6061

6162
struct user_namespace *user_ns; /* Owning user namespace */
6263

63-
unsigned int proc_inum;
64+
struct ns_common ns;
6465

6566
struct proc_dir_entry *proc_net;
6667
struct proc_dir_entry *proc_net_stat;

‎init/version.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct uts_namespace init_uts_ns = {
3535
.domainname = UTS_DOMAINNAME,
3636
},
3737
.user_ns = &init_user_ns,
38-
.proc_inum = PROC_UTS_INIT_INO,
38+
.ns.inum = PROC_UTS_INIT_INO,
3939
};
4040
EXPORT_SYMBOL_GPL(init_uts_ns);
4141

‎ipc/msgutil.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ DEFINE_SPINLOCK(mq_lock);
3131
struct ipc_namespace init_ipc_ns = {
3232
.count = ATOMIC_INIT(1),
3333
.user_ns = &init_user_ns,
34-
.proc_inum = PROC_IPC_INIT_INO,
34+
.ns.inum = PROC_IPC_INIT_INO,
3535
};
3636

3737
atomic_t nr_ipc_ns = ATOMIC_INIT(1);

0 commit comments

Comments
 (0)