From 308a451f7f5ecded4f194a50abab5ca123b6d397 Mon Sep 17 00:00:00 2001 From: Matthew Ahrens Date: Sat, 6 Sep 2014 00:03:09 +0200 Subject: Illumos 5134 - if ZFS_DEBUG or debug= is set, libzpool should enable debug prints 5134 if ZFS_DEBUG or debug= is set, libzpool should enable debug prints Reviewed by: Adam Leventhal Reviewed by: Christopher Siden Reviewed by: George Wilson Reviewed by: Saso Kiselkov Approved by: Dan McDonald References: https://www.illumos.org/projects/illumos-gate/issues/5134 https://github.com/illumos/illumos-gate/commit/7fa49ea Porting notes: Added dprintf_setup() to main in zfs_main.c and zpool_main.c. Ported by: Turbo Fredriksson Signed-off-by: Brian Behlendorf Closes #2669 --- cmd/zfs/zfs_main.c | 2 ++ cmd/zpool/zpool_main.c | 2 ++ lib/libzpool/kernel.c | 3 +++ 3 files changed, 7 insertions(+) diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index 5b469cfc7..c361e18b9 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -6661,6 +6661,8 @@ main(int argc, char **argv) (void) setlocale(LC_ALL, ""); (void) textdomain(TEXT_DOMAIN); + dprintf_setup(&argc, argv); + opterr = 0; /* diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index 9e37eb228..ca3737475 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -5879,6 +5879,8 @@ main(int argc, char **argv) (void) setlocale(LC_ALL, ""); (void) textdomain(TEXT_DOMAIN); + dprintf_setup(&argc, argv); + opterr = 0; /* diff --git a/lib/libzpool/kernel.c b/lib/libzpool/kernel.c index 9136560df..85fe24afd 100644 --- a/lib/libzpool/kernel.c +++ b/lib/libzpool/kernel.c @@ -837,6 +837,9 @@ dprintf_setup(int *argc, char **argv) */ if (dprintf_find_string("on")) dprintf_print_all = 1; + + if (dprintf_string != NULL) + zfs_flags |= ZFS_DEBUG_DPRINTF; } /* -- cgit v1.2.3