[Devel] [RFC][PATCH 1/5]: Rename namespaces functions

sukadev at us.ibm.com sukadev at us.ibm.com
Fri Mar 9 20:01:34 PST 2007


From: Sukadev Bhattiprolu <sukadev at us.ibm.com>
Subject: [RFC][PATCH 1/5]: Rename namespaces functions

We want to treat pid namespace differently from other namespaces
and want to move pid_namespace out of struct nsproxy.

So rename the *namespaces() functions to *nsproxy() to reflect
that they only operate on the nsproxy and not on all namespaces.

Signed-off-by: Sukadev Bhattiprolu <sukadev at us.ibm.com>
Cc: Cedric Le Goater <clg at fr.ibm.com>
Cc: Dave Hansen <haveblue at us.ibm.com>
Cc: Serge Hallyn <serue at us.ibm.com>
Cc: containers at lists.osdl.org

---
 include/linux/nsproxy.h |    4 ++--
 kernel/fork.c           |    4 ++--
 kernel/nsproxy.c        |   12 ++++++------
 3 files changed, 10 insertions(+), 10 deletions(-)

Index: lx26-20-mm2b/include/linux/nsproxy.h
===================================================================
--- lx26-20-mm2b.orig/include/linux/nsproxy.h	2007-03-09 19:00:12.000000000 -0800
+++ lx26-20-mm2b/include/linux/nsproxy.h	2007-03-09 19:00:14.000000000 -0800
@@ -31,8 +31,8 @@ struct nsproxy {
 };
 extern struct nsproxy init_nsproxy;
 
-struct nsproxy *dup_namespaces(struct nsproxy *orig);
-int copy_namespaces(int flags, struct task_struct *tsk);
+struct nsproxy *dup_nsproxy(struct nsproxy *orig);
+int copy_nsproxy(int flags, struct task_struct *tsk);
 void get_task_namespaces(struct task_struct *tsk);
 void free_nsproxy(struct nsproxy *ns);
 
Index: lx26-20-mm2b/kernel/fork.c
===================================================================
--- lx26-20-mm2b.orig/kernel/fork.c	2007-03-09 19:00:12.000000000 -0800
+++ lx26-20-mm2b/kernel/fork.c	2007-03-09 19:00:14.000000000 -0800
@@ -1134,7 +1134,7 @@ static struct task_struct *copy_process(
 		goto bad_fork_cleanup_signal;
 	if ((retval = copy_keys(clone_flags, p)))
 		goto bad_fork_cleanup_mm;
-	if ((retval = copy_namespaces(clone_flags, p)))
+	if ((retval = copy_nsproxy(clone_flags, p)))
 		goto bad_fork_cleanup_keys;
 	retval = copy_thread(0, clone_flags, stack_start, stack_size, p, regs);
 	if (retval)
@@ -1644,7 +1644,7 @@ asmlinkage long sys_unshare(unsigned lon
 
 	if (new_ns || new_uts || new_ipc || new_pid_nr) {
 		old_nsproxy = current->nsproxy;
-		new_nsproxy = dup_namespaces(old_nsproxy);
+		new_nsproxy = dup_nsproxy(old_nsproxy);
 		if (!new_nsproxy) {
 			err = -ENOMEM;
 			goto bad_unshare_cleanup_pid;
Index: lx26-20-mm2b/kernel/nsproxy.c
===================================================================
--- lx26-20-mm2b.orig/kernel/nsproxy.c	2007-03-09 19:00:12.000000000 -0800
+++ lx26-20-mm2b/kernel/nsproxy.c	2007-03-09 19:00:14.000000000 -0800
@@ -39,9 +39,9 @@ void get_task_namespaces(struct task_str
 /*
  * creates a copy of "orig" with refcount 1.
  * This does not grab references to the contained namespaces,
- * so that needs to be done by dup_namespaces.
+ * so that needs to be done by dup_nsproxy.
  */
-static inline struct nsproxy *clone_namespaces(struct nsproxy *orig)
+static inline struct nsproxy *clone_nsproxy(struct nsproxy *orig)
 {
 	struct nsproxy *ns;
 
@@ -56,9 +56,9 @@ static inline struct nsproxy *clone_name
  * reference to all contained namespaces.  Called from
  * sys_unshare()
  */
-struct nsproxy *dup_namespaces(struct nsproxy *orig)
+struct nsproxy *dup_nsproxy(struct nsproxy *orig)
 {
-	struct nsproxy *ns = clone_namespaces(orig);
+	struct nsproxy *ns = clone_nsproxy(orig);
 
 	if (ns) {
 		if (ns->mnt_ns)
@@ -78,7 +78,7 @@ struct nsproxy *dup_namespaces(struct ns
  * called from clone.  This now handles copy for nsproxy and all
  * namespaces therein.
  */
-int copy_namespaces(int flags, struct task_struct *tsk)
+int copy_nsproxy(int flags, struct task_struct *tsk)
 {
 	struct nsproxy *old_ns = tsk->nsproxy;
 	struct nsproxy *new_ns;
@@ -95,7 +95,7 @@ int copy_namespaces(int flags, struct ta
 	if (!(flags & ns_all))
 		return 0;
 
-	new_ns = clone_namespaces(old_ns);
+	new_ns = clone_nsproxy(old_ns);
 	if (!new_ns) {
 		err = -ENOMEM;
 		goto out;
_______________________________________________
Containers mailing list
Containers at lists.osdl.org
https://lists.osdl.org/mailman/listinfo/containers




More information about the Devel mailing list