aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zpool_influxdb
diff options
context:
space:
mode:
authorнаб <[email protected]>2021-05-15 12:35:46 +0200
committerBrian Behlendorf <[email protected]>2021-05-29 14:26:38 -0700
commit757df529280d789029bb91761e31031c45c68b8f (patch)
treea0e62776be6719ad007d803da1634a9a26b9ca05 /cmd/zpool_influxdb
parente618e4a4ff0b0512e6b6a5230d101a4baad1aabd (diff)
libzfs: add zfs_get_underlying_type. Stop including libzfs_impl.h in cmd
Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12116
Diffstat (limited to 'cmd/zpool_influxdb')
-rw-r--r--cmd/zpool_influxdb/zpool_influxdb.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/cmd/zpool_influxdb/zpool_influxdb.c b/cmd/zpool_influxdb/zpool_influxdb.c
index 71ffcb253..5dc39afe8 100644
--- a/cmd/zpool_influxdb/zpool_influxdb.c
+++ b/cmd/zpool_influxdb/zpool_influxdb.c
@@ -71,7 +71,7 @@
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
-#include <libzfs_impl.h>
+#include <libzfs.h>
#define POOL_MEASUREMENT "zpool_stats"
#define SCAN_MEASUREMENT "zpool_scan_stats"
@@ -101,9 +101,10 @@ typedef int (*stat_printer_f)(nvlist_t *, const char *, const char *);
* caller is responsible for freeing result
*/
static char *
-escape_string(char *s)
+escape_string(const char *s)
{
- char *c, *d;
+ const char *c;
+ char *d;
char *t = (char *)malloc(ZFS_MAX_DATASET_NAME_LEN * 2);
if (t == NULL) {
fprintf(stderr, "error: cannot allocate memory\n");
@@ -714,7 +715,7 @@ print_stats(zpool_handle_t *zhp, void *data)
/* if not this pool return quickly */
if (data &&
- strncmp(data, zhp->zpool_name, ZFS_MAX_DATASET_NAME_LEN) != 0) {
+ strncmp(data, zpool_get_name(zhp), ZFS_MAX_DATASET_NAME_LEN) != 0) {
zpool_close(zhp);
return (0);
}
@@ -742,7 +743,7 @@ print_stats(zpool_handle_t *zhp, void *data)
return (3);
}
- pool_name = escape_string(zhp->zpool_name);
+ pool_name = escape_string(zpool_get_name(zhp));
err = print_recursive_stats(print_summary_stats, nvroot,
pool_name, NULL, 1);
/* if any of these return an error, skip the rest */