diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2022-08-04 15:06:58 +0200 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2022-08-11 11:10:11 +0200 |
commit | 02f015990b2d077f304e19c9ff11728d4480bee8 (patch) | |
tree | 41641ef488f553df69d4dfd3e2535e6b7b35536c /libdm/libdm-report.c | |
parent | 2fc52b6c41172fc4ae15e736fae095aa681ff03a (diff) | |
download | lvm2-02f015990b2d077f304e19c9ff11728d4480bee8.tar.gz |
libdm: report: add DM_REPORT_GROUP_JSON_STD group
The original JSON formatting will be still available using the original
DM_REPORT_GROUP_JSON identifier. Subsequent patches will add enhancements
to JSON formatting code so that it adheres more to JSON standard - this
will be identified by new DM_REPORT_GROUP_JSON_STD identifier.
Diffstat (limited to 'libdm/libdm-report.c')
-rw-r--r-- | libdm/libdm-report.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c index f3bf628a5..b43ac4298 100644 --- a/libdm/libdm-report.c +++ b/libdm/libdm-report.c @@ -4368,10 +4368,17 @@ static int _is_basic_report(struct dm_report *rh) (rh->group_item->group->type == DM_REPORT_GROUP_BASIC); } +static int _is_json_std_report(struct dm_report *rh) +{ + return rh->group_item && + rh->group_item->group->type == DM_REPORT_GROUP_JSON_STD; +} + static int _is_json_report(struct dm_report *rh) { return rh->group_item && - (rh->group_item->group->type == DM_REPORT_GROUP_JSON); + (rh->group_item->group->type == DM_REPORT_GROUP_JSON || + rh->group_item->group->type == DM_REPORT_GROUP_JSON_STD); } /* @@ -4982,6 +4989,7 @@ int dm_report_group_push(struct dm_report_group *group, struct dm_report *report goto_bad; break; case DM_REPORT_GROUP_JSON: + case DM_REPORT_GROUP_JSON_STD: if (!_report_group_push_json(item, data)) goto_bad; break; @@ -5045,6 +5053,7 @@ int dm_report_group_pop(struct dm_report_group *group) return_0; break; case DM_REPORT_GROUP_JSON: + case DM_REPORT_GROUP_JSON_STD: if (!_report_group_pop_json(item)) return_0; break; @@ -5081,7 +5090,7 @@ int dm_report_group_output_and_pop_all(struct dm_report_group *group) return_0; } - if (group->type == DM_REPORT_GROUP_JSON) { + if (group->type == DM_REPORT_GROUP_JSON || group->type == DM_REPORT_GROUP_JSON_STD) { _json_output_start(group); log_print(JSON_OBJECT_END); group->indent -= JSON_INDENT_UNIT; |