X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=block%2Fgenhd.c;h=e0ce23ac2ece84b24a283f9ae9203ec3291f2f78;hb=bcbc713470283bc82d043fd23b02e41a9eb8dee5;hp=d9743ff67898d7040ccabfd4c3b7790577764d99;hpb=bb23b431db7405f6d79f989ad0236bf6428ba1cb;p=linux-2.6 diff --git a/block/genhd.c b/block/genhd.c index d9743ff678..e0ce23ac2e 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -307,7 +307,7 @@ static void *part_start(struct seq_file *part, loff_t *pos) loff_t k = *pos; if (!k) - seq_puts(part, "major minor #blocks name\n\n"); + part->private = (void *)1LU; /* tell show to print header */ mutex_lock(&block_class_lock); dev = class_find_device(&block_class, NULL, &k, find_start); @@ -349,6 +349,17 @@ static int show_partition(struct seq_file *part, void *v) int n; char buf[BDEVNAME_SIZE]; + /* + * Print header if start told us to do. This is to preserve + * the original behavior of not printing header if no + * partition exists. This hackery will be removed later with + * class iteration clean up. + */ + if (part->private) { + seq_puts(part, "major minor #blocks name\n\n"); + part->private = NULL; + } + /* Don't show non-partitionable removeable devices or empty devices */ if (!get_capacity(sgp) || (sgp->minors == 1 && (sgp->flags & GENHD_FL_REMOVABLE)))