linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kirill Korotaev <dev@sw.ru>
To: "Serge E. Hallyn" <serue@us.ibm.com>
Cc: linux-kernel@vger.kernel.org, herbert@13thfloor.at,
	devel@openvz.org, sam@vilain.net,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	xemul@sw.ru, James Morris <jmorris@namei.org>
Subject: Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack
Date: Wed, 19 Apr 2006 19:50:31 +0400	[thread overview]
Message-ID: <44465C47.9050706@sw.ru> (raw)
In-Reply-To: <20060419152129.GA14756@sergelap.austin.ibm.com>

Serge,

> Please look closer at the patch.
> I *am* doing nothing with sysctls.
 >
> system_utsname no longer exists, and the way to get to that is by using
> init_uts_ns.name.  That's all this does.
Sorry for being not concrete enough.
I mean switch () in the code. Until we decided how to virtualize 
sysctls/proc, I believe no dead code/hacks should be commited. IMHO.

FYI, I strongly object against virtualizing sysctls this way as it is 
not flexible and is a real hack from my POV.

Sure, change of system_utsname.sysname -> init_uts_ns.name.sysname is Ok.

Thanks,
Kirill

>>>Sysctl uts patch.  This clearly will need to be done another way, but
>>>since sysctl itself needs to be container aware, 'the right thing' is
>>>a separate patchset.
>>>
>>>Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
>>>---
>>>kernel/sysctl.c |   38 ++++++++++++++++++++++++++++----------
>>>1 files changed, 28 insertions(+), 10 deletions(-)
>>>
>>>40f7e1320c82efb6e875fc3bf44408cdfd093f21
>>>diff --git a/kernel/sysctl.c b/kernel/sysctl.c
>>>index e82726f..c2b18ef 100644
>>>--- a/kernel/sysctl.c
>>>+++ b/kernel/sysctl.c
>>>@@ -233,8 +233,8 @@ static ctl_table kern_table[] = {
>>>	{
>>>		.ctl_name	= KERN_OSTYPE,
>>>		.procname	= "ostype",
>>>-		.data		= system_utsname.sysname,
>>>-		.maxlen		= sizeof(system_utsname.sysname),
>>>+		.data		= init_uts_ns.name.sysname,
>>>+		.maxlen		= sizeof(init_uts_ns.name.sysname),
>>>		.mode		= 0444,
>>>		.proc_handler	= &proc_doutsstring,
>>>		.strategy	= &sysctl_string,
>>>@@ -242,8 +242,8 @@ static ctl_table kern_table[] = {
>>>	{
>>>		.ctl_name	= KERN_OSRELEASE,
>>>		.procname	= "osrelease",
>>>-		.data		= system_utsname.release,
>>>-		.maxlen		= sizeof(system_utsname.release),
>>>+		.data		= init_uts_ns.name.release,
>>>+		.maxlen		= sizeof(init_uts_ns.name.release),
>>>		.mode		= 0444,
>>>		.proc_handler	= &proc_doutsstring,
>>>		.strategy	= &sysctl_string,
>>>@@ -251,8 +251,8 @@ static ctl_table kern_table[] = {
>>>	{
>>>		.ctl_name	= KERN_VERSION,
>>>		.procname	= "version",
>>>-		.data		= system_utsname.version,
>>>-		.maxlen		= sizeof(system_utsname.version),
>>>+		.data		= init_uts_ns.name.version,
>>>+		.maxlen		= sizeof(init_uts_ns.name.version),
>>>		.mode		= 0444,
>>>		.proc_handler	= &proc_doutsstring,
>>>		.strategy	= &sysctl_string,
>>>@@ -260,8 +260,8 @@ static ctl_table kern_table[] = {
>>>	{
>>>		.ctl_name	= KERN_NODENAME,
>>>		.procname	= "hostname",
>>>-		.data		= system_utsname.nodename,
>>>-		.maxlen		= sizeof(system_utsname.nodename),
>>>+		.data		= init_uts_ns.name.nodename,
>>>+		.maxlen		= sizeof(init_uts_ns.name.nodename),
>>>		.mode		= 0644,
>>>		.proc_handler	= &proc_doutsstring,
>>>		.strategy	= &sysctl_string,
>>>@@ -269,8 +269,8 @@ static ctl_table kern_table[] = {
>>>	{
>>>		.ctl_name	= KERN_DOMAINNAME,
>>>		.procname	= "domainname",
>>>-		.data		= system_utsname.domainname,
>>>-		.maxlen		= sizeof(system_utsname.domainname),
>>>+		.data		= init_uts_ns.name.domainname,
>>>+		.maxlen		= sizeof(init_uts_ns.name.domainname),
>>>		.mode		= 0644,
>>>		.proc_handler	= &proc_doutsstring,
>>>		.strategy	= &sysctl_string,
>>>@@ -1619,6 +1619,24 @@ static int proc_doutsstring(ctl_table *t
>>>{
>>>	int r;
>>>
>>>+	switch (table->ctl_name) {
>>>+		case KERN_OSTYPE:
>>>+			table->data = utsname()->sysname;
>>>+			break;
>>>+		case KERN_OSRELEASE:
>>>+			table->data = utsname()->release;
>>>+			break;
>>>+		case KERN_VERSION:
>>>+			table->data = utsname()->version;
>>>+			break;
>>>+		case KERN_NODENAME:
>>>+			table->data = utsname()->nodename;
>>>+			break;
>>>+		case KERN_DOMAINNAME:
>>>+			table->data = utsname()->domainname;
>>>+			break;
>>>+	}
>>>+
>>>	if (!write) {
>>>		down_read(&uts_sem);
>>>		r=proc_dostring(table,0,filp,buffer,lenp, ppos);
>>
> 



  reply	other threads:[~2006-04-19 15:43 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-07 18:36 [RFC][PATCH 0/5] uts namespaces: Introduction Serge E. Hallyn
2006-04-07 18:36 ` [RFC][PATCH 5/5] uts namespaces: Enable UTS namespaces debugging Serge E. Hallyn
2006-04-07 18:36 ` [RFC][PATCH 2/5] uts namespaces: Switch to using uts namespaces Serge E. Hallyn
2006-04-07 19:17   ` Sam Ravnborg
2006-04-07 19:25     ` Serge E. Hallyn
2006-04-11 12:26   ` Kirill Korotaev
2006-04-11 21:04     ` Sam Vilain
2006-04-12  5:01       ` Serge E. Hallyn
2006-04-12  6:00         ` Eric W. Biederman
2006-04-19 15:00           ` Serge E. Hallyn
2006-04-07 18:36 ` [RFC][PATCH 3/5] uts namespaces: Use init uts_namespace when appropriate Serge E. Hallyn
2006-04-07 18:36 ` [RFC][PATCH 4/5] utsname namespaces: sysctl hack Serge E. Hallyn
2006-04-19 15:17   ` Kirill Korotaev
2006-04-19 15:21     ` Serge E. Hallyn
2006-04-19 15:50       ` Kirill Korotaev [this message]
2006-04-19 16:54         ` Cedric Le Goater
2006-04-19 17:10           ` Eric W. Biederman
2006-04-19 17:10         ` Serge E. Hallyn
2006-04-19 15:52       ` Eric W. Biederman
2006-04-19 16:23         ` Dave Hansen
2006-04-19 16:52           ` Eric W. Biederman
2006-04-19 17:19             ` Dave Hansen
2006-04-19 17:37               ` Eric W. Biederman
2006-04-19 17:48               ` Eric W. Biederman
2006-04-19 15:29     ` Eric W. Biederman
2006-04-19 17:51       ` Serge E. Hallyn
2006-04-19 18:27         ` Eric W. Biederman
2006-04-19 20:24           ` Serge E. Hallyn
2006-04-19 21:44           ` Sam Vilain
2006-04-20 17:05             ` Serge E. Hallyn
2006-04-25 22:00             ` Serge E. Hallyn
2006-04-26  4:09               ` Sam Vilain
2006-04-26 10:28                 ` Christoph Hellwig
2006-04-27 12:32                 ` Eric W. Biederman
2006-04-07 18:36 ` [RFC][PATCH 1/5] uts namespaces: Implement utsname namespaces Serge E. Hallyn
2006-04-07 19:13   ` Sam Ravnborg
2006-04-07 19:20     ` Serge E. Hallyn
2006-04-07 19:39     ` Serge E. Hallyn
2006-04-07 20:47   ` James Morris
2006-04-07 22:13     ` Serge E. Hallyn
2006-04-08 13:44   ` Andi Kleen
2006-04-08 13:45   ` Andi Kleen
2006-04-08 20:28     ` Serge E. Hallyn
2006-04-09  6:00       ` Andi Kleen
2006-04-09 19:08         ` Eric W. Biederman
2006-04-07 19:06 ` [RFC][PATCH 0/5] uts namespaces: Introduction Eric W. Biederman
2006-04-07 19:28   ` Serge E. Hallyn
2006-04-07 19:39     ` Eric W. Biederman
2006-04-11 12:32 ` Kirill Korotaev
2006-04-11 14:01   ` Serge E. Hallyn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44465C47.9050706@sw.ru \
    --to=dev@sw.ru \
    --cc=devel@openvz.org \
    --cc=ebiederm@xmission.com \
    --cc=herbert@13thfloor.at \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@vilain.net \
    --cc=serue@us.ibm.com \
    --cc=xemul@sw.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).