aboutsummaryrefslogtreecommitdiffstats
path: root/fs/partitions/msdos.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/partitions/msdos.c')
-rw-r--r--fs/partitions/msdos.c67
1 files changed, 45 insertions, 22 deletions
diff --git a/fs/partitions/msdos.c b/fs/partitions/msdos.c
index 15bfb7b1e044..5f79a6677c69 100644
--- a/fs/partitions/msdos.c
+++ b/fs/partitions/msdos.c
@@ -213,10 +213,18 @@ static void parse_solaris_x86(struct parsed_partitions *state,
213 put_dev_sector(sect); 213 put_dev_sector(sect);
214 return; 214 return;
215 } 215 }
216 printk(" %s%d: <solaris:", state->name, origin); 216 {
217 char tmp[1 + BDEVNAME_SIZE + 10 + 11 + 1];
218
219 snprintf(tmp, sizeof(tmp), " %s%d: <solaris:", state->name, origin);
220 strlcat(state->pp_buf, tmp, PAGE_SIZE);
221 }
217 if (le32_to_cpu(v->v_version) != 1) { 222 if (le32_to_cpu(v->v_version) != 1) {
218 printk(" cannot handle version %d vtoc>\n", 223 char tmp[64];
219 le32_to_cpu(v->v_version)); 224
225 snprintf(tmp, sizeof(tmp), " cannot handle version %d vtoc>\n",
226 le32_to_cpu(v->v_version));
227 strlcat(state->pp_buf, tmp, PAGE_SIZE);
220 put_dev_sector(sect); 228 put_dev_sector(sect);
221 return; 229 return;
222 } 230 }
@@ -224,9 +232,12 @@ static void parse_solaris_x86(struct parsed_partitions *state,
224 max_nparts = le16_to_cpu (v->v_nparts) > 8 ? SOLARIS_X86_NUMSLICE : 8; 232 max_nparts = le16_to_cpu (v->v_nparts) > 8 ? SOLARIS_X86_NUMSLICE : 8;
225 for (i=0; i<max_nparts && state->next<state->limit; i++) { 233 for (i=0; i<max_nparts && state->next<state->limit; i++) {
226 struct solaris_x86_slice *s = &v->v_slice[i]; 234 struct solaris_x86_slice *s = &v->v_slice[i];
235 char tmp[3 + 10 + 1 + 1];
236
227 if (s->s_size == 0) 237 if (s->s_size == 0)
228 continue; 238 continue;
229 printk(" [s%d]", i); 239 snprintf(tmp, sizeof(tmp), " [s%d]", i);
240 strlcat(state->pp_buf, tmp, PAGE_SIZE);
230 /* solaris partitions are relative to current MS-DOS 241 /* solaris partitions are relative to current MS-DOS
231 * one; must add the offset of the current partition */ 242 * one; must add the offset of the current partition */
232 put_partition(state, state->next++, 243 put_partition(state, state->next++,
@@ -234,7 +245,7 @@ static void parse_solaris_x86(struct parsed_partitions *state,
234 le32_to_cpu(s->s_size)); 245 le32_to_cpu(s->s_size));
235 } 246 }
236 put_dev_sector(sect); 247 put_dev_sector(sect);
237 printk(" >\n"); 248 strlcat(state->pp_buf, " >\n", PAGE_SIZE);
238#endif 249#endif
239} 250}
240 251
@@ -250,6 +261,7 @@ static void parse_bsd(struct parsed_partitions *state,
250 Sector sect; 261 Sector sect;
251 struct bsd_disklabel *l; 262 struct bsd_disklabel *l;
252 struct bsd_partition *p; 263 struct bsd_partition *p;
264 char tmp[64];
253 265
254 l = read_part_sector(state, offset + 1, &sect); 266 l = read_part_sector(state, offset + 1, &sect);
255 if (!l) 267 if (!l)
@@ -258,7 +270,9 @@ static void parse_bsd(struct parsed_partitions *state,
258 put_dev_sector(sect); 270 put_dev_sector(sect);
259 return; 271 return;
260 } 272 }
261 printk(" %s%d: <%s:", state->name, origin, flavour); 273
274 snprintf(tmp, sizeof(tmp), " %s%d: <%s:", state->name, origin, flavour);
275 strlcat(state->pp_buf, tmp, PAGE_SIZE);
262 276
263 if (le16_to_cpu(l->d_npartitions) < max_partitions) 277 if (le16_to_cpu(l->d_npartitions) < max_partitions)
264 max_partitions = le16_to_cpu(l->d_npartitions); 278 max_partitions = le16_to_cpu(l->d_npartitions);
@@ -275,16 +289,18 @@ static void parse_bsd(struct parsed_partitions *state,
275 /* full parent partition, we have it already */ 289 /* full parent partition, we have it already */
276 continue; 290 continue;
277 if (offset > bsd_start || offset+size < bsd_start+bsd_size) { 291 if (offset > bsd_start || offset+size < bsd_start+bsd_size) {
278 printk("bad subpartition - ignored\n"); 292 strlcat(state->pp_buf, "bad subpartition - ignored\n", PAGE_SIZE);
279 continue; 293 continue;
280 } 294 }
281 put_partition(state, state->next++, bsd_start, bsd_size); 295 put_partition(state, state->next++, bsd_start, bsd_size);
282 } 296 }
283 put_dev_sector(sect); 297 put_dev_sector(sect);
284 if (le16_to_cpu(l->d_npartitions) > max_partitions) 298 if (le16_to_cpu(l->d_npartitions) > max_partitions) {
285 printk(" (ignored %d more)", 299 snprintf(tmp, sizeof(tmp), " (ignored %d more)",
286 le16_to_cpu(l->d_npartitions) - max_partitions); 300 le16_to_cpu(l->d_npartitions) - max_partitions);
287 printk(" >\n"); 301 strlcat(state->pp_buf, tmp, PAGE_SIZE);
302 }
303 strlcat(state->pp_buf, " >\n", PAGE_SIZE);
288} 304}
289#endif 305#endif
290 306
@@ -333,7 +349,12 @@ static void parse_unixware(struct parsed_partitions *state,
333 put_dev_sector(sect); 349 put_dev_sector(sect);
334 return; 350 return;
335 } 351 }
336 printk(" %s%d: <unixware:", state->name, origin); 352 {
353 char tmp[1 + BDEVNAME_SIZE + 10 + 12 + 1];
354
355 snprintf(tmp, sizeof(tmp), " %s%d: <unixware:", state->name, origin);
356 strlcat(state->pp_buf, tmp, PAGE_SIZE);
357 }
337 p = &l->vtoc.v_slice[1]; 358 p = &l->vtoc.v_slice[1];
338 /* I omit the 0th slice as it is the same as whole disk. */ 359 /* I omit the 0th slice as it is the same as whole disk. */
339 while (p - &l->vtoc.v_slice[0] < UNIXWARE_NUMSLICE) { 360 while (p - &l->vtoc.v_slice[0] < UNIXWARE_NUMSLICE) {
@@ -347,7 +368,7 @@ static void parse_unixware(struct parsed_partitions *state,
347 p++; 368 p++;
348 } 369 }
349 put_dev_sector(sect); 370 put_dev_sector(sect);
350 printk(" >\n"); 371 strlcat(state->pp_buf, " >\n", PAGE_SIZE);
351#endif 372#endif
352} 373}
353 374
@@ -376,8 +397,10 @@ static void parse_minix(struct parsed_partitions *state,
376 * the normal boot sector. */ 397 * the normal boot sector. */
377 if (msdos_magic_present (data + 510) && 398 if (msdos_magic_present (data + 510) &&
378 SYS_IND(p) == MINIX_PARTITION) { /* subpartition table present */ 399 SYS_IND(p) == MINIX_PARTITION) { /* subpartition table present */
400 char tmp[1 + BDEVNAME_SIZE + 10 + 9 + 1];
379 401
380 printk(" %s%d: <minix:", state->name, origin); 402 snprintf(tmp, sizeof(tmp), " %s%d: <minix:", state->name, origin);
403 strlcat(state->pp_buf, tmp, PAGE_SIZE);
381 for (i = 0; i < MINIX_NR_SUBPARTITIONS; i++, p++) { 404 for (i = 0; i < MINIX_NR_SUBPARTITIONS; i++, p++) {
382 if (state->next == state->limit) 405 if (state->next == state->limit)
383 break; 406 break;
@@ -386,7 +409,7 @@ static void parse_minix(struct parsed_partitions *state,
386 put_partition(state, state->next++, 409 put_partition(state, state->next++,
387 start_sect(p), nr_sects(p)); 410 start_sect(p), nr_sects(p));
388 } 411 }
389 printk(" >\n"); 412 strlcat(state->pp_buf, " >\n", PAGE_SIZE);
390 } 413 }
391 put_dev_sector(sect); 414 put_dev_sector(sect);
392#endif /* CONFIG_MINIX_SUBPARTITION */ 415#endif /* CONFIG_MINIX_SUBPARTITION */
@@ -425,7 +448,7 @@ int msdos_partition(struct parsed_partitions *state)
425 448
426 if (aix_magic_present(state, data)) { 449 if (aix_magic_present(state, data)) {
427 put_dev_sector(sect); 450 put_dev_sector(sect);
428 printk( " [AIX]"); 451 strlcat(state->pp_buf, " [AIX]", PAGE_SIZE);
429 return 0; 452 return 0;
430 } 453 }
431 454
@@ -446,7 +469,7 @@ int msdos_partition(struct parsed_partitions *state)
446 fb = (struct fat_boot_sector *) data; 469 fb = (struct fat_boot_sector *) data;
447 if (slot == 1 && fb->reserved && fb->fats 470 if (slot == 1 && fb->reserved && fb->fats
448 && fat_valid_media(fb->media)) { 471 && fat_valid_media(fb->media)) {
449 printk("\n"); 472 strlcat(state->pp_buf, "\n", PAGE_SIZE);
450 put_dev_sector(sect); 473 put_dev_sector(sect);
451 return 1; 474 return 1;
452 } else { 475 } else {
@@ -491,21 +514,21 @@ int msdos_partition(struct parsed_partitions *state)
491 n = min(size, max(sector_size, n)); 514 n = min(size, max(sector_size, n));
492 put_partition(state, slot, start, n); 515 put_partition(state, slot, start, n);
493 516
494 printk(" <"); 517 strlcat(state->pp_buf, " <", PAGE_SIZE);
495 parse_extended(state, start, size); 518 parse_extended(state, start, size);
496 printk(" >"); 519 strlcat(state->pp_buf, " >", PAGE_SIZE);
497 continue; 520 continue;
498 } 521 }
499 put_partition(state, slot, start, size); 522 put_partition(state, slot, start, size);
500 if (SYS_IND(p) == LINUX_RAID_PARTITION) 523 if (SYS_IND(p) == LINUX_RAID_PARTITION)
501 state->parts[slot].flags = ADDPART_FLAG_RAID; 524 state->parts[slot].flags = ADDPART_FLAG_RAID;
502 if (SYS_IND(p) == DM6_PARTITION) 525 if (SYS_IND(p) == DM6_PARTITION)
503 printk("[DM]"); 526 strlcat(state->pp_buf, "[DM]", PAGE_SIZE);
504 if (SYS_IND(p) == EZD_PARTITION) 527 if (SYS_IND(p) == EZD_PARTITION)
505 printk("[EZD]"); 528 strlcat(state->pp_buf, "[EZD]", PAGE_SIZE);
506 } 529 }
507 530
508 printk("\n"); 531 strlcat(state->pp_buf, "\n", PAGE_SIZE);
509 532
510 /* second pass - output for each on a separate line */ 533 /* second pass - output for each on a separate line */
511 p = (struct partition *) (0x1be + data); 534 p = (struct partition *) (0x1be + data);