[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200807222012.39852.ioe-lkml@rameria.de>
Date: Tue, 22 Jul 2008 20:12:38 +0200
From: Ingo Oeser <ioe-lkml@...eria.de>
To: Greg Kroah-Hartman <gregkh@...e.de>
Cc: linux-kernel@...r.kernel.org, Kay Sievers <kay.sievers@...y.org>
Subject: Re: [PATCH 02/79] kobject: replace '/' with '!' in name
Hi Greg,
hi Kay,
On Tuesday 22 July 2008, Greg Kroah-Hartman wrote:
> From: Kay Sievers <kay.sievers@...y.org>
>
> 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.
Yes, but why replace only one?
> diff --git a/lib/kobject.c b/lib/kobject.c
> index dcade05..7444015 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;
> }
while (s = strchr(kobj->name, '/')) {
s[0] = '!';
}
instead?
Best Regards
Ingo Oeser
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists