[Devel] [patch 19/20] [Network namespace] For debug purpose only. Add the network namespace pointer to the info file.

dlezcano at fr.ibm.com dlezcano at fr.ibm.com
Sun Dec 10 13:58:36 PST 2006


Signed-off-by: Daniel Lezcano <dlezcano at fr.ibm.com>

---

 fs/debugfs/net_ns.c |   28 +++++++++-------------------
 1 files changed, 9 insertions(+), 19 deletions(-)

Index: 2.6.19-rc6-mm2/fs/debugfs/net_ns.c
===================================================================
--- 2.6.19-rc6-mm2.orig/fs/debugfs/net_ns.c
+++ 2.6.19-rc6-mm2/fs/debugfs/net_ns.c
@@ -49,23 +49,7 @@ static int net_ns_start_open_file(struct
 static ssize_t net_ns_start_read_file(struct file *file, char __user *user_buf,
 				      size_t count, loff_t *ppos)
 {
-	char c;
-
-	if (*ppos < 0)
-		return -EINVAL;
-	if (*ppos >= count)
-		return 0;
-	if (!count)
-		return 0;
-
-	c = (current_net_ns == &init_net_ns)?'0':'1';
-
-	if (copy_to_user(user_buf, &c, sizeof(c)))
-		return -EINVAL;
-
-	*ppos += count;
-
-	return count;
+	return 0;
 }
 
 int net_ns_start(void);
@@ -123,6 +107,7 @@ static ssize_t net_ns_info_read_file(str
 	char buff[length];
 	char *level;
 	struct net_namespace *net_ns = current_net_ns;
+	struct nsproxy *ns = current->nsproxy;
 
 	if (*ppos < 0)
 		return -EINVAL;
@@ -143,8 +128,13 @@ static ssize_t net_ns_info_read_file(str
 		break;
 	}
 
-	sprintf(buff,"refcnt: %d\nlevel: %s\n",
-		atomic_read(&net_ns->kref.refcount), level);
+ 	sprintf(buff,
+ 		"nsproxy: %p\nnsproxy refcnt: %d\nnet_ns: %p\nnet_ns refcnt: %d\nlevel: %s\n",
+ 		ns,
+ 		atomic_read(&ns->count),
+ 		net_ns,
+ 		atomic_read(&net_ns->kref.refcount),
+ 		level);
 
 	len = strlen(buff);
 	if (len > count)

-- 
_______________________________________________
Containers mailing list
Containers at lists.osdl.org
https://lists.osdl.org/mailman/listinfo/containers




More information about the Devel mailing list