Commit 2ae2199f authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Make naming of parititions in sysfs match /proc/partitions.

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 anomoly so that names in sysfs can be
parsed more reliably.


This has been extensively discussed.  It will probably break the external
`iostat' tool.  But only for disks whose name ends in a digit, which appears
to be only DAC960.
parent 057ee909
......@@ -315,7 +315,10 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len)
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment