From: Neil Brown <neilb@cse.unsw.edu.au>

In fs/partitions/check.c  there are two pieces of code that add a 
partition number to a block-device name:

  - the 'disk_name' function 
  - a snprintf in add_partitions.

'disk_name' inserts a 'p' before the partition number if the device
name ends with a digit.  The snprintf in add_partitions doesn't.

This patch rectifies this anomily so that names in sysfs can be
parsed more reliably.



---

 fs/partitions/check.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

diff -puN fs/partitions/check.c~partition-naming-fix fs/partitions/check.c
--- 25/fs/partitions/check.c~partition-naming-fix	2004-01-21 20:06:26.000000000 -0800
+++ 25-akpm/fs/partitions/check.c	2004-01-21 20:06:26.000000000 -0800
@@ -315,7 +315,10 @@ void add_partition(struct gendisk *disk,
 			S_IFBLK|S_IRUSR|S_IWUSR,
 			"%s/part%d", disk->devfs_name, part);
 
-	snprintf(p->kobj.name,KOBJ_NAME_LEN,"%s%d",disk->kobj.name,part);
+	if (isdigit(disk->kobj.name[strlen(disk->kobj.name)-1]))
+		snprintf(p->kobj.name,KOBJ_NAME_LEN,"%sp%d",disk->kobj.name,part);
+	else
+		snprintf(p->kobj.name,KOBJ_NAME_LEN,"%s%d",disk->kobj.name,part);
 	p->kobj.parent = &disk->kobj;
 	p->kobj.ktype = &ktype_part;
 	kobject_register(&p->kobj);

_