linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Abd-Alrhman Masalkhi <abd.masalkhi@gmail.com>,
	linux-block@vger.kernel.org
Subject: [PATCH 3/6] block: use the %pg format specifier in show_partition
Date: Tue, 27 Jul 2021 08:25:15 +0200	[thread overview]
Message-ID: <20210727062518.122108-4-hch@lst.de> (raw)
In-Reply-To: <20210727062518.122108-1-hch@lst.de>

Simplify printing the partition name by using the %pg format specifier
that is equivalent to a bdevname call.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/genhd.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index e07b1b028875..ffdbdefdea7b 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -783,7 +783,6 @@ static int show_partition(struct seq_file *seqf, void *v)
 	struct gendisk *sgp = v;
 	struct block_device *part;
 	unsigned long idx;
-	char buf[BDEVNAME_SIZE];
 
 	/* Don't show non-partitionable removeable devices or empty devices */
 	if (!get_capacity(sgp) || (!disk_max_parts(sgp) &&
@@ -796,10 +795,9 @@ static int show_partition(struct seq_file *seqf, void *v)
 	xa_for_each(&sgp->part_tbl, idx, part) {
 		if (!bdev_nr_sectors(part))
 			continue;
-		seq_printf(seqf, "%4d  %7d %10llu %s\n",
+		seq_printf(seqf, "%4d  %7d %10llu %pg\n",
 			   MAJOR(part->bd_dev), MINOR(part->bd_dev),
-			   bdev_nr_sectors(part) >> 1,
-			   disk_name(sgp, part->bd_partno, buf));
+			   bdev_nr_sectors(part) >> 1, part);
 	}
 	rcu_read_unlock();
 	return 0;
-- 
2.30.2


  parent reply	other threads:[~2021-07-27  6:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27  6:25 remove disk_name() Christoph Hellwig
2021-07-27  6:25 ` [PATCH 1/6] block: reduce stack usage in diskstats_show Christoph Hellwig
2021-07-27  8:32   ` Hannes Reinecke
2021-07-27  6:25 ` [PATCH 2/6] block: use the %pg format specifier in printk_all_partitions Christoph Hellwig
2021-07-27  6:25 ` Christoph Hellwig [this message]
2021-07-27  6:25 ` [PATCH 4/6] block: simplify printing the device names disk_stack_limits Christoph Hellwig
2021-07-27  6:25 ` [PATCH 5/6] block: simplify disk name formatting in check_partition Christoph Hellwig
2021-07-27  6:25 ` [PATCH 6/6] block: remove disk_name() Christoph Hellwig
2021-07-27 17:36 ` Martin K. Petersen
2021-07-28  1:41 ` 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=20210727062518.122108-4-hch@lst.de \
    --to=hch@lst.de \
    --cc=abd.masalkhi@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@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;
as well as URLs for NNTP newsgroup(s).