diff options
author | LOLi <[email protected]> | 2017-05-02 22:43:53 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-05-02 13:43:53 -0700 |
commit | e7fbeb606a18b9f04daadddc19b9c4f9a9b34841 (patch) | |
tree | 8b9e4a464343553bc5d8b01ca1dd25b917a73990 /lib/libzfs/libzfs_status.c | |
parent | 03b60eee78b0bf1125878dbad0fcffd717def61f (diff) |
Add zfs_nicebytes() to print human-readable sizes
* Add zfs_nicebytes() to print human-readable sizes
Some 'zfs', 'zpool' and 'zdb' output strings can be confusing to the
user when no units are specified. This add a new zfs_nicenum_format
"ZFS_NICENUM_BYTES" used to print bytes in their human-readable form.
Additionally, update some test cases to use machine-parsable 'zfs get'.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: loli10K <[email protected]>
Closes #2414
Closes #3185
Closes #3594
Closes #6032
Diffstat (limited to 'lib/libzfs/libzfs_status.c')
-rw-r--r-- | lib/libzfs/libzfs_status.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libzfs/libzfs_status.c b/lib/libzfs/libzfs_status.c index f69bd4544..d5470f412 100644 --- a/lib/libzfs/libzfs_status.c +++ b/lib/libzfs/libzfs_status.c @@ -412,13 +412,13 @@ dump_ddt_stat(const ddt_stat_t *dds, int h) zfs_nicenum(1ULL << h, refcnt, sizeof (refcnt)); zfs_nicenum(dds->dds_blocks, blocks, sizeof (blocks)); - zfs_nicenum(dds->dds_lsize, lsize, sizeof (lsize)); - zfs_nicenum(dds->dds_psize, psize, sizeof (psize)); - zfs_nicenum(dds->dds_dsize, dsize, sizeof (dsize)); + zfs_nicebytes(dds->dds_lsize, lsize, sizeof (lsize)); + zfs_nicebytes(dds->dds_psize, psize, sizeof (psize)); + zfs_nicebytes(dds->dds_dsize, dsize, sizeof (dsize)); zfs_nicenum(dds->dds_ref_blocks, ref_blocks, sizeof (ref_blocks)); - zfs_nicenum(dds->dds_ref_lsize, ref_lsize, sizeof (ref_lsize)); - zfs_nicenum(dds->dds_ref_psize, ref_psize, sizeof (ref_psize)); - zfs_nicenum(dds->dds_ref_dsize, ref_dsize, sizeof (ref_dsize)); + zfs_nicebytes(dds->dds_ref_lsize, ref_lsize, sizeof (ref_lsize)); + zfs_nicebytes(dds->dds_ref_psize, ref_psize, sizeof (ref_psize)); + zfs_nicebytes(dds->dds_ref_dsize, ref_dsize, sizeof (ref_dsize)); (void) printf("%6s %6s %5s %5s %5s %6s %5s %5s %5s\n", refcnt, |