]> www.infradead.org Git - users/hch/block.git/commitdiff
block: use the %pg format specifier in show_partition
authorChristoph Hellwig <hch@lst.de>
Fri, 23 Jul 2021 06:18:20 +0000 (08:18 +0200)
committerChristoph Hellwig <hch@lst.de>
Sun, 25 Jul 2021 05:36:54 +0000 (07:36 +0200)
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

index e07b1b028875bcf44a1c0cacc6ee37182c28749e..ffdbdefdea7b73963367a46095b62a034c3e845d 100644 (file)
@@ -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;