From: Tejun Heo <tj@kernel.org>
To: Greg KH <greg@kroah.com>, Jens Axboe <jens.axboe@oracle.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Subject: [PATCH] block: restore original behavior of /proc/partition when there's no partition
Date: Sat, 30 Aug 2008 16:02:47 +0200 [thread overview]
Message-ID: <48B95307.8040902@kernel.org> (raw)
/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)))
next reply other threads:[~2008-08-30 14:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-30 14:02 Tejun Heo [this message]
2008-09-01 6:53 ` [PATCH] block: restore original behavior of /proc/partition when there's no partition Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48B95307.8040902@kernel.org \
--to=tj@kernel.org \
--cc=greg@kroah.com \
--cc=jens.axboe@oracle.com \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox