OpenVZ Forum


Home » Mailing lists » Devel » [patch 00/20] [Network namespace] Introduction
[patch 19/20] [Network namespace] For debug purpose only. Add the network namespace pointer to the i [message #16911 is a reply to message #16892] Sun, 10 December 2006 21:58 Go to previous messageGo to previous message
Daniel Lezcano is currently offline  Daniel Lezcano
Messages: 417
Registered: June 2006
Senior Member
Signed-off-by: Daniel Lezcano <dlezcano@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@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/containers
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [PATCH] ncpfs: Use struct pid to track the userspace watchdog process.
Next Topic: Re: [patch 06/20] [Network namespace] Move the nsproxy NULL affection
Goto Forum:
  


Current Time: Thu Oct 09 01:39:40 GMT 2025

Total time taken to generate the page: 0.13458 seconds