From 9c867fbe06458a8957024236b574733fae0cefed Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Tue, 10 Aug 2010 18:03:14 -0700 Subject: 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 sda5 sda6 sda7 > Make "sda: sda1 ..." lines actually lines. Signed-off-by: Alexey Dobriyan Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/partitions/ibm.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'fs/partitions/ibm.c') diff --git a/fs/partitions/ibm.c b/fs/partitions/ibm.c index fc8497643fd..d1b8a5c4bc0 100644 --- a/fs/partitions/ibm.c +++ b/fs/partitions/ibm.c @@ -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; -- cgit v1.2.3