From f302f5734b134a514a71689c45aaf6f83a5318c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B6ppner?= Date: Wed, 1 Apr 2026 18:38:11 +0200 Subject: [PATCH] zpwr: Adapt to new JSON Lines text format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit util_fmt now provides support for JSON Lines text format. Adapt certain checks in the code and document the newly supported format in the man page accordingly. Signed-off-by: Jan Höppner --- zpwr/man/zpwr.1 | 6 +++--- zpwr/zpwr.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/zpwr/man/zpwr.1 b/zpwr/man/zpwr.1 index 7d655b1b..89a373b4 100644 --- a/zpwr/man/zpwr.1 +++ b/zpwr/man/zpwr.1 @@ -30,8 +30,8 @@ CPC readings include total, unassigned resources and infrastructure power readings. .sp Power reading units are automatically presented in a human readable format, -whereas complex formats like json, csv, json-seq, pairs display the power -readings in microwatts. +whereas complex formats like json, csv, json-seq, jsonl, pairs display the +power readings in microwatts. .sp CPC power readings can be retrieved only when the required authorization was set for the LPAR. Enable the required authorization by setting "Global @@ -48,7 +48,7 @@ Retrieve power readings in the following formats: json, csv, json-seq or pairs. If no format is specified in the command, the output will default to the human readable format. .sp -When the format is json, csv, json-seq or pairs, the power readings are +When the format is json, csv, json-seq, jsonl or pairs, the power readings are displayed in microwatts. .RE .PP diff --git a/zpwr/zpwr.c b/zpwr/zpwr.c index 40d19dbf..d415d17e 100644 --- a/zpwr/zpwr.c +++ b/zpwr/zpwr.c @@ -284,7 +284,7 @@ static void fmt_start(enum util_fmt_t fmt, unsigned int fmt_flags, if (!fmt_specified) return; util_fmt_init(stdout, fmt, fmt_flags, 1); - if (fmt != FMT_JSONSEQ) + if (!util_fmt_is_json_stream(fmt)) util_fmt_obj_start(FMT_LIST, "zpwr"); } @@ -292,7 +292,7 @@ static void fmt_end(enum util_fmt_t fmt, int fmt_specified) { if (!fmt_specified) return; - if (fmt != FMT_JSONSEQ) + if (!util_fmt_is_json_stream(fmt)) util_fmt_obj_end(); /* zpwr[] */ util_fmt_exit(); }