Re: [RFC][PATCH 1/2] Virtualization of UTS
From: James Morris
Date: Fri Mar 24 2006 - 15:25:24 EST
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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/