summaryrefslogtreecommitdiffstats
path: root/block/genhd.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-09-01 08:55:10 +0200
committerJens Axboe <jens.axboe@oracle.com>2008-09-01 08:55:10 +0200
commitddef43a843f620c6742a06633739887a901ec06b (patch)
tree25eec6c04abf5c7ec3cb9aba2338d249844ffb61 /block/genhd.c
parentbb23b431db7405f6d79f989ad0236bf6428ba1cb (diff)
downloadlinux-ddef43a843f620c6742a06633739887a901ec06b.tar.bz2
block: restore original behavior of /proc/partition when there's no partition
/proc/partitions didn't use to write out the header if there was no partition. However, recent commit 66c64afe changed the behavior. This is nothing major but there's no reason to change user visible behavior without a good rationale. Restore the original behavior. Note that 2.6.28 has clean up changes scheduled which will replace this rather hacky implementation. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Greg KH <greg@kroah.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/genhd.c')
-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)
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)))