diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2008-05-06 22:24:04 +0200 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2008-06-13 09:28:45 +1000 |
commit | b3854bf877aa51afbcf825ea93e18919b7d5dbeb (patch) | |
tree | 9acdaf385bab171654b9c914d33da68e1f80a46d /lib | |
parent | 35e7929442875f1685f9885c566798d23b360859 (diff) |
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 <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kobject.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/kobject.c b/lib/kobject.c index c7fb09238092..fa8ef86a072d 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; } |