diff options
author | Jason King <[email protected]> | 2017-06-13 04:16:45 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-10-30 14:47:20 -0700 |
commit | f3c8c9e6f0e5e2ce6a1cba31db0422d8585e8c7c (patch) | |
tree | aa1c8b5ff93e1329ebf58139527a6546902a1e92 /cmd/ztest/ztest.c | |
parent | 47c8e7fd97d8406f3fe51882a4a2787103012a82 (diff) |
OpenZFS 640 - number_to_scaled_string is duplicated in several commands
Porting Notes:
- The OpenZFS patch added nicenum_scale() and nicenum() to a
library not used by ZFS. Rather than pull in a new dependency
the version of nicenum in lib/libzpool/util.c was simply
replaced with the new one.
Reviewed by: Sebastian Wiedenroth <[email protected]>
Reviewed by: Robert Mustacchi <[email protected]>
Reviewed by: Yuri Pankov <[email protected]>
Approved by: Dan McDonald <[email protected]>
Authored by: Jason King <[email protected]>
Ported-by: Brian Behlendorf <[email protected]>
OpenZFS-issue: https://www.illumos.org/issues/640
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/0a055120
Closes #6796
Diffstat (limited to 'cmd/ztest/ztest.c')
-rw-r--r-- | cmd/ztest/ztest.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c index d45d0c8ff..e1b1ae3ff 100644 --- a/cmd/ztest/ztest.c +++ b/cmd/ztest/ztest.c @@ -23,6 +23,8 @@ * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. + * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 Joyent, Inc. */ /* @@ -608,12 +610,13 @@ usage(boolean_t requested) { const ztest_shared_opts_t *zo = &ztest_opts_defaults; - char nice_vdev_size[10]; - char nice_gang_bang[10]; + char nice_vdev_size[NN_NUMBUF_SZ]; + char nice_gang_bang[NN_NUMBUF_SZ]; FILE *fp = requested ? stdout : stderr; - nicenum(zo->zo_vdev_size, nice_vdev_size); - nicenum(zo->zo_metaslab_gang_bang, nice_gang_bang); + nicenum(zo->zo_vdev_size, nice_vdev_size, sizeof (nice_vdev_size)); + nicenum(zo->zo_metaslab_gang_bang, nice_gang_bang, + sizeof (nice_gang_bang)); (void) fprintf(fp, "Usage: %s\n" "\t[-v vdevs (default: %llu)]\n" @@ -3550,10 +3553,10 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, uint64_t id) old_class_space, new_class_space); if (ztest_opts.zo_verbose >= 5) { - char oldnumbuf[6], newnumbuf[6]; + char oldnumbuf[NN_NUMBUF_SZ], newnumbuf[NN_NUMBUF_SZ]; - nicenum(old_class_space, oldnumbuf); - nicenum(new_class_space, newnumbuf); + nicenum(old_class_space, oldnumbuf, sizeof (oldnumbuf)); + nicenum(new_class_space, newnumbuf, sizeof (newnumbuf)); (void) printf("%s grew from %s to %s\n", spa->spa_name, oldnumbuf, newnumbuf); } @@ -7024,7 +7027,7 @@ main(int argc, char **argv) ztest_info_t *zi; ztest_shared_callstate_t *zc; char timebuf[100]; - char numbuf[6]; + char numbuf[NN_NUMBUF_SZ]; spa_t *spa; char *cmd; boolean_t hasalt; @@ -7178,7 +7181,7 @@ main(int argc, char **argv) now = MIN(now, zs->zs_proc_stop); print_time(zs->zs_proc_stop - now, timebuf); - nicenum(zs->zs_space, numbuf); + nicenum(zs->zs_space, numbuf, sizeof (numbuf)); (void) printf("Pass %3d, %8s, %3llu ENOSPC, " "%4.1f%% of %5s used, %3.0f%% done, %8s to go\n", |