* [PATCH -next] block/genhd: align title and output
@ 2020-04-26 12:22 Bo YU
2020-04-30 1:23 ` Bo YU
0 siblings, 1 reply; 2+ messages in thread
From: Bo YU @ 2020-04-26 12:22 UTC (permalink / raw)
To: axboe; +Cc: linux-block, linux-kernel
Before the patch:
major minor #blocks name
254 0 57671680 vda
254 1 57670656 vda1
After the patch:
major minor #blocks name
254 0 57671680 vda
254 1 57670656 vda1
According to LDD3,major device maximun number is 12 bit,as it has 4 char
placeholders.minor device maximum number is 20 bit(7 char palceholders)
and keeping 10 char palceholders for blocks tag.If want to keep
palceholder's numbers dynamiclly, There is more tricks to do that. So i
keep it simple.
Signed-off-by: Bo YU <tsu.yubo@gmail.com>
---
block/genhd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/genhd.c b/block/genhd.c
index 06b642b23a07..63a483cf76b9 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1151,7 +1151,7 @@ static void *show_partition_start(struct seq_file *seqf, loff_t *pos)
p = disk_seqf_start(seqf, pos);
if (!IS_ERR_OR_NULL(p) && !*pos)
- seq_puts(seqf, "major minor #blocks name\n\n");
+ seq_puts(seqf, "major minor #blocks name\n\n");
return p;
}
@@ -1172,7 +1172,7 @@ static int show_partition(struct seq_file *seqf, void *v)
/* show the full disk and all non-0 size partitions of it */
disk_part_iter_init(&piter, sgp, DISK_PITER_INCL_PART0);
while ((part = disk_part_iter_next(&piter)))
- seq_printf(seqf, "%4d %7d %10llu %s\n",
+ seq_printf(seqf, "%-4d %-7d %-10llu %s\n",
MAJOR(part_devt(part)), MINOR(part_devt(part)),
(unsigned long long)part_nr_sects_read(part) >> 1,
disk_name(sgp, part->partno, buf));
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] block/genhd: align title and output
2020-04-26 12:22 [PATCH -next] block/genhd: align title and output Bo YU
@ 2020-04-30 1:23 ` Bo YU
0 siblings, 0 replies; 2+ messages in thread
From: Bo YU @ 2020-04-30 1:23 UTC (permalink / raw)
To: axboe; +Cc: linux-block, open list
On Sun, Apr 26, 2020 at 8:22 PM Bo YU <tsu.yubo@gmail.com> wrote:
>
> Before the patch:
>
> major minor #blocks name
>
> 254 0 57671680 vda
> 254 1 57670656 vda1
>
> After the patch:
>
> major minor #blocks name
>
> 254 0 57671680 vda
> 254 1 57670656 vda1
>
> According to LDD3,major device maximun number is 12 bit,as it has 4 char
> placeholders.minor device maximum number is 20 bit(7 char palceholders)
> and keeping 10 char palceholders for blocks tag.If want to keep
> palceholder's numbers dynamiclly, There is more tricks to do that. So i
> keep it simple.
>
> Signed-off-by: Bo YU <tsu.yubo@gmail.com>
> ---
> block/genhd.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/block/genhd.c b/block/genhd.c
> index 06b642b23a07..63a483cf76b9 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -1151,7 +1151,7 @@ static void *show_partition_start(struct seq_file *seqf, loff_t *pos)
>
> p = disk_seqf_start(seqf, pos);
> if (!IS_ERR_OR_NULL(p) && !*pos)
> - seq_puts(seqf, "major minor #blocks name\n\n");
> + seq_puts(seqf, "major minor #blocks name\n\n");
> return p;
> }
>
> @@ -1172,7 +1172,7 @@ static int show_partition(struct seq_file *seqf, void *v)
> /* show the full disk and all non-0 size partitions of it */
> disk_part_iter_init(&piter, sgp, DISK_PITER_INCL_PART0);
> while ((part = disk_part_iter_next(&piter)))
> - seq_printf(seqf, "%4d %7d %10llu %s\n",
> + seq_printf(seqf, "%-4d %-7d %-10llu %s\n",
> MAJOR(part_devt(part)), MINOR(part_devt(part)),
> (unsigned long long)part_nr_sects_read(part) >> 1,
> disk_name(sgp, part->partno, buf));
> --
> 2.11.0
>
Sorry, Ping again
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-30 1:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-26 12:22 [PATCH -next] block/genhd: align title and output Bo YU
2020-04-30 1:23 ` Bo YU
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).