From c5c8150db84680165f5e791d0a3732c1919ef2f2 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Mon, 1 Sep 2008 08:55:10 +0200 Subject: [PATCH] --- yaml --- r: 109359 b: refs/heads/master c: ddef43a843f620c6742a06633739887a901ec06b h: refs/heads/master i: 109357: e9a74f9f478ca99096a72dd647b9cf15c6a2ca5d 109355: a35c2889d9fc12c70dbc61e7737d2a098cc92061 109351: 96cf96946ab10835061ef2de82343052c340b9c8 109343: 89aaabd1f6c211ea4b44319306421ce06b27b948 v: v3 --- [refs] | 2 +- trunk/block/genhd.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 285d0b10c8ad..b676b634c613 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: bb23b431db7405f6d79f989ad0236bf6428ba1cb +refs/heads/master: ddef43a843f620c6742a06633739887a901ec06b diff --git a/trunk/block/genhd.c b/trunk/block/genhd.c index d9743ff67898..e0ce23ac2ece 100644 --- a/trunk/block/genhd.c +++ b/trunk/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)))