Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

Al Viro 435d5f4b cac7f242

+43 -29
+2 -1
fs/mount.h
··· 1 1 #include <linux/mount.h> 2 2 #include <linux/seq_file.h> 3 3 #include <linux/poll.h> 4 + #include <linux/ns_common.h> 4 5 5 6 struct mnt_namespace { 6 7 atomic_t count; 7 - unsigned int proc_inum; 8 + struct ns_common ns; 8 9 struct mount * root; 9 10 struct list_head list; 10 11 struct user_namespace *user_ns;
+3 -3
fs/namespace.c
··· 2640 2640 2641 2641 static void free_mnt_ns(struct mnt_namespace *ns) 2642 2642 { 2643 - proc_free_inum(ns->proc_inum); 2643 + proc_free_inum(ns->ns.inum); 2644 2644 put_user_ns(ns->user_ns); 2645 2645 kfree(ns); 2646 2646 } ··· 2662 2662 new_ns = kmalloc(sizeof(struct mnt_namespace), GFP_KERNEL); 2663 2663 if (!new_ns) 2664 2664 return ERR_PTR(-ENOMEM); 2665 - ret = proc_alloc_inum(&new_ns->proc_inum); 2665 + ret = proc_alloc_inum(&new_ns->ns.inum); 2666 2666 if (ret) { 2667 2667 kfree(new_ns); 2668 2668 return ERR_PTR(ret); ··· 3201 3201 static unsigned int mntns_inum(void *ns) 3202 3202 { 3203 3203 struct mnt_namespace *mnt_ns = ns; 3204 - return mnt_ns->proc_inum; 3204 + return mnt_ns->ns.inum; 3205 3205 } 3206 3206 3207 3207 const struct proc_ns_operations mntns_operations = {
+2 -1
include/linux/ipc_namespace.h
··· 6 6 #include <linux/rwsem.h> 7 7 #include <linux/notifier.h> 8 8 #include <linux/nsproxy.h> 9 + #include <linux/ns_common.h> 9 10 10 11 /* 11 12 * ipc namespace events ··· 69 68 /* user_ns which owns the ipc ns */ 70 69 struct user_namespace *user_ns; 71 70 72 - unsigned int proc_inum; 71 + struct ns_common ns; 73 72 }; 74 73 75 74 extern struct ipc_namespace init_ipc_ns;
+8
include/linux/ns_common.h
··· 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
+2 -1
include/linux/pid_namespace.h
··· 8 8 #include <linux/threads.h> 9 9 #include <linux/nsproxy.h> 10 10 #include <linux/kref.h> 11 + #include <linux/ns_common.h> 11 12 12 13 struct pidmap { 13 14 atomic_t nr_free; ··· 44 43 kgid_t pid_gid; 45 44 int hide_pid; 46 45 int reboot; /* group exit code if this pidns was rebooted */ 47 - unsigned int proc_inum; 46 + struct ns_common ns; 48 47 }; 49 48 50 49 extern struct pid_namespace init_pid_ns;
+2 -1
include/linux/user_namespace.h
··· 3 3 4 4 #include <linux/kref.h> 5 5 #include <linux/nsproxy.h> 6 + #include <linux/ns_common.h> 6 7 #include <linux/sched.h> 7 8 #include <linux/err.h> 8 9 ··· 27 26 int level; 28 27 kuid_t owner; 29 28 kgid_t group; 30 - unsigned int proc_inum; 29 + struct ns_common ns; 31 30 32 31 /* Register of per-UID persistent keyrings for this namespace */ 33 32 #ifdef CONFIG_PERSISTENT_KEYRINGS
+2 -1
include/linux/utsname.h
··· 5 5 #include <linux/sched.h> 6 6 #include <linux/kref.h> 7 7 #include <linux/nsproxy.h> 8 + #include <linux/ns_common.h> 8 9 #include <linux/err.h> 9 10 #include <uapi/linux/utsname.h> 10 11 ··· 24 23 struct kref kref; 25 24 struct new_utsname name; 26 25 struct user_namespace *user_ns; 27 - unsigned int proc_inum; 26 + struct ns_common ns; 28 27 }; 29 28 extern struct uts_namespace init_uts_ns; 30 29
+2 -1
include/net/net_namespace.h
··· 26 26 #endif 27 27 #include <net/netns/nftables.h> 28 28 #include <net/netns/xfrm.h> 29 + #include <linux/ns_common.h> 29 30 30 31 struct user_namespace; 31 32 struct proc_dir_entry; ··· 61 60 62 61 struct user_namespace *user_ns; /* Owning user namespace */ 63 62 64 - unsigned int proc_inum; 63 + struct ns_common ns; 65 64 66 65 struct proc_dir_entry *proc_net; 67 66 struct proc_dir_entry *proc_net_stat;
+1 -1
init/version.c
··· 35 35 .domainname = UTS_DOMAINNAME, 36 36 }, 37 37 .user_ns = &init_user_ns, 38 - .proc_inum = PROC_UTS_INIT_INO, 38 + .ns.inum = PROC_UTS_INIT_INO, 39 39 }; 40 40 EXPORT_SYMBOL_GPL(init_uts_ns); 41 41
+1 -1
ipc/msgutil.c
··· 31 31 struct ipc_namespace init_ipc_ns = { 32 32 .count = ATOMIC_INIT(1), 33 33 .user_ns = &init_user_ns, 34 - .proc_inum = PROC_IPC_INIT_INO, 34 + .ns.inum = PROC_IPC_INIT_INO, 35 35 }; 36 36 37 37 atomic_t nr_ipc_ns = ATOMIC_INIT(1);
+4 -4
ipc/namespace.c
··· 26 26 if (ns == NULL) 27 27 return ERR_PTR(-ENOMEM); 28 28 29 - err = proc_alloc_inum(&ns->proc_inum); 29 + err = proc_alloc_inum(&ns->ns.inum); 30 30 if (err) { 31 31 kfree(ns); 32 32 return ERR_PTR(err); ··· 35 35 atomic_set(&ns->count, 1); 36 36 err = mq_init_ns(ns); 37 37 if (err) { 38 - proc_free_inum(ns->proc_inum); 38 + proc_free_inum(ns->ns.inum); 39 39 kfree(ns); 40 40 return ERR_PTR(err); 41 41 } ··· 119 119 */ 120 120 ipcns_notify(IPCNS_REMOVED); 121 121 put_user_ns(ns->user_ns); 122 - proc_free_inum(ns->proc_inum); 122 + proc_free_inum(ns->ns.inum); 123 123 kfree(ns); 124 124 } 125 125 ··· 186 186 { 187 187 struct ipc_namespace *ns = vp; 188 188 189 - return ns->proc_inum; 189 + return ns->ns.inum; 190 190 } 191 191 192 192 const struct proc_ns_operations ipcns_operations = {
+1 -1
kernel/pid.c
··· 79 79 .level = 0, 80 80 .child_reaper = &init_task, 81 81 .user_ns = &init_user_ns, 82 - .proc_inum = PROC_PID_INIT_INO, 82 + .ns.inum = PROC_PID_INIT_INO, 83 83 }; 84 84 EXPORT_SYMBOL_GPL(init_pid_ns); 85 85
+3 -3
kernel/pid_namespace.c
··· 105 105 if (ns->pid_cachep == NULL) 106 106 goto out_free_map; 107 107 108 - err = proc_alloc_inum(&ns->proc_inum); 108 + err = proc_alloc_inum(&ns->ns.inum); 109 109 if (err) 110 110 goto out_free_map; 111 111 ··· 142 142 { 143 143 int i; 144 144 145 - proc_free_inum(ns->proc_inum); 145 + proc_free_inum(ns->ns.inum); 146 146 for (i = 0; i < PIDMAP_ENTRIES; i++) 147 147 kfree(ns->pidmap[i].page); 148 148 put_user_ns(ns->user_ns); ··· 365 365 static unsigned int pidns_inum(void *ns) 366 366 { 367 367 struct pid_namespace *pid_ns = ns; 368 - return pid_ns->proc_inum; 368 + return pid_ns->ns.inum; 369 369 } 370 370 371 371 const struct proc_ns_operations pidns_operations = {
+1 -1
kernel/user.c
··· 50 50 .count = ATOMIC_INIT(3), 51 51 .owner = GLOBAL_ROOT_UID, 52 52 .group = GLOBAL_ROOT_GID, 53 - .proc_inum = PROC_USER_INIT_INO, 53 + .ns.inum = PROC_USER_INIT_INO, 54 54 #ifdef CONFIG_PERSISTENT_KEYRINGS 55 55 .persistent_keyring_register_sem = 56 56 __RWSEM_INITIALIZER(init_user_ns.persistent_keyring_register_sem),
+3 -3
kernel/user_namespace.c
··· 86 86 if (!ns) 87 87 return -ENOMEM; 88 88 89 - ret = proc_alloc_inum(&ns->proc_inum); 89 + ret = proc_alloc_inum(&ns->ns.inum); 90 90 if (ret) { 91 91 kmem_cache_free(user_ns_cachep, ns); 92 92 return ret; ··· 136 136 #ifdef CONFIG_PERSISTENT_KEYRINGS 137 137 key_put(ns->persistent_keyring_register); 138 138 #endif 139 - proc_free_inum(ns->proc_inum); 139 + proc_free_inum(ns->ns.inum); 140 140 kmem_cache_free(user_ns_cachep, ns); 141 141 ns = parent; 142 142 } while (atomic_dec_and_test(&parent->count)); ··· 891 891 static unsigned int userns_inum(void *ns) 892 892 { 893 893 struct user_namespace *user_ns = ns; 894 - return user_ns->proc_inum; 894 + return user_ns->ns.inum; 895 895 } 896 896 897 897 const struct proc_ns_operations userns_operations = {
+3 -3
kernel/utsname.c
··· 42 42 if (!ns) 43 43 return ERR_PTR(-ENOMEM); 44 44 45 - err = proc_alloc_inum(&ns->proc_inum); 45 + err = proc_alloc_inum(&ns->ns.inum); 46 46 if (err) { 47 47 kfree(ns); 48 48 return ERR_PTR(err); ··· 84 84 85 85 ns = container_of(kref, struct uts_namespace, kref); 86 86 put_user_ns(ns->user_ns); 87 - proc_free_inum(ns->proc_inum); 87 + proc_free_inum(ns->ns.inum); 88 88 kfree(ns); 89 89 } 90 90 ··· 127 127 { 128 128 struct uts_namespace *ns = vp; 129 129 130 - return ns->proc_inum; 130 + return ns->ns.inum; 131 131 } 132 132 133 133 const struct proc_ns_operations utsns_operations = {
+3 -3
net/core/net_namespace.c
··· 386 386 387 387 static __net_init int net_ns_net_init(struct net *net) 388 388 { 389 - return proc_alloc_inum(&net->proc_inum); 389 + return proc_alloc_inum(&net->ns.inum); 390 390 } 391 391 392 392 static __net_exit void net_ns_net_exit(struct net *net) 393 393 { 394 - proc_free_inum(net->proc_inum); 394 + proc_free_inum(net->ns.inum); 395 395 } 396 396 397 397 static struct pernet_operations __net_initdata net_ns_ops = { ··· 664 664 static unsigned int netns_inum(void *ns) 665 665 { 666 666 struct net *net = ns; 667 - return net->proc_inum; 667 + return net->ns.inum; 668 668 } 669 669 670 670 const struct proc_ns_operations netns_operations = {