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/acorn.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'fs/partitions/acorn.c') diff --git a/fs/partitions/acorn.c b/fs/partitions/acorn.c index 6921e78..fbeb697 100644 --- a/fs/partitions/acorn.c +++ b/fs/partitions/acorn.c @@ -45,8 +45,11 @@ adfs_partition(struct parsed_partitions *state, char *name, char *data, nr_sects = (le32_to_cpu(dr->disc_size_high) << 23) | (le32_to_cpu(dr->disc_size) >> 9); - if (name) - printk(" [%s]", name); + if (name) { + strlcat(state->pp_buf, " [", PAGE_SIZE); + strlcat(state->pp_buf, name, PAGE_SIZE); + strlcat(state->pp_buf, "]", PAGE_SIZE); + } put_partition(state, slot, first_sector, nr_sects); return dr; } @@ -81,14 +84,14 @@ static int riscix_partition(struct parsed_partitions *state, if (!rr) return -1; - printk(" [RISCiX]"); + strlcat(state->pp_buf, " [RISCiX]", PAGE_SIZE); if (rr->magic == RISCIX_MAGIC) { unsigned long size = nr_sects > 2 ? 2 : nr_sects; int part; - printk(" <"); + strlcat(state->pp_buf, " <", PAGE_SIZE); put_partition(state, slot++, first_sect, size); for (part = 0; part < 8; part++) { @@ -97,11 +100,13 @@ static int riscix_partition(struct parsed_partitions *state, put_partition(state, slot++, le32_to_cpu(rr->part[part].start), le32_to_cpu(rr->part[part].length)); - printk("(%s)", rr->part[part].name); + strlcat(state->pp_buf, "(", PAGE_SIZE); + strlcat(state->pp_buf, rr->part[part].name, PAGE_SIZE); + strlcat(state->pp_buf, ")", PAGE_SIZE); } } - printk(" >\n"); + strlcat(state->pp_buf, " >\n", PAGE_SIZE); } else { put_partition(state, slot++, first_sect, nr_sects); } @@ -131,7 +136,7 @@ static int linux_partition(struct parsed_partitions *state, struct linux_part *linuxp; unsigned long size = nr_sects > 2 ? 2 : nr_sects; - printk(" [Linux]"); + strlcat(state->pp_buf, " [Linux]", PAGE_SIZE); put_partition(state, slot++, first_sect, size); @@ -139,7 +144,7 @@ static int linux_partition(struct parsed_partitions *state, if (!linuxp) return -1; - printk(" <"); + strlcat(state->pp_buf, " <", PAGE_SIZE); while (linuxp->magic == cpu_to_le32(LINUX_NATIVE_MAGIC) || linuxp->magic == cpu_to_le32(LINUX_SWAP_MAGIC)) { if (slot == state->limit) @@ -149,7 +154,7 @@ static int linux_partition(struct parsed_partitions *state, le32_to_cpu(linuxp->nr_sects)); linuxp ++; } - printk(" >"); + strlcat(state->pp_buf, " >", PAGE_SIZE); put_dev_sector(sect); return slot; @@ -294,7 +299,7 @@ int adfspart_check_ADFS(struct parsed_partitions *state) break; } } - printk("\n"); + strlcat(state->pp_buf, "\n", PAGE_SIZE); return 1; } #endif @@ -367,7 +372,7 @@ int adfspart_check_ICS(struct parsed_partitions *state) return 0; } - printk(" [ICS]"); + strlcat(state->pp_buf, " [ICS]", PAGE_SIZE); for (slot = 1, p = (const struct ics_part *)data; p->size; p++) { u32 start = le32_to_cpu(p->start); @@ -401,7 +406,7 @@ int adfspart_check_ICS(struct parsed_partitions *state) } put_dev_sector(sect); - printk("\n"); + strlcat(state->pp_buf, "\n", PAGE_SIZE); return 1; } #endif @@ -461,7 +466,7 @@ int adfspart_check_POWERTEC(struct parsed_partitions *state) return 0; } - printk(" [POWERTEC]"); + strlcat(state->pp_buf, " [POWERTEC]", PAGE_SIZE); for (i = 0, p = (const struct ptec_part *)data; i < 12; i++, p++) { u32 start = le32_to_cpu(p->start); @@ -472,7 +477,7 @@ int adfspart_check_POWERTEC(struct parsed_partitions *state) } put_dev_sector(sect); - printk("\n"); + strlcat(state->pp_buf, "\n", PAGE_SIZE); return 1; } #endif @@ -543,7 +548,7 @@ int adfspart_check_EESOX(struct parsed_partitions *state) size = get_capacity(state->bdev->bd_disk); put_partition(state, slot++, start, size - start); - printk("\n"); + strlcat(state->pp_buf, "\n", PAGE_SIZE); } return i ? 1 : 0; -- cgit v1.1