diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2010-08-10 18:03:14 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-11 08:59:20 -0700 |
commit | 9c867fbe06458a8957024236b574733fae0cefed (patch) | |
tree | 6eae6def53e4ca9e30f90f6e9c07d8044581f08f /fs/partitions/msdos.c | |
parent | ecd6269174c04da5efbd17d6bff793e428eb45ef (diff) | |
download | kernel_samsung_aries-9c867fbe06458a8957024236b574733fae0cefed.zip kernel_samsung_aries-9c867fbe06458a8957024236b574733fae0cefed.tar.gz kernel_samsung_aries-9c867fbe06458a8957024236b574733fae0cefed.tar.bz2 |
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>
Diffstat (limited to 'fs/partitions/msdos.c')
-rw-r--r-- | fs/partitions/msdos.c | 67 |
1 files changed, 45 insertions, 22 deletions
diff --git a/fs/partitions/msdos.c b/fs/partitions/msdos.c index 15bfb7b..5f79a66 100644 --- a/fs/partitions/msdos.c +++ b/fs/partitions/msdos.c @@ -213,10 +213,18 @@ static void parse_solaris_x86(struct parsed_partitions *state, put_dev_sector(sect); return; } - printk(" %s%d: <solaris:", state->name, origin); + { + char tmp[1 + BDEVNAME_SIZE + 10 + 11 + 1]; + + snprintf(tmp, sizeof(tmp), " %s%d: <solaris:", state->name, origin); + strlcat(state->pp_buf, tmp, PAGE_SIZE); + } if (le32_to_cpu(v->v_version) != 1) { - printk(" cannot handle version %d vtoc>\n", - le32_to_cpu(v->v_version)); + char tmp[64]; + + snprintf(tmp, sizeof(tmp), " cannot handle version %d vtoc>\n", + le32_to_cpu(v->v_version)); + strlcat(state->pp_buf, tmp, PAGE_SIZE); put_dev_sector(sect); return; } @@ -224,9 +232,12 @@ static void parse_solaris_x86(struct parsed_partitions *state, max_nparts = le16_to_cpu (v->v_nparts) > 8 ? SOLARIS_X86_NUMSLICE : 8; for (i=0; i<max_nparts && state->next<state->limit; i++) { struct solaris_x86_slice *s = &v->v_slice[i]; + char tmp[3 + 10 + 1 + 1]; + if (s->s_size == 0) continue; - printk(" [s%d]", i); + snprintf(tmp, sizeof(tmp), " [s%d]", i); + strlcat(state->pp_buf, tmp, PAGE_SIZE); /* solaris partitions are relative to current MS-DOS * one; must add the offset of the current partition */ put_partition(state, state->next++, @@ -234,7 +245,7 @@ static void parse_solaris_x86(struct parsed_partitions *state, le32_to_cpu(s->s_size)); } put_dev_sector(sect); - printk(" >\n"); + strlcat(state->pp_buf, " >\n", PAGE_SIZE); #endif } @@ -250,6 +261,7 @@ static void parse_bsd(struct parsed_partitions *state, Sector sect; struct bsd_disklabel *l; struct bsd_partition *p; + char tmp[64]; l = read_part_sector(state, offset + 1, §); if (!l) @@ -258,7 +270,9 @@ static void parse_bsd(struct parsed_partitions *state, put_dev_sector(sect); return; } - printk(" %s%d: <%s:", state->name, origin, flavour); + + snprintf(tmp, sizeof(tmp), " %s%d: <%s:", state->name, origin, flavour); + strlcat(state->pp_buf, tmp, PAGE_SIZE); if (le16_to_cpu(l->d_npartitions) < max_partitions) max_partitions = le16_to_cpu(l->d_npartitions); @@ -275,16 +289,18 @@ static void parse_bsd(struct parsed_partitions *state, /* full parent partition, we have it already */ continue; if (offset > bsd_start || offset+size < bsd_start+bsd_size) { - printk("bad subpartition - ignored\n"); + strlcat(state->pp_buf, "bad subpartition - ignored\n", PAGE_SIZE); continue; } put_partition(state, state->next++, bsd_start, bsd_size); } put_dev_sector(sect); - if (le16_to_cpu(l->d_npartitions) > max_partitions) - printk(" (ignored %d more)", - le16_to_cpu(l->d_npartitions) - max_partitions); - printk(" >\n"); + if (le16_to_cpu(l->d_npartitions) > max_partitions) { + snprintf(tmp, sizeof(tmp), " (ignored %d more)", + le16_to_cpu(l->d_npartitions) - max_partitions); + strlcat(state->pp_buf, tmp, PAGE_SIZE); + } + strlcat(state->pp_buf, " >\n", PAGE_SIZE); } #endif @@ -333,7 +349,12 @@ static void parse_unixware(struct parsed_partitions *state, put_dev_sector(sect); return; } - printk(" %s%d: <unixware:", state->name, origin); + { + char tmp[1 + BDEVNAME_SIZE + 10 + 12 + 1]; + + snprintf(tmp, sizeof(tmp), " %s%d: <unixware:", state->name, origin); + strlcat(state->pp_buf, tmp, PAGE_SIZE); + } p = &l->vtoc.v_slice[1]; /* I omit the 0th slice as it is the same as whole disk. */ while (p - &l->vtoc.v_slice[0] < UNIXWARE_NUMSLICE) { @@ -347,7 +368,7 @@ static void parse_unixware(struct parsed_partitions *state, p++; } put_dev_sector(sect); - printk(" >\n"); + strlcat(state->pp_buf, " >\n", PAGE_SIZE); #endif } @@ -376,8 +397,10 @@ static void parse_minix(struct parsed_partitions *state, * the normal boot sector. */ if (msdos_magic_present (data + 510) && SYS_IND(p) == MINIX_PARTITION) { /* subpartition table present */ + char tmp[1 + BDEVNAME_SIZE + 10 + 9 + 1]; - printk(" %s%d: <minix:", state->name, origin); + snprintf(tmp, sizeof(tmp), " %s%d: <minix:", state->name, origin); + strlcat(state->pp_buf, tmp, PAGE_SIZE); for (i = 0; i < MINIX_NR_SUBPARTITIONS; i++, p++) { if (state->next == state->limit) break; @@ -386,7 +409,7 @@ static void parse_minix(struct parsed_partitions *state, put_partition(state, state->next++, start_sect(p), nr_sects(p)); } - printk(" >\n"); + strlcat(state->pp_buf, " >\n", PAGE_SIZE); } put_dev_sector(sect); #endif /* CONFIG_MINIX_SUBPARTITION */ @@ -425,7 +448,7 @@ int msdos_partition(struct parsed_partitions *state) if (aix_magic_present(state, data)) { put_dev_sector(sect); - printk( " [AIX]"); + strlcat(state->pp_buf, " [AIX]", PAGE_SIZE); return 0; } @@ -446,7 +469,7 @@ int msdos_partition(struct parsed_partitions *state) fb = (struct fat_boot_sector *) data; if (slot == 1 && fb->reserved && fb->fats && fat_valid_media(fb->media)) { - printk("\n"); + strlcat(state->pp_buf, "\n", PAGE_SIZE); put_dev_sector(sect); return 1; } else { @@ -491,21 +514,21 @@ int msdos_partition(struct parsed_partitions *state) n = min(size, max(sector_size, n)); put_partition(state, slot, start, n); - printk(" <"); + strlcat(state->pp_buf, " <", PAGE_SIZE); parse_extended(state, start, size); - printk(" >"); + strlcat(state->pp_buf, " >", PAGE_SIZE); continue; } put_partition(state, slot, start, size); if (SYS_IND(p) == LINUX_RAID_PARTITION) state->parts[slot].flags = ADDPART_FLAG_RAID; if (SYS_IND(p) == DM6_PARTITION) - printk("[DM]"); + strlcat(state->pp_buf, "[DM]", PAGE_SIZE); if (SYS_IND(p) == EZD_PARTITION) - printk("[EZD]"); + strlcat(state->pp_buf, "[EZD]", PAGE_SIZE); } - printk("\n"); + strlcat(state->pp_buf, "\n", PAGE_SIZE); /* second pass - output for each on a separate line */ p = (struct partition *) (0x1be + data); |