[Devel] Re: [RFC][PATCH 1/2] Virtualization of UTS
James Morris
jmorris at namei.org
Fri Mar 24 12:28:09 PST 2006
On Fri, 24 Mar 2006, Kirill Korotaev wrote:
> This patch introduces utsname namespace in system, which allows to have
> different utsnames on the host.
> Introduces config option CONFIG_UTS_NS and uts_namespace structure for this.
>
Please include patches inline, so they can be quoted inline.
+#define system_utsname (current->uts_ns->name)
This should be a static inline.
+struct uts_namespace *create_uts_ns(void)
+{
+ struct uts_namespace *ns;
+
+ ns = kmalloc(sizeof(struct uts_namespace), GFP_KERNEL);
+ if (ns == NULL)
+ return NULL;
+
+ memset(&ns->name, 0, sizeof(ns->name));
+ atomic_set(&ns->cnt, 1);
+ return ns;
+}
IMHO, it's better to do something like:
{
foo = kmalloc();
if (foo) {
stuff;
etc;
}
return foo;
}
I suggest you use kzalloc(), too.
Also, I think the API approach needs to be determined before the patches
go into -mm, in case it impacts on the code.
More information about the Devel
mailing list