aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/genhd.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/block/genhd.c b/block/genhd.c
index d9743ff67898..e0ce23ac2ece 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -307,7 +307,7 @@ static void *part_start(struct seq_file *part, loff_t *pos)
307 loff_t k = *pos; 307 loff_t k = *pos;
308 308
309 if (!k) 309 if (!k)
310 seq_puts(part, "major minor #blocks name\n\n"); 310 part->private = (void *)1LU; /* tell show to print header */
311 311
312 mutex_lock(&block_class_lock); 312 mutex_lock(&block_class_lock);
313 dev = class_find_device(&block_class, NULL, &k, find_start); 313 dev = class_find_device(&block_class, NULL, &k, find_start);
@@ -349,6 +349,17 @@ static int show_partition(struct seq_file *part, void *v)
349 int n; 349 int n;
350 char buf[BDEVNAME_SIZE]; 350 char buf[BDEVNAME_SIZE];
351 351
352 /*
353 * Print header if start told us to do. This is to preserve
354 * the original behavior of not printing header if no
355 * partition exists. This hackery will be removed later with
356 * class iteration clean up.
357 */
358 if (part->private) {
359 seq_puts(part, "major minor #blocks name\n\n");
360 part->private = NULL;
361 }
362
352 /* Don't show non-partitionable removeable devices or empty devices */ 363 /* Don't show non-partitionable removeable devices or empty devices */
353 if (!get_capacity(sgp) || 364 if (!get_capacity(sgp) ||
354 (sgp->minors == 1 && (sgp->flags & GENHD_FL_REMOVABLE))) 365 (sgp->minors == 1 && (sgp->flags & GENHD_FL_REMOVABLE)))