Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b318c9c20f40be1583e7d…
Commit: b318c9c20f40be1583e7d0751a733f77be173012
Parent: efd083f66883e674a6f24370d8c7cc06aa4fafe7
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Aug 5 10:31:08 2022 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Aug 11 11:10:11 2022 +0200
make: generate
---
conf/example.conf.in | 6 ++++++
man/lvchange.8_pregen | 10 ++++++----
man/lvcreate.8_pregen | 10 ++++++----
man/lvextend.8_pregen | 10 ++++++----
man/lvm-fullreport.8_pregen | 8 +++++---
man/lvreduce.8_pregen | 8 +++++---
man/lvremove.8_pregen | 8 +++++---
man/lvrename.8_pregen | 8 +++++---
man/lvresize.8_pregen | 10 ++++++----
man/lvs.8_pregen | 8 +++++---
man/lvscan.8_pregen | 8 +++++---
man/pvchange.8_pregen | 8 +++++---
man/pvcreate.8_pregen | 8 +++++---
man/pvdisplay.8_pregen | 8 +++++---
man/pvmove.8_pregen | 8 +++++---
man/pvremove.8_pregen | 8 +++++---
man/pvresize.8_pregen | 8 +++++---
man/pvs.8_pregen | 8 +++++---
man/pvscan.8_pregen | 14 ++++++++------
man/vgcfgbackup.8_pregen | 8 +++++---
man/vgchange.8_pregen | 18 ++++++++++--------
man/vgck.8_pregen | 8 +++++---
man/vgconvert.8_pregen | 8 +++++---
man/vgcreate.8_pregen | 8 +++++---
man/vgexport.8_pregen | 8 +++++---
man/vgextend.8_pregen | 8 +++++---
man/vgimport.8_pregen | 8 +++++---
man/vgimportdevices.8_pregen | 8 +++++---
man/vgmknodes.8_pregen | 8 +++++---
man/vgreduce.8_pregen | 10 ++++++----
man/vgremove.8_pregen | 8 +++++---
man/vgrename.8_pregen | 8 +++++---
man/vgs.8_pregen | 8 +++++---
man/vgscan.8_pregen | 8 +++++---
34 files changed, 184 insertions(+), 112 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 5fadeac12..10810d8b8 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -1951,6 +1951,12 @@ activation {
# name for identification.
# json
# JSON format.
+ # json_std
+ # JSON format that is more compliant with JSON standard.
+ # Compared to original "json" format:
+ # - it does not use double quotes around numeric values,
+ # - it uses 'null' for undefined numeric values,
+ # - it prints string list as proper JSON array of strings instead of a single string.
# This configuration option has an automatic default value.
# output_format = "basic"
diff --git a/man/lvchange.8_pregen b/man/lvchange.8_pregen
index e46a3b9b2..90aec5483 100644
--- a/man/lvchange.8_pregen
+++ b/man/lvchange.8_pregen
@@ -111,7 +111,7 @@ lvchange \(em Change the attributes of logical volume(s)
.br
\fB--refresh\fP
.br
- \fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
\fB--resync\fP
.br
@@ -397,7 +397,7 @@ Common options for command:
.br
[ \fB--noudevsync\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.ad b
.RE
.P
@@ -847,14 +847,16 @@ if something has gone wrong, or if some form of manual LV
sharing is being used.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB--resync\fP
diff --git a/man/lvcreate.8_pregen b/man/lvcreate.8_pregen
index 3940aa77e..cde896b7a 100644
--- a/man/lvcreate.8_pregen
+++ b/man/lvcreate.8_pregen
@@ -129,7 +129,7 @@ lvcreate \(em Create a logical volume
.br
\fB-R\fP|\fB--regionsize\fP \fISize\fP[m|UNIT]
.br
- \fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
\fB-k\fP|\fB--setactivationskip\fP \fBy\fP|\fBn\fP
.br
@@ -781,7 +781,7 @@ Common options for command:
.br
[ \fB--noudevsync\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ \fB--setautoactivation\fP \fBy\fP|\fBn\fP ]
.ad b
@@ -1299,14 +1299,16 @@ Size of each raid or mirror synchronization region.
configure a default.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-k\fP|\fB--setactivationskip\fP \fBy\fP|\fBn\fP
diff --git a/man/lvextend.8_pregen b/man/lvextend.8_pregen
index 445afc25e..3c2bfa6bf 100644
--- a/man/lvextend.8_pregen
+++ b/man/lvextend.8_pregen
@@ -63,7 +63,7 @@ lvextend \(em Add space to a logical volume
.br
\fB-q\fP|\fB--quiet\fP
.br
- \fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
\fB-r\fP|\fB--resizefs\fP
.br
@@ -219,7 +219,7 @@ Common options for command:
.br
[ \fB--noudevsync\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ \fB--type\fP \c
.nh
@@ -471,14 +471,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-r\fP|\fB--resizefs\fP
diff --git a/man/lvm-fullreport.8_pregen b/man/lvm-fullreport.8_pregen
index 4bcfba4f8..7e9348e1d 100644
--- a/man/lvm-fullreport.8_pregen
+++ b/man/lvm-fullreport.8_pregen
@@ -55,7 +55,7 @@ if information changes between commands.
.br
[ \fB--readonly\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ \fB--rows\fP ]
.br
@@ -308,14 +308,16 @@ device-mapper kernel driver, so this option is unable to report whether
or not LVs are actually in use.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB--rows\fP
diff --git a/man/lvreduce.8_pregen b/man/lvreduce.8_pregen
index e8953bc8f..4f6615449 100644
--- a/man/lvreduce.8_pregen
+++ b/man/lvreduce.8_pregen
@@ -50,7 +50,7 @@ the options section.
.br
[ \fB--noudevsync\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -245,14 +245,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-r\fP|\fB--resizefs\fP
diff --git a/man/lvremove.8_pregen b/man/lvremove.8_pregen
index f47181213..7ae83f1bb 100644
--- a/man/lvremove.8_pregen
+++ b/man/lvremove.8_pregen
@@ -56,7 +56,7 @@ former LV completely.
.br
[ \fB--noudevsync\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -229,14 +229,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-S\fP|\fB--select\fP \fIString\fP
diff --git a/man/lvrename.8_pregen b/man/lvrename.8_pregen
index 278e8e989..2c0c4e1b9 100644
--- a/man/lvrename.8_pregen
+++ b/man/lvrename.8_pregen
@@ -42,7 +42,7 @@ Common options for command:
.br
[ \fB--noudevsync\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.ad b
.RE
.P
@@ -200,14 +200,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-t\fP|\fB--test\fP
diff --git a/man/lvresize.8_pregen b/man/lvresize.8_pregen
index 625fed0a1..1671741ce 100644
--- a/man/lvresize.8_pregen
+++ b/man/lvresize.8_pregen
@@ -61,7 +61,7 @@ lvresize \(em Resize a logical volume
.br
\fB-q\fP|\fB--quiet\fP
.br
- \fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
\fB-r\fP|\fB--resizefs\fP
.br
@@ -177,7 +177,7 @@ Common options for command:
.br
[ \fB--noudevsync\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ \fB--type\fP \c
.nh
@@ -424,14 +424,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-r\fP|\fB--resizefs\fP
diff --git a/man/lvs.8_pregen b/man/lvs.8_pregen
index d055851f5..3f35dc652 100644
--- a/man/lvs.8_pregen
+++ b/man/lvs.8_pregen
@@ -55,7 +55,7 @@ lvs produces formatted output about LVs.
.br
[ \fB--readonly\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ \fB--rows\fP ]
.br
@@ -318,14 +318,16 @@ device-mapper kernel driver, so this option is unable to report whether
or not LVs are actually in use.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB--rows\fP
diff --git a/man/lvscan.8_pregen b/man/lvscan.8_pregen
index 012479618..e2938dee4 100644
--- a/man/lvscan.8_pregen
+++ b/man/lvscan.8_pregen
@@ -33,7 +33,7 @@ comprehensive information about LVs.
.br
[ \fB--readonly\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -207,14 +207,16 @@ device-mapper kernel driver, so this option is unable to report whether
or not LVs are actually in use.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-t\fP|\fB--test\fP
diff --git a/man/pvchange.8_pregen b/man/pvchange.8_pregen
index 57d1570c4..0b35a2013 100644
--- a/man/pvchange.8_pregen
+++ b/man/pvchange.8_pregen
@@ -79,7 +79,7 @@ Common options for command:
.br
[ \fB-u\fP|\fB--uuid\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.ad b
.RE
.P
@@ -265,14 +265,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-S\fP|\fB--select\fP \fIString\fP
diff --git a/man/pvcreate.8_pregen b/man/pvcreate.8_pregen
index 67b5c27d0..3445898d0 100644
--- a/man/pvcreate.8_pregen
+++ b/man/pvcreate.8_pregen
@@ -124,7 +124,7 @@ pe_start value.
.br
[ \fB--setphysicalvolumesize\fP \fISize\fP[m|UNIT] ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ \fB--restorefile\fP \fIString\fP ]
.br
@@ -353,14 +353,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB--restorefile\fP \fIString\fP
diff --git a/man/pvdisplay.8_pregen b/man/pvdisplay.8_pregen
index e7767d0c4..92dda936f 100644
--- a/man/pvdisplay.8_pregen
+++ b/man/pvdisplay.8_pregen
@@ -61,7 +61,7 @@ and more, using a more compact and configurable output format.
.br
[ \fB--readonly\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ \fB--separator\fP \fIString\fP ]
.br
@@ -322,14 +322,16 @@ device-mapper kernel driver, so this option is unable to report whether
or not LVs are actually in use.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-S\fP|\fB--select\fP \fIString\fP
diff --git a/man/pvmove.8_pregen b/man/pvmove.8_pregen
index 28b0ea4e8..53f8a2ac6 100644
--- a/man/pvmove.8_pregen
+++ b/man/pvmove.8_pregen
@@ -54,7 +54,7 @@ Move PV extents.
.br
[ \fB--noudevsync\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -296,14 +296,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-t\fP|\fB--test\fP
diff --git a/man/pvremove.8_pregen b/man/pvremove.8_pregen
index a086724b8..0d4802187 100644
--- a/man/pvremove.8_pregen
+++ b/man/pvremove.8_pregen
@@ -29,7 +29,7 @@ an existing VG. Normally, \fBvgreduce\fP(8) should be used instead.
.ad l
[ \fB-f\fP|\fB--force\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -181,14 +181,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-t\fP|\fB--test\fP
diff --git a/man/pvresize.8_pregen b/man/pvresize.8_pregen
index 708b7d72a..fda57a246 100644
--- a/man/pvresize.8_pregen
+++ b/man/pvresize.8_pregen
@@ -24,7 +24,7 @@ LVs allocated on it.
.ad l
[ \fB--setphysicalvolumesize\fP \fISize\fP[m|UNIT] ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -170,14 +170,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB--setphysicalvolumesize\fP \fISize\fP[m|UNIT]
diff --git a/man/pvs.8_pregen b/man/pvs.8_pregen
index 485e651a7..d08e92818 100644
--- a/man/pvs.8_pregen
+++ b/man/pvs.8_pregen
@@ -53,7 +53,7 @@ pvs produces formatted output about PVs.
.br
[ \fB--readonly\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ \fB--rows\fP ]
.br
@@ -308,14 +308,16 @@ device-mapper kernel driver, so this option is unable to report whether
or not LVs are actually in use.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB--rows\fP
diff --git a/man/pvscan.8_pregen b/man/pvscan.8_pregen
index cb837b8ca..20aec7267 100644
--- a/man/pvscan.8_pregen
+++ b/man/pvscan.8_pregen
@@ -66,7 +66,7 @@ pvscan \(em List all physical volumes
.br
\fB-q\fP|\fB--quiet\fP
.br
- \fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
\fB-s\fP|\fB--short\fP
.br
@@ -157,7 +157,7 @@ Display PV information.
.br
[ \fB--ignorelockingfailure\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -176,7 +176,7 @@ Record that a PV is online or offline.
.br
[ \fB--ignorelockingfailure\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ \fB--minor\fP \fINumber\fP ]
.br
@@ -202,7 +202,7 @@ Record that a PV is online and autoactivate the VG if complete.
.br
[ \fB--ignorelockingfailure\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ \fB--minor\fP \fINumber\fP ]
.br
@@ -499,14 +499,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-s\fP|\fB--short\fP
diff --git a/man/vgcfgbackup.8_pregen b/man/vgcfgbackup.8_pregen
index e732a7d43..62707ed1f 100644
--- a/man/vgcfgbackup.8_pregen
+++ b/man/vgcfgbackup.8_pregen
@@ -46,7 +46,7 @@ It may also be useful to regularly back up the files in
.br
[ \fB--readonly\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -224,14 +224,16 @@ device-mapper kernel driver, so this option is unable to report whether
or not LVs are actually in use.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-t\fP|\fB--test\fP
diff --git a/man/vgchange.8_pregen b/man/vgchange.8_pregen
index d70f1e5ac..9df1ef733 100644
--- a/man/vgchange.8_pregen
+++ b/man/vgchange.8_pregen
@@ -97,7 +97,7 @@ vgchange \(em Change volume group attributes
.br
\fB--refresh\fP
.br
- \fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
\fB-x\fP|\fB--resizeable\fP \fBy\fP|\fBn\fP
.br
@@ -184,7 +184,7 @@ required, after which the others are optional.
.br
[ \fB--noudevsync\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -218,7 +218,7 @@ Start or stop monitoring LVs from dmeventd.
.br
[ \fB--noudevsync\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -248,7 +248,7 @@ Start or stop processing LV conversions.
.br
[ \fB--noudevsync\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -294,7 +294,7 @@ Activate or deactivate LVs.
.br
[ \fB--noudevsync\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -328,7 +328,7 @@ Reactivate LVs using the latest metadata.
.br
[ \fB--noudevsync\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -780,14 +780,16 @@ if something has gone wrong, or if some form of manual LV
sharing is being used.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-x\fP|\fB--resizeable\fP \fBy\fP|\fBn\fP
diff --git a/man/vgck.8_pregen b/man/vgck.8_pregen
index 23bd7ea6d..d0fe0403e 100644
--- a/man/vgck.8_pregen
+++ b/man/vgck.8_pregen
@@ -26,7 +26,7 @@ Read and display information about a VG.
.br
.RS 4
.ad l
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -186,14 +186,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-t\fP|\fB--test\fP
diff --git a/man/vgconvert.8_pregen b/man/vgconvert.8_pregen
index cdeee39fa..41baaf9ad 100644
--- a/man/vgconvert.8_pregen
+++ b/man/vgconvert.8_pregen
@@ -35,7 +35,7 @@ convert VGs from the LVM1 format to LVM2.
.br
[ \fB--metadatasize\fP \fISize\fP[m|UNIT] ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -234,14 +234,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-t\fP|\fB--test\fP
diff --git a/man/vgcreate.8_pregen b/man/vgcreate.8_pregen
index 2c0c548b5..07fc9e485 100644
--- a/man/vgcreate.8_pregen
+++ b/man/vgcreate.8_pregen
@@ -63,7 +63,7 @@ device.
.br
[ \fB--\fP[\fBvg\fP]\fBmetadatacopies\fP \fBall\fP|\fBunmanaged\fP|\fINumber\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ \fB--dataalignment\fP \fISize\fP[k|UNIT] ]
.br
@@ -351,14 +351,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB--setautoactivation\fP \fBy\fP|\fBn\fP
diff --git a/man/vgexport.8_pregen b/man/vgexport.8_pregen
index 25f767bc8..4fa6eadbf 100644
--- a/man/vgexport.8_pregen
+++ b/man/vgexport.8_pregen
@@ -63,7 +63,7 @@ Common options for command:
.
.RS 4
.ad l
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.ad b
.RE
.P
@@ -211,14 +211,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-S\fP|\fB--select\fP \fIString\fP
diff --git a/man/vgextend.8_pregen b/man/vgextend.8_pregen
index af5679118..a1ed2f3e3 100644
--- a/man/vgextend.8_pregen
+++ b/man/vgextend.8_pregen
@@ -51,7 +51,7 @@ will initialize them. In this case pvcreate options can be used, e.g.
.br
[ \fB--dataalignmentoffset\fP \fISize\fP[k|UNIT] ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ \fB--restoremissing\fP ]
.br
@@ -265,14 +265,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB--restoremissing\fP
diff --git a/man/vgimport.8_pregen b/man/vgimport.8_pregen
index fee109849..f23f8f4f1 100644
--- a/man/vgimport.8_pregen
+++ b/man/vgimport.8_pregen
@@ -51,7 +51,7 @@ Common options for command:
.ad l
[ \fB-f\fP|\fB--force\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.ad b
.RE
.P
@@ -206,14 +206,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-S\fP|\fB--select\fP \fIString\fP
diff --git a/man/vgimportdevices.8_pregen b/man/vgimportdevices.8_pregen
index c030c01a5..1cce85766 100644
--- a/man/vgimportdevices.8_pregen
+++ b/man/vgimportdevices.8_pregen
@@ -56,7 +56,7 @@ Common options for command:
.ad l
[ \fB--foreign\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.ad b
.RE
.P
@@ -210,14 +210,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-S\fP|\fB--select\fP \fIString\fP
diff --git a/man/vgmknodes.8_pregen b/man/vgmknodes.8_pregen
index 511d579bd..60e693571 100644
--- a/man/vgmknodes.8_pregen
+++ b/man/vgmknodes.8_pregen
@@ -31,7 +31,7 @@ interoperating correctly.
.br
[ \fB--refresh\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -194,14 +194,16 @@ if something has gone wrong, or if some form of manual LV
sharing is being used.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-t\fP|\fB--test\fP
diff --git a/man/vgreduce.8_pregen b/man/vgreduce.8_pregen
index 278aa0fac..ca6ab6786 100644
--- a/man/vgreduce.8_pregen
+++ b/man/vgreduce.8_pregen
@@ -50,7 +50,7 @@ vgreduce \(em Remove physical volume(s) from a volume group
.br
\fB--removemissing\fP
.br
- \fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
\fB-t\fP|\fB--test\fP
.br
@@ -116,7 +116,7 @@ Common options for command:
.br
[ \fB-f\fP|\fB--force\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.ad b
.RE
.P
@@ -296,14 +296,16 @@ If LVs spanned several disks, including ones that are lost, salvaging
some data first may be possible by activating LVs in partial mode.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-t\fP|\fB--test\fP
diff --git a/man/vgremove.8_pregen b/man/vgremove.8_pregen
index 9e6051ade..df6588115 100644
--- a/man/vgremove.8_pregen
+++ b/man/vgremove.8_pregen
@@ -35,7 +35,7 @@ without confirmation.
.br
[ \fB--noudevsync\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -195,14 +195,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-S\fP|\fB--select\fP \fIString\fP
diff --git a/man/vgrename.8_pregen b/man/vgrename.8_pregen
index 932a51103..d55b6a0f9 100644
--- a/man/vgrename.8_pregen
+++ b/man/vgrename.8_pregen
@@ -55,7 +55,7 @@ Common options for command:
.br
[ \fB-f\fP|\fB--force\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.ad b
.RE
.P
@@ -211,14 +211,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-t\fP|\fB--test\fP
diff --git a/man/vgs.8_pregen b/man/vgs.8_pregen
index 0c89c5b5e..8b1f69c4f 100644
--- a/man/vgs.8_pregen
+++ b/man/vgs.8_pregen
@@ -51,7 +51,7 @@ vgs produces formatted output about VGs.
.br
[ \fB--readonly\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ \fB--rows\fP ]
.br
@@ -305,14 +305,16 @@ device-mapper kernel driver, so this option is unable to report whether
or not LVs are actually in use.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB--rows\fP
diff --git a/man/vgscan.8_pregen b/man/vgscan.8_pregen
index 600c2c978..7b4ffb615 100644
--- a/man/vgscan.8_pregen
+++ b/man/vgscan.8_pregen
@@ -27,7 +27,7 @@ vgscan scans all supported LVM block devices in the system for VGs.
.br
[ \fB--notifydbus\fP ]
.br
-[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP ]
+[ \fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -192,14 +192,16 @@ Suppress output and log messages. Overrides --debug and --verbose.
Repeat once to also suppress any prompts with answer 'no'.
.
.HP
-\fB--reportformat\fP \fBbasic\fP|\fBjson\fP
+\fB--reportformat\fP \fBbasic\fP|\fBjson\fP|\fBjson_std\fP
.br
Overrides current output format for reports which is defined globally by
the report/output_format setting in \fBlvm.conf\fP(5).
\fBbasic\fP is the original format with columns and rows.
If there is more than one report per command, each report is prefixed
with the report name for identification. \fBjson\fP produces report
-output in JSON format. See \fBlvmreport\fP(7) for more information.
+output in JSON format. \fBjson_std\fP produces report output in
+JSON format which is more compliant with JSON standard.
+See \fBlvmreport\fP(7) for more information.
.
.HP
\fB-t\fP|\fB--test\fP
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=efd083f66883e674a6f24…
Commit: efd083f66883e674a6f24370d8c7cc06aa4fafe7
Parent: aa7cec61edae849c5fab7e1319684b43fdc439de
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Aug 4 16:52:22 2022 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Aug 11 11:10:11 2022 +0200
man: update lvmreport man page about json_std format
---
man/lvmreport.7_main | 36 ++++++++++++++++++++++++++++--------
1 file changed, 28 insertions(+), 8 deletions(-)
diff --git a/man/lvmreport.7_main b/man/lvmreport.7_main
index f0f04ad1c..1ef5d25db 100644
--- a/man/lvmreport.7_main
+++ b/man/lvmreport.7_main
@@ -1303,9 +1303,19 @@ binary_values_as_numeric=1
.
LVM can output reports in different formats - use \fBreport/output_format\fP
configuration setting (or \fB--reportformat\fP command line option) to swith
-the report output format. Currently, LVM supports \fB"basic"\fP (all the examples
-we used above used this format) and \fB"JSON"\fP output format.
+the report output format.
+
.P
+Currently, LVM supports these outpout formats:
+.RS
+- \fB"basic"\fP (all the examples we used above used this format),
+.br
+- \fB"json"\fP,
+.br
+- \fB"json_std"\fP.
+.RE
+.P
+For example:
.nf
# lvs -o lv_name,lv_size --reportformat json
{
@@ -1320,13 +1330,23 @@ we used above used this format) and \fB"JSON"\fP output format.
}
.fi
.P
+The \fBjson_std\fP output format is more compliant with JSON standard and
+compared to the original \fBjson\fP format:
+.RS
+- it does not use double quotes around numeric values,
+.br
+- it uses 'null' for undefined numeric values,
+.br
+- it prints string list as proper JSON array of strings instead of a single string.
+.RE
+.P
Note that some configuration settings and command line options have no
-effect with certain report formats. For example, with \fBJSON\fP output,
-it doesn't have any meaning to use \fBreport/aligned\fP (\fB--aligned\fP),
-\fBreport/noheadings\fP (\fB--noheadings\fP), \fBreport/columns_as_rows\fP
-(\fB--rows\fP) or \fBreport/buffered\fP (\fB--unbuffered\fP). All these
-configuration settings and command line options are ignored if using the
-\fBJSON\fP report output format.
+effect with certain report formats. For example, with \fBjson\fP or
+\fBjson_std\fP output, it doesn't have any meaning to use \fBreport/aligned\fP
+(\fB--aligned\fP), \fBreport/noheadings\fP (\fB--noheadings\fP),
+\fBreport/columns_as_rows\fP (\fB--rows\fP) or \fBreport/buffered\fP
+(\fB--unbuffered\fP). All these configuration settings and command line options
+are ignored if using the \fBjson\fP or \fBjson_std\fP report output format.
.
.SS Selection
.
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=31cd8346ae92fcc32ce4f…
Commit: 31cd8346ae92fcc32ce4f2f60f7962e620a7b12f
Parent: 1e31621cebfb38f652233e2f80dd081cca5e8374
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jun 28 17:00:00 2022 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Aug 11 11:10:11 2022 +0200
libdm: report: enhance the way string list is stored internally
Before, we stored only the report string itself for a string list
in field->report_string. The field->report_string has either
sorted items or not, depending on what we need for a field -
some report fields have sorted output, some don't...
The field->sort_value.value then contains pointer to the exact
field->report_string. The field->sort_value.items ALWAYS keeps
sorted array of individual items, represented as '[position,length]'
pairs pointing to the field->sort_value.value string.
This approach was fine as far as we didn't need to apply further
formatting to field->report_string. However, if we need to apply
further formatting to field->report_string content, taking into
account individual items, we also need to know where each item
starts and what is its length. Before, we only knew this when
items in report string were sorted, but not in the unsorted version.
We can't rely on the delimiter (default ",") only to separate items
back out of report string, because that delimiter can be contained
in the item value itself.
So this patch enhances the field->report_string for a string list so
it also contains '[position,length]' pairs for each individual item
inside field->report_string. We store this array right beyond the
string itself and we encode it in the same manner we already did for
field->sort_value.items before.
If field->report_string has sorted items, the field->sort_value.items
just points to the array of items we store beyond the report string.
If field->report_string has unsorted items, we store separate array
of items for both field->report_string and field->sort_value.
This patch also cleans up the _report_field_string_list function a bit
so it's easier and more straightforward to follow than the original
version.
Example. If we have "abc", "xy", "defgh" as list on input with ","
as delimiter, then:
- field->report_string will have:
- if we need field->report_string unsorted:
abc,xy,defgh\0{[3,12],[0,3],[4,2],[7,5]}
|____________||________________________|
string array of [pos,len] pairs
|____||________________|
#items items
- if we need field->report_string sorted:
repstr_extra
|
V
abc,defgh,xy\0{[3,12],[0,3],[4,5],[10,2]}
|____________||________________________|
string array of [pos,len] pairs
|____||________________|
#items items
- field->sort_value will have:
- if field->report_string is unsorted:
field->sort_value.value = field->report_string
field->sort_value.items = {[0,3],[0,3],[7,5],[4,2]}
(that is 'abc,defgh,xy')
- if field->report_string is sorted already:
field->sort_value.value = field->report_string
field->sort_value.items = repstr_extra
(that is also 'abc,defgh,xy')
---
device_mapper/libdm-report.c | 306 +++++++++++++++++++++++++++----------------
libdm/libdm-report.c | 306 +++++++++++++++++++++++++++----------------
2 files changed, 380 insertions(+), 232 deletions(-)
diff --git a/device_mapper/libdm-report.c b/device_mapper/libdm-report.c
index 3c4b01127..aab7bdd63 100644
--- a/device_mapper/libdm-report.c
+++ b/device_mapper/libdm-report.c
@@ -384,172 +384,246 @@ int dm_report_field_percent(struct dm_report *rh,
return 1;
}
-struct str_list_sort_value_item {
+struct pos_len {
unsigned pos;
size_t len;
};
-struct str_list_sort_value {
- const char *value;
- struct str_list_sort_value_item *items;
+struct str_pos_len {
+ const char *str;
+ struct pos_len item;
};
-struct str_list_sort_item {
- const char *str;
- struct str_list_sort_value_item item;
+struct str_list_sort_value {
+ const char *value;
+ struct pos_len *items;
};
-static int _str_list_sort_item_cmp(const void *a, const void *b)
+static int _str_sort_cmp(const void *a, const void *b)
{
- const struct str_list_sort_item *slsi_a = (const struct str_list_sort_item *) a;
- const struct str_list_sort_item *slsi_b = (const struct str_list_sort_item *) b;
-
- return strcmp(slsi_a->str, slsi_b->str);
+ return strcmp(((const struct str_pos_len *) a)->str, ((const struct str_pos_len *) b)->str);
}
+#define FIELD_STRING_LIST_DEFAULT_DELIMITER ","
+
static int _report_field_string_list(struct dm_report *rh,
struct dm_report_field *field,
const struct dm_list *data,
const char *delimiter,
- int sort)
+ int sort_repstr)
{
- static const char _string_list_grow_object_failed_msg[] = "dm_report_field_string_list: dm_pool_grow_object_failed";
- struct str_list_sort_value *sort_value = NULL;
- unsigned int list_size, pos, i;
- struct str_list_sort_item *arr = NULL;
+ static const char _error_msg_prefix[] = "_report_field_string_list: ";
+ unsigned int list_size, i, pos;
+ struct str_pos_len *arr = NULL;
struct dm_str_list *sl;
- size_t delimiter_len, len;
- void *object;
+ size_t delimiter_len, repstr_str_len, repstr_size;
+ char *repstr = NULL;
+ struct pos_len *repstr_extra;
+ struct str_list_sort_value *sortval = NULL;
int r = 0;
- if (!(sort_value = dm_pool_zalloc(rh->mem, sizeof(struct str_list_sort_value)))) {
- log_error("dm_report_field_string_list: dm_pool_zalloc failed for sort_value");
- return 0;
- }
-
- list_size = dm_list_size(data);
-
/*
- * Sort value stores the pointer to the report_string and then
- * position and length for each list element withing the report_string.
- * The first element stores number of elements in 'len' (therefore
- * list_size + 1 is used below for the extra element).
- * For example, with this input:
- * sort = 0; (we don't want to report sorted)
- * report_string = "abc,xy,defgh"; (this is reported)
+ * The 'field->report_string' has 2 parts:
+ *
+ * - string representing the whole string list
+ * (terminated by '\0' at its end as usual)
+ *
+ * - extra info beyond the end of the string representing
+ * position and length of each list item within the
+ * field->report_string (array of 'struct pos_len')
+ *
+ * We can use the extra info to unambiguously identify list items,
+ * the delimiter is not enough here as it's not assured it won't appear
+ * in list item itself. We will make use of this extra info in case
+ * we need to apply further formatting to the list in dm_report_output
+ * where the pure field->report_string is not enough for printout.
+ *
+ *
+ * The 'field->sort_value' contains a value of type 'struct
+ * str_list_sort_value' ('sortval'). This one has a pointer to the
+ * 'field->report_string' string ('sortval->value') and info
+ * about position and length of each list item within the string
+ * (array of 'struct pos_len').
+ *
+ *
+ * The 'field->report_string' is either in sorted or unsorted form,
+ * depending on 'sort_repstr' arg.
*
- * ...we end up with:
- * sort_value->value = report_string; (we'll use the original report_string for indices)
- * sort_value->items[0] = {0,3}; (we have 3 items)
- * sort_value->items[1] = {0,3}; ("abc")
- * sort_value->items[2] = {7,5}; ("defgh")
- * sort_value->items[3] = {4,2}; ("xy")
+ * The 'field->sort_value.items' is always in sorted form because
+ * we need that for effective sorting and selection.
*
- * The items alone are always sorted while in report_string they can be
- * sorted or not (based on "sort" arg) - it depends on how we prefer to
- * display the list. Having items sorted internally helps with searching
- * through them.
+ * If 'field->report_string' is sorted, then field->report_string
+ * and field->sort_value.items share the same array of
+ * 'struct pos_len' (because they're both sorted the same way),
+ * otherwise, each one has its own array.
+ *
+ * The very first item in the array of 'struct pos_len' is always
+ * a pair denoting '[list_size,strlen(field->report_string)]'. The
+ * rest of items denote start and lenght of each item in the list.
+ *
+ *
+ * For example, if we have a list with "abc", "xy", "defgh"
+ * as input and delimiter is ",", we end up with either:
+ *
+ * A) if we don't want the report string sorted ('sort_repstr == 0'):
+ *
+ * - field->report_string = repstr
+ *
+ * repstr repstr_extra
+ * | |
+ * V V
+ * abc,xy,defgh\0{[3,12],[0,3],[4,2],[7,5]}
+ * |____________||________________________|
+ * string array of struct pos_len
+ * |____||________________|
+ * #items items
+ *
+ * - field->sort_value = sortval
+ *
+ * sortval->value = repstr
+ * sortval->items = {[3,12],[0,3],[7,5],[4,2]}
+ * (that is 'abc,defgh,xy')
+ *
+ *
+ * B) if we want the report string sorted ('sort_repstr == 1'):
+ *
+ * - field->report_string = repstr
+ *
+ * repstr repstr_extra
+ * | |
+ * V V
+ * abc,defgh,xy\0{[3,12],[0,3],[4,5],[10,2]}
+ * |____________||________________________|
+ * string array of struct pos_len
+ * |____||________________|
+ * #items items
+ *
+ * - field->sort_value = sortval
+ *
+ * sortval->value = repstr
+ * sortval->items = repstr_extra
+ * (that is 'abc,defgh,xy')
*/
- if (!(sort_value->items = dm_pool_zalloc(rh->mem, (list_size + 1) * sizeof(struct str_list_sort_value_item)))) {
- log_error("dm_report_fiel_string_list: dm_pool_zalloc failed for sort value items");
+
+ if (!delimiter)
+ delimiter = FIELD_STRING_LIST_DEFAULT_DELIMITER;
+ delimiter_len = strlen(delimiter);
+ list_size = dm_list_size(data);
+
+ if (!(sortval = dm_pool_alloc(rh->mem, sizeof(struct str_list_sort_value)))) {
+ log_error("%s failed to allocate sort value structure", _error_msg_prefix);
goto out;
}
- sort_value->items[0].len = list_size;
/* zero items */
- if (!list_size) {
- sort_value->value = field->report_string = "";
- field->sort_value = sort_value;
+ if (list_size == 0) {
+ field->report_string = sortval->value = "";
+ sortval->items = NULL;
+ field->sort_value = sortval;
return 1;
}
/* one item */
if (list_size == 1) {
sl = (struct dm_str_list *) dm_list_first(data);
- if (!sl ||
- !(sort_value->value = field->report_string = dm_pool_strdup(rh->mem, sl->str))) {
- log_error("dm_report_field_string_list: dm_pool_strdup failed");
+
+ repstr_str_len = strlen(sl->str);
+ repstr_size = repstr_str_len + 1 + (2 * sizeof(struct pos_len));
+
+ if (!(repstr = dm_pool_alloc(rh->mem, repstr_size))) {
+ log_error("%s failed to allocate report string structure", _error_msg_prefix);
goto out;
}
- sort_value->items[1].pos = 0;
- sort_value->items[1].len = strlen(sl->str);
- field->sort_value = sort_value;
- return 1;
- }
+ repstr_extra = (struct pos_len *) (repstr + repstr_str_len + 1);
- /* more than one item - sort the list */
- if (!(arr = malloc(sizeof(struct str_list_sort_item) * list_size))) {
- log_error("dm_report_field_string_list: malloc failed");
- goto out;
+ memcpy(repstr, sl->str, repstr_str_len + 1);
+ memcpy(repstr_extra, &((struct pos_len) {.pos = 1, .len = repstr_str_len}), sizeof(struct pos_len));
+ memcpy(repstr_extra + 1, &((struct pos_len) {.pos = 0, .len = repstr_str_len}), sizeof(struct pos_len));
+
+ sortval->value = field->report_string = repstr;
+ sortval->items = repstr_extra;
+ field->sort_value = sortval;
+ return 1;
}
- if (!(dm_pool_begin_object(rh->mem, 256))) {
- log_error(_string_list_grow_object_failed_msg);
+ /* more than one item - allocate temporary array for string list items for further processing */
+ if (!(arr = malloc(list_size * sizeof(struct str_pos_len)))) {
+ log_error("%s failed to allocate temporary array for processing", _error_msg_prefix);
goto out;
}
- if (!delimiter)
- delimiter = ",";
- delimiter_len = strlen(delimiter);
-
- i = pos = 0;
+ i = 0;
+ repstr_size = 0;
dm_list_iterate_items(sl, data) {
arr[i].str = sl->str;
- if (!sort) {
- /* sorted outpud not required - report the list as it is */
- len = strlen(sl->str);
- if (!dm_pool_grow_object(rh->mem, arr[i].str, len) ||
- (i+1 != list_size && !dm_pool_grow_object(rh->mem, delimiter, delimiter_len))) {
- log_error(_string_list_grow_object_failed_msg);
- goto out;
- }
- arr[i].item.pos = pos;
- arr[i].item.len = len;
- pos = i+1 == list_size ? pos+len : pos+len+delimiter_len;
- }
+ repstr_size += (arr[i].item.len = strlen(sl->str));
i++;
}
- qsort(arr, i, sizeof(struct str_list_sort_item), _str_list_sort_item_cmp);
+ /*
+ * At this point, repstr_size contains sum of lengths of all string list items.
+ * Now, add these to the repstr_size:
+ *
+ * --> sum of character count used by all delimiters: + ((list_size - 1) * delimiter_len)
+ *
+ * --> '\0' used at the end of the string list: + 1
+ *
+ * --> sum of structures used to keep info about pos and length of each string list item:
+ * [0, <list_size>] [<pos1>,<size1>] [<pos2>,<size2>] ...
+ * That is: + ((list_size + 1) * sizeof(struct pos_len))
+ */
+ repstr_size += ((list_size - 1) * delimiter_len);
+ repstr_str_len = repstr_size;
+ repstr_size += 1 + ((list_size + 1) * sizeof(struct pos_len));
+
+ if (sort_repstr)
+ qsort(arr, list_size, sizeof(struct str_pos_len), _str_sort_cmp);
+ if (!(repstr = dm_pool_alloc(rh->mem, repstr_size))) {
+ log_error("%s failed to allocate report string structure", _error_msg_prefix);
+ goto out;
+ }
+ repstr_extra = (struct pos_len *) (repstr + repstr_str_len + 1);
+
+ memcpy(repstr_extra, &(struct pos_len) {.pos = list_size, .len = repstr_str_len}, sizeof(struct pos_len));
for (i = 0, pos = 0; i < list_size; i++) {
- if (sort) {
- /* sorted output required - report the list as sorted */
- len = strlen(arr[i].str);
- if (!dm_pool_grow_object(rh->mem, arr[i].str, len) ||
- (i+1 != list_size && !dm_pool_grow_object(rh->mem, delimiter, delimiter_len))) {
- log_error(_string_list_grow_object_failed_msg);
- goto out;
- }
- /*
- * Save position and length of the string
- * element in report_string for sort_value.
- * Use i+1 here since items[0] stores list size!!!
- */
- sort_value->items[i+1].pos = pos;
- sort_value->items[i+1].len = len;
- pos = i+1 == list_size ? pos+len : pos+len+delimiter_len;
- } else {
- sort_value->items[i+1].pos = arr[i].item.pos;
- sort_value->items[i+1].len = arr[i].item.len;
+ arr[i].item.pos = pos;
+
+ memcpy(repstr + pos, arr[i].str, arr[i].item.len);
+ memcpy(repstr_extra + i + 1, &arr[i].item, sizeof(struct pos_len));
+
+ pos += arr[i].item.len;
+ if (i + 1 < list_size) {
+ memcpy(repstr + pos, delimiter, delimiter_len);
+ pos += delimiter_len;
}
}
+ *(repstr + pos) = '\0';
- if (!dm_pool_grow_object(rh->mem, "\0", 1)) {
- log_error(_string_list_grow_object_failed_msg);
- goto out;
+ sortval->value = repstr;
+ if (sort_repstr)
+ sortval->items = repstr_extra;
+ else {
+ if (!(sortval->items = dm_pool_alloc(rh->mem, (list_size + 1) * sizeof(struct pos_len)))) {
+ log_error("%s failed to allocate array of items inside sort value structure",
+ _error_msg_prefix);
+ goto out;
+ }
+
+ qsort(arr, list_size, sizeof(struct str_pos_len), _str_sort_cmp);
+
+ sortval->items[0] = (struct pos_len) {.pos = list_size, .len = repstr_str_len};
+ for (i = 0; i < list_size; i++)
+ sortval->items[i+1] = arr[i].item;
}
- object = dm_pool_end_object(rh->mem);
- sort_value->value = object;
- field->sort_value = sort_value;
- field->report_string = object;
+ field->report_string = repstr;
+ field->sort_value = sortval;
r = 1;
out:
- if (!r && sort_value)
- dm_pool_free(rh->mem, sort_value);
+ if (!r && sortval)
+ dm_pool_free(rh->mem, sortval);
free(arr);
-
return r;
}
@@ -1688,7 +1762,7 @@ static int _cmp_field_string_list_strict_all(const struct str_list_sort_value *v
struct dm_str_list *sel_item;
unsigned int i = 1;
- if (!val->items[0].len) {
+ if (!val->items) {
if (sel_list_size == 1) {
/* match blank string list with selection defined as blank string only */
sel_item = dm_list_item(dm_list_first(&sel->str_list.list), struct dm_str_list);
@@ -1698,7 +1772,7 @@ static int _cmp_field_string_list_strict_all(const struct str_list_sort_value *v
}
/* if item count differs, it's clear the lists do not match */
- if (val->items[0].len != sel_list_size)
+ if (val->items[0].pos != sel_list_size)
return 0;
/* both lists are sorted so they either match 1:1 or not */
@@ -1721,7 +1795,7 @@ static int _cmp_field_string_list_subset_all(const struct str_list_sort_value *v
unsigned int i, last_found = 1;
int r = 0;
- if (!val->items[0].len) {
+ if (!val->items) {
if (sel_list_size == 1) {
/* match blank string list with selection defined as blank string only */
sel_item = dm_list_item(dm_list_first(&sel->str_list.list), struct dm_str_list);
@@ -1733,7 +1807,7 @@ static int _cmp_field_string_list_subset_all(const struct str_list_sort_value *v
/* check selection is a subset of the value */
dm_list_iterate_items(sel_item, &sel->str_list.list) {
r = 0;
- for (i = last_found; i <= val->items[0].len; i++) {
+ for (i = last_found; i <= val->items[0].pos; i++) {
if ((strlen(sel_item->str) == val->items[i].len) &&
!strncmp(sel_item->str, val->value + val->items[i].pos, val->items[i].len)) {
last_found = i;
@@ -1755,7 +1829,7 @@ static int _cmp_field_string_list_any(const struct str_list_sort_value *val,
unsigned int i;
/* match blank string list with selection that contains blank string */
- if (!val->items[0].len) {
+ if (!val->items) {
dm_list_iterate_items(sel_item, &sel->str_list.list) {
if (!strcmp(sel_item->str, ""))
return 1;
@@ -1768,7 +1842,7 @@ static int _cmp_field_string_list_any(const struct str_list_sort_value *val,
* TODO: Optimize this so we don't need to compare the whole lists' content.
* Make use of the fact that the lists are sorted!
*/
- for (i = 1; i <= val->items[0].len; i++) {
+ for (i = 1; i <= val->items[0].pos; i++) {
if ((strlen(sel_item->str) == val->items[i].len) &&
!strncmp(sel_item->str, val->value + val->items[i].pos, val->items[i].len))
return 1;
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index df52ee088..9fac341a4 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -383,172 +383,246 @@ int dm_report_field_percent(struct dm_report *rh,
return 1;
}
-struct str_list_sort_value_item {
+struct pos_len {
unsigned pos;
size_t len;
};
-struct str_list_sort_value {
- const char *value;
- struct str_list_sort_value_item *items;
+struct str_pos_len {
+ const char *str;
+ struct pos_len item;
};
-struct str_list_sort_item {
- const char *str;
- struct str_list_sort_value_item item;
+struct str_list_sort_value {
+ const char *value;
+ struct pos_len *items;
};
-static int _str_list_sort_item_cmp(const void *a, const void *b)
+static int _str_sort_cmp(const void *a, const void *b)
{
- const struct str_list_sort_item *slsi_a = (const struct str_list_sort_item *) a;
- const struct str_list_sort_item *slsi_b = (const struct str_list_sort_item *) b;
-
- return strcmp(slsi_a->str, slsi_b->str);
+ return strcmp(((const struct str_pos_len *) a)->str, ((const struct str_pos_len *) b)->str);
}
+#define FIELD_STRING_LIST_DEFAULT_DELIMITER ","
+
static int _report_field_string_list(struct dm_report *rh,
struct dm_report_field *field,
const struct dm_list *data,
const char *delimiter,
- int sort)
+ int sort_repstr)
{
- static const char _string_list_grow_object_failed_msg[] = "dm_report_field_string_list: dm_pool_grow_object_failed";
- struct str_list_sort_value *sort_value = NULL;
- unsigned int list_size, pos, i;
- struct str_list_sort_item *arr = NULL;
+ static const char _error_msg_prefix[] = "_report_field_string_list: ";
+ unsigned int list_size, i, pos;
+ struct str_pos_len *arr = NULL;
struct dm_str_list *sl;
- size_t delimiter_len, len;
- void *object;
+ size_t delimiter_len, repstr_str_len, repstr_size;
+ char *repstr = NULL;
+ struct pos_len *repstr_extra;
+ struct str_list_sort_value *sortval = NULL;
int r = 0;
- if (!(sort_value = dm_pool_zalloc(rh->mem, sizeof(struct str_list_sort_value)))) {
- log_error("dm_report_field_string_list: dm_pool_zalloc failed for sort_value");
- return 0;
- }
-
- list_size = dm_list_size(data);
-
/*
- * Sort value stores the pointer to the report_string and then
- * position and length for each list element withing the report_string.
- * The first element stores number of elements in 'len' (therefore
- * list_size + 1 is used below for the extra element).
- * For example, with this input:
- * sort = 0; (we don't want to report sorted)
- * report_string = "abc,xy,defgh"; (this is reported)
+ * The 'field->report_string' has 2 parts:
+ *
+ * - string representing the whole string list
+ * (terminated by '\0' at its end as usual)
+ *
+ * - extra info beyond the end of the string representing
+ * position and length of each list item within the
+ * field->report_string (array of 'struct pos_len')
+ *
+ * We can use the extra info to unambiguously identify list items,
+ * the delimiter is not enough here as it's not assured it won't appear
+ * in list item itself. We will make use of this extra info in case
+ * we need to apply further formatting to the list in dm_report_output
+ * where the pure field->report_string is not enough for printout.
+ *
+ *
+ * The 'field->sort_value' contains a value of type 'struct
+ * str_list_sort_value' ('sortval'). This one has a pointer to the
+ * 'field->report_string' string ('sortval->value') and info
+ * about position and length of each list item within the string
+ * (array of 'struct pos_len').
+ *
+ *
+ * The 'field->report_string' is either in sorted or unsorted form,
+ * depending on 'sort_repstr' arg.
*
- * ...we end up with:
- * sort_value->value = report_string; (we'll use the original report_string for indices)
- * sort_value->items[0] = {0,3}; (we have 3 items)
- * sort_value->items[1] = {0,3}; ("abc")
- * sort_value->items[2] = {7,5}; ("defgh")
- * sort_value->items[3] = {4,2}; ("xy")
+ * The 'field->sort_value.items' is always in sorted form because
+ * we need that for effective sorting and selection.
*
- * The items alone are always sorted while in report_string they can be
- * sorted or not (based on "sort" arg) - it depends on how we prefer to
- * display the list. Having items sorted internally helps with searching
- * through them.
+ * If 'field->report_string' is sorted, then field->report_string
+ * and field->sort_value.items share the same array of
+ * 'struct pos_len' (because they're both sorted the same way),
+ * otherwise, each one has its own array.
+ *
+ * The very first item in the array of 'struct pos_len' is always
+ * a pair denoting '[list_size,strlen(field->report_string)]'. The
+ * rest of items denote start and lenght of each item in the list.
+ *
+ *
+ * For example, if we have a list with "abc", "xy", "defgh"
+ * as input and delimiter is ",", we end up with either:
+ *
+ * A) if we don't want the report string sorted ('sort_repstr == 0'):
+ *
+ * - field->report_string = repstr
+ *
+ * repstr repstr_extra
+ * | |
+ * V V
+ * abc,xy,defgh\0{[3,12],[0,3],[4,2],[7,5]}
+ * |____________||________________________|
+ * string array of struct pos_len
+ * |____||________________|
+ * #items items
+ *
+ * - field->sort_value = sortval
+ *
+ * sortval->value = repstr
+ * sortval->items = {[3,12],[0,3],[7,5],[4,2]}
+ * (that is 'abc,defgh,xy')
+ *
+ *
+ * B) if we want the report string sorted ('sort_repstr == 1'):
+ *
+ * - field->report_string = repstr
+ *
+ * repstr repstr_extra
+ * | |
+ * V V
+ * abc,defgh,xy\0{[3,12],[0,3],[4,5],[10,2]}
+ * |____________||________________________|
+ * string array of struct pos_len
+ * |____||________________|
+ * #items items
+ *
+ * - field->sort_value = sortval
+ *
+ * sortval->value = repstr
+ * sortval->items = repstr_extra
+ * (that is 'abc,defgh,xy')
*/
- if (!(sort_value->items = dm_pool_zalloc(rh->mem, (list_size + 1) * sizeof(struct str_list_sort_value_item)))) {
- log_error("dm_report_fiel_string_list: dm_pool_zalloc failed for sort value items");
+
+ if (!delimiter)
+ delimiter = FIELD_STRING_LIST_DEFAULT_DELIMITER;
+ delimiter_len = strlen(delimiter);
+ list_size = dm_list_size(data);
+
+ if (!(sortval = dm_pool_alloc(rh->mem, sizeof(struct str_list_sort_value)))) {
+ log_error("%s failed to allocate sort value structure", _error_msg_prefix);
goto out;
}
- sort_value->items[0].len = list_size;
/* zero items */
- if (!list_size) {
- sort_value->value = field->report_string = "";
- field->sort_value = sort_value;
+ if (list_size == 0) {
+ field->report_string = sortval->value = "";
+ sortval->items = NULL;
+ field->sort_value = sortval;
return 1;
}
/* one item */
if (list_size == 1) {
sl = (struct dm_str_list *) dm_list_first(data);
- if (!sl ||
- !(sort_value->value = field->report_string = dm_pool_strdup(rh->mem, sl->str))) {
- log_error("dm_report_field_string_list: dm_pool_strdup failed");
+
+ repstr_str_len = strlen(sl->str);
+ repstr_size = repstr_str_len + 1 + (2 * sizeof(struct pos_len));
+
+ if (!(repstr = dm_pool_alloc(rh->mem, repstr_size))) {
+ log_error("%s failed to allocate report string structure", _error_msg_prefix);
goto out;
}
- sort_value->items[1].pos = 0;
- sort_value->items[1].len = strlen(sl->str);
- field->sort_value = sort_value;
- return 1;
- }
+ repstr_extra = (struct pos_len *) (repstr + repstr_str_len + 1);
- /* more than one item - sort the list */
- if (!(arr = dm_malloc(sizeof(struct str_list_sort_item) * list_size))) {
- log_error("dm_report_field_string_list: dm_malloc failed");
- goto out;
+ memcpy(repstr, sl->str, repstr_str_len + 1);
+ memcpy(repstr_extra, &((struct pos_len) {.pos = 1, .len = repstr_str_len}), sizeof(struct pos_len));
+ memcpy(repstr_extra + 1, &((struct pos_len) {.pos = 0, .len = repstr_str_len}), sizeof(struct pos_len));
+
+ sortval->value = field->report_string = repstr;
+ sortval->items = repstr_extra;
+ field->sort_value = sortval;
+ return 1;
}
- if (!(dm_pool_begin_object(rh->mem, 256))) {
- log_error(_string_list_grow_object_failed_msg);
+ /* more than one item - allocate temporary array for string list items for further processing */
+ if (!(arr = dm_malloc(list_size * sizeof(struct str_pos_len)))) {
+ log_error("%s failed to allocate temporary array for processing", _error_msg_prefix);
goto out;
}
- if (!delimiter)
- delimiter = ",";
- delimiter_len = strlen(delimiter);
-
- i = pos = 0;
+ i = 0;
+ repstr_size = 0;
dm_list_iterate_items(sl, data) {
arr[i].str = sl->str;
- if (!sort) {
- /* sorted outpud not required - report the list as it is */
- len = strlen(sl->str);
- if (!dm_pool_grow_object(rh->mem, arr[i].str, len) ||
- (i+1 != list_size && !dm_pool_grow_object(rh->mem, delimiter, delimiter_len))) {
- log_error(_string_list_grow_object_failed_msg);
- goto out;
- }
- arr[i].item.pos = pos;
- arr[i].item.len = len;
- pos = i+1 == list_size ? pos+len : pos+len+delimiter_len;
- }
+ repstr_size += (arr[i].item.len = strlen(sl->str));
i++;
}
- qsort(arr, i, sizeof(struct str_list_sort_item), _str_list_sort_item_cmp);
+ /*
+ * At this point, repstr_size contains sum of lengths of all string list items.
+ * Now, add these to the repstr_size:
+ *
+ * --> sum of character count used by all delimiters: + ((list_size - 1) * delimiter_len)
+ *
+ * --> '\0' used at the end of the string list: + 1
+ *
+ * --> sum of structures used to keep info about pos and length of each string list item:
+ * [0, <list_size>] [<pos1>,<size1>] [<pos2>,<size2>] ...
+ * That is: + ((list_size + 1) * sizeof(struct pos_len))
+ */
+ repstr_size += ((list_size - 1) * delimiter_len);
+ repstr_str_len = repstr_size;
+ repstr_size += 1 + ((list_size + 1) * sizeof(struct pos_len));
+
+ if (sort_repstr)
+ qsort(arr, list_size, sizeof(struct str_pos_len), _str_sort_cmp);
+ if (!(repstr = dm_pool_alloc(rh->mem, repstr_size))) {
+ log_error("%s failed to allocate report string structure", _error_msg_prefix);
+ goto out;
+ }
+ repstr_extra = (struct pos_len *) (repstr + repstr_str_len + 1);
+
+ memcpy(repstr_extra, &(struct pos_len) {.pos = list_size, .len = repstr_str_len}, sizeof(struct pos_len));
for (i = 0, pos = 0; i < list_size; i++) {
- if (sort) {
- /* sorted output required - report the list as sorted */
- len = strlen(arr[i].str);
- if (!dm_pool_grow_object(rh->mem, arr[i].str, len) ||
- (i+1 != list_size && !dm_pool_grow_object(rh->mem, delimiter, delimiter_len))) {
- log_error(_string_list_grow_object_failed_msg);
- goto out;
- }
- /*
- * Save position and length of the string
- * element in report_string for sort_value.
- * Use i+1 here since items[0] stores list size!!!
- */
- sort_value->items[i+1].pos = pos;
- sort_value->items[i+1].len = len;
- pos = i+1 == list_size ? pos+len : pos+len+delimiter_len;
- } else {
- sort_value->items[i+1].pos = arr[i].item.pos;
- sort_value->items[i+1].len = arr[i].item.len;
+ arr[i].item.pos = pos;
+
+ memcpy(repstr + pos, arr[i].str, arr[i].item.len);
+ memcpy(repstr_extra + i + 1, &arr[i].item, sizeof(struct pos_len));
+
+ pos += arr[i].item.len;
+ if (i + 1 < list_size) {
+ memcpy(repstr + pos, delimiter, delimiter_len);
+ pos += delimiter_len;
}
}
+ *(repstr + pos) = '\0';
- if (!dm_pool_grow_object(rh->mem, "\0", 1)) {
- log_error(_string_list_grow_object_failed_msg);
- goto out;
+ sortval->value = repstr;
+ if (sort_repstr)
+ sortval->items = repstr_extra;
+ else {
+ if (!(sortval->items = dm_pool_alloc(rh->mem, (list_size + 1) * sizeof(struct pos_len)))) {
+ log_error("%s failed to allocate array of items inside sort value structure",
+ _error_msg_prefix);
+ goto out;
+ }
+
+ qsort(arr, list_size, sizeof(struct str_pos_len), _str_sort_cmp);
+
+ sortval->items[0] = (struct pos_len) {.pos = list_size, .len = repstr_str_len};
+ for (i = 0; i < list_size; i++)
+ sortval->items[i+1] = arr[i].item;
}
- object = dm_pool_end_object(rh->mem);
- sort_value->value = object;
- field->sort_value = sort_value;
- field->report_string = object;
+ field->report_string = repstr;
+ field->sort_value = sortval;
r = 1;
out:
- if (!r && sort_value)
- dm_pool_free(rh->mem, sort_value);
+ if (!r && sortval)
+ dm_pool_free(rh->mem, sortval);
dm_free(arr);
-
return r;
}
@@ -1687,7 +1761,7 @@ static int _cmp_field_string_list_strict_all(const struct str_list_sort_value *v
struct dm_str_list *sel_item;
unsigned int i = 1;
- if (!val->items[0].len) {
+ if (!val->items) {
if (sel_list_size == 1) {
/* match blank string list with selection defined as blank string only */
sel_item = dm_list_item(dm_list_first(&sel->str_list.list), struct dm_str_list);
@@ -1697,7 +1771,7 @@ static int _cmp_field_string_list_strict_all(const struct str_list_sort_value *v
}
/* if item count differs, it's clear the lists do not match */
- if (val->items[0].len != sel_list_size)
+ if (val->items[0].pos != sel_list_size)
return 0;
/* both lists are sorted so they either match 1:1 or not */
@@ -1720,7 +1794,7 @@ static int _cmp_field_string_list_subset_all(const struct str_list_sort_value *v
unsigned int i, last_found = 1;
int r = 0;
- if (!val->items[0].len) {
+ if (!val->items) {
if (sel_list_size == 1) {
/* match blank string list with selection defined as blank string only */
sel_item = dm_list_item(dm_list_first(&sel->str_list.list), struct dm_str_list);
@@ -1732,7 +1806,7 @@ static int _cmp_field_string_list_subset_all(const struct str_list_sort_value *v
/* check selection is a subset of the value */
dm_list_iterate_items(sel_item, &sel->str_list.list) {
r = 0;
- for (i = last_found; i <= val->items[0].len; i++) {
+ for (i = last_found; i <= val->items[0].pos; i++) {
if ((strlen(sel_item->str) == val->items[i].len) &&
!strncmp(sel_item->str, val->value + val->items[i].pos, val->items[i].len)) {
last_found = i;
@@ -1754,7 +1828,7 @@ static int _cmp_field_string_list_any(const struct str_list_sort_value *val,
unsigned int i;
/* match blank string list with selection that contains blank string */
- if (!val->items[0].len) {
+ if (!val->items) {
dm_list_iterate_items(sel_item, &sel->str_list.list) {
if (!strcmp(sel_item->str, ""))
return 1;
@@ -1767,7 +1841,7 @@ static int _cmp_field_string_list_any(const struct str_list_sort_value *val,
* TODO: Optimize this so we don't need to compare the whole lists' content.
* Make use of the fact that the lists are sorted!
*/
- for (i = 1; i <= val->items[0].len; i++) {
+ for (i = 1; i <= val->items[0].pos; i++) {
if ((strlen(sel_item->str) == val->items[i].len) &&
!strncmp(sel_item->str, val->value + val->items[i].pos, val->items[i].len))
return 1;