aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-11-01 00:37:32 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-12-04 14:34:17 -0500
commit64964528b24ea390824f0e5ce9d34b8d39b28cde (patch)
tree2de66d75468ad4ddecc7e175f86f1dbaae47ea9a /kernel
parent3c0411846118a578de3a979faf2da3ab5fb81179 (diff)
make proc_ns_operations work with struct ns_common * instead of void *
We can do that now. And kill ->inum(), while we are at it - all instances are identical. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/pid_namespace.c12
-rw-r--r--kernel/user_namespace.c12
-rw-r--r--kernel/utsname.c12
3 files changed, 9 insertions, 27 deletions
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
index dd961ad86fbd..79aabce49a85 100644
--- a/kernel/pid_namespace.c
+++ b/kernel/pid_namespace.c
@@ -318,7 +318,7 @@ static inline struct pid_namespace *to_pid_ns(struct ns_common *ns)
318 return container_of(ns, struct pid_namespace, ns); 318 return container_of(ns, struct pid_namespace, ns);
319} 319}
320 320
321static void *pidns_get(struct task_struct *task) 321static struct ns_common *pidns_get(struct task_struct *task)
322{ 322{
323 struct pid_namespace *ns; 323 struct pid_namespace *ns;
324 324
@@ -331,12 +331,12 @@ static void *pidns_get(struct task_struct *task)
331 return ns ? &ns->ns : NULL; 331 return ns ? &ns->ns : NULL;
332} 332}
333 333
334static void pidns_put(void *ns) 334static void pidns_put(struct ns_common *ns)
335{ 335{
336 put_pid_ns(to_pid_ns(ns)); 336 put_pid_ns(to_pid_ns(ns));
337} 337}
338 338
339static int pidns_install(struct nsproxy *nsproxy, void *ns) 339static int pidns_install(struct nsproxy *nsproxy, struct ns_common *ns)
340{ 340{
341 struct pid_namespace *active = task_active_pid_ns(current); 341 struct pid_namespace *active = task_active_pid_ns(current);
342 struct pid_namespace *ancestor, *new = to_pid_ns(ns); 342 struct pid_namespace *ancestor, *new = to_pid_ns(ns);
@@ -367,18 +367,12 @@ static int pidns_install(struct nsproxy *nsproxy, void *ns)
367 return 0; 367 return 0;
368} 368}
369 369
370static unsigned int pidns_inum(void *ns)
371{
372 return ((struct ns_common *)ns)->inum;
373}
374
375const struct proc_ns_operations pidns_operations = { 370const struct proc_ns_operations pidns_operations = {
376 .name = "pid", 371 .name = "pid",
377 .type = CLONE_NEWPID, 372 .type = CLONE_NEWPID,
378 .get = pidns_get, 373 .get = pidns_get,
379 .put = pidns_put, 374 .put = pidns_put,
380 .install = pidns_install, 375 .install = pidns_install,
381 .inum = pidns_inum,
382}; 376};
383 377
384static __init int pid_namespaces_init(void) 378static __init int pid_namespaces_init(void)
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index 1ab2209228ff..29cd5ccfc37a 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -846,7 +846,7 @@ static inline struct user_namespace *to_user_ns(struct ns_common *ns)
846 return container_of(ns, struct user_namespace, ns); 846 return container_of(ns, struct user_namespace, ns);
847} 847}
848 848
849static void *userns_get(struct task_struct *task) 849static struct ns_common *userns_get(struct task_struct *task)
850{ 850{
851 struct user_namespace *user_ns; 851 struct user_namespace *user_ns;
852 852
@@ -857,12 +857,12 @@ static void *userns_get(struct task_struct *task)
857 return user_ns ? &user_ns->ns : NULL; 857 return user_ns ? &user_ns->ns : NULL;
858} 858}
859 859
860static void userns_put(void *ns) 860static void userns_put(struct ns_common *ns)
861{ 861{
862 put_user_ns(to_user_ns(ns)); 862 put_user_ns(to_user_ns(ns));
863} 863}
864 864
865static int userns_install(struct nsproxy *nsproxy, void *ns) 865static int userns_install(struct nsproxy *nsproxy, struct ns_common *ns)
866{ 866{
867 struct user_namespace *user_ns = to_user_ns(ns); 867 struct user_namespace *user_ns = to_user_ns(ns);
868 struct cred *cred; 868 struct cred *cred;
@@ -893,18 +893,12 @@ static int userns_install(struct nsproxy *nsproxy, void *ns)
893 return commit_creds(cred); 893 return commit_creds(cred);
894} 894}
895 895
896static unsigned int userns_inum(void *ns)
897{
898 return ((struct ns_common *)ns)->inum;
899}
900
901const struct proc_ns_operations userns_operations = { 896const struct proc_ns_operations userns_operations = {
902 .name = "user", 897 .name = "user",
903 .type = CLONE_NEWUSER, 898 .type = CLONE_NEWUSER,
904 .get = userns_get, 899 .get = userns_get,
905 .put = userns_put, 900 .put = userns_put,
906 .install = userns_install, 901 .install = userns_install,
907 .inum = userns_inum,
908}; 902};
909 903
910static __init int user_namespaces_init(void) 904static __init int user_namespaces_init(void)
diff --git a/kernel/utsname.c b/kernel/utsname.c
index 1917f74be8ec..20697befe466 100644
--- a/kernel/utsname.c
+++ b/kernel/utsname.c
@@ -93,7 +93,7 @@ static inline struct uts_namespace *to_uts_ns(struct ns_common *ns)
93 return container_of(ns, struct uts_namespace, ns); 93 return container_of(ns, struct uts_namespace, ns);
94} 94}
95 95
96static void *utsns_get(struct task_struct *task) 96static struct ns_common *utsns_get(struct task_struct *task)
97{ 97{
98 struct uts_namespace *ns = NULL; 98 struct uts_namespace *ns = NULL;
99 struct nsproxy *nsproxy; 99 struct nsproxy *nsproxy;
@@ -109,12 +109,12 @@ static void *utsns_get(struct task_struct *task)
109 return ns ? &ns->ns : NULL; 109 return ns ? &ns->ns : NULL;
110} 110}
111 111
112static void utsns_put(void *ns) 112static void utsns_put(struct ns_common *ns)
113{ 113{
114 put_uts_ns(to_uts_ns(ns)); 114 put_uts_ns(to_uts_ns(ns));
115} 115}
116 116
117static int utsns_install(struct nsproxy *nsproxy, void *new) 117static int utsns_install(struct nsproxy *nsproxy, struct ns_common *new)
118{ 118{
119 struct uts_namespace *ns = to_uts_ns(new); 119 struct uts_namespace *ns = to_uts_ns(new);
120 120
@@ -128,16 +128,10 @@ static int utsns_install(struct nsproxy *nsproxy, void *new)
128 return 0; 128 return 0;
129} 129}
130 130
131static unsigned int utsns_inum(void *vp)
132{
133 return ((struct ns_common *)vp)->inum;
134}
135
136const struct proc_ns_operations utsns_operations = { 131const struct proc_ns_operations utsns_operations = {
137 .name = "uts", 132 .name = "uts",
138 .type = CLONE_NEWUTS, 133 .type = CLONE_NEWUTS,
139 .get = utsns_get, 134 .get = utsns_get,
140 .put = utsns_put, 135 .put = utsns_put,
141 .install = utsns_install, 136 .install = utsns_install,
142 .inum = utsns_inum,
143}; 137};