aboutsummaryrefslogtreecommitdiffstats
path: root/man
diff options
context:
space:
mode:
authorAlek P <[email protected]>2018-03-19 15:40:58 -0400
committerBrian Behlendorf <[email protected]>2018-03-19 12:40:58 -0700
commit272b5d730f9ddd1db7cd7511da7bba75d6bd2450 (patch)
tree9c7d8a1e05571bc8b157427815e05fd65f1dfe91 /man
parenta76f3d0437e5e974f0f748f8735af3539443b388 (diff)
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 <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Richard Elling <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Alek Pinchuk <[email protected]> Closes #7281
Diffstat (limited to 'man')
-rw-r--r--man/man8/zfs-program.86
-rw-r--r--man/man8/zfs.88
2 files changed, 11 insertions, 3 deletions
diff --git a/man/man8/zfs-program.8 b/man/man8/zfs-program.8
index 8a478b70f..72a33761b 100644
--- a/man/man8/zfs-program.8
+++ b/man/man8/zfs-program.8
@@ -18,7 +18,7 @@
.Nd executes ZFS channel programs
.Sh SYNOPSIS
.Cm "zfs program"
-.Op Fl n
+.Op Fl jn
.Op Fl t Ar instruction-limit
.Op Fl m Ar memory-limit
.Ar pool
@@ -46,6 +46,10 @@ will be run on
and any attempts to access or modify other pools will cause an error.
.Sh OPTIONS
.Bl -tag -width "-t"
+.It Fl j
+Display channel program output in JSON format. When this flag is specified and
+standard output is empty - channel program encountered an error. The details of
+such an error will be printed to standard error in plain text.
.It Fl n
Executes a read-only channel program, which runs faster.
The program cannot change on-disk state by calling functions from the
diff --git a/man/man8/zfs.8 b/man/man8/zfs.8
index 7d7af1540..bfae494c6 100644
--- a/man/man8/zfs.8
+++ b/man/man8/zfs.8
@@ -300,7 +300,7 @@
.Ar snapshot Ar snapshot Ns | Ns Ar filesystem
.Nm
.Cm program
-.Op Fl n
+.Op Fl jn
.Op Fl t Ar timeout
.Op Fl m Ar memory_limit
.Ar pool script
@@ -4264,7 +4264,7 @@ Display the path's inode change time as the first column of output.
.It Xo
.Nm
.Cm program
-.Op Fl n
+.Op Fl jn
.Op Fl t Ar timeout
.Op Fl m Ar memory_limit
.Ar pool script
@@ -4286,6 +4286,10 @@ For full documentation of the ZFS channel program interface, see the manual
page for
.Xr zfs-program 8 .
.Bl -tag -width ""
+.It Fl j
+Display channel program output in JSON format. When this flag is specified and
+standard output is empty - channel program encountered an error. The details of
+such an error will be printed to standard error in plain text.
.It Fl n
Executes a read-only channel program, which runs faster.
The program cannot change on-disk state by calling functions from