public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: ebiederm@xmission•com (Eric W. Biederman)
To: <linux-kernel@vger•kernel.org>
Cc: Linux Containers <containers@lists•osdl.org>,
	<netdev@vger•kernel.org>,
	netfilter-devel@vger•kernel.org, <linux-fsdevel@vger•kernel.org>,
	jamal <hadi@cyberus•ca>, Daniel Lezcano <daniel.lezcano@free•fr>,
	Linus Torvalds <torvalds@linux-foundation•org>,
	Michael Kerrisk <mtk.manpages@gmail•com>,
	Ulrich Drepper <drepper@gmail•com>,
	Al Viro <viro@ZenIV•linux.org.uk>,
	David Miller <davem@davemloft•net>,
	"Serge E. Hallyn" <serge@hallyn•com>,
	Pavel Emelyanov <xemul@openvz•org>,
	Pavel Emelyanov <xemul@parallels•com>,
	Ben Greear <greearb@candelatech•com>,
	Matt Helsley <matthltc@us•ibm.com>,
	Jonathan Corbet <corbet@lwn•net>,
	Sukadev Bhattiprolu <sukadev@linux•vnet.ibm.com>,
	Jan Engelhardt <jengelh@medozas•de>,
	Patrick McHardy <kaber@trash•net>
Subject: [PATCH 4/8] ns proc: Add support for the uts namespace
Date: Thu, 23 Sep 2010 01:48:22 -0700	[thread overview]
Message-ID: <m1y6asq209.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <m1ocborgq7.fsf@fess.ebiederm.org> (Eric W. Biederman's message of "Thu, 23 Sep 2010 01:45:04 -0700")


Signed-off-by: Eric W. Biederman <ebiederm@xmission•com>
---
 fs/proc/namespaces.c    |    3 +++
 include/linux/proc_fs.h |    1 +
 kernel/utsname.c        |   32 ++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c
index 31e32f3..902443e 100644
--- a/fs/proc/namespaces.c
+++ b/fs/proc/namespaces.c
@@ -19,6 +19,9 @@ static const struct proc_ns_operations *ns_entries[] = {
 #ifdef CONFIG_NET_NS
 	&netns_operations,
 #endif
+#ifdef CONFIG_UTS_NS
+	&utsns_operations,
+#endif
 };
 
 static const struct file_operations ns_file_operations = {
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 9cd3fae..28b4ffd 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -263,6 +263,7 @@ struct proc_ns_operations {
 };
 #define PROC_NSNAME(NAME) { .name = (NAME), .len = (sizeof(NAME) - 1), }
 extern const struct proc_ns_operations netns_operations;
+extern const struct proc_ns_operations utsns_operations;
 extern struct file *proc_ns_fget(int fd);
 
 union proc_op {
diff --git a/kernel/utsname.c b/kernel/utsname.c
index 8a82b4b..ff06086 100644
--- a/kernel/utsname.c
+++ b/kernel/utsname.c
@@ -14,6 +14,7 @@
 #include <linux/utsname.h>
 #include <linux/err.h>
 #include <linux/slab.h>
+#include <linux/proc_fs.h>
 
 static struct uts_namespace *create_uts_ns(void)
 {
@@ -73,3 +74,34 @@ void free_uts_ns(struct kref *kref)
 	ns = container_of(kref, struct uts_namespace, kref);
 	kfree(ns);
 }
+
+static void *utsns_get(struct task_struct *task)
+{
+	struct uts_namespace *ns;
+	rcu_read_lock();
+	ns = task->nsproxy->uts_ns;
+	get_uts_ns(ns);
+	rcu_read_unlock();
+	return ns;
+}
+
+static void utsns_put(void *ns)
+{
+	put_uts_ns(ns);
+}
+
+static int utsns_install(struct nsproxy *nsproxy, void *ns)
+{
+	get_uts_ns(ns);
+	put_uts_ns(nsproxy->uts_ns);
+	nsproxy->uts_ns = ns;
+	return 0;
+}
+
+const struct proc_ns_operations utsns_operations = {
+	.name		= PROC_NSNAME("uts"),
+	.get		= utsns_get,
+	.put		= utsns_put,
+	.install	= utsns_install,
+};
+
-- 
1.6.5.2.143.g8cc62


  parent reply	other threads:[~2010-09-23  8:48 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-23  8:45 [ABI REVIEW][PATCH 0/8] Namespace file descriptors Eric W. Biederman
2010-09-23  8:46 ` [PATCH 1/8] ns: proc files for namespace naming policy Eric W. Biederman
2010-09-23  8:46 ` [PATCH 2/8] ns: Introduce the setns syscall Eric W. Biederman
2010-09-23  8:47 ` [PATCH 3/8] ns proc: Add support for the network namespace Eric W. Biederman
2010-09-23 11:27   ` Louis Rilling
2010-09-23 16:00     ` Eric W. Biederman
2010-09-23  8:48 ` Eric W. Biederman [this message]
2010-09-23  8:49 ` [PATCH 5/8] ns proc: Add support for the ipc namespace Eric W. Biederman
2010-09-23  8:50 ` [PATCH 6/8] ns proc: Add support for the mount namespace Eric W. Biederman
     [not found] ` <m1ocborgq7.fsf-+imSwln9KH6u2/kzUuoCbdi2O/JbrIOy@public.gmane.org>
2010-09-23  8:51   ` [PATCH 7/8] net: Allow setting the network namespace by fd Eric W. Biederman
2010-09-23  9:41     ` Eric Dumazet
2010-09-23 16:03       ` Eric W. Biederman
2010-09-23 11:22     ` jamal
2010-09-23 14:58       ` David Lamparter
2010-09-24 11:51         ` jamal
2010-09-24 12:57           ` David Lamparter
2010-09-24 13:32             ` jamal
2010-09-24 14:09               ` David Lamparter
2010-09-24 14:16                 ` jamal
2010-09-23 15:14       ` Eric W. Biederman
2010-09-23 14:22     ` Brian Haley
2010-09-23 16:16       ` Eric W. Biederman
     [not found]     ` <m1hbhgq1v1.fsf-+imSwln9KH6u2/kzUuoCbdi2O/JbrIOy@public.gmane.org>
2010-09-24 13:46       ` Daniel Lezcano
2010-09-23  8:51   ` [PATCH 8/8] net: Implement socketat Eric W. Biederman
2010-09-23  8:56     ` Pavel Emelyanov
2010-09-23 11:19       ` jamal
2010-09-23 11:33         ` Pavel Emelyanov
     [not found]           ` <4C9B3B06.900-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2010-09-23 11:40             ` jamal
2010-09-23 11:53               ` Pavel Emelyanov
2010-09-23 12:11                 ` jamal
2010-09-23 12:34                   ` Pavel Emelyanov
2010-09-23 14:54                     ` David Lamparter
2010-09-23 15:00                     ` Eric W. Biederman
2010-10-02 21:13                 ` Daniel Lezcano
2010-10-03 13:44                   ` jamal
2010-10-04 10:13                     ` Daniel Lezcano
2010-10-04 19:07                     ` Eric W. Biederman
2010-10-15 12:30                     ` netns patches WAS( " jamal
2010-10-26 20:52                       ` jamal
2010-10-27  0:27                         ` Eric W. Biederman
2010-09-23 15:18 ` [ABI REVIEW][PATCH 0/8] Namespace file descriptors David Lamparter
2010-09-23 16:32   ` Eric W. Biederman
2010-09-23 16:49     ` David Lamparter
2010-09-24 13:02 ` Andrew Lutomirski
2010-09-24 13:49   ` Daniel Lezcano
2010-09-24 17:06     ` Eric W. Biederman
2010-09-29  3:09 ` Rémi Denis-Courmont

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=m1y6asq209.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission$(echo .)com \
    --cc=containers@lists$(echo .)osdl.org \
    --cc=corbet@lwn$(echo .)net \
    --cc=daniel.lezcano@free$(echo .)fr \
    --cc=davem@davemloft$(echo .)net \
    --cc=drepper@gmail$(echo .)com \
    --cc=greearb@candelatech$(echo .)com \
    --cc=hadi@cyberus$(echo .)ca \
    --cc=jengelh@medozas$(echo .)de \
    --cc=kaber@trash$(echo .)net \
    --cc=linux-fsdevel@vger$(echo .)kernel.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=matthltc@us$(echo .)ibm.com \
    --cc=mtk.manpages@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=netfilter-devel@vger$(echo .)kernel.org \
    --cc=serge@hallyn$(echo .)com \
    --cc=sukadev@linux$(echo .)vnet.ibm.com \
    --cc=torvalds@linux-foundation$(echo .)org \
    --cc=viro@ZenIV$(echo .)linux.org.uk \
    --cc=xemul@openvz$(echo .)org \
    --cc=xemul@parallels$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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