zonectl: display conventional zones better during RZ

zonectl's Report Zones subcommand displays a tabular list of zones.  A
conventional zone's WP column is displayed as 0xffffffffffffffff , the
literal value that the HDD reports.  But that's too wide for the column,
causing the text to be misaligned.  It's also not really meaningful,
because the Write Pointer isn't really defined for a Conventional zone.
Change it to "-1" to fix the text misalignment.

MFC after:	2 weeks
Sponsored by:	ConnectWise
Reviewed by:	fuz
Differential Revision: https://reviews.freebsd.org/D57512
This commit is contained in:
Alan Somers committed 2026-07-11 14:31:51 -06:00
1 parent 541e6e2d51
commit 4735ef6196
1 file changed
+14 -3
+14 -3
View File
@@ -288,11 +288,22 @@ zonectl_print_rz(struct disk_zone_report *report, zone_output_flags out_flags,
for (i = 0; i < report->entries_filled; i++) {
entry = &report->entries[i];
printf("%#*jx, %*ju, %#*jx, ", field_widths[ZONE_FW_START],
printf("%#*jx, %*ju, ", field_widths[ZONE_FW_START],
(uintmax_t)entry->zone_start_lba,
field_widths[ZONE_FW_LEN],
(uintmax_t)entry->zone_length, field_widths[ZONE_FW_WP],
(uintmax_t)entry->write_pointer_lba);
(uintmax_t)entry->zone_length);
if (entry->write_pointer_lba == 0xffffffffffffffff) {
/*
* This value is reported by HDDs for conventional
* zones. It really means "N/A". Reported it as -1,
* even though it's technically unsigned, to save
* space.
*/
printf("%*d, ", field_widths[ZONE_FW_WP], -1);
} else {
printf("%#*jx, ", field_widths[ZONE_FW_WP],
(uintmax_t)entry->write_pointer_lba);
}
switch (entry->zone_type) {
case DISK_ZONE_TYPE_CONVENTIONAL: