]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
blkzone: Improve zone information print
authorDamien Le Moal <damien.lemoal@wdc.com>
Fri, 24 Feb 2017 03:47:29 +0000 (12:47 +0900)
committerKarel Zak <kzak@redhat.com>
Fri, 24 Feb 2017 10:53:45 +0000 (11:53 +0100)
Add "0x" to the zone start, length and write pointer print
to make it always clear that the values are Hexadecimal.

Also update the zone condition string and associated comments
to match more closely the wording in the standard document.
The man page is also updated to match the new wording.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
sys-utils/blkzone.8
sys-utils/blkzone.c

index 6394ed274314c545955da7507fe38dd2615bc0fc..24b0cc7bdbd27a3227fbebb028861d2ee67e6706 100644 (file)
@@ -9,8 +9,8 @@ blkzone \- run zone command on a device
 .SH DESCRIPTION
 .B blkzone
 is used to run zone command on device that support the Zoned Block Commands
-(ZBC) or Zoned-device ATA Commands (ZAC). The zones are addresses by the offset
-and length options.
+(ZBC) or Zoned-device ATA Commands (ZAC). The zones to operate on can be
+specified using the offset and length options.
 .PP
 The
 .I device
@@ -40,15 +40,15 @@ type:Zone type
 .TS
 tab(:);
 left l l.
-Cl:closed
-cv:conventional zone
-e0:empty
-fu:full
-Oe:open explicit
-Oi:open implicit
-OL:offline
-ro:read only
-x?:reserved conditions (should not be reported)
+cl:Closed
+nw:Not write pointer
+em:Empty
+fu:Full
+oe:Explicitly opened
+oi:Implicitly opened
+ol:Offline
+ro:Read only
+x?:Reserved conditions (should not be reported)
 .TE
 
 .SS reset
@@ -56,23 +56,20 @@ The command \fBblkzone reset\fP is used to reset one or more zones.  Unlike
 .BR sg_reset_wp (8) ,
 this command operates from the block layer and can reset a range of zones.
 .PP
-By default, the command will operate on the zone at device logical
-sector 0.  Options may be used to modify this behavior as well as specify the
-operation to be performed on the zone, as explained below.
+By default, the command will operate from the zone at device logical
+sector 0 and reset all zones. Options may be used to modify this behavior
+as well as specify the operation to be performed on the zone, as explained below.
 .PP
-The default number of zones (options \fB\-\-length\fP) is 4096, the maximum 65536.
+The default number of zones (option \fB\-\-length\fP) is all zones.
 
 .SH OPTIONS
 The
-.I sector
-and
-.I count
-option arguments may be followed by the multiplicative suffixes KiB (=1024),
+.I offset
+option argument may be followed by the multiplicative suffixes KiB (=1024),
 MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is
 optional, e.g., "K" has the same meaning as "KiB") or the suffixes
 KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB.
-Additionally, the 0x prefix can be used to specify \fIsector\fR and
-\fIcount\fR in hex.
+Additionally, the 0x prefix can be used to specify \fIoffset\fR in hex.
 .TP
 .BR \-o , " \-\-offset "\fIsector\fP
 The starting zone specified as a sector offset.  The provided offset in sector
index c9d65dc236975043f326492c2937c24887107aea..2d6a760154c57f924313302ff39aa35ac6c74a4d 100644 (file)
@@ -147,15 +147,15 @@ static const char *type_text[] = {
 };
 
 static const char *condition_str[] = {
-       "cv", /* conventional zone */
-       "e0", /* empty */
-       "Oi", /* open implicit */
-       "Oe", /* open explicit */
-       "Cl", /* closed */
+       "nw", /* Not write pointer */
+       "em", /* Empty */
+       "io", /* Implicitly opened */
+       "eo", /* Explicitly opened */
+       "cl", /* Closed */
        "x5", "x6", "x7", "x8", "x9", "xA", "xB", /* xN: reserved */
-       "ro", /* read only */
-       "fu", /* full */
-       "OL"  /* offline */
+       "ro", /* Read only */
+       "fu", /* Full */
+       "of"  /* Offline */
 };
 
 static int blkzone_report(struct blkzone_control *ctl)
@@ -188,7 +188,7 @@ static int blkzone_report(struct blkzone_control *ctl)
                        err(EXIT_FAILURE, _("%s: BLKREPORTZONE ioctl failed"), ctl->devname);
 
                if (ctl->verbose)
-                       printf(_("Found %d zones from %lx\n"),
+                       printf(_("Found %d zones from 0x%lx\n"),
                                zi->nr_zones, ctl->offset);
 
                if (!zi->nr_zones) {
@@ -209,9 +209,9 @@ static int blkzone_report(struct blkzone_control *ctl)
                                break;
                        }
 
-                       printf(_("  start: %9lx, len %6lx, wptr %6lx"
+                       printf(_("  start: 0x%09lx, len 0x%06lx, wptr 0x%06lx"
                                " reset:%u non-seq:%u, zcond:%2u(%s) [type: %u(%s)]\n"),
-                               start, len, wp - start,
+                               start, len, (type == 0x1) ? 0 : wp - start,
                                entry->reset, entry->non_seq,
                                cond, condition_str[cond & ARRAY_SIZE(condition_str)],
                                type, type_text[type]);