partitions: fix sometimes unreadable partition strings
Fix this garbage happening quite often: ==> sda: scsi 3:0:0:0: CD-ROM TOSHIBA ==> sda1 sda2 sda3 sda4 <sr0: scsi3-mmc drive: 24x/24x writer dvd-ram cd/rw xa/form2 cdda tray ^^^ Uniform CD-ROM driver Revision: 3.20 sr 3:0:0:0: Attached scsi CD-ROM sr0 ==> sda5 sda6 sda7 > Make "sda: sda1 ..." lines actually lines. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
ecd6269174
commit
9c867fbe06
@@ -75,6 +75,7 @@ int ibm_partition(struct parsed_partitions *state)
|
||||
unsigned char *data;
|
||||
Sector sect;
|
||||
sector_t labelsect;
|
||||
char tmp[64];
|
||||
|
||||
res = 0;
|
||||
blocksize = bdev_logical_block_size(bdev);
|
||||
@@ -144,13 +145,15 @@ int ibm_partition(struct parsed_partitions *state)
|
||||
*/
|
||||
blocksize = label->cms.block_size;
|
||||
if (label->cms.disk_offset != 0) {
|
||||
printk("CMS1/%8s(MDSK):", name);
|
||||
snprintf(tmp, sizeof(tmp), "CMS1/%8s(MDSK):", name);
|
||||
strlcat(state->pp_buf, tmp, PAGE_SIZE);
|
||||
/* disk is reserved minidisk */
|
||||
offset = label->cms.disk_offset;
|
||||
size = (label->cms.block_count - 1)
|
||||
* (blocksize >> 9);
|
||||
} else {
|
||||
printk("CMS1/%8s:", name);
|
||||
snprintf(tmp, sizeof(tmp), "CMS1/%8s:", name);
|
||||
strlcat(state->pp_buf, tmp, PAGE_SIZE);
|
||||
offset = (info->label_block + 1);
|
||||
size = label->cms.block_count
|
||||
* (blocksize >> 9);
|
||||
@@ -159,7 +162,8 @@ int ibm_partition(struct parsed_partitions *state)
|
||||
size-offset*(blocksize >> 9));
|
||||
} else {
|
||||
if (strncmp(type, "LNX1", 4) == 0) {
|
||||
printk("LNX1/%8s:", name);
|
||||
snprintf(tmp, sizeof(tmp), "LNX1/%8s:", name);
|
||||
strlcat(state->pp_buf, tmp, PAGE_SIZE);
|
||||
if (label->lnx.ldl_version == 0xf2) {
|
||||
fmt_size = label->lnx.formatted_blocks
|
||||
* (blocksize >> 9);
|
||||
@@ -178,7 +182,7 @@ int ibm_partition(struct parsed_partitions *state)
|
||||
offset = (info->label_block + 1);
|
||||
} else {
|
||||
/* unlabeled disk */
|
||||
printk("(nonl)");
|
||||
strlcat(tmp, sizeof(tmp), "(nonl)", PAGE_SIZE);
|
||||
size = i_size >> 9;
|
||||
offset = (info->label_block + 1);
|
||||
}
|
||||
@@ -197,7 +201,8 @@ int ibm_partition(struct parsed_partitions *state)
|
||||
* if not, something is wrong, skipping partition detection
|
||||
*/
|
||||
if (strncmp(type, "VOL1", 4) == 0) {
|
||||
printk("VOL1/%8s:", name);
|
||||
snprintf(tmp, sizeof(tmp), "VOL1/%8s:", name);
|
||||
strlcat(state->pp_buf, tmp, PAGE_SIZE);
|
||||
/*
|
||||
* get block number and read then go through format1
|
||||
* labels
|
||||
@@ -253,7 +258,7 @@ int ibm_partition(struct parsed_partitions *state)
|
||||
|
||||
}
|
||||
|
||||
printk("\n");
|
||||
strlcat(state->pp_buf, "\n", PAGE_SIZE);
|
||||
goto out_freeall;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user