zpool: main: list: don't pay for printf
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13125
This commit is contained in:
parent
cdb3eb5aa4
commit
06b8050678
|
@ -5022,7 +5022,7 @@ get_namewidth(zpool_handle_t *zhp, int min_width, int flags, boolean_t verbose)
|
||||||
if ((config = zpool_get_config(zhp, NULL)) != NULL) {
|
if ((config = zpool_get_config(zhp, NULL)) != NULL) {
|
||||||
verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE,
|
verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE,
|
||||||
&nvroot) == 0);
|
&nvroot) == 0);
|
||||||
unsigned int poolname_len = strlen(zpool_get_name(zhp));
|
size_t poolname_len = strlen(zpool_get_name(zhp));
|
||||||
if (verbose == B_FALSE) {
|
if (verbose == B_FALSE) {
|
||||||
width = MAX(poolname_len, min_width);
|
width = MAX(poolname_len, min_width);
|
||||||
} else {
|
} else {
|
||||||
|
@ -5961,7 +5961,7 @@ print_header(list_cbdata_t *cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!first)
|
if (!first)
|
||||||
(void) printf(" ");
|
(void) fputs(" ", stdout);
|
||||||
else
|
else
|
||||||
first = B_FALSE;
|
first = B_FALSE;
|
||||||
|
|
||||||
|
@ -5979,14 +5979,14 @@ print_header(list_cbdata_t *cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pl->pl_next == NULL && !right_justify)
|
if (pl->pl_next == NULL && !right_justify)
|
||||||
(void) printf("%s", header);
|
(void) fputs(header, stdout);
|
||||||
else if (right_justify)
|
else if (right_justify)
|
||||||
(void) printf("%*s", (int)width, header);
|
(void) printf("%*s", (int)width, header);
|
||||||
else
|
else
|
||||||
(void) printf("%-*s", (int)width, header);
|
(void) printf("%-*s", (int)width, header);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) printf("\n");
|
(void) fputc('\n', stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -6016,9 +6016,9 @@ print_pool(zpool_handle_t *zhp, list_cbdata_t *cb)
|
||||||
|
|
||||||
if (!first) {
|
if (!first) {
|
||||||
if (cb->cb_scripted)
|
if (cb->cb_scripted)
|
||||||
(void) printf("\t");
|
(void) fputc('\t', stdout);
|
||||||
else
|
else
|
||||||
(void) printf(" ");
|
(void) fputs(" ", stdout);
|
||||||
} else {
|
} else {
|
||||||
first = B_FALSE;
|
first = B_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -6048,14 +6048,14 @@ print_pool(zpool_handle_t *zhp, list_cbdata_t *cb)
|
||||||
* format specifier.
|
* format specifier.
|
||||||
*/
|
*/
|
||||||
if (cb->cb_scripted || (pl->pl_next == NULL && !right_justify))
|
if (cb->cb_scripted || (pl->pl_next == NULL && !right_justify))
|
||||||
(void) printf("%s", propstr);
|
(void) fputs(propstr, stdout);
|
||||||
else if (right_justify)
|
else if (right_justify)
|
||||||
(void) printf("%*s", (int)width, propstr);
|
(void) printf("%*s", (int)width, propstr);
|
||||||
else
|
else
|
||||||
(void) printf("%-*s", (int)width, propstr);
|
(void) printf("%-*s", (int)width, propstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) printf("\n");
|
(void) fputc('\n', stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -6191,7 +6191,7 @@ print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
|
||||||
}
|
}
|
||||||
print_one_column(ZPOOL_PROP_HEALTH, 0, state, scripted,
|
print_one_column(ZPOOL_PROP_HEALTH, 0, state, scripted,
|
||||||
B_TRUE, format);
|
B_TRUE, format);
|
||||||
(void) printf("\n");
|
(void) fputc('\n', stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
|
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
|
||||||
|
|
Loading…
Reference in New Issue