* [PATCH] block: restore original behavior of /proc/partition when there's no partition
@ 2008-08-30 14:02 Tejun Heo
2008-09-01 6:53 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Tejun Heo @ 2008-08-30 14:02 UTC (permalink / raw)
To: Greg KH, Jens Axboe, Linux Kernel Mailing List; +Cc: Kay Sievers
/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>
---
block/genhd.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/block/genhd.c b/block/genhd.c
index 656c2c7..e86b312 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -309,7 +309,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);
@@ -351,6 +351,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)))
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] block: restore original behavior of /proc/partition when there's no partition
2008-08-30 14:02 [PATCH] block: restore original behavior of /proc/partition when there's no partition Tejun Heo
@ 2008-09-01 6:53 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2008-09-01 6:53 UTC (permalink / raw)
To: Tejun Heo; +Cc: Greg KH, Linux Kernel Mailing List, Kay Sievers
On Sat, Aug 30 2008, Tejun Heo wrote:
> /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>
I agree, queued up.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-09-01 6:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-30 14:02 [PATCH] block: restore original behavior of /proc/partition when there's no partition Tejun Heo
2008-09-01 6:53 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox