--- linux-2.6.18.2/arch/ia64/sn/kernel/xpc_main.c	2006-09-20 16:57:58 +0200
+++ linux-2.6.18.2-vs2.1.1/arch/ia64/sn/kernel/xpc_main.c	2006-09-20 17:01:44 +0200
@@ -108,6 +108,7 @@ static ctl_table xpc_sys_xpc_hb_dir[] = 
 		0644,
 		NULL,
 		&proc_dointvec_minmax,
+		NULL,
 		&sysctl_intvec,
 		NULL,
 		&xpc_hb_min_interval,
--- linux-2.6.18.2/arch/ia64/sn/kernel/xpc_main.c	2006-09-20 16:57:58 +0200
+++ linux-2.6.18.2-vs2.1.1/arch/ia64/sn/kernel/xpc_main.c	2006-09-20 17:01:44 +0200
@@ -121,6 +122,7 @@ static ctl_table xpc_sys_xpc_hb_dir[] = 
 		0644,
 		NULL,
 		&proc_dointvec_minmax,
+		NULL,
 		&sysctl_intvec,
 		NULL,
 		&xpc_hb_check_min_interval,
--- linux-2.6.18.2/arch/ia64/sn/kernel/xpc_main.c	2006-09-20 16:57:58 +0200
+++ linux-2.6.18.2-vs2.1.1/arch/ia64/sn/kernel/xpc_main.c	2006-09-20 17:01:44 +0200
@@ -145,6 +147,7 @@ static ctl_table xpc_sys_xpc_dir[] = {
 		0644,
 		NULL,
 		&proc_dointvec_minmax,
+		NULL,
 		&sysctl_intvec,
 		NULL,
 		&xpc_disengage_request_min_timelimit,
--- linux-2.6.18.2/drivers/char/random.c	2006-09-20 16:58:13 +0200
+++ linux-2.6.18.2-vs2.1.1/drivers/char/random.c	2006-09-20 17:01:44 +0200
@@ -1173,7 +1173,7 @@ static char sysctl_bootid[16];
 static int proc_do_uuid(ctl_table *table, int write, struct file *filp,
 			void __user *buffer, size_t *lenp, loff_t *ppos)
 {
-	ctl_table fake_table;
+	ctl_table fake_table = {0};
 	unsigned char buf[64], tmp_uuid[16], *uuid;
 
 	uuid = table->data;
--- linux-2.6.18.2/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 16:58:39 +0200
+++ linux-2.6.18.2-vs2.1.1/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 18:32:51 +0200
@@ -57,7 +57,7 @@ xfs_stats_clear_proc_handler(
 STATIC ctl_table xfs_table[] = {
 	{XFS_RESTRICT_CHOWN, "restrict_chown", &xfs_params.restrict_chown.val,
 	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
+	NULL, &sysctl_intvec, NULL,
 	&xfs_params.restrict_chown.min, &xfs_params.restrict_chown.max},
 
 	{XFS_SGID_INHERIT, "irix_sgid_inherit", &xfs_params.sgid_inherit.val,
--- linux-2.6.18.2/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 16:58:39 +0200
+++ linux-2.6.18.2-vs2.1.1/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 18:32:51 +0200
@@ -62,7 +62,7 @@ *****
 
 	{XFS_SGID_INHERIT, "irix_sgid_inherit", &xfs_params.sgid_inherit.val,
 	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
+	NULL, &sysctl_intvec, NULL,
 	&xfs_params.sgid_inherit.min, &xfs_params.sgid_inherit.max},
 
 	{XFS_SYMLINK_MODE, "irix_symlink_mode", &xfs_params.symlink_mode.val,
--- linux-2.6.18.2/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 16:58:39 +0200
+++ linux-2.6.18.2-vs2.1.1/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 18:32:51 +0200
@@ -67,7 +67,7 @@ *****
 
 	{XFS_SYMLINK_MODE, "irix_symlink_mode", &xfs_params.symlink_mode.val,
 	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
+	NULL, &sysctl_intvec, NULL,
 	&xfs_params.symlink_mode.min, &xfs_params.symlink_mode.max},
 
 	{XFS_PANIC_MASK, "panic_mask", &xfs_params.panic_mask.val,
--- linux-2.6.18.2/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 16:58:39 +0200
+++ linux-2.6.18.2-vs2.1.1/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 18:32:51 +0200
@@ -72,7 +72,7 @@ *****
 
 	{XFS_PANIC_MASK, "panic_mask", &xfs_params.panic_mask.val,
 	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
+	NULL, &sysctl_intvec, NULL,
 	&xfs_params.panic_mask.min, &xfs_params.panic_mask.max},
 
 	{XFS_ERRLEVEL, "error_level", &xfs_params.error_level.val,
--- linux-2.6.18.2/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 16:58:39 +0200
+++ linux-2.6.18.2-vs2.1.1/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 18:32:51 +0200
@@ -77,7 +77,7 @@ *****
 
 	{XFS_ERRLEVEL, "error_level", &xfs_params.error_level.val,
 	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
+	NULL, &sysctl_intvec, NULL,
 	&xfs_params.error_level.min, &xfs_params.error_level.max},
 
 	{XFS_SYNCD_TIMER, "xfssyncd_centisecs", &xfs_params.syncd_timer.val,
--- linux-2.6.18.2/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 16:58:39 +0200
+++ linux-2.6.18.2-vs2.1.1/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 18:32:51 +0200
@@ -82,7 +82,7 @@ *****
 
 	{XFS_SYNCD_TIMER, "xfssyncd_centisecs", &xfs_params.syncd_timer.val,
 	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
+	NULL, &sysctl_intvec, NULL,
 	&xfs_params.syncd_timer.min, &xfs_params.syncd_timer.max},
 
 	{XFS_INHERIT_SYNC, "inherit_sync", &xfs_params.inherit_sync.val,
--- linux-2.6.18.2/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 16:58:39 +0200
+++ linux-2.6.18.2-vs2.1.1/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 18:32:51 +0200
@@ -87,7 +87,7 @@ *****
 
 	{XFS_INHERIT_SYNC, "inherit_sync", &xfs_params.inherit_sync.val,
 	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
+	NULL, &sysctl_intvec, NULL,
 	&xfs_params.inherit_sync.min, &xfs_params.inherit_sync.max},
 
 	{XFS_INHERIT_NODUMP, "inherit_nodump", &xfs_params.inherit_nodump.val,
--- linux-2.6.18.2/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 16:58:39 +0200
+++ linux-2.6.18.2-vs2.1.1/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 18:32:51 +0200
@@ -92,7 +92,7 @@ *****
 
 	{XFS_INHERIT_NODUMP, "inherit_nodump", &xfs_params.inherit_nodump.val,
 	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
+	NULL, &sysctl_intvec, NULL,
 	&xfs_params.inherit_nodump.min, &xfs_params.inherit_nodump.max},
 
 	{XFS_INHERIT_NOATIME, "inherit_noatime", &xfs_params.inherit_noatim.val,
--- linux-2.6.18.2/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 16:58:39 +0200
+++ linux-2.6.18.2-vs2.1.1/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 18:32:51 +0200
@@ -97,7 +97,7 @@ *****
 
 	{XFS_INHERIT_NOATIME, "inherit_noatime", &xfs_params.inherit_noatim.val,
 	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
+	NULL, &sysctl_intvec, NULL,
 	&xfs_params.inherit_noatim.min, &xfs_params.inherit_noatim.max},
 
 	{XFS_BUF_TIMER, "xfsbufd_centisecs", &xfs_params.xfs_buf_timer.val,
--- linux-2.6.18.2/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 16:58:39 +0200
+++ linux-2.6.18.2-vs2.1.1/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 18:32:51 +0200
@@ -102,7 +102,7 @@ *****
 
 	{XFS_BUF_TIMER, "xfsbufd_centisecs", &xfs_params.xfs_buf_timer.val,
 	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
+	NULL, &sysctl_intvec, NULL,
 	&xfs_params.xfs_buf_timer.min, &xfs_params.xfs_buf_timer.max},
 
 	{XFS_BUF_AGE, "age_buffer_centisecs", &xfs_params.xfs_buf_age.val,
--- linux-2.6.18.2/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 16:58:39 +0200
+++ linux-2.6.18.2-vs2.1.1/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 18:32:51 +0200
@@ -107,7 +107,7 @@ *****
 
 	{XFS_BUF_AGE, "age_buffer_centisecs", &xfs_params.xfs_buf_age.val,
 	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
+	NULL, &sysctl_intvec, NULL,
 	&xfs_params.xfs_buf_age.min, &xfs_params.xfs_buf_age.max},
 
 	{XFS_INHERIT_NOSYM, "inherit_nosymlinks", &xfs_params.inherit_nosym.val,
--- linux-2.6.18.2/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 16:58:39 +0200
+++ linux-2.6.18.2-vs2.1.1/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 18:32:51 +0200
@@ -112,7 +112,7 @@ *****
 
 	{XFS_INHERIT_NOSYM, "inherit_nosymlinks", &xfs_params.inherit_nosym.val,
 	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
+	NULL, &sysctl_intvec, NULL,
 	&xfs_params.inherit_nosym.min, &xfs_params.inherit_nosym.max},
 
 	{XFS_ROTORSTEP, "rotorstep", &xfs_params.rotorstep.val,
--- linux-2.6.18.2/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 16:58:39 +0200
+++ linux-2.6.18.2-vs2.1.1/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 18:32:51 +0200
@@ -117,7 +117,7 @@ *****
 
 	{XFS_ROTORSTEP, "rotorstep", &xfs_params.rotorstep.val,
 	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
+	NULL, &sysctl_intvec, NULL,
 	&xfs_params.rotorstep.min, &xfs_params.rotorstep.max},
 
 	{XFS_INHERIT_NODFRG, "inherit_nodefrag", &xfs_params.inherit_nodfrg.val,
--- linux-2.6.18.2/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 16:58:39 +0200
+++ linux-2.6.18.2-vs2.1.1/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 18:32:51 +0200
@@ -122,7 +122,7 @@ *****
 
 	{XFS_INHERIT_NODFRG, "inherit_nodefrag", &xfs_params.inherit_nodfrg.val,
 	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
+	NULL, &sysctl_intvec, NULL,
 	&xfs_params.inherit_nodfrg.min, &xfs_params.inherit_nodfrg.max},
 
 	/* please keep this the last entry */
--- linux-2.6.18.2/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 16:58:39 +0200
+++ linux-2.6.18.2-vs2.1.1/fs/xfs/linux-2.6/xfs_sysctl.c	2006-09-20 18:32:51 +0200
@@ -129,7 +129,7 @@ *****
 #ifdef CONFIG_PROC_FS
 	{XFS_STATS_CLEAR, "stats_clear", &xfs_params.stats_clear.val,
 	sizeof(int), 0644, NULL, &xfs_stats_clear_proc_handler,
-	&sysctl_intvec, NULL,
+	NULL, &sysctl_intvec, NULL,
 	&xfs_params.stats_clear.min, &xfs_params.stats_clear.max},
 #endif /* CONFIG_PROC_FS */
 
--- linux-2.6.18.2/include/linux/sysctl.h	2006-11-04 19:43:24 +0100
+++ linux-2.6.18.2-vs2.1.1/include/linux/sysctl.h	2006-10-18 01:14:30 +0200
@@ -917,6 +918,9 @@ typedef int ctl_handler (ctl_table *tabl
 typedef int proc_handler (ctl_table *ctl, int write, struct file * filp,
 			  void __user *buffer, size_t *lenp, loff_t *ppos);
 
+typedef int virt_handler (struct ctl_table *ctl, int write, xid_t xid,
+			  void **datap, size_t *lenp);
+
 extern int proc_dostring(ctl_table *, int, struct file *,
 			 void __user *, size_t *, loff_t *);
 extern int proc_dointvec(ctl_table *, int, struct file *,
--- linux-2.6.18.2/include/linux/sysctl.h	2006-11-04 19:43:24 +0100
+++ linux-2.6.18.2-vs2.1.1/include/linux/sysctl.h	2006-10-18 01:14:30 +0200
@@ -998,6 +1002,7 @@ struct ctl_table 
 	mode_t mode;
 	ctl_table *child;
 	proc_handler *proc_handler;	/* Callback for text formatting */
+	virt_handler *virt_handler;	/* Context virtualization */
 	ctl_handler *strategy;		/* Callback function for all r/w */
 	struct proc_dir_entry *de;	/* /proc control block */
 	void *extra1;
--- linux-2.6.18.2/kernel/sysctl.c	2006-11-04 19:43:24 +0100
+++ linux-2.6.18.2-vs2.1.1/kernel/sysctl.c	2006-10-18 01:14:31 +0200
@@ -235,6 +237,7 @@ static ctl_table kern_table[] = {
 		.maxlen		= sizeof(system_utsname.sysname),
 		.mode		= 0444,
 		.proc_handler	= &proc_doutsstring,
+		.virt_handler	= &vx_uts_virt_handler,
 		.strategy	= &sysctl_string,
 	},
 	{
--- linux-2.6.18.2/kernel/sysctl.c	2006-11-04 19:43:24 +0100
+++ linux-2.6.18.2-vs2.1.1/kernel/sysctl.c	2006-10-18 01:14:31 +0200
@@ -244,6 +247,7 @@ static ctl_table kern_table[] = {
 		.maxlen		= sizeof(system_utsname.release),
 		.mode		= 0444,
 		.proc_handler	= &proc_doutsstring,
+		.virt_handler	= &vx_uts_virt_handler,
 		.strategy	= &sysctl_string,
 	},
 	{
--- linux-2.6.18.2/kernel/sysctl.c	2006-11-04 19:43:24 +0100
+++ linux-2.6.18.2-vs2.1.1/kernel/sysctl.c	2006-10-18 01:14:31 +0200
@@ -253,6 +257,7 @@ static ctl_table kern_table[] = {
 		.maxlen		= sizeof(system_utsname.version),
 		.mode		= 0444,
 		.proc_handler	= &proc_doutsstring,
+		.virt_handler	= &vx_uts_virt_handler,
 		.strategy	= &sysctl_string,
 	},
 	{
--- linux-2.6.18.2/kernel/sysctl.c	2006-11-04 19:43:24 +0100
+++ linux-2.6.18.2-vs2.1.1/kernel/sysctl.c	2006-10-18 01:14:31 +0200
@@ -262,6 +267,7 @@ static ctl_table kern_table[] = {
 		.maxlen		= sizeof(system_utsname.nodename),
 		.mode		= 0644,
 		.proc_handler	= &proc_doutsstring,
+		.virt_handler	= &vx_uts_virt_handler,
 		.strategy	= &sysctl_string,
 	},
 	{
--- linux-2.6.18.2/kernel/sysctl.c	2006-11-04 19:43:24 +0100
+++ linux-2.6.18.2-vs2.1.1/kernel/sysctl.c	2006-10-18 01:14:31 +0200
@@ -271,6 +277,7 @@ static ctl_table kern_table[] = {
 		.maxlen		= sizeof(system_utsname.domainname),
 		.mode		= 0644,
 		.proc_handler	= &proc_doutsstring,
+		.virt_handler	= &vx_uts_virt_handler,
 		.strategy	= &sysctl_string,
 	},
 	{
--- linux-2.6.18.2/kernel/sysctl.c	2006-11-04 19:43:24 +0100
+++ linux-2.6.18.2-vs2.1.1/kernel/sysctl.c	2006-10-18 01:14:31 +0200
@@ -1611,16 +1627,20 @@ static ssize_t proc_writesys(struct file
 int proc_dostring(ctl_table *table, int write, struct file *filp,
 		  void __user *buffer, size_t *lenp, loff_t *ppos)
 {
-	size_t len;
+	size_t len, maxlen;
 	char __user *p;
 	char c;
+	void *data;
+
+	data = table->data;
+	maxlen = table->maxlen;
+
+	if (!data || !maxlen || !*lenp || (*ppos && !write))
+		return (*lenp = 0);
 	
-	if (!table->data || !table->maxlen || !*lenp ||
-	    (*ppos && !write)) {
-		*lenp = 0;
-		return 0;
-	}
-	
+	if (table->virt_handler)
+		table->virt_handler(table, write, filp->f_xid, &data, &maxlen);
+
 	if (write) {
 		len = 0;
 		p = buffer;
--- linux-2.6.18.2/kernel/sysctl.c	2006-11-04 19:43:24 +0100
+++ linux-2.6.18.2-vs2.1.1/kernel/sysctl.c	2006-10-18 01:14:31 +0200
@@ -1631,16 +1651,16 @@ int proc_dostring(ctl_table *table, int 
 				break;
 			len++;
 		}
-		if (len >= table->maxlen)
-			len = table->maxlen-1;
-		if(copy_from_user(table->data, buffer, len))
+		if (len >= maxlen)
+			len = maxlen-1;
+		if(copy_from_user(data, buffer, len))
 			return -EFAULT;
-		((char *) table->data)[len] = 0;
+		((char *) data)[len] = 0;
 		*ppos += *lenp;
 	} else {
-		len = strlen(table->data);
-		if (len > table->maxlen)
-			len = table->maxlen;
+		len = strlen(data);
+		if (len > maxlen)
+			len = maxlen;
 		if (len > *lenp)
 			len = *lenp;
 		if (len)
--- linux-2.6.18.2/kernel/vserver/sysctl.c	1970-01-01 01:00:00 +0100
+++ linux-2.6.18.2-vs2.1.1/kernel/vserver/sysctl.c	2006-10-27 18:51:01 +0200
@@ -0,0 +1,242 @@
+/*
+ *  kernel/vserver/sysctl.c
+ *
+ *  Virtual Context Support
+ *
+ *  Copyright (C) 2004-2005  Herbert Pötzl
+ *
+ *  V0.01  basic structure
+ *
+ */
+
+#include <linux/errno.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/ctype.h>
+#include <linux/sysctl.h>
+#include <linux/parser.h>
+#include <linux/fs.h>
+
+#include <asm/uaccess.h>
+#include <asm/unistd.h>
+
+
+#define CTL_VSERVER	4242    /* unused? */
+
+enum {
+	CTL_DEBUG_ERROR		= 0,
+	CTL_DEBUG_SWITCH	= 1,
+	CTL_DEBUG_XID,
+	CTL_DEBUG_NID,
+	CTL_DEBUG_TAG,
+	CTL_DEBUG_NET,
+	CTL_DEBUG_LIMIT,
+	CTL_DEBUG_CRES,
+	CTL_DEBUG_DLIM,
+	CTL_DEBUG_QUOTA,
+	CTL_DEBUG_CVIRT,
+	CTL_DEBUG_MISC,
+};
+
+
+unsigned int vx_debug_switch	= 0;
+unsigned int vx_debug_xid	= 0;
+unsigned int vx_debug_nid	= 0;
+unsigned int vx_debug_tag	= 0;
+unsigned int vx_debug_net	= 0;
+unsigned int vx_debug_limit	= 0;
+unsigned int vx_debug_cres	= 0;
+unsigned int vx_debug_dlim	= 0;
+unsigned int vx_debug_quota	= 0;
+unsigned int vx_debug_cvirt	= 0;
+unsigned int vx_debug_misc	= 0;
+
+
+static struct ctl_table_header *vserver_table_header;
+static ctl_table vserver_table[];
+
+
+void vserver_register_sysctl(void)
+{
+	if (!vserver_table_header) {
+		vserver_table_header = register_sysctl_table(vserver_table, 1);
+	}
+
+}
+
+void vserver_unregister_sysctl(void)
+{
+	if (vserver_table_header) {
+		unregister_sysctl_table(vserver_table_header);
+		vserver_table_header = NULL;
+	}
+}
+
+
+static int proc_dodebug(ctl_table *table, int write,
+	struct file *filp, void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+	char		tmpbuf[20], *p, c;
+	unsigned int	value;
+	size_t		left, len;
+
+	if ((*ppos && !write) || !*lenp) {
+		*lenp = 0;
+		return 0;
+	}
+
+	left = *lenp;
+
+	if (write) {
+		if (!access_ok(VERIFY_READ, buffer, left))
+			return -EFAULT;
+		p = (char *) buffer;
+		while (left && __get_user(c, p) >= 0 && isspace(c))
+			left--, p++;
+		if (!left)
+			goto done;
+
+		if (left > sizeof(tmpbuf) - 1)
+			return -EINVAL;
+		if (copy_from_user(tmpbuf, p, left))
+			return -EFAULT;
+		tmpbuf[left] = '\0';
+
+		for (p = tmpbuf, value = 0; '0' <= *p && *p <= '9'; p++, left--)
+			value = 10 * value + (*p - '0');
+		if (*p && !isspace(*p))
+			return -EINVAL;
+		while (left && isspace(*p))
+			left--, p++;
+		*(unsigned int *) table->data = value;
+	} else {
+		if (!access_ok(VERIFY_WRITE, buffer, left))
+			return -EFAULT;
+		len = sprintf(tmpbuf, "%d", *(unsigned int *) table->data);
+		if (len > left)
+			len = left;
+		if (__copy_to_user(buffer, tmpbuf, len))
+			return -EFAULT;
+		if ((left -= len) > 0) {
+			if (put_user('\n', (char *)buffer + len))
+				return -EFAULT;
+			left--;
+		}
+	}
+
+done:
+	*lenp -= left;
+	*ppos += *lenp;
+	return 0;
+}
+
+
+#define	CTL_ENTRY(ctl, name)				\
+	{						\
+		.ctl_name	= ctl,			\
+		.procname	= #name,		\
+		.data		= &vx_##name,		\
+		.maxlen		= sizeof(int),		\
+		.mode		= 0644,			\
+		.proc_handler	= &proc_dodebug		\
+	}
+
+static ctl_table debug_table[] = {
+	CTL_ENTRY (CTL_DEBUG_SWITCH,	debug_switch),
+	CTL_ENTRY (CTL_DEBUG_XID,	debug_xid),
+	CTL_ENTRY (CTL_DEBUG_NID,	debug_nid),
+	CTL_ENTRY (CTL_DEBUG_TAG,	debug_tag),
+	CTL_ENTRY (CTL_DEBUG_NET,	debug_net),
+	CTL_ENTRY (CTL_DEBUG_LIMIT,	debug_limit),
+	CTL_ENTRY (CTL_DEBUG_CRES,	debug_cres),
+	CTL_ENTRY (CTL_DEBUG_DLIM,	debug_dlim),
+	CTL_ENTRY (CTL_DEBUG_QUOTA,	debug_quota),
+	CTL_ENTRY (CTL_DEBUG_CVIRT,	debug_cvirt),
+	CTL_ENTRY (CTL_DEBUG_MISC,	debug_misc),
+	{ .ctl_name = 0 }
+};
+
+static ctl_table vserver_table[] = {
+	{
+		.ctl_name	= CTL_VSERVER,
+		.procname	= "vserver",
+		.mode		= 0555,
+		.child		= debug_table
+	},
+	{ .ctl_name = 0 }
+};
+
+
+static match_table_t tokens = {
+	{ CTL_DEBUG_SWITCH,	"switch=%x"	},
+	{ CTL_DEBUG_XID,	"xid=%x"	},
+	{ CTL_DEBUG_NID,	"nid=%x"	},
+	{ CTL_DEBUG_TAG,	"tag=%x"	},
+	{ CTL_DEBUG_NET,	"net=%x"	},
+	{ CTL_DEBUG_LIMIT,	"limit=%x"	},
+	{ CTL_DEBUG_CRES,	"cres=%x"	},
+	{ CTL_DEBUG_DLIM,	"dlim=%x"	},
+	{ CTL_DEBUG_QUOTA,	"quota=%x"	},
+	{ CTL_DEBUG_CVIRT,	"cvirt=%x"	},
+	{ CTL_DEBUG_MISC,	"misc=%x"	},
+	{ CTL_DEBUG_ERROR,	NULL		}
+};
+
+#define	HANDLE_CASE(id, name, val)				\
+	case CTL_DEBUG_ ## id:					\
+		vx_debug_ ## name = val;			\
+		printk("vs_debug_" #name "=0x%x\n", val);	\
+		break
+
+
+static int __init vs_debug_setup(char *str)
+{
+	char *p;
+	int token;
+
+	printk("vs_debug_setup(%s)\n", str);
+	while ((p = strsep(&str, ",")) != NULL) {
+		substring_t args[MAX_OPT_ARGS];
+		unsigned int value;
+
+		if (!*p)
+			continue;
+
+		token = match_token(p, tokens, args);
+		value = (token>0)?simple_strtoul(args[0].from, NULL, 0):0;
+
+		switch (token) {
+		HANDLE_CASE(SWITCH, switch, value);
+		HANDLE_CASE(XID,    xid,    value);
+		HANDLE_CASE(NID,    nid,    value);
+		HANDLE_CASE(TAG,    tag,    value);
+		HANDLE_CASE(NET,    net,    value);
+		HANDLE_CASE(LIMIT,  limit,  value);
+		HANDLE_CASE(CRES,   cres,   value);
+		HANDLE_CASE(DLIM,   dlim,   value);
+		HANDLE_CASE(QUOTA,  quota,  value);
+		HANDLE_CASE(CVIRT,  cvirt,  value);
+		HANDLE_CASE(MISC,   misc,   value);
+		default:
+			return -EINVAL;
+			break;
+		}
+	}
+	return 1;
+}
+
+__setup("vsdebug=", vs_debug_setup);
+
+
+
+EXPORT_SYMBOL_GPL(vx_debug_switch);
+EXPORT_SYMBOL_GPL(vx_debug_xid);
+EXPORT_SYMBOL_GPL(vx_debug_nid);
+EXPORT_SYMBOL_GPL(vx_debug_net);
+EXPORT_SYMBOL_GPL(vx_debug_limit);
+EXPORT_SYMBOL_GPL(vx_debug_cres);
+EXPORT_SYMBOL_GPL(vx_debug_dlim);
+EXPORT_SYMBOL_GPL(vx_debug_quota);
+EXPORT_SYMBOL_GPL(vx_debug_cvirt);
+EXPORT_SYMBOL_GPL(vx_debug_misc);
+
