aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2026-06-09 18:06:13 +0000
committerAlan Somers <asomers@FreeBSD.org>2026-07-11 20:31:51 +0000
commit4735ef6196bcb2802ad7fc7d1b8054a4756d786b (patch)
tree4fc64e37933596d88f4af498c7027ee9dbb65b6b
parent541e6e2d516b6c9d3681b24464e9ef53c1f2579a (diff)
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
-rw-r--r--usr.sbin/zonectl/zonectl.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/usr.sbin/zonectl/zonectl.c b/usr.sbin/zonectl/zonectl.c
index 53e5e6599597..9dc6ddfd1aae 100644
--- a/usr.sbin/zonectl/zonectl.c
+++ b/usr.sbin/zonectl/zonectl.c
@@ -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: