NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/59956: gpt(8): show human-readable units



I guess the ':' in my commit message (which was really planned
to be after the PR number, not before) caused CVS to not send
this commit message to gnats - so I will do it.

From:    "Robert Elz" <kre%netbsd.org@localhost>
Reply-To: source-changes-d%NetBSD.org@localhost
Date:    Mon, 9 Feb 2026 17:21:28 +0000
To:      source-changes%NetBSD.org@localhost
Subject: CVS commit: src/sbin/gpt

Module Name:	src
Committed By:	kre
Date:		Mon Feb  9 17:21:28 UTC 2026

Modified Files:
	src/sbin/gpt: gpt.8 show.c

Log Message:
PR: bin/59956 Add human friendly output (and more) to gpt show

Many improvements to the output generated by "gpt show", essentially
all conditioned by new options.

Two that aren't are a fix to alignment of "gpt show -a" for the lines
of data about the partition which follow the line giving the start
block number, size, and partition type.  Now the following lines are
correctly aligned, always - this change affects only the number of
spaces before the data.

And second, in that data, the "Size:" line now always shows the size
of the partition in bytes - that was always what was shown in the tools
build (where humanize_number is not available) but is now also shown
(in parentheses in this case) after the human form output in non-tools
builds (the size, in sectors, in the size column is not altered)

Much more is available with new options.   First is an option (-p) available
in all 3 output forms (which all existed previously), which generates
precisely defined parsable output, which, once this percolates into all
releases, will be allow gpt(8) to be used as a backend tool to manipulate
the gpt tables in for any front end tool anyone wants to create.

When that is not used, new options -A -H and -h can condition the size/start
fields of the default "gpt show" output, and add some additional information
to the "Size: " data line (not the size column) of "gpt show -a" output, the
"gpt show -[ib] N" output is not modified.

gpt show has also grown a -W width option (and when that is not used, a
- -w alternative for when no other value can be found) for setting the desired
output width (and a little data, generated with the new options above, can be
aligned to the right margin - to defeat that, -W1 works).

The manual page has been updated to document all of the above, the scaling 'K'
allowed for the -s sectorsize general option added in a previous commit,
and many wording, formatting, and random other changes have also been applied.

Most of the "gpt show" output changes should be considered as
exploratory, to see what works, and what people are happy with.
Feel free to test, and comment upon how it seems, or could be
improved.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sbin/gpt/gpt.8
cvs rdiff -u -r1.48 -r1.49 src/sbin/gpt/show.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index