]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Add JSON output support to channel programs
authorAlek P <alek-p@users.noreply.github.com>
Mon, 19 Mar 2018 19:40:58 +0000 (15:40 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 19 Mar 2018 19:40:58 +0000 (12:40 -0700)
commit272b5d730f9ddd1db7cd7511da7bba75d6bd2450
tree9c7d8a1e05571bc8b157427815e05fd65f1dfe91
parenta76f3d0437e5e974f0f748f8735af3539443b388
Add JSON output support to channel programs

The changes piggyback JSON output support on top of channel programs
(#6558).  This way the JSON output support is targeted to scripting
use cases and is easily maintainable since it really only touches
one function (zfs_do_channel_program()).

This patch ports Joyent's JSON nvlist library from illumos to enable
easy JSON printing of channel program output nvlist.  To keep the
delta small I also took advantage of the fact that printing in
zfs_do_channel_program() was almost always done before exiting
the program.

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alek Pinchuk <apinchuk@datto.com>
Closes #7281
13 files changed:
cmd/zfs/zfs_main.c
configure.ac
include/libnvpair.h
lib/libnvpair/Makefile.am
lib/libnvpair/libnvpair_json.c [new file with mode: 0644]
man/man8/zfs-program.8
man/man8/zfs.8
tests/runfiles/linux.run
tests/zfs-tests/tests/functional/cli_root/Makefile.am
tests/zfs-tests/tests/functional/cli_root/zfs_program/Makefile.am [new file with mode: 0644]
tests/zfs-tests/tests/functional/cli_root/zfs_program/cleanup.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/cli_root/zfs_program/setup.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/cli_root/zfs_program/zfs_program_json.ksh [new file with mode: 0755]