[PATCH 24/23] md: remove slashes from disk names when creation dev names in sysfs

From: Chris Wright
Date: Wed Feb 08 2006 - 18:31:52 EST


-stable review patch. If anyone has any objections, please let us know.
(this should've been in the series. i missed this one, mea culpa)
------------------

e.g. The sx8 driver uses names like sx8/0.

This would make a md component dev name like

/sys/block/md0/md/dev-sx8/0

which is not allowed. So we change the '/' to '!' just like
fs/partitions/check.c(register_disk) does.

Signed-off-by: Neil Brown <neilb@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
Signed-off-by: Linus Torvalds <torvalds@xxxxxxxx>
Signed-off-by: Chris Wright <chrisw@xxxxxxxxxxxx>
---
drivers/md/md.c | 3 +++
1 files changed, 3 insertions(+)

--- linux-2.6.15.3.orig/drivers/md/md.c
+++ linux-2.6.15.3/drivers/md/md.c
@@ -1182,6 +1182,7 @@ static int bind_rdev_to_array(mdk_rdev_t
mdk_rdev_t *same_pdev;
char b[BDEVNAME_SIZE], b2[BDEVNAME_SIZE];
struct kobject *ko;
+ char *s;

if (rdev->mddev) {
MD_BUG();
@@ -1213,6 +1214,8 @@ static int bind_rdev_to_array(mdk_rdev_t
bdevname(rdev->bdev,b);
if (kobject_set_name(&rdev->kobj, "dev-%s", b) < 0)
return -ENOMEM;
+ while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL)
+ *s = '!';

list_add(&rdev->same_set, &mddev->disks);
rdev->mddev = mddev;
-
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/