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>
This commit is contained in:
parent
e105b8bfc7
commit
9f255651fb
|
@ -216,13 +216,19 @@ static int kobject_add_internal(struct kobject *kobj)
|
||||||
static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
|
static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
|
||||||
va_list vargs)
|
va_list vargs)
|
||||||
{
|
{
|
||||||
/* Free the old name, if necessary. */
|
const char *old_name = kobj->name;
|
||||||
kfree(kobj->name);
|
char *s;
|
||||||
|
|
||||||
kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs);
|
kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs);
|
||||||
if (!kobj->name)
|
if (!kobj->name)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
/* ewww... some of these buggers have '/' in the name ... */
|
||||||
|
s = strchr(kobj->name, '/');
|
||||||
|
if (s)
|
||||||
|
s[0] = '!';
|
||||||
|
|
||||||
|
kfree(old_name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue