From: Kay Sievers Date: Tue, 6 May 2008 20:24:04 +0000 (+0200) Subject: kobject: replace '/' with '!' in name X-Git-Tag: v2.6.27-rc1~866^2~77 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=9f255651fb41c111ee35a2ae632df8ce9bd61def;p=linux-2.6-omap-h63xx.git kobject: replace '/' with '!' in name Some (block) devices have a '/' in the name, and need special handling. Let's have that rule to the core, so we can remove it from the block class. Signed-off-by: Kay Sievers Signed-off-by: Greg Kroah-Hartman --- diff --git a/lib/kobject.c b/lib/kobject.c index dcade0543bd..744401571ed 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -216,13 +216,19 @@ static int kobject_add_internal(struct kobject *kobj) static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, va_list vargs) { - /* Free the old name, if necessary. */ - kfree(kobj->name); + const char *old_name = kobj->name; + char *s; kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs); if (!kobj->name) return -ENOMEM; + /* ewww... some of these buggers have '/' in the name ... */ + s = strchr(kobj->name, '/'); + if (s) + s[0] = '!'; + + kfree(old_name); return 0; }